PDA

View Full Version : monitor virtuozzo privvmpages (and others)


globifrosch
29-02-2008, 21:43
i have some Virtuozzo hosts. There is one parameter (at least for me) to watch out for: privvmpages

so now, this is how you can do it:

1. save this script somewhre (eg. /usr/local/bin)

#!/bin/sh

if [ -z $1 ] ; then echo argument error && exit 1; fi;

COLUMN=1

case $2 in
held) COLUMN=1 ;;
maxheld) COLUMN=2 ;;
barrier) COLUMN=3 ;;
limit) COLUMN=4 ;;
failcnt) COLUMN=5 ;;
esac


REGEX='s| +[a-z]+ +([0-9]+) +([0-9]+) +([0-9]+) +([0-9]+) +([0-9]+)|'
REGEX="$REGEX\\${COLUMN}|"

cat /proc/user_beancounters | grep $1 | sed -r "$REGEX"

2. add a UserParameter to zabbix_agendtd.conf (or whatever zabbix*.conf you are using:

UserParameter=vz ,sudo <pathtoyoursavedscript> $1 $2

3. edit the sudoers file (aka: visudo)

zabbix ALL=(root) NOPASSWD: <pathtoyoursavedscript>

4. restart zabbix_agent

5. add new item with key "vz[privvmpages,held]", "vz[privvmpages,barrier]", vz[privvmpages,failcnt], etc. Have a look at /proc/user_beancounters what other counters and limits there are.