2008/09/29

Check on Nagios the latest files in folder with NSClient++

CURRENT CONFIGURATION: Linux OpenSuSe, Nagios 3.0.1, NRPE; Windows 2003 x64 server, NSClient++ 0.3.5.1

OBJECTIVE: Monitor SQL backup with Nagios. Check FOLDER with SQL backup files. Send WARNING if ALL files *.bak are older than 24 hours.

SOLUTION:
NRPE has to work on Nagios server and on Windows client computer with NSClient++.
Nagios server command.cfg file:

define command{
command_name check_nrpe_file_new
command_line $USER1$/check_nrpe -H $HOSTADDRESS$ -c CheckFile2 -a file="$ARG1$" filter=in filter+creation=\<"$ARG2$" syntax="%filename% was created %creation%" MinWarn=0 #MinCrit=0 }

define command{
command_name check_nrpe_file_mod
command_line $USER1$/check_nrpe -H $HOSTADDRESS$ -c CheckFile2 -a file="$ARG1$" filter=in filter+written=\<"$ARG2$" syntax="%filename% was modified %write%" MinWarn=0 }


Nagios server somename.cfg file:

define service{
...
check_command check_nrpe_file_new!X:\\FOLDER\\TX\\*.trn!35m
normal_check_interval 60
}

define service{
...
check_command check_nrpe_file_mod!X:\\FOLDER\\*.bak!30h
normal_check_interval 60
}


NSClient++ NSC.ini file:

[modules]
NRPEListener.dll
[NRPE]
allow_arguments=1
allow_nasty_meta_chars=1


Big thanks to NSClient++ author for program and excellent support.
P.S. I use
NSClient++ 0.3.6.316 (10/09/2009). For NSClient++ 0.3.9.330 2011-09-02 please read article Check on Nagios the latest files in folder with NSClient++ 0.3.9

TAGS: Nagios, Windows server, file age

4 комментария:

jcl4ever комментирует...

Your command_line confuses me. What is the value for the "-a" option?

As far as I know, spaces separate arguments so, only file="$ARG1$ is the value for the -a option.

Which leaves the question of how the rest of the line is processed (listed below)

filter=in filter+creation=\<"$ARG2$" syntax="%filename% was created %creation%" MinWarn=0 #MinCrit=0

And finally, where is the script that actually does the checking?

Vadim Zenin комментирует...

Hi thequietcenter,

Thanks for your response.
>Your command_line confuses me. What is the value for the "-a" option?
Please read this link "Using NSClient++ from nagios with check_nrpe" http://nsclient.org/nscp/wiki/doc/usage/nagios/nrpe
Please keep in mind that it is article for NSClient++ 0.3.5.1. Filter commands was changed for newer version. I would update the article as soon as I have free time.

With love and light.

Анонимный комментирует...

What to do with the version nsclient + + 0.3.9? It does not work. on version 0.3.6 and it works.

Vadim Zenin комментирует...

For NSClient++ 0.3.9.330 2011-09-02 please read my article Check on Nagios the latest files in folder with NSClient++ 0.3.9