[Nagiosplug-devel] patch: contrib/check_mem.pl using incorrect command

Stanley Hopcroft Stanley.Hopcroft at IPAustralia.Gov.AU
Wed Aug 18 03:38:05 CEST 2004


Dear Sir,

I am writing to thank you for your contribution and say that AFAIK 

- *BSD systems (FreeBSD 4.x anyway) do _not_ have a 'free' command

- they do however have a vmstat command which displays

stan> vmstat 
 procs      memory      page                    disks     faults      
cpu
 r b w     avm    fre  flt  re  pi  po  fr  sr ad0 ac0   in   sy  cs us 
sy id
 0 1 0   39356 134156   11   0   0   0   7   0   0   0 1345 2761 1064  1  
0 99
stan> 

from man vmstat
'
memory  Information about the usage of virtual and real memory.  Virtual
  pages (reported in units of 1024 bytes) are considered active if
  they belong to processes which are running or have run in the
  last 20 seconds.
 
  avm     active virtual pages
  fre     size of the free list

'

Would it be better to fish the free mem from the vmstat output (for 
those systems whose vmstat do show free memory) ?

On another matter, you may want to save a few fork and execs by 
replacing the piped calls to awk and head and friends with direct Perl 
manipulation of the command output

(eg

@vmstat = `vmstat`; # could even redirect stderr and check for errors
$head   = unshift @vmstat ; # etc etc

).

OTOH, I can well see why anyone would want to avoid breaking a plugin 
that works quite well.

Yours sincerely.

-- 
Stanley Hopcroft

Network specialist, IT Infrastructure
IP Australia
Ph: (02) 6283 3189  Fax: (02) 6281 1353
PO Box 200 Woden  ACT 2606
http://www.ipaustralia.gov.au




More information about the Devel mailing list