tru64-unix-managers (formerly alpha-osf-managers) (1994-2012)
 help / color / mirror / Atom feed
From: Dirk Bergl <dbergl () dbtech ! com ! au>
To: tru64-unix-managers
Subject: SUMMARY: mrtg - recording swap and mem. with vmstat
Date: Thu, 05 Aug 1999 07:41:15 +0000	[thread overview]
Message-ID: <96079067215811.tru64-unix-managers.marc@archive.invalid> (raw)

Hi eveyone,


Thanks to the following for responding.......

"Frank Wortner" <frank@bondnet.com>
alan@nabeth.cxo.dec.com
"Alvarez, Cynthia" <Alvare2C@kochind.com>
"Balamuralikrishnan" <bsriniva@oakland.edu>
"Thomas.Meyer" <meyert@dla-marbach.de>

(Sorry if I left anyone out)



The original question was....

What is the best/easiest way to collect free memory and swap for use with 
mrtg.

From the several different answers I recieved, there's a number of ways. 
 It comes down to individual choice...


A)
try "vmstat -s | sed -ne 4p" for free memory,
and the same for swap  space:	 "swapon -s | sed -ne 16p"

------------------------------------------------------------------------  
--------------------------------------------
B)

If you don't mind dealing in percentages rather than total MB...

	/usr/sbin/swapon -s | awk '/Available/ { print $6 }' | sed -e 's/%)//'

If you want total physical memory use,  then vmstat -P :

	vmstat -P | awk '/Physical/ { print $7 }' | sed -e 's/M//'

If you want a percentage,  just recover the total physical memory from the
boot message in /var/adm/messages and do the arithmetic:

	awk 'BEGIN { MEM = 0 }
		/physical memory/ { MEM = $9 }
		END { print MEM }'

------------------------------------------------------------------------  
--------------------------------------------
C)
Use TOP, a utility program, and grep the headings for the required data.


------------------------------------------------------------------------  
--------------------------------------------
D)

Use Performance Manager Metrics Server as a source for MRTG
data.
pmgrd runs on port 1167 if set up and delivers a rich variety of data,
including memory and swap statistics.


------


Also, as I discovered, and as Alan pointed out, if you use vmstat with 
MRTG, beware that sometimes vmstat's fields overrun, joining fields 
togeather.  To overcome this I used NF in the awk script,  and then grabbed 
the last 3 fields I was interested in via "(NR-1) (NR-2) (NR-3).

After initially using vmstat, I converted to using top for the stats, 
although I'm still checking top to make sure it's stats are accurate.
pmgrd also looks like it might be worth investigating (Thanks for that 
info. Thomas)



Thanks again for everyone's help.
Cheers,
Dirk.

                 reply	other threads:[~1999-08-05  7:41 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed
read-only archive

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox