Hi Seth,

 to your first problem - I actually suspect a problem with your setup.
Never seen a "/dev2/" before. Google shows:

http://lists.debian.org/debian-kernel/2005/05/msg00319.html

Also, your fix seems very unportable. What happens when there is a
"/dev3/" out there some day? *If* the code needs changing at all, *I*
would change it to check just for "/dev" and a length of more than 4
chars. Anybody else has this kind of entries?

 An even better solution might be to provide a actual list of mount
points for the disk space accounting. The code in its current form is
pretty unflexible. Definitely post-3.0.2 stuff.

 For the second problem I would prefer that updating the pid file is
done in the invoking init script. This way every distribution can do
what they need to do and keep the core code portable. Do not forget
that gmond and gmetad need to run on non-Linux platforms.

Cheers
Martin

--- Seth Alves <[EMAIL PROTECTED]> wrote:

> 
> Hello,
> 
> I've been experimenting with using ganglios to monitor our machines,
> and 
> I've run into a couple small problems.
> 
> The first is that /proc/mounts looks like this for us (debian sarge, 
> 2.6.8-2-686-smp).  I don't know why it's /dev2 instead of /dev, our
> /dev 
> directory is normal, there is no /dev2 in the file system.
> 
> station17$ more /proc/mounts
> rootfs / rootfs rw 0 0
> /dev2/root2 / xfs rw 0 0
> proc /proc proc rw,nodiratime 0 0
> sysfs /sys sysfs rw 0 0
> ...
> 
> This change allows ganglia to report free disk correctly:
> 
> station17$ cvs diff -r ganglia-3-0-1-20051004 
> srclib/libmetrics/linux/metrics.c
> Index: srclib/libmetrics/linux/metrics.c
> ===================================================================
> RCS file: /cvs/ganglia/srclib/libmetrics/linux/metrics.c,v
> retrieving revision 1.3
> retrieving revision 1.4
> diff -r1.3 -r1.4
> 1188c1188,1189
> <       if (strncmp(device, "/dev/", 5)) continue;
> ---
>  >       if (strncmp(device, "/dev/", 5) != 0 &&
>  >         strncmp(device, "/dev2/", 6) != 0) continue;
> 
> 
> The second problem: We need daemons we run to put a pid in 
> /var/run/whatever so they can be watched with monit, etc.
> 
> I've added this function to daemon_init.c and I call it from gmond.c
> and 
> gmetad.c.  I'm not familiar enough with the code to know where this 
> should go, so I'll offer this instead of a patch:
> 
> 
> /**
>   * @fn void update_pidfile (const char *pname)
>   * @param argv0 name of this program
>   */
> 
> void
> update_pidfile (const char *argv0)
> {
>    pid_t pid;
>    static char pidfile[ 256 ];
>    const char *myname;
>    FILE *file;
> 
>    myname = strrchr (argv0, '/');
>    if (! myname)
>      myname = argv0;
>    snprintf (pidfile, sizeof (pidfile), "%s/run/%s.pid",
> localstatedir, 
> myname);
> 
>    /* make sure this program isn't already running. */
>    file = fopen (pidfile, "r");
>    if (file)
>      {
>        if (fscanf(file, "%d", &pid) == 1 &&
>         getpgid (pid) > -1)
>       {
>         fprintf (stderr, "%s is already running: pid %d\n", myname, pid);
>         exit (1);
>       }
>        close (file);
>      }
> 
>    /* write the pid of this process to the pidfile */
>    umask(0112);
>    unlink(pidfile);
> 
>    file = fopen (pidfile, "w");
>    if (!file)
>      {
>        fprintf (stderr, "%s: Error writing pidfile '%s' -- %s\n",
>              argv0, pidfile, strerror (errno));
>        exit (1);
>      }
>    fprintf (file, "%d\n", (int) getpid());
>    fclose (file);
> }
> 
> 
>       -seth
> 
> 
> 
> -------------------------------------------------------
> This SF.Net email is sponsored by:
> Power Architecture Resource Center: Free content, downloads,
> discussions,
> and more. http://solutions.newsforge.com/ibmarch.tmpl
> _______________________________________________
> Ganglia-developers mailing list
> Ganglia-developers@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/ganglia-developers
> 
> 


------------------------------------------------------
Martin Knoblauch
email: k n o b i AT knobisoft DOT de
www:   http://www.knobisoft.de

Reply via email to