On Sat, Jun 07, 2008 at 11:35:41PM -0300, Fábio Firmo wrote:

since this is about a yet unreleased development version of ganglia, this
discussion will be better taken in the ganglia-developers list.

> I'm about to introduce Ganglia in a project to take care of the
> monitoring of clusters. We need to know the cpu and memory usage for
> some specifics processes, so I'm trying to write a C module for gmond
> to do this.

(assuming Linux) some of that information is easily accessible through the
/proc interface in text form :

  /proc/${PID}/stat  (cpu)
  /proc/${PID}/statm (memory)

so an alternative will be to use a python module instead if they have the
granularity you need and the extra resource use is not a concern.

> I've installed ganglia 3.1.0.1361 snapshot (devel, libganglia and
> gmond), but the mod_example doesn't compiles. Here the error:

you also need development headers for apr-1, and confuse as they are all
used by libganglia internally.

> $ g++ mod_example.c -I/usr/include/apr-1/  #there's a problem finding
> apr.h, so the need for -I
> In file included from /usr/include/gm_metric.h:7,
>                  from mod_example.c:33:
> /usr/include/gm_protocol.h:73: error: declaration of 'u_short
> Ganglia_gmetric_ushort::u_short'
> /usr/include/sys/types.h:36: error: changes meaning of 'u_short' from
> 'typedef __u_short u_short'
> /usr/include/gm_protocol.h:94: error: declaration of 'u_int
> Ganglia_gmetric_uint::u_int'
> /usr/include/sys/types.h:37: error: changes meaning of 'u_int' from
> 'typedef __u_int u_int'
> mod_example.c:117: warning: deprecated conversion from string constant
> to 'char*'
> mod_example.c:117: warning: deprecated conversion from string constant
> to 'char*'
> mod_example.c:117: warning: deprecated conversion from string constant
> to 'char*'
> mod_example.c:117: warning: deprecated conversion from string constant
> to 'char*'
> mod_example.c:117: warning: deprecated conversion from string constant
> to 'char*'
> mod_example.c:117: warning: deprecated conversion from string constant
> to 'char*'
> mod_example.c:117: warning: deprecated conversion from string constant
> to 'char*'
> mod_example.c:117: warning: deprecated conversion from string constant
> to 'char*'
> mod_example.c:117: warning: deprecated conversion from string constant
> to 'char*'
> mod_example.c:117: warning: deprecated conversion from string constant
> to 'char*'
> mod_example.c:119: error: redefinition of 'mmodule example_module'
> mod_example.c:42: error: 'mmodule example_module' previously declared here

APR (which is used by the ganglia modules) has some buggy type definition that
requires that you use -D_LARGEFILE64_SOURCE

there seems to be also a bug in our include headers which are preventiing you
to use a C++ compiler, but since this is still in development, that might be
hopefully fixed at release time.

> Can someone help me?

use gcc instead like (not tested, so take it with a grain of salt):

gcc -fpic -I/usr/include/apr-1 -D_LARGEFILE64_SOURCE -Wall -c mod_example.c -o
mod_example.o
ld -shared mod_example.o -ldl -lnsl -lexpat -lconfuse -lapr-1 -lpthread
-soname modexample.so -o modexample.so

Carlo

-------------------------------------------------------------------------
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://sourceforge.net/services/buy/index.php
_______________________________________________
Ganglia-general mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ganglia-general

Reply via email to