Plugin Help Please - " check_cap "
-
nagios4all
- Posts: 11
- Joined: Tue Mar 06, 2012 1:31 pm
Plugin Help Please - " check_cap "
Hello
I hope some of you will be able to help me out to get the following plugin work on Nagios Core 3.3.1 :
http://exchange.nagios.org/directory/Pl ... ds/details
Could you please write a step-by-step instructions specifically applies to a fully working Nagios Core v3.3.1 instance?
Thanks in advance.
Scott
I hope some of you will be able to help me out to get the following plugin work on Nagios Core 3.3.1 :
http://exchange.nagios.org/directory/Pl ... ds/details
Could you please write a step-by-step instructions specifically applies to a fully working Nagios Core v3.3.1 instance?
Thanks in advance.
Scott
Re: Plugin Help Please - " check_cap "
Download the plugin and put it in the "/usr/local/nagios/libexec" directory.
Make it executable:
In order to see the options, run in terminal:
# cd /usr/local/nagios/libexec
# ./check_cap -h
Create a command definition. It may look something like this:
Create a service definition. (I added this service to my localhost, but you can set it up your own way). It may look something like this:
Make sure you don't have any configuration errors:
Note: Paths may vary on your machine.
Restart nagios:
Log in the web interface. You should see something like this:
Make it executable:
Code: Select all
# chmod +x /usr/local/nagios/libexec/check_cap# cd /usr/local/nagios/libexec
# ./check_cap -h
Create a command definition. It may look something like this:
Code: Select all
define command {
command_name check_cap
command_line $USER1$/./check_cap -s MN -l 027123 -w Moderate -c SevereCode: Select all
define service {
host_name localhost
service_description Weather Alerts
use generic-service
display_name Weather Alerts
check_command check_cap!!!!!!!!
max_check_attempts 5
check_interval 1
retry_interval 3
check_period nagiosadmin_notification_times
notification_interval 60
first_notification_delay 0
notification_period nagiosadmin_notification_times
notification_options w,u,r,c
notifications_enabled 1
contacts nagiosadmin
register 1
}Code: Select all
/usr/local/nagios/bin/nagios -v /usr/local/nagios/etc/nagios.cfgRestart nagios:
Code: Select all
service nagios restartBe sure to check out our Knowledgebase for helpful articles and solutions!
-
nagios4all
- Posts: 11
- Joined: Tue Mar 06, 2012 1:31 pm
Re: Plugin Help Please - " check_cap "
Lmiltchev,
Thanks for your instructions and I followed the step with almost success. Unfortunately, I'm getting a "null" return and "warning" status. I'm sure it has something to do with my environment/config and I would like you please review my config and recommend a fix if at all possible. Our area is notorious for bad weather related damages and would like to utilize this useful plugin for this season.

/usr/local/nagios/etc/objects/commands.cfg
################################################################################
#
# SAMPLE SERVICE CHECK COMMANDS
#
# These are some example service check commands. They may or may not work on
# your system, as they must be modified for your plugins. See the HTML
# documentation on the plugins for examples of how to configure command definitions.
#
# NOTE: The following 'check_local_...' functions are designed to monitor
# various metrics on the host that Nagios is running on (i.e. this one).
################################################################################
# 'check_cap' command definition
define command {
command_name check_cap
command_line $USER1$/./check_cap -s MN -l 027123 -w Moderate -c Severe
}
# 'check_local_disk' command definition
define command{
command_name check_local_disk
command_line $USER1$/check_disk -w $ARG1$ -c $ARG2$ -p $ARG3$
}
/usr/local/nagios/etc/objects/localhost.cfg
# Define an optional hostgroup for Linux machines
define hostgroup{
hostgroup_name linux-servers ; The name of the hostgroup
alias Linux Servers ; Long name of the group
members localhost ; Comma separated list of hosts that belong to this group
}
###############################################################################
###############################################################################
#
# SERVICE DEFINITIONS
#
###############################################################################
###############################################################################
# Define a service to "check_cap" for weather alerts from NOAA
define service{
use local-service ; Name of service template to use
host_name localhost
service_description Weather Alerts
check_command check_cap
}
Thanks in advance.
Scott
Thanks for your instructions and I followed the step with almost success. Unfortunately, I'm getting a "null" return and "warning" status. I'm sure it has something to do with my environment/config and I would like you please review my config and recommend a fix if at all possible. Our area is notorious for bad weather related damages and would like to utilize this useful plugin for this season.

/usr/local/nagios/etc/objects/commands.cfg
################################################################################
#
# SAMPLE SERVICE CHECK COMMANDS
#
# These are some example service check commands. They may or may not work on
# your system, as they must be modified for your plugins. See the HTML
# documentation on the plugins for examples of how to configure command definitions.
#
# NOTE: The following 'check_local_...' functions are designed to monitor
# various metrics on the host that Nagios is running on (i.e. this one).
################################################################################
# 'check_cap' command definition
define command {
command_name check_cap
command_line $USER1$/./check_cap -s MN -l 027123 -w Moderate -c Severe
}
# 'check_local_disk' command definition
define command{
command_name check_local_disk
command_line $USER1$/check_disk -w $ARG1$ -c $ARG2$ -p $ARG3$
}
/usr/local/nagios/etc/objects/localhost.cfg
# Define an optional hostgroup for Linux machines
define hostgroup{
hostgroup_name linux-servers ; The name of the hostgroup
alias Linux Servers ; Long name of the group
members localhost ; Comma separated list of hosts that belong to this group
}
###############################################################################
###############################################################################
#
# SERVICE DEFINITIONS
#
###############################################################################
###############################################################################
# Define a service to "check_cap" for weather alerts from NOAA
define service{
use local-service ; Name of service template to use
host_name localhost
service_description Weather Alerts
check_command check_cap
}
Thanks in advance.
Scott
Re: Plugin Help Please - " check_cap "
What happens when you run it in the command line?
Did you restart nagios?
Code: Select all
# cd /usr/local/nagios/libexec
# ./check_cap -s MN -l 027123 -w Moderate -c SevereBe sure to check out our Knowledgebase for helpful articles and solutions!
Re: Plugin Help Please - " check_cap "
Here's another way to set up this check:
command definition:
command definition:
Code: Select all
$USER1$/check_cap -s $ARG1$ -l $ARG2$ -w $ARG3$ -c $ARG4$Code: Select all
define service {
host_name Weather
service_description Somewhere In Nevada
check_command check_cap!NV!NVZ454!Unknown!Unknown-
nagios4all
- Posts: 11
- Joined: Tue Mar 06, 2012 1:31 pm
Re: Plugin Help Please - " check_cap "
lmiltchev
Thanks for reviewing my post. After following your initial instructions, I have run the following:
# chmod +x /usr/local/nagios/libexec/check_cap = OK
# /usr/local/nagios/bin/nagios -v /usr/local/nagios/etc/nagios.cfg = OK
# service nagios restart = OK
Whe I do the following:
# cd /usr/local/nagios/libexec
# ./check_cap -s MN -l 027123 -w Moderate -c Severe
I get the following out put with an error at the very bottom line:
[root@localhost libexec]# ./check_cap -s MN -l 027123 -w Moderate -c Severe
Traceback (most recent call last):
File "./check_cap", line 307, in <module>
sys.exit(main(sys.argv[1:]))
File "./check_cap", line 224, in main
feed = opener.open(request)
File "/usr/lib/python2.7/urllib2.py", line 391, in open
response = self._open(req, data)
File "/usr/lib/python2.7/urllib2.py", line 409, in _open
'_open', req)
File "/usr/lib/python2.7/urllib2.py", line 369, in _call_chain
result = func(*args)
File "/usr/lib/python2.7/urllib2.py", line 1173, in http_open
return self.do_open(httplib.HTTPConnection, req)
File "/usr/lib/python2.7/urllib2.py", line 1142, in do_open
h.request(req.get_method(), req.get_selector(), req.data, headers)
File "/usr/lib/python2.7/httplib.py", line 946, in request
self._send_request(method, url, body, headers)
File "/usr/lib/python2.7/httplib.py", line 986, in _send_request
self.putheader(hdr, value)
File "/usr/lib/python2.7/httplib.py", line 924, in putheader
str = '%s: %s' % (header, '\r\n\t'.join(values))
TypeError: sequence item 0: expected string, datetime.datetime found
[root@localhost libexec]#
Naturally, I have the same status on the web interface: Current Status -Warning, Status Information: (null), Current Attempt: 4/4 HARD State.
I have a total of 4 hosts and 12 services and only this particular one is having problem and everything else is OK.
Please advise.
Scott
Thanks for reviewing my post. After following your initial instructions, I have run the following:
# chmod +x /usr/local/nagios/libexec/check_cap = OK
# /usr/local/nagios/bin/nagios -v /usr/local/nagios/etc/nagios.cfg = OK
# service nagios restart = OK
Whe I do the following:
# cd /usr/local/nagios/libexec
# ./check_cap -s MN -l 027123 -w Moderate -c Severe
I get the following out put with an error at the very bottom line:
[root@localhost libexec]# ./check_cap -s MN -l 027123 -w Moderate -c Severe
Traceback (most recent call last):
File "./check_cap", line 307, in <module>
sys.exit(main(sys.argv[1:]))
File "./check_cap", line 224, in main
feed = opener.open(request)
File "/usr/lib/python2.7/urllib2.py", line 391, in open
response = self._open(req, data)
File "/usr/lib/python2.7/urllib2.py", line 409, in _open
'_open', req)
File "/usr/lib/python2.7/urllib2.py", line 369, in _call_chain
result = func(*args)
File "/usr/lib/python2.7/urllib2.py", line 1173, in http_open
return self.do_open(httplib.HTTPConnection, req)
File "/usr/lib/python2.7/urllib2.py", line 1142, in do_open
h.request(req.get_method(), req.get_selector(), req.data, headers)
File "/usr/lib/python2.7/httplib.py", line 946, in request
self._send_request(method, url, body, headers)
File "/usr/lib/python2.7/httplib.py", line 986, in _send_request
self.putheader(hdr, value)
File "/usr/lib/python2.7/httplib.py", line 924, in putheader
str = '%s: %s' % (header, '\r\n\t'.join(values))
TypeError: sequence item 0: expected string, datetime.datetime found
[root@localhost libexec]#
Naturally, I have the same status on the web interface: Current Status -Warning, Status Information: (null), Current Attempt: 4/4 HARD State.
I have a total of 4 hosts and 12 services and only this particular one is having problem and everything else is OK.
Please advise.
Scott
-
nagios4all
- Posts: 11
- Joined: Tue Mar 06, 2012 1:31 pm
Re: Plugin Help Please - " check_cap "
Mguthrie,
Thanks for chip in to solve this issue. Please see my post above and for curiosity sake, I have tried your suggestions after trying Lmiltchev's instructions to try the check via command line. Unfortunately, no luck as we know the command line did not output a correct result and I know there is no point trying your suggestion but I was just trying my luck here! It has been a few days I'm trying to get this plugin to work as we are approaching another bad weather season here in the southeast region.
Any help from both of you would be highly appreciated.
Thanks
Scott
Thanks for chip in to solve this issue. Please see my post above and for curiosity sake, I have tried your suggestions after trying Lmiltchev's instructions to try the check via command line. Unfortunately, no luck as we know the command line did not output a correct result and I know there is no point trying your suggestion but I was just trying my luck here! It has been a few days I'm trying to get this plugin to work as we are approaching another bad weather season here in the southeast region.
Any help from both of you would be highly appreciated.
Thanks
Scott
Re: Plugin Help Please - " check_cap "
Hi Scott,
I'm wondering if there's maybe something in python that's changed from our version to yours. I'm running 2.4 on mine, and there could be some things that have changed with that particular library from our version to yours...
I'm wondering if there's maybe something in python that's changed from our version to yours. I'm running 2.4 on mine, and there could be some things that have changed with that particular library from our version to yours...
TypeError: sequence item 0: expected string, datetime.datetime found
-
nagios4all
- Posts: 11
- Joined: Tue Mar 06, 2012 1:31 pm
Re: Plugin Help Please - " check_cap "
Lmiltchev, Mguthrie,
Do you think the Python version could be the culprit on my system. The Python version on my system is as follows by running:
#Python -v:
Python 2.7 (r27:82500, Sep 16 2010, 18:03:06)
[GCC 4.5.1 20100907 (Red Hat 4.5.1-3)] on linux2
If this is the case can you give me the steps to replace with v.2.4? I'm running on a Fedora 14 x86 box.
Thanks in advance.
Mark
Do you think the Python version could be the culprit on my system. The Python version on my system is as follows by running:
#Python -v:
Python 2.7 (r27:82500, Sep 16 2010, 18:03:06)
[GCC 4.5.1 20100907 (Red Hat 4.5.1-3)] on linux2
If this is the case can you give me the steps to replace with v.2.4? I'm running on a Fedora 14 x86 box.
Thanks in advance.
Mark
Re: Plugin Help Please - " check_cap "
I am not sure what could be the issue. I don't think you should be downgrading python to v2.4 because of it. In fact, I was also using v2.4 and just upgraded to v2.7 to see if it is going to crash on me, but my check is working fine. Do you have SELinux enabled?
Code: Select all
# sestatusBe sure to check out our Knowledgebase for helpful articles and solutions!