checking memory and cpu consumption of procs

Voon, Ton Ton.Voon at egg.com
Fri Dec 20 15:07:45 CET 2002


Dave,

I've tried to run your program on Solaris but I'm not having any joy. I
managed to add in the poll checks for configure, but when running, it goes
into an infinite loop. It seems that the line:

n = poll (fdarray, 2, INFTIM);

is returning 2, but the condition

(fdarray[0].revents & readable)

is not true and so the read_size never gets set to 0 and the loop never
ends.

I don't know if this is a Solaris limitation (uname: SunOS 2.6).

Is there any particular reason you wanted to use poll? I think for a simple
subcommand, the spopen and fgets used in check_procs is probably sufficient.

Ton

> -----Original Message-----
> From:	Dave Viner [SMTP:dviner at yahoo-inc.com]
> Sent:	Thursday, December 19, 2002 6:00 PM
> To:	Voon, Ton; nagios-users at lists.sourceforge.net
> Subject:	RE: [Nagios-users] checking memory and cpu consumption of
> procs
> 
> Here's my first stab at a check_cpu.c program.  I want to use poll() to
> watch both stdout and stderr of the child process, but I can't get it to
> compile on both FreeBSD and Linux.  FreeBSD just needs:
> 	#include <poll.h>
> but Linux needs:
> 	#include <sys/poll.h>
> 	#include <asm/poll.h>
> 
> Unfortunately this means that it requires a new definition in
> configure.in.
> I'm not quite sure how to handle that, but I'll also look into make those
> changes.  Can anyone help me with that?
> 
> Other than that, this program works very well (I think).
> 
> thanks
> 
> dave
> 
> -----Original Message-----
> From: nagios-users-admin at lists.sourceforge.net
> [mailto:nagios-users-admin at lists.sourceforge.net]On Behalf Of Dave Viner
> Sent: Wednesday, December 18, 2002 9:38 AM
> To: Voon, Ton; nagios-users at lists.sourceforge.net
> Subject: RE: [Nagios-users] checking memory and cpu consumption of procs
> 
> 
> I'll make one for FreeBSD and Linux.  I'll post it to the list when I have
> it ready.  Unforunately, I don't really understand autoconf/automake and
> configure.in/makefile.am, so I don't know that I'll be able to help much
> there....
> 
> Thanks !
> 
> dave
> 
> 
> -----Original Message-----
> From: Voon, Ton [mailto:Ton.Voon at egg.com]
> Sent: Wednesday, December 18, 2002 1:33 AM
> To: 'Dave Viner'; Voon, Ton; nagios-users at lists.sourceforge.net
> Subject: RE: [Nagios-users] checking memory and cpu consumption of procs
> 
> 
> A check_cpu, based on check_vsz, would be useful. However, it would
> require
> quite a few non-trivial changes to the configure.in and makefile.am to
> pick
> up various flags for the ps command to make it portable. If you want to
> make
> a start, I'd be happy to add in other OSes.
> 
> > -----Original Message-----
> > From:	Dave Viner [SMTP:dviner at yahoo-inc.com]
> > Sent:	Tuesday, December 17, 2002 6:23 PM
> > To:	Voon, Ton; nagios-users at lists.sourceforge.net
> > Subject:	RE: [Nagios-users] checking memory and cpu consumption of
> > procs
> >
> > Hi,
> >
> > Thanks for pointing me to check_vsz.  This is a really great utility.
> > From
> > looking at the usage message and the code itself, it looks to me like
> this
> > monitors virtual memory consumption.  Are there any hooks to monitor
> %cpu
> > consumption ?  Perhaps something like
> > 	ps waxco 'vsz %cpu command'
> > ?  I'm happy to try to add this in if it sounds useful.
> >
> > dave
> >
> > -----Original Message-----
> > From: Voon, Ton [mailto:Ton.Voon at egg.com]
> > Sent: Tuesday, December 17, 2002 1:31 AM
> > To: 'Dave Viner'; nagios-users at lists.sourceforge.net
> > Subject: RE: [Nagios-users] checking memory and cpu consumption of procs
> >
> >
> > Dave,
> >
> > Take a look at check_vsz for the virtual size of memory usage on a
> process
> > level. I've put lot of functionality patches on sourceforge, so you'll
> > need
> > to apply those.
> >
> > Ton
> >
> > > -----Original Message-----
> > > From:	Dave Viner [SMTP:dviner at yahoo-inc.com]
> > > Sent:	Tuesday, December 17, 2002 6:56 AM
> > > To:	nagios-users at lists.sourceforge.net
> > > Subject:	[Nagios-users] checking memory and cpu consumption of procs
> > >
> > > Hi,
> > > 	I want to ensure that no process on a machine consumes more than x %
> > > of the
> > > cpu, and y MB memory.  Is there an existing plugin that handles this?
> I
> > > saw
> > > that check_procs will monitor the number of processes on a machine
> > > (including ones that match a certain name), and check_load will
> examine
> > > the
> > > machine's overall load averages as reported by uptime.  But I can't
> seem
> > > to
> > > find anything that monitors cpu consumption or memory consumption.  Is
> > > there
> > > a plugin for this already?
> > >
> > > thanks
> > > dave
> > >
> >
> >
> 


This private and confidential e-mail has been sent to you by Egg.
The Egg group of companies includes Egg Banking plc
(registered no. 2999842), Egg Financial Products Ltd (registered
no. 3319027) and Egg Investments Ltd (registered no. 3403963) which
carries out investment business on behalf of Egg and is regulated
by the Financial Services Authority.  
Registered in England and Wales. Registered offices: 1 Waterhouse Square,
138-142 Holborn, London EC1N 2NA.
If you are not the intended recipient of this e-mail and have
received it in error, please notify the sender by replying with
'received in error' as the subject and then delete it from your
mailbox.



-------------------------------------------------------
This SF.NET email is sponsored by:  The Best Geek Holiday Gifts!
Time is running out!  Thinkgeek.com has the coolest gifts for
your favorite geek.   Let your fingers do the typing.   Visit Now.
T H I N K G E E K . C O M        http://www.thinkgeek.com/sf/




More information about the Users mailing list