https://<ip address>:5693/api/disk/logical/%7C/used_percent
Code: Select all
{
"value": {
"used_percent": [
9.1999999999999993,
"%"
]
}
}
Code: Select all
{
"value": {
"used_percent": [
9.1999999999999993,
"%"
]
}
}
Code: Select all
ll -d /usr/local/nagios/var/spool/
ll -d /usr/local/nagios/var/spool/checkresults
ll /usr/local/nagios/var/spool/checkresults | wc -l
ll /usr/local/nagios/var/rw/Code: Select all
[root@NagiosXI ~]# ll -d /usr/local/nagios/var/spool
drwxr-xr-x 5 root root 4096 Jun 6 2012 /usr/local/nagios/var/spool
[root@NagiosXI ~]# ll -d /usr/local/nagios/var/spool/
drwxr-xr-x 5 root root 4096 Jun 6 2012 /usr/local/nagios/var/spool/
[root@NagiosXI ~]# ll -d /usr/local/nagios/var/spool/checkresults
drwxrwsr-x 2 nagios nagcmd 36864 Jun 13 14:29 /usr/local/nagios/var/spool/checkresults
[root@NagiosXI ~]# ll /usr/local/nagios/var/spool/checkresults | wc -l
1
[root@NagiosXI ~]# ll /usr/local/nagios/var/rw/
total 0
prw-rw---- 1 nagios nagcmd 0 Jun 13 10:15 nagios.cmd
srw-rw---- 1 nagios nagcmd 0 Jun 12 13:01 nagios.qh
Code: Select all
/usr/local/nagios/libexec/check_ncpa.py -H <remote ip> -t 'token' -P 5693 -M 'disk/logical/|/used_percent' -w 80 -c 90Code: Select all
%HOSTNAME%|disk root used percent = /disk/logical/'|'/used_percent --warning 80 --critical 90
Code: Select all
2014-08-15 08:53:33,742 26496 DEBUG Parsing config...
2014-08-15 08:53:33,743 26496 DEBUG Parsing commands...
2014-08-15 08:53:33,743 26496 WARNING Invalid command entered. Pipe (|) symbol required: uid
2014-08-15 08:53:33,743 26496 DEBUG Parsing new individual command.
2014-08-15 08:53:33,744 26496 DEBUG Using the config directive for the hostname: hostname.domain.com
2014-08-15 08:53:33,744 26496 DEBUG Setting hostname to hostname.domain.com and servicename to memory usage
2014-08-15 08:53:33,744 26496 DEBUG Parsing command: /memory/virtual/percent --warning 60 --critical 80
2014-08-15 08:53:33,744 26496 DEBUG Command contained arguments.
2014-08-15 08:53:33,745 26496 DEBUG Command to be run: Nagios Hostname: hostname.domain.com -- Nagios Servicename: memory usage -- Command: /memory/virtual/percent -- Arguments: --warning 60 --critical 80 -- Stdout: None -- Return Code: None
2014-08-15 08:53:33,745 26496 WARNING Invalid command entered. Pipe (|) symbol required: loglevel
2014-08-15 08:53:33,745 26496 DEBUG Parsing new individual command.
2014-08-15 08:53:33,746 26496 DEBUG Using the config directive for the hostname: hostname.domain.com
2014-08-15 08:53:33,746 26496 DEBUG Setting hostname to hostname.domain.com and servicename to swap usage
2014-08-15 08:53:33,746 26496 DEBUG Parsing command: /memory/swap/percent --warning 40 --critical 80
2014-08-15 08:53:33,747 26496 DEBUG Command contained arguments.
2014-08-15 08:53:33,747 26496 DEBUG Command to be run: Nagios Hostname: hostname.domain.com -- Nagios Servicename: swap usage -- Command: /memory/swap/percent -- Arguments: --warning 40 --critical 80 -- Stdout: None -- Return Code: None
2014-08-15 08:53:33,747 26496 DEBUG Parsing new individual command.
2014-08-15 08:53:33,748 26496 DEBUG Using the config directive for the hostname: hostname.domain.com
2014-08-15 08:53:33,748 26496 DEBUG Setting hostname to hostname.domain.com and servicename to cpu usage
2014-08-15 08:53:33,748 26496 DEBUG Parsing command: /cpu/percent --warning 20 --critical 30
2014-08-15 08:53:33,748 26496 DEBUG Command contained arguments.
2014-08-15 08:53:33,749 26496 DEBUG Command to be run: Nagios Hostname: hostname.domain.com -- Nagios Servicename: cpu usage -- Command: /cpu/percent -- Arguments: --warning 20 --critical 30 -- Stdout: None -- Return Code: None
2014-08-15 08:53:33,749 26496 WARNING Invalid command entered. Pipe (|) symbol required: logbackups
2014-08-15 08:53:33,749 26496 WARNING Invalid command entered. Pipe (|) symbol required: logmaxmb
2014-08-15 08:53:33,750 26496 WARNING Invalid command entered. Pipe (|) symbol required: gid
2014-08-15 08:53:33,750 26496 DEBUG Parsing new individual command.
2014-08-15 08:53:33,750 26496 DEBUG Using the config directive for the hostname: hostname.domain.com
2014-08-15 08:53:33,751 26496 DEBUG Setting hostname to hostname.domain.com and servicename to disk root used percent
2014-08-15 08:53:33,751 26496 DEBUG Parsing command: /disk/logical/'|'/used_percent --warning 80 --critical 90
2014-08-15 08:53:33,751 26496 DEBUG Command contained arguments.
2014-08-15 08:53:33,752 26496 DEBUG Command to be run: Nagios Hostname: hostname.domain.com -- Nagios Servicename: disk root used percent -- Command: /disk/logical/'|'/used_percent -- Arguments: --warning 80 --critical 90 -- Stdout: None -- Return Code: None
2014-08-15 08:53:33,752 26496 DEBUG Establishing Nagios handler...
2014-08-15 08:53:33,752 26496 DEBUG Parsing arguments: --warning 60 --critical 80
2014-08-15 08:53:33,753 26496 DEBUG String args: ['./xxx', '--warning', '60', '--critical', '80']
2014-08-15 08:53:33,754 26496 DEBUG Accessing internal API with accessor /memory/virtual/percent?warning=60&critical=80&unit=
2014-08-15 08:53:33,754 26496 DEBUG Accessing internal API with accessor memory/virtual/percent
2014-08-15 08:53:33,754 26496 ERROR getter() takes exactly 2 arguments (1 given)
Traceback (most recent call last):
File "ncpa_posix_passive.py", line 38, in run_all_handlers
File "/root/Development/ncpa/agent/passive/nrdp.py", line 77, in run
File "/root/Development/ncpa/agent/passive/abstract.py", line 93, in send_all_commands
File "/root/Development/ncpa/agent/passive/abstract.py", line 84, in send_command
File "/root/Development/ncpa/agent/listener/server.py", line 383, in internal_api
TypeError: getter() takes exactly 2 arguments (1 given)
Code: Select all
[root@mpllxtest1 var]# service ncpa_listener restart
Exception KeyError: KeyError(47781200,) in <module 'threading' from '/usr/local/ncpa/library.zip/threading.pyc'> ignored
Exited.
Started listener...
Code: Select all
2014-08-15 09:00:03,827 26625 DEBUG Parsing config...
2014-08-15 09:00:03,828 26625 DEBUG Parsing commands...
2014-08-15 09:00:03,828 26625 WARNING Invalid command entered. Pipe (|) symbol required: loglevel
2014-08-15 09:00:03,828 26625 WARNING Invalid command entered. Pipe (|) symbol required: logmaxmb
2014-08-15 09:00:03,828 26625 WARNING Invalid command entered. Pipe (|) symbol required: gid
2014-08-15 09:00:03,828 26625 WARNING Invalid command entered. Pipe (|) symbol required: logbackups
2014-08-15 09:00:03,829 26625 WARNING Invalid command entered. Pipe (|) symbol required: uid
2014-08-15 09:00:03,829 26625 DEBUG Establishing Nagios handler...
2014-08-15 09:00:03,829 26625 DEBUG XML to be submitted: <?xml version="1.0" ?><checkresults/>
2014-08-15 09:00:03,830 26625 INFO Starting new HTTP connection (1): 192.168.1.1
2014-08-15 09:00:03,834 26625 DEBUG "POST /nrdp/ HTTP/1.1" 200 119
2014-08-15 09:00:03,834 26625 DEBUG hitting url with payload: http://192.168.1.1/nrdp/
2014-08-15 09:00:03,835 26625 DEBUG content response from payload: Array
(
)
<?xml version="1.0" encoding="utf-8"?>
<result>
<status>-1</status>
<message>BAD XML</message>
</result>
2014-08-15 09:00:03,835 26625 ERROR syntax error: line 1, column 0
Traceback (most recent call last):
File "ncpa_posix_passive.py", line 38, in run_all_handlers
File "/root/Development/ncpa/agent/passive/nrdp.py", line 78, in run
File "/root/Development/ncpa/agent/passive/nrdp.py", line 112, in submit_to_nagios
File "/root/Development/ncpa/agent/passive/nrdp.py", line 85, in log_result
File "/usr/local/lib/python2.7/xml/dom/minidom.py", line 1928, in parseString
File "/usr/local/lib/python2.7/xml/dom/expatbuilder.py", line 940, in parseString
File "/usr/local/lib/python2.7/xml/dom/expatbuilder.py", line 223, in parseString
ExpatError: syntax error: line 1, column 0
Code: Select all
[listener]
uid = nagios
certificate = adhoc
loglevel = debug
ip = 0.0.0.0
gid = nagcmd
logfile = var/ncpa_listener.log
port = 5693
pidfile = var/ncpa_listener.pid
[passive]
uid = nagios
handlers = nrdp
loglevel = debug
gid = nagcmd
sleep = 5
logfile = var/ncpa_passive.log
pidfile = var/ncpa_passive.pid
[nrdp]
token = thetoken
hostname = hostname.domain.com
parent = http://192.168.1.1/nrdp/
[nrds]
url = None
CONFIG_VERSION = None
token = None
CONFIG_NAME = None
CONFIG_OS = None
[api]
community_string = thestring
[plugin directives]
plugin_path = plugins/
.sh = /bin/sh $plugin_name $plugin_args
.ps1 = powershell -ExecutionPolicy Unrestricted $plugin_name $plugin_args
.vbs = cscript $plugin_name $plugin_args //NoLogo
[passive checks]
#%HOSTNAME%|cpu usage = /cpu/percent --warning 20 --critical 30
#%HOSTNAME%|swap usage = /memory/swap/percent --warning 40 --critical 80
#%HOSTNAME%|memory usage = /memory/virtual/percent --warning 60 --critical 80
#%HOSTNAME%|disk root used percent = /disk/logical/'|'/used_percent --warning 80 --critical 90