guys-

i've rewriten the queues and have a better example for you of what ganglia 
3 will look like.  it's a weak example (monitoring the number of files in 
/tmp) but it gives you an idea.  

i put a snapshot of the source at http://matt-massie.com/g3/

if you do a "./configure && make".. then

% ./gmond -f -p plugins/.libs/g3_test_plugin.so
Tue Jan 28 16:07:16 2003: gmond starting
Tue Jan 28 16:07:16 2003: plugin 'Test Module Name' version '0.1.0' author 
'Joe Developer' loaded successfully
Tue Jan 28 16:07:16 2003: PULLED from queue: There are [0] files
Tue Jan 28 16:07:16 2003: COLLECTING number of files in /tmp
Tue Jan 28 16:07:16 2003: PUBLISH: There are [33] files in /tmp
Tue Jan 28 16:07:21 2003: PULLED from queue: There are [33] files
Tue Jan 28 16:07:24 2003: COLLECTING number of files in /tmp
Tue Jan 28 16:07:26 2003: PULLED from queue: There are [33] files
Tue Jan 28 16:07:31 2003: PULLED from queue: There are [33] files
Tue Jan 28 16:07:32 2003: COLLECTING number of files in /tmp
Tue Jan 28 16:07:36 2003: PULLED from queue: There are [33] files

these messages will run on and on.  

if you open gmond.c line 80 you'll see what is going on...
  msg = (char *) strdup("PULLED from queue:");
  for(;;)
    {
      /* Walk the queue */
      g3_q_walk ( q, mycallback, msg, G3_FALSE);
      sleep(5);
    }

in this example, the argument i pass to the callback function is a string 
(it can be anything) but most likely it will be a filehandle to a client 
which connected to gmond to pull the data from the priority queue.
-- 
matt


Reply via email to