Path containing ! (exclamation mark)


#1

Hello,
I just tried to figure out how to monitor mounted volumes containing an exclamation mark (!) but had no luck.

e.g.: Volume VOLUME1 is mounted to C:!VOLUME1!

The line in NSC.ini:

command[nrpe_check_disk]=inject CheckDriveSize $ARG1$

The Nagios checkcommand:

check_command check_nrpe!nrpe_check_disk!-a ‘ShowAll MinWarnFree=10% MinCritFree=5% Drive=C:!VOLUME1!’

Output (nsclient++ -test)

d \NSClient++.cpp(910) Injecting: nrpe_check_disk: ShowAll MinWarnFree=10% MinCritFree=5% Drive=C:, VOLUME1,\

d \NSClient++.cpp(910) Injecting: CheckDriveSize: ShowAll, MinWarnFree=10%, MinCritFree=5%, Drive=C:\

d \NSClient++.cpp(946) Injected Result: OK ‘OK: C:: 34.1G’

d \NSClient++.cpp(947) Injected Performance Result: '‘C:’=15%;10;5; ’

d \NSClient++.cpp(946) Injected Result: OK ‘OK: C:: 34.1G’

d \NSClient++.cpp(947) Injected Performance Result: '‘C:’=15%;10;5; ’

In NSC.ini all allow_nasty_meta_chars are set to 1

I’m using the latest nightly build NSClient+±Win32-20080923-2231.zip.

It would be very nice if someone is able to tell me how to “escape” the exclamation mark (!) when using “inject” for checking DriveSize.


#2

you “cant” :slight_smile:

NRPE does not (AFAIK) support any form of “escaping” of ! (as it uses as separator)

What you can do is add it “in” NSClient++ in other words use the ExternalScripts module and the “alias” section. BUt that would mean “hard configuring” the command on the client.

Any thoughts on how to “improve” this would be appreciated (so feel free to come with nice ideas).

// MickeM


#3

Thanks for your advice!!

The solution suitable for me:

In NSC.ini:

uncomment CheckExternalScripts.dll in [modules] section

create alias_VOLUME1=CheckDriveSize ShowAll MinWarnFree=10% MinCritFree=5% “Drive=C:!VOLUME1!” in [External Alias] section

create command[nrpe_check_disk_VOLUME1]=inject alias_VOLUME1 in [NRPE Handlers] section

Executed the following command on NAGIOS host to check configuration:

check_nrpe -H XXX.XXX.XXX.XXX -p 5666 -c nrpe_check_disk_VOLUME1

…and it works perfectly!!


#4

humm, you dont actually need the "create command[nrpe_check_disk_VOLUME1]=inject alias_VOLUME1 in [NRPE Handlers] section "

all “commands” are available via NRPE so you can just use the lias as-is.

// MickeM


#5

Hello,

just played with the thing and now here is the config just running:

In NSC.INI:

[External Alias]

;# Now follow the checks used on NAGIOS server

;# External aliases must be used because NRPE does not forward special characters

;# like the exclamation mark (!)

;####################################################

;# Commands #

;####################################################

;# Please uncomment the line containing the drive letter, volume or directory you want to check.

;# Set and values at the end of each line to the amount suiting your purposes

nrpe_check_disk_volume1=CheckDriveSize ShowAll MinWarnFree=10% MinCritFree=5% “Drive=C:!volume1!”

nrpe_check_disk_volume2=CheckDriveSize ShowAll MinWarnFree=10% MinCritFree=5% “Drive=C:!volume2!”

nrpe_check_disk_volume3=CheckDriveSize ShowAll MinWarnFree=10% MinCritFree=5% “Drive=C:!volume3!”

check commands on NAGIOS server:

check_nrpe!nrpe_check_disk_volume1

check_nrpe!nrpe_check_disk_volume2

check_nrpe!nrpe_check_disk_volume3

Again thanks for helping and putting me on the right track!!


#6

Hi,

since your answer was a long time ago, are there any news to it? Tested with Backslashes and exclamation marks as escape.

Best regards


#7

check_drivesize “crit=free<10%” drive=* check_drivesize "perf-config=*(unit:g)" check_drivesize “crit=free<1M” “warn=free<10M” drive=c:\volumne_test