Open ccztux opened 1 year ago
Please merge @ccztux 's commit, it fixes my problem with check_ncpa.py
for the check_http
(and similar) plugins.
EDIT: I observe this version breaks usability of the '-a' argument.
@JamieSimon2 Do you have any issues using the -a
argument? There was an issue using it, but this should be fixed.
Yes, the current release at https://github.com/NagiosEnterprises/ncpa/blob/master/client/check_ncpa.py has the exact problem described above. Arguments with slashes aren't interpreted/parsed correctly -- example below is for HTTP calls -- and result in bad NCPA responses.
Example:
[centos@lab-eu-1a-0504-h17 ~]$ /usr/lib64/nagios/plugins/check_ncpa.py -H 172.19.6.0 -P 5693 --token "REDACTED" -M 'plugins/check_http' -a '--IP-address=172.19.6.0 -p 3000 -u /login' -v
Connecting to: https://172.19.6.0:5693/api/plugins/check_http/--IP-address%3D172.19.6.0/-p/3000/-u/%2Flogin?token=REDACTED&check=1
File returned contained:
{
"returncode": 1,
"stdout": "HTTP WARNING: HTTP/1.1 400 Bad Request - 103 bytes in 0.000 second response time |time=0.000416s;;;0.000000 size=103B;;;0"
}
HTTP WARNING: HTTP/1.1 400 Bad Request - 103 bytes in 0.000 second response time |time=0.000416s;;;0.000000 size=103B;;;0
The changes were merged into the maint
branch.
Try the version from the maint branch.
I regret to report my testing of https://github.com/NagiosEnterprises/ncpa/blob/maint/client/check_ncpa.py indicates "-a" still does not work correctly with the "/" character, but the "-r" argument does.
$ /usr/bin/python3 /usr/lib64/nagios/plugins/check_ncpa.py -H 172.19.6.0 -P 5693 -t "MYTOKEN" -M "plugins/check_http" -r "-I 172.19.6.0 -p 3000 -u /login --onredirect=follow"
HTTP OK: HTTP/1.0 200 OK - 32253 bytes in 0.006 second response time |time=0.005890s;;;0.000000 size=32253B;;;0
$ /usr/bin/python3 /usr/lib64/nagios/plugins/check_ncpa.py -H 172.19.6.0 -P 5693 -t "MYTOKEN" -M "plugins/check_http" -a "-I 172.19.6.0 -p 3000 -u /login --onredirect=follow"
HTTP WARNING: HTTP/1.1 400 Bad Request - 103 bytes in 0.000 second response time |time=0.000440s;;;0.000000 size=103B;;;0
I have issues with the plugin arguments used by
check_http_json.py
.Neither this call:
nor that:
works.
I have fixed this for me and will provide the fix via a pull request. The fix adds the following new argument to
check_ncpa.py
: