Problems using check_nrpe
Posted: Tue Dec 07, 2010 3:24 pm
I am having problems using the check_nrpe command to determine the age of a file on a server. I get the file to execute correctly from the command line but now that I’ve created a service for it in NagiosXI , the service will not find the file. Any ideas to why this is happening????
This runs fine from the command line. Responds with Critical State. I had to change the NSC.ini file to "allow_nasty_meta_chars=1" on the server I was trying to run the command against in order to get it to work, notice the 2 backslashes in the path of the file.
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
[root@nagios libexec]#./check_nrpe -H 10.5.5.5 -c CheckFile2 -a path=c:\\aw-test pattern=aw-test.txt MaxCrit=1 filter+written=gt:46m
aw-test.txt, aw-test.txt: 1 > critical|'aw-test.txt'=1;0;1;
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Below is the message I see from NagiosXI Service State Information page. Notice the Performance Data: ‘no files found’ = 0;0;1; Although the status says OK, it’s actually in Critical state according to the check parameters (see command line output above).
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
10.5.5.5
Service State Information
Current Status: OK
(for 0d 0h 55m 4s)
Status Information: CheckFile ok
Performance Data: 'no files found'=0;0;1;
Current Attempt: 1/5 (HARD state)
Last Check Time: 12-07-2010 11:14:35
Check Type: ACTIVE
Check Latency / Duration: 0.045 / 0.278 seconds
Next Scheduled Check: 12-07-2010 11:19:35
Last State Change: 12-07-2010 10:19:37
Last Notification: N/A (notification 0)
Is This Service Flapping? NO
(0.00% state change)
In Scheduled Downtime? NO
Last Update: 12-07-2010 11:14:37 ( 0d 0h 0m 4s ago)
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Below is the NagiosXI service configuration:
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
[root@nagios libexec]# cat /usr/local/nagios/etc/services/10.5.5.5\ -\ AW\ File\ Check.cfg
###############################################################################
#
# Service configuration file
#
# Created by: Nagios QL Version 3.0.3
# Date: 2010-12-07 11:10:40
# Version: Nagios 3.x config file
#
# --- DO NOT EDIT THIS FILE BY HAND ---
# Nagios QL will overwite all manual settings during the next update
#
###############################################################################
define service {
host_name 10.5.5.5
service_description 10.5.5.5 - AW File Check
check_command check_nrpe!CheckFile2 -a path=c:\\aw-test pattern=aw-test.txt MaxCrit=1 filter+written=gt:46m!!!!!!!
max_check_attempts 5
check_interval 5
retry_interval 1
register 1
}
###############################################################################
#
# Service configuration file
#
# END OF FILE
#
###############################################################################
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
This runs fine from the command line. Responds with Critical State. I had to change the NSC.ini file to "allow_nasty_meta_chars=1" on the server I was trying to run the command against in order to get it to work, notice the 2 backslashes in the path of the file.
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
[root@nagios libexec]#./check_nrpe -H 10.5.5.5 -c CheckFile2 -a path=c:\\aw-test pattern=aw-test.txt MaxCrit=1 filter+written=gt:46m
aw-test.txt, aw-test.txt: 1 > critical|'aw-test.txt'=1;0;1;
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Below is the message I see from NagiosXI Service State Information page. Notice the Performance Data: ‘no files found’ = 0;0;1; Although the status says OK, it’s actually in Critical state according to the check parameters (see command line output above).
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
10.5.5.5
Service State Information
Current Status: OK
(for 0d 0h 55m 4s)
Status Information: CheckFile ok
Performance Data: 'no files found'=0;0;1;
Current Attempt: 1/5 (HARD state)
Last Check Time: 12-07-2010 11:14:35
Check Type: ACTIVE
Check Latency / Duration: 0.045 / 0.278 seconds
Next Scheduled Check: 12-07-2010 11:19:35
Last State Change: 12-07-2010 10:19:37
Last Notification: N/A (notification 0)
Is This Service Flapping? NO
(0.00% state change)
In Scheduled Downtime? NO
Last Update: 12-07-2010 11:14:37 ( 0d 0h 0m 4s ago)
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Below is the NagiosXI service configuration:
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
[root@nagios libexec]# cat /usr/local/nagios/etc/services/10.5.5.5\ -\ AW\ File\ Check.cfg
###############################################################################
#
# Service configuration file
#
# Created by: Nagios QL Version 3.0.3
# Date: 2010-12-07 11:10:40
# Version: Nagios 3.x config file
#
# --- DO NOT EDIT THIS FILE BY HAND ---
# Nagios QL will overwite all manual settings during the next update
#
###############################################################################
define service {
host_name 10.5.5.5
service_description 10.5.5.5 - AW File Check
check_command check_nrpe!CheckFile2 -a path=c:\\aw-test pattern=aw-test.txt MaxCrit=1 filter+written=gt:46m!!!!!!!
max_check_attempts 5
check_interval 5
retry_interval 1
register 1
}
###############################################################################
#
# Service configuration file
#
# END OF FILE
#
###############################################################################
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------