This support forum board is for support questions relating to
Nagios XI , our flagship commercial network monitoring solution.
WillemDH
Posts: 2320 Joined: Wed Mar 20, 2013 5:49 am
Location: Ghent
Contact:
Post
by WillemDH » Tue Apr 15, 2014 9:15 am
Hello,
I'm trying to use checkfilesize to check if the nsclient log grows.
How would I have to escape the plus sign?
Code: Select all
COMMAND: /usr/local/nagios/libexec/check_nrpe -H servername -t 120 -c Checkfilesize -a ShowAll MaxWarn=10B MaxCrit=1M 'File=c:/Program Files/Nsclient\+\+ /nsclient.log'
OUTPUT: OK: c:/Program Files/Nsclient\\ \\ /nsclient.log: 0B|'c:/Program Files/Nsclient\\ \\ /nsclient.log'=0B;10;1048576
The command outputs OK, but in fact it doesn't find the file and thinks the size is zero bytes.
So I need to check c:/Program Files/Nsclient++/nsclient.log
Thanks for any advice
Willem
lmiltchev
Bugs find me
Posts: 13589 Joined: Mon May 23, 2011 12:15 pm
Post
by lmiltchev » Tue Apr 15, 2014 9:56 am
I haven't been able to make this work with passing arguments on the nagios side of things, but maybe you can try setting up an alias in the NSC.ini (nsclient.ini) as such:
Code: Select all
; Check File Size
check_file_size=CheckFileSize ShowAll MaxWarn=10B MaxCrit=1M "File=c:/program files/nsclient++/nsclient.log"
then run from the CLI:
Code: Select all
./check_nrpe -H servername -t 120 -c check_file_size
Here's what I got on my test box:
Code: Select all
[root@testbox libexec]# ./check_nrpe -H servername -t 120 -c check_file_size
CRITICAL: c:/program files/nsclient++/nsclient.log: 64.2M > critical|'c:/program files/nsclient++/nsclient.log'=67309773B;10;1048576
Be sure to check out our
Knowledgebase for helpful articles and solutions!
WillemDH
Posts: 2320 Joined: Wed Mar 20, 2013 5:49 am
Location: Ghent
Contact:
Post
by WillemDH » Wed Apr 16, 2014 4:24 am
Hi Ludmil,
An alias does indeed seem to work. As I'd like to be able to give the maxwarn and maxcrit as a parameter, I tested also with:
Code: Select all
; alias_check_file_size_nsclientlog
alias_check_file_size_nsclientlog=CheckFileSize ShowAll $ARG2$ "File=c:/program files/nsclient++/nsclient.log"
But when testing I get
Code: Select all
COMMAND: /usr/local/nagios/libexec/check_nrpe -H servername -t 120 -c alias_check_file_size_nsclientlog MaxWarn=25B MaxCrit=1M
OUTPUT: Unknown argument: $ARG2$
Any tips on how to pass the maxwarn and maxcrit as $arg2$ to the alias?
Grtz
Willem
WillemDH
Posts: 2320 Joined: Wed Mar 20, 2013 5:49 am
Location: Ghent
Contact:
Post
by WillemDH » Wed Apr 16, 2014 4:43 am
Ludmill,
Ok, I seem to have found it:
Made a command
Code: Select all
$USER1$/check_nrpe -H $HOSTADDRESS$ -t 30 -c alias_check_file_size_nsclientlog -a $ARG1$ $ARG2$
Changed the alias into
Code: Select all
; alias_check_file_size_nsclientlog
alias_check_file_size_nsclientlog=CheckFileSize ShowAll $ARG1$ $ARG2$ "File=c:/program files/nsclient++/nsclient.log"
And then pass MaxWarn as $ARG1$ and maxCrit as $ARG2$
And it seems to work fine. Thread can be closed!
Tx