Page 1 of 1

use check_nt with COUNTER convert kb to gb

Posted: Tue Nov 15, 2016 3:17 am
by dicenl
We are using a check to monitor the temdb file size with check_nt

./check_nt -H $HOSTADDRESS$ -p 12489 -v COUNTER -l "\\SQLServer:Databases(tempdb)\Data File(s) Size (KB)","%f"

but we would like to display the file size in GB instead of KB. With this check we always get a kb file size back. Is there a simple way to still use the check_nt check and display (UOM) in GB? Or is there a document we can use (we already checked ./check_nt --help)

Thanks in advance!

Re: use check_nt with COUNTER convert kb to gb

Posted: Tue Nov 15, 2016 11:31 am
by rkennedy
Does the counter have an output for GB? I don't think check_nt will perform the math for it as it's just polling that counter for the data.

One way around this, would be to write a wrapper script around it to add some math calculations.

Re: use check_nt with COUNTER convert kb to gb

Posted: Wed Nov 16, 2016 9:03 am
by dicenl
ok, thnx. I will take a look at it. If i find a solutions / script i will post it.

Re: use check_nt with COUNTER convert kb to gb

Posted: Wed Nov 16, 2016 5:41 pm
by ssax
As an example, you can use something like this:

Code: Select all

#!/bin/bash
value=`/usr/local/nagios/libexec/check_nt -H 192.168.X.X -p 12489 -s'secret' -v COUNTER -l "\memory\cache faults/sec"`
exitcode=$?
echo $(echo "$value/1024/1024" | bc -l)
exit $exitcode