ncpa and plugins

This support forum board is for support questions relating to Nagios XI, our flagship commercial network monitoring solution.
Locked
kendallchenoweth
Posts: 195
Joined: Fri Sep 13, 2013 10:43 am

ncpa and plugins

Post by kendallchenoweth »

I'm having trouble making the check_ncpa.py script work with plugins. It works with built in directives.

Code: Select all

./check_ncpa.py -H kchenowe-ubuntu.dhcp.mathworks.com -t mytoken -M cpu/percent
OK: Percent was 3.0%,1.0%|'percent_0'=3.0% 'percent_1'=1.0%
It returns an error with the plugin script, random.pl which I created for testing.

Code: Select all

./check_ncpa.py -H kchenowe-ubuntu.dhcp.mathworks.com -t mytoken -M agent/plugin/random.pl -a "-a kendall -w 2 -c 7"
This script works on it's own.

Code: Select all

./random.pl -a kendall -w 2 -c 7
RANDOM OK - whatever r=1.57083422717736 a=kendall value | random=1.57083422717736;2;7
I'm using the check_ncpa.py that comes with the wizard. There is a more recent version in github that doesn't behave any different, except it does allow for the -V and the -l flag.

sum check_ncpa.py
19991 5

This is the error in the ncpa_listener.log

Code: Select all

2014-07-21 21:03:46,321 3196 INFO 172.29.233.30 - - [21/Jul/2014 21:03:46] "GET /api/agent/plugin/random.pl?token=mytoken&check=1&arguments=-a+kendall+-w+2+-c+7 HTTP/1.0" 301 -
2014-07-21 21:03:46,335 3196 ERROR [Errno 2] No such file or directory
Traceback (most recent call last):
  File "/build/ncpa/agent/listener/server.py", line 210, in plugin_api
  File "/build/ncpa/agent/listener/pluginapi.py", line 222, in execute_plugin
  File "/usr/lib/python2.6/subprocess.py", line 623, in __init__
  File "/usr/lib/python2.6/subprocess.py", line 1141, in _execute_child
OSError: [Errno 2] No such file or directory
2014-07-21 21:03:46,339 3196 INFO 172.29.233.30 - - [21/Jul/2014 21:03:46] "GET /api/agent/plugin/random.pl/?token=mytoken&check=1&arguments=-a+kendall+-w+2+-c+7 HTTP/1.0" 302 -
2014-07-21 21:03:46,348 3196 INFO 172.29.233.30 - - [21/Jul/2014 21:03:46] "GET /error/Error%20running%20plugin. HTTP/1.0" 200 -

This is the output in the log for the cpu percent check.

Code: Select all

2014-07-21 21:04:41,408 3196 INFO 172.29.233.30 - - [21/Jul/2014 21:04:41] "GET /api/cpu/percent?token=mytoken&check=1 HTTP/1.0" 200 -
The ncpa_listener client is version 1.1 running on 64 bit Ubuntu.

The ncpa.cfg plugin path is correct. The tokens match.

Code: Select all

[plugin directives]
plugin_path = plugins/
The scripts are in the plugin directory.

Code: Select all

/usr/local/ncpa/plugins# ls
check_ncpa.py  check_ncpa.py.new  random  random.pl  utils.pm  utils.sh
Am I using the right versions/latest/combinations of software? If not, please advise which I should use.


Thanks!
User avatar
lmiltchev
Bugs find me
Posts: 13589
Joined: Mon May 23, 2011 12:15 pm

Re: ncpa and plugins

Post by lmiltchev »

We will have to do some digging into this, but for the time being, you can try running something like this:

Code: Select all

./check_ncpa.py -H kchenowe-ubuntu.dhcp.mathworks.com -t mytoken -M agent/plugin/random.pl -a "-t 'kendall' -b '-w 2 -c 7'"
http://assets.nagios.com/downloads/ncpa ... un-by-ncpa
Be sure to check out our Knowledgebase for helpful articles and solutions!
kendallchenoweth
Posts: 195
Joined: Fri Sep 13, 2013 10:43 am

Re: ncpa and plugins

Post by kendallchenoweth »

Were you able to recreate the problem I had? If not, what versions of the agent and check script did you use?
User avatar
lmiltchev
Bugs find me
Posts: 13589
Joined: Mon May 23, 2011 12:15 pm

Re: ncpa and plugins

Post by lmiltchev »

I also had a problem with running plugins on my test box. Our developers will be looking into this ASAP. FYI - we will be releasing NCPA 1.7, which has many bug fixes, and improvements. I hope it will happen today, even though I am not sure. I will be testing it as soon as it's available.
Be sure to check out our Knowledgebase for helpful articles and solutions!
kendallchenoweth
Posts: 195
Joined: Fri Sep 13, 2013 10:43 am

Re: ncpa and plugins

Post by kendallchenoweth »

So does NCPA 1.7 fix the bug I found?
kendallchenoweth
Posts: 195
Joined: Fri Sep 13, 2013 10:43 am

Re: ncpa and plugins

Post by kendallchenoweth »

FIXED with NPCA 1.7 and check_ncpa.py version 0.2! The web page API now works again on ubuntu 64 as well (https://localhost:5693/api/).

Code: Select all

[/usr/local/ncpa/plugins]>./check_ncpa.py.new -H kchenowe-ubuntu.dhcp.mathworks.com -t mytoken -M agent/plugin/random.pl -a "-a kendall -w 3 -c 7"
RANDOM WARNING - whatever r=6.60693395025195 a=kendall value | random=6.60693395025195;3;7
tmcdonald
Posts: 9117
Joined: Mon Sep 23, 2013 8:40 am

Re: ncpa and plugins

Post by tmcdonald »

Great! Sorry we couldn't get to you sooner - I believe there were some last-minute bugs in NCPA that needed investigating. At any rate, glad to see it's working for you. I'll close this thread up now.
Former Nagios employee
Locked