Re: new plugin: check_system_load

2008-03-12 Thread Mark Powell
On Sat, 8 Mar 2008, Steve Kemp wrote: Having said that though executing "uptime" on each incoming connection might increase resource usage at a time when the system is already loaded - but I'm certain that doing that will be a lot less resource intensive than running clamav, spambayes, and all

Re: new plugin: check_system_load

2008-03-08 Thread Matt Sergeant
On 8-Mar-08, at 3:21 PM, Brian Szymanski wrote: eval { require Sys::CpuLoad }; my $_has_sys_cpuload = !$@; You might find this meme useful: use constant HAVE_CPULOAD => eval { require Sys::CpuLoad };

Re: new plugin: check_system_load

2008-03-08 Thread Steve Kemp
On Sat Mar 08, 2008 at 15:21:48 -0500, Brian Szymanski wrote: > I started cleaning this up to use a block, not string eval, and pull the > check out of getload so it needn't be called as often... But really, if > your load is "too" high, do you want to be exec'ing uptime on every > call? I sure wo

Re: new plugin: check_system_load

2008-03-08 Thread Brian Szymanski
I started cleaning this up to use a block, not string eval, and pull the check out of getload so it needn't be called as often... But really, if your load is "too" high, do you want to be exec'ing uptime on every call? I sure wouldn't. I say just require Sys::CpuLoad, warn and return DECLINED if it

Re: new plugin: check_system_load

2008-03-08 Thread Steve Kemp
On Sat Mar 08, 2008 at 10:02:12 -0600, Peter Eisch wrote: > I'm happy to take patches that keep the plugin universal and gather the > stats better. How about something like this: sub getLoad { # # Use the module if we can. # my $test = "use Sys::CpuLoad;"; eval( $test );

Re: new plugin: check_system_load

2008-03-08 Thread Peter Eisch
On Sat, 8 Mar 2008 16:08:10 +0100 Juerd Waalboer <[EMAIL PROTECTED]> wrote: > Peter Eisch skribis 2008-03-07 16:17 (-0600): > > $self->{_args}->{uptime} = '/usr/bin/uptime' > > if (! defined $self->{_args}->{uptime}); > > (...) > > my $res = `$self->{_args}->{uptime}`; > > Especially du

Re: new plugin: check_system_load

2008-03-08 Thread Juerd Waalboer
Peter Eisch skribis 2008-03-07 16:17 (-0600): > $self->{_args}->{uptime} = '/usr/bin/uptime' > if (! defined $self->{_args}->{uptime}); > (...) > my $res = `$self->{_args}->{uptime}`; Especially during high load, forking and executing uptime may not be such a wise thing to do, depending

Re: new plugin: check_system_load

2008-03-07 Thread Steve Kemp
On Fri Mar 07, 2008 at 17:48:22 -0500, Matt Sergeant wrote: > Note - you'd be better off using Linux::SysInfo (on Linux, obviously) to > save the backtick call. Noted. I'll update the code to use that where possible. (Right now I figured portability would be a good thing - although I realis

Re: new plugin: check_system_load

2008-03-07 Thread Matt Sergeant
Note - you'd be better off using Linux::SysInfo (on Linux, obviously) to save the backtick call. On 7-Mar-08, at 4:39 PM, Steve Kemp wrote: This seems like rather an obvious idea: Reject new connections if the system load is too high. But surprisingly there seem to be no plugins which

Re: new plugin: check_system_load

2008-03-07 Thread Peter Eisch
On 3/7/08 3:39 PM, "Steve Kemp" <[EMAIL PROTECTED]> wrote: > > This seems like rather an obvious idea: Reject new > connections if the system load is too high. But surprisingly > there seem to be no plugins which I could find implementing it. > I had posted this one to the list back a couple

new plugin: check_system_load

2008-03-07 Thread Steve Kemp
This seems like rather an obvious idea: Reject new connections if the system load is too high. But surprisingly there seem to be no plugins which I could find implementing it. So here's mine: http://mail-scanning.com/qpsmtpd/system-load This reads /etc/qpsmtpd/max_system_load, and