Thank you very much for the suggestion.

On 7/14/06, matt massie <[EMAIL PROTECTED]> wrote:

there is a C api for getting stats.  if you take a look at
./gmond/gstat/gstat.c, you'll get an example of how to use it.  you'll
need to link against libganglia.

gexec_cluster_t cluster;
gexec_host_t *host;
llist_entry *li;

rval = gexec_cluster(&cluster, ip, port );
if ( rval != 0) { /* could not get stats from gmond */ }

/* if you want all hosts */
host = cluster.hosts;

/* if you just want gexec enabled hosts */
host = cluster.gexec_hosts;

for( ; li != NULL; li = li->next )
            {
                host = li->val;
                /* Do what you like with the host stats */
            }

the gexec_host_t is defined in ./lib/ganglia.h

struct gexec_host_t {
  char ip[64];
  char name[GEXEC_HOST_STRING_LEN];
  char domain[GEXEC_HOST_STRING_LEN];
  double load_one;
  double load_five;
  double load_fifteen;
  double cpu_user;
  double cpu_nice;
  double cpu_system;
  double cpu_idle;
  double cpu_wio;
  unsigned int proc_run;
  unsigned int proc_total;
  unsigned int cpu_num;
  time_t last_reported;
  int gexec_on;
  int name_resolved;
};

good luck!
-matt













[EMAIL PROTECTED] wrote:
> Arun,
>
> as an example, run "nc localhost 8651" on your ganglia server.
> That is the grid level raw data that could be used for snapshot
> processing.
>
> If you netcatted directly to a cluster member (or headnode if you
> unicast), then
> that provides current values for the cluster.
>
> So even though a C API does not exist as such, you could pretty easily
> make a wrapper that connects to the right host/port and slurps the
> data in.
>
> - richard
>
>     -----Original Message-----
>     *From:* [EMAIL PROTECTED]
>     [mailto:[EMAIL PROTECTED] *On
>     Behalf Of *Arun Babu
>     *Sent:* 13 July 2006 05:47
>     *To:* ganglia-developers@lists.sourceforge.net
>     *Subject:* [Ganglia-developers] api for data gathering using ganglia
>
>     Hi
>      We have ganglia installed in our cluster and used for monitoring.
>      I can see the graphs listing the load on cpu of diffrent nodes,
>     average load, etc..
>      I need to get the cpu load at an instant using an api, preferably
>     in C.
>      Is there an interface available?
>
>     Thank you,
>     Arun
>
> ------------------------------------------------------------------------
> For more information about Barclays Capital, please visit our web site
> at http://www.barcap.com.
>
> Internet communications are not secure and therefore the Barclays
> Group does not accept legal responsibility for the contents of this
> message.  Although the Barclays Group operates anti-virus programmes,
> it does not accept responsibility for any damage whatsoever that is
> caused by viruses being passed.  Any views or opinions presented are
> solely those of the author and do not necessarily represent those of
> the Barclays Group.  Replies to this email may be monitored by the
> Barclays
> Group for operational or business reasons.
> ------------------------------------------------------------------------
>
> ------------------------------------------------------------------------
>
>
>
-------------------------------------------------------------------------
> Using Tomcat but need to do more? Need to support web services,
security?
> Get stuff done quickly with pre-integrated technology to make your job
easier
> Download IBM WebSphere Application Server v.1.0.1 based on Apache
Geronimo
> http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
>
> ------------------------------------------------------------------------
>
> _______________________________________________
> Ganglia-developers mailing list
> Ganglia-developers@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/ganglia-developers
>





Reply via email to