How to use new cluster 'cl' commands from c/c++ code
Hi All
I need to invoke cluster commands from c/c++ code and parse the output to retrieve neccessary fields e.g status to be used in program.
e.g
#cluster status
I need to capture output and use it in c/c++ code.
Does any one have tried to use new cluster 'cl' commands from c/c++ code?
Thanks
Pandit
[351 byte] By [
Pandita] at [2007-11-27 2:36:42]

# 1
The output of the cl* commands is for human consumption and as such (as most administrative commands) the output is not considered stable, so it could change with a Patch, etc.
Instead you should use the cluster api to retreive the information you need.
The Sun Cluster Data Services Developer's Guide for Solaris OS (http://docs.sun.com/app/docs/doc/819-2972?a=expand) describes the various possibilities, including the C API.
Read especially http://docs.sun.com/app/docs/doc/819-2972/6n57ngitf?a=view for more details as which functions are available via the libdsdev. Each function has a specific manpage outlining the lib and includes needed as well es which information it offers.
In your example, you can use scha_resource_get() (3HA) in order to retrieve the status of a specific resource (http://docs.sun.com/app/docs/doc/819-3055/6n5a6lhnl?a=view).
Greets
Thorsten