check_ncpa.py to execute plugin remotely?

This support forum board is for support questions relating to Nagios XI, our flagship commercial network monitoring solution.
Locked
nagmemore
Posts: 8
Joined: Fri Mar 01, 2019 6:36 am

check_ncpa.py to execute plugin remotely?

Post by nagmemore »

Hi Support,

Both Nagiosxi server and NCPA client host are running CentOS Linux release 7.6.1810 (Core) 64bit and were both manually installed via the Nagios repo.

I have been trying to make use of the check_ncpa.py script to execute check_log3.pl script on a remote machine with the NCPA agent installed but I seem to be hitting a brick wall.

I have placed the check_log3.pl script under /usr/local/ncpa/plugins and I also added another plugin to test but that also returns the same results.

I have replaced the token with XXX in the command I ran below and from the log of the NCPA agent

Code: Select all

./check_ncpa.py -H 10.140.41.38 -t XXX -P 5693 -M 'plugins/check_log3.pl' -a "-l /tmp/log.log -s /dev/null --pattern='^.* reporting: NOK' --missing=WARNING" -D
The debug option returns,

The stack trace:Traceback (most recent call last):
File "./check_ncpa.py", line 281, in main
info_json = get_json(options)
File "./check_ncpa.py", line 221, in get_json
ret = urlopen(url, context=ctx)
File "/usr/lib64/python2.7/urllib2.py", line 154, in urlopen
return opener.open(url, data, timeout)
File "/usr/lib64/python2.7/urllib2.py", line 437, in open
response = meth(req, response)
File "/usr/lib64/python2.7/urllib2.py", line 550, in http_response
'http', request, response, code, msg, hdrs)
File "/usr/lib64/python2.7/urllib2.py", line 475, in error
return self._call_chain(*args)
File "/usr/lib64/python2.7/urllib2.py", line 409, in _call_chain
result = func(*args)
File "/usr/lib64/python2.7/urllib2.py", line 558, in http_error_default
raise HTTPError(req.get_full_url(), code, msg, hdrs, fp)
HTTPError: HTTP Error 500: INTERNAL SERVER ERROR

Currently the ncpa_listener.log returns the following error,

2019-07-18 12:08:06,712 26214 ERROR Exception on /api/plugins/check_log3.pl/-l//tmp/log.log/-s//dev/null/--pattern='^.*/reporting:/NOK'/--missing=WARNING [GET]
Traceback (most recent call last):
File "/usr/local/lib/python2.7/site-packages/flask/app.py", line 1817, in wsgi_app
File "/usr/local/lib/python2.7/site-packages/flask/app.py", line 1477, in full_dispatch_request
File "/usr/local/lib/python2.7/site-packages/flask/app.py", line 1381, in handle_user_exception
File "/usr/local/lib/python2.7/site-packages/flask/app.py", line 1475, in full_dispatch_request
File "/usr/local/lib/python2.7/site-packages/flask/app.py", line 1461, in dispatch_request
File "/root/ncpa/agent/listener/server.py", line 173, in token_auth_decoration
File "/root/ncpa/agent/listener/server.py", line 931, in api
File "/root/ncpa/agent/listener/nodes.py", line 299, in run_check
File "/root/ncpa/agent/listener/pluginnodes.py", line 107, in execute_plugin
File "/usr/local/lib/python2.7/site-packages/gevent/subprocess.py", line 585, in __init__
File "/usr/local/lib/python2.7/site-packages/gevent/subprocess.py", line 554, in __init__
File "/usr/local/lib/python2.7/site-packages/gevent/subprocess.py", line 1312, in _execute_child
OSError: [Errno 2] No such file or directory
2019-07-18 12:08:06,715 26214 INFO ::ffff:10.140.41.32 - - [2019-07-18 12:08:06] "GET /api/plugins/check_log3.pl/-l/%2Ftmp%2Flog.log/-s/%2Fdev%2Fnull/--pattern%3D%27%5E.%2A/reporting%3A/NOK%27/--missing%3DWARNING?token=XXX&check=1 HTTP/1.1" 500 2362 0.017006

Is there something that I have overlooked?

Let me know if you require any more information.

Regards,

Nag
nagmemore
Posts: 8
Joined: Fri Mar 01, 2019 6:36 am

Re: check_ncpa.py to execute plugin remotely?

Post by nagmemore »

Hi Support,

found the issue, we were missing the perl modules for os and Nagios, please close this off.

Regards,

Nag
scottwilkerson
DevOps Engineer
Posts: 19396
Joined: Tue Nov 15, 2011 3:11 pm
Location: Nagios Enterprises
Contact:

Re: check_ncpa.py to execute plugin remotely?

Post by scottwilkerson »

nagmemore wrote:Hi Support,

found the issue, we were missing the perl modules for os and Nagios, please close this off.

Regards,

Nag
Great!

Locking
Former Nagios employee
Creator:
Human Design Website
Get Your Human Design Chart
Locked