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
#
###############################################################################
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Problems using check_nrpe
-
- Posts: 4380
- Joined: Mon Jun 14, 2010 10:21 am
Re: Problems using check_nrpe
Can you send us a screenshot of how you're entering the check command into the CCM?
I'm wondering if it would make a difference if you put all of the arguments as one of the $ARGx$ entries.
check_command check_nrpe!check_mem!-a '-w 15 -c 5'
Example Attached
I'm wondering if it would make a difference if you put all of the arguments as one of the $ARGx$ entries.
check_command check_nrpe!check_mem!-a '-w 15 -c 5'
Example Attached
You do not have the required permissions to view the files attached to this post.
-
- Posts: 13
- Joined: Fri Nov 19, 2010 9:18 am
Re: Problems using check_nrpe
I've added a picture of the check command. It is currently under 1 argument.
You do not have the required permissions to view the files attached to this post.
-
- Posts: 4380
- Joined: Mon Jun 14, 2010 10:21 am
Re: Problems using check_nrpe
I would try doing the check command as the first argument, and then the arguments as $ARG2$, and put those in single quotes.
-
- Posts: 13
- Joined: Fri Nov 19, 2010 9:18 am
Re: Problems using check_nrpe
I've tried a few different variations. Do I still need 2 back slashes? Can you give me an example?
$USER1$/check_nrpe -H $HOSTADDRESS$ -t 30 -c $ARG1$ $ARG2$
This is what I currently have. Still doesn't work.
$ARG1$ CheckFile2
$ARG2$ -a path='c:\aw-test pattern=aw-test.txt MaxCrit=1 filter+written=gt:46m'
Also tried this:
$ARG1$ CheckFile2
$ARG2$ -a path='c:\\aw-test pattern=aw-test.txt MaxCrit=1 filter+written=gt:46m'
$USER1$/check_nrpe -H $HOSTADDRESS$ -t 30 -c $ARG1$ $ARG2$
This is what I currently have. Still doesn't work.
$ARG1$ CheckFile2
$ARG2$ -a path='c:\aw-test pattern=aw-test.txt MaxCrit=1 filter+written=gt:46m'
Also tried this:
$ARG1$ CheckFile2
$ARG2$ -a path='c:\\aw-test pattern=aw-test.txt MaxCrit=1 filter+written=gt:46m'
-
- Posts: 4380
- Joined: Mon Jun 14, 2010 10:21 am
Re: Problems using check_nrpe
Try the entire argument string in quotes.
The other possibility would be to add these arguments in your description on the client side. However if you are reusing this command at multiple locations it's better to set this up on the Nagios server.$ARG1$ CheckFile2
$ARG2$ '-a path=c:\\aw-test pattern=aw-test.txt MaxCrit=1 filter+written=gt:46m'
-
- Posts: 13
- Joined: Fri Nov 19, 2010 9:18 am
Re: Problems using check_nrpe
Still not working, below are the variations I tried.
$ARG1$ CheckFile2
$ARG2$ '-a path=c:\\aw-test pattern=aw-test.txt MaxCrit=1 filter+written=gt:46m'
Current Status: UNKNOWN (for 0d 0h 0m 11s)
Status Information: Unknown argument: -a path
Performance Data:
-----------------------------------------------------------------------------------------------------------
$ARG1$ CheckFile2 -a
$ARG2$ 'path='c:\\aw-test pattern=aw-test.txt MaxCrit=1 filter+written=gt:46m'
Current Status: OK (for 0d 0h 0m 13s)
Status Information: CheckFile ok
Performance Data: 'no files found'=0;0;0;
-----------------------------------------------------------------------------------------------------------
$ARG1$ CheckFile2
$ARG2$ -a path='c:\\aw-test pattern=aw-test.txt' MaxCrit=1 filter+written=gt:46m
Current Status: OK (for 0d 0h 2m 21s)
Status Information: CheckFile ok
Performance Data: 'no files found'=0;0;1;
-----------------------------------------------------------------------------------------------------------
What's the difference in the Performance Data line? 0;0;0 and 0;0;1
How would I add this on the client side description?
$ARG1$ CheckFile2
$ARG2$ '-a path=c:\\aw-test pattern=aw-test.txt MaxCrit=1 filter+written=gt:46m'
Current Status: UNKNOWN (for 0d 0h 0m 11s)
Status Information: Unknown argument: -a path
Performance Data:
-----------------------------------------------------------------------------------------------------------
$ARG1$ CheckFile2 -a
$ARG2$ 'path='c:\\aw-test pattern=aw-test.txt MaxCrit=1 filter+written=gt:46m'
Current Status: OK (for 0d 0h 0m 13s)
Status Information: CheckFile ok
Performance Data: 'no files found'=0;0;0;
-----------------------------------------------------------------------------------------------------------
$ARG1$ CheckFile2
$ARG2$ -a path='c:\\aw-test pattern=aw-test.txt' MaxCrit=1 filter+written=gt:46m
Current Status: OK (for 0d 0h 2m 21s)
Status Information: CheckFile ok
Performance Data: 'no files found'=0;0;1;
-----------------------------------------------------------------------------------------------------------
What's the difference in the Performance Data line? 0;0;0 and 0;0;1
How would I add this on the client side description?
-
- Posts: 4380
- Joined: Mon Jun 14, 2010 10:21 am
Re: Problems using check_nrpe
I just re-read through this thread and I realized I may have misunderstood what you're asking for. So you're getting a valid check result, but your performance data is not returning as expected, correct?
Here's the breakdown for the expected format for performance data. In order for the data to graph correctly the syntax being returned by the check plugin must be correct.
http://docs.pnp4nagios.org/pnp-0.4/abou ... quirements
Here's the breakdown for the expected format for performance data. In order for the data to graph correctly the syntax being returned by the check plugin must be correct.
http://docs.pnp4nagios.org/pnp-0.4/abou ... quirements
-
- Posts: 13
- Joined: Fri Nov 19, 2010 9:18 am
Re: Problems using check_nrpe
The problem is that the check command works from the command line but when I created a service for it the check command doesn't return the correct status of the file.
The performance data question was just the 0;0;0 vs. 0;0;1. When the check runs correctly from the command line I get 1;0;1.
I just want the check to work in the service the same way it works from the command line.
The performance data question was just the 0;0;0 vs. 0;0;1. When the check runs correctly from the command line I get 1;0;1.
I just want the check to work in the service the same way it works from the command line.
-
- Posts: 13
- Joined: Fri Nov 19, 2010 9:18 am
Re: Problems using check_nrpe
These 2 variations work from the command line:
[root@b-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;
[root@b-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;
--------------------------------------------------------------------------------------------------------
This is the service check:
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-09 10:16:29
# 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 is the Service State Information:
Service State Information
Current Status: OK (for 0d 2h 15m 11s)
Status Information: CheckFile ok
Performance Data: 'no files found'=0;0;1;
Current Attempt: 1/5 (HARD state)
Last Check Time: 12-09-2010 12:17:05
Check Type: ACTIVE
Check Latency / Duration: 0.198 / 0.300 seconds
Next Scheduled Check: 12-09-2010 12:22:05
Last State Change: 12-09-2010 10:06:05
Last Notification: N/A (notification 0)
Is This Service Flapping? NO (0.00% state change)
In Scheduled Downtime? NO
Last Update: 12-09-2010 12:21:16 ( 0d 0h 0m 0s ago)
----------------------------------------------------
The check is NOT ok. As you can tell from the command line output, the check is in a Critical state.
[root@b-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;
[root@b-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;
--------------------------------------------------------------------------------------------------------
This is the service check:
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-09 10:16:29
# 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 is the Service State Information:
Service State Information
Current Status: OK (for 0d 2h 15m 11s)
Status Information: CheckFile ok
Performance Data: 'no files found'=0;0;1;
Current Attempt: 1/5 (HARD state)
Last Check Time: 12-09-2010 12:17:05
Check Type: ACTIVE
Check Latency / Duration: 0.198 / 0.300 seconds
Next Scheduled Check: 12-09-2010 12:22:05
Last State Change: 12-09-2010 10:06:05
Last Notification: N/A (notification 0)
Is This Service Flapping? NO (0.00% state change)
In Scheduled Downtime? NO
Last Update: 12-09-2010 12:21:16 ( 0d 0h 0m 0s ago)
----------------------------------------------------
The check is NOT ok. As you can tell from the command line output, the check is in a Critical state.