ncpa passive checks not working

This support forum board is for support questions relating to Nagios XI, our flagship commercial network monitoring solution.
jcwuerfl
Posts: 76
Joined: Tue Jun 10, 2014 12:44 pm

Re: ncpa passive checks not working

Post by jcwuerfl »

Yes.

https://<ip address>:5693/api/disk/logical/%7C/used_percent

Code: Select all

{
  "value": {
    "used_percent": [
      9.1999999999999993, 
      "%"
    ]
  }
}
sreinhardt
-fno-stack-protector
Posts: 4366
Joined: Mon Nov 19, 2012 12:10 pm

Re: ncpa passive checks not working

Post by sreinhardt »

What are the results of the following commands?

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/
Nagios-Plugins maintainer exclusively, unless you have other C language bugs with open-source nagios projects, then I am happy to help! Please pm or use other communication to alert me to issues as I no longer track the forum.
jcwuerfl
Posts: 76
Joined: Tue Jun 10, 2014 12:44 pm

Re: ncpa passive checks not working

Post by jcwuerfl »

I don't think its a perm. issue?

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
User avatar
lmiltchev
Bugs find me
Posts: 13589
Joined: Mon May 23, 2011 12:15 pm

Re: ncpa passive checks not working

Post by lmiltchev »

Did you restart the "ncpa_posix_passive" after making the changes to the "ncpa.cfg"? Can you show how the passive disk check is defined now? Can you run an active check successfully from the Nagios XI server?

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 90
Be sure to check out our Knowledgebase for helpful articles and solutions!
jcwuerfl
Posts: 76
Joined: Tue Jun 10, 2014 12:44 pm

Re: ncpa passive checks not working

Post by jcwuerfl »

Yes, I restarted the ncpa_posix_passive after making changes. Active checks work fine. Its passive checks we are having issues with.
User avatar
lmiltchev
Bugs find me
Posts: 13589
Joined: Mon May 23, 2011 12:15 pm

Re: ncpa passive checks not working

Post by lmiltchev »

Can you show how the passive disk check is defined now in the ncpa.cfg?

Also, try deleting both disk checks in XI (disk root used percent & disk-root-used-percent), and re-configure the check, when it shows up in the Unconfigured Objects.
Be sure to check out our Knowledgebase for helpful articles and solutions!
jcwuerfl
Posts: 76
Joined: Tue Jun 10, 2014 12:44 pm

Re: ncpa passive checks not working

Post by jcwuerfl »

I have the 1.7 version of the ncpa agent now, however, I am still not sure how to define this passive check:

Code: Select all

%HOSTNAME%|disk root used percent = /disk/logical/'|'/used_percent --warning 80 --critical 90
With the 1.7 NCPA Agent now I'm getting a bunch of other stuff I didn't see before, something seems broken from what I had before. Running on Redhat 6 so used the CentOS 6 RPM.


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)


When restarting the listener I am seeing:

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...
If I remove all of the passive checks I get :

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


Also, here is the ncpa.cfg file right now:

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


Really need to get this linux client working better so I can start deploying it. I can't use it if its going to be broken like this.
Thanks!
abrist
Red Shirt
Posts: 8334
Joined: Thu Nov 15, 2012 1:20 pm

Re: ncpa passive checks not working

Post by abrist »

Would you consider opening a bug/issue on github? It may help expedite resolution.
https://github.com/NagiosEnterprises/ncpa
Former Nagios employee
"It is turtles. All. The. Way. Down. . . .and maybe an elephant or two."
VI VI VI - The editor of the Beast!
Come to the Dark Side.
Locked