check_nt wrapper

Jim Avery jim at jimavery.me.uk
Tue Nov 8 08:54:09 CET 2011


On 4 November 2011 14:18, mazar <mazar at autistici.org> wrote:
> Hi list,
>
> I've put together a wrapper for the Disk Reads/sec and Disk Writes/sec
> counters, my goal is to have an output as follow:
>
> ./check_diskio_win.sh 1.1.1.1 C
>
> Disk Reads/sec is 5 ; Disk Writes/sec is 25
>
> I'm able to accomplish this via script, but when I give it to nagios, as
> check_command the output (web interface) is as follow:
>
> Disk Reads/sec is : Disk Writes/sec is
>
> what I do in the script is basically the below command and some parsing
> (that works from shell script):
>
> check_nt -H $1 -v COUNTER  -l "\\PhysicalDisk(0 $2:)\\Disk
> Reads/sec","PhysicalDisk(0 $2:) Disk Reads/sec is %.f "

My guess is the shell is interpreting the "%" character in some way.
Try escaping it like so ..
  Reads/sec is \%.f "

but note that sometimes you need to escape a few times, as it might be
some other level in the process that needs the backslash to appear
intact.  Try with two or even three backslashes like so..
  Reads/sec is \\\%.f "

The most number of backslashes I have needed in a similar situation was five!

hth

------------------------------------------------------------------------------
RSA(R) Conference 2012
Save $700 by Nov 18
Register now
http://p.sf.net/sfu/rsa-sfdev2dev1
_______________________________________________
Nagios-users mailing list
Nagios-users at lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/nagios-users
::: Please include Nagios version, plugin version (-v) and OS when reporting any issue. 
::: Messages without supporting info will risk being sent to /dev/null





More information about the Users mailing list