check_nt WMI Perfmon - Virtual Memory Usage Output Problem


#1

So I’m monitoring the virtual memory usage of a particular process via check_nt and the WMI interface.

The interface works great and it’s returning data fine, the problem is that it’s returning the value in bits.

Thus: Virtual Memory Usage: 141369344

That’s 141,369,344 bits, or 17,671,168 bytes, or around 17MB of VRAM being used.

I really don’t want to have to run that through a calculator, and for some reason, when I set the Warning/Critical limits to 12,000,000,000 and 16,000,000,000 respectively (Obviously without commas in the actual config, 1.5GB and 2.0GB by the way) it goes critical immediately.

I would like one of two solutions to this problem, or both if that’s feasable.

Either I would like to have the output display in MB or I would like a way for the Warning and Critical levels to work correctly with the output remaining in Bits.

Any suggestions would be greatly appreciated, I don’t mind compiling a separate version of check_nt if I have to, but I’d rather just find a way to parse the output before it hits the Nagios CGIs.

Thanks in advance.


#2

If i were you, i’d make a script called check_nt_virtmem that runs the check_nt plugin, then performs some math on the results. This is my terrible script-plugin i made for you ahaha:
#############

#!/bin/bash
RESULT=check_nt -h host1.bla.com -c virtmem | sed -e 's/Virtual Memory Usage: //'

CALCULATED=echo $RESULT | awk '{print $1/8/1000000 " MB"}'

echo $CALCULATED
exit 0

#############

Replace check_nt with proper values cause I don’t know them, and change your sed -e matching as appropriate. Good luck!


#3

Thanks for the reply, I got it working on the command line, but Nagios itself doesn’t like it:

ADR-Server-VM-Usage OK 12-18-2007 15:21:16 0d 0h 0m 29s 1/3 0 MB
Is what Nagios says

./check_adr02_vmem

38.6724 MB

./check_adr01_vmem

204.457 MB

Is what outputs from this script:
#############

#!/bin/bash

RESULT=./check_nt -H adr01 -p 1248 -v COUNTER -l "\Process(EvDRServer)\Virtual Bytes" -w 1500 -c 2000 | sed -e 's/Virtual Memory Usage: //'

CALCULATED=echo $RESULT | awk '{print $1/8/1000000 " MB"}'

echo $CALCULATED
exit 0

#############

I’m really glad I got the command line part working, do you have any suggestions about the Nagios side?