NagiosEnterprises/ncpa

Inconsistency with check_ncpa.py and check_ping using IPv6

vtracnagios opened this issue · 0 comments

Example "check_ncpa.py"
nagios@nagioserver:/usr/local/nagios/libexec$ ./check_ncpa.py -H 1111:2222:3333:4444:5555::20 -t 'ebpDZeURGJJUDiqE' -P 5693 -M 'disk/logical/C:|' -w '70' -c '90'
UNKNOWN: An error occurred connecting to API. (HTTP error: '500 INTERNAL SERVER ERROR')

nagios@nagioserver:/usr/local/nagios/libexec$ ./check_ncpa.py -H [1111:2222:3333:4444:5555::20] -t 'ebpDZeURGJJUDiqE' -P 5693 -M 'disk/logical/C:|' -w '70' -c '90'
OK: Used disk space was 20.40 % (Used: 25.75 GiB, Free: 100.57 GiB, Total: 126.32 GiB) | 'used'=25.75GiB;;; 'free'=100.57GiB;;; 'total'=126.32GiB;;;

Example "check_ping"
nagios@nagioserver:/usr/local/nagios/libexec$ ./check_ping -H [1111:2222:3333:4444:5555::20] -w 3000.0,80% -c 5000.0,100% -p 5
check_ping: Invalid hostname/address - [1111:2222:3333:4444:5555::20]
Usage:
check_ping -H <host_address> -w ,% -c ,%
[-p packets] [-t timeout] [-4|-6]

nagios@nagioserver:/usr/local/nagios/libexec$ ./check_ping -H 1111:2222:3333:4444:5555::20 -w 3000.0,80% -c 5000.0,100% -p 5
PING OK - Packet loss = 0%, RTA = 40.96 ms|rta=40.955002ms;3000.000000;5000.000000;0.000000 pl=0%;80;100;0

A client experimenting with editing check_ncpa.py Line 173-176

api_address = '[https://%s:%d/api](https://%25s:%d/api)' % (hostname, port)
else:
api_address = '[https://%s:%d/api/%s/%s](https://%25s:%d/api/%s/%s)' % (hostname, port, metric, arguments)

Changing to

api_address = 'https://[%s]:%d/api' % (hostname, port)
else:
api_address = 'https://[%s]:%d/api/%s/%s' % (hostname, port, metric, arguments)

Ticket:
https://nagiosenterprises.lightning.force.com/lightning/r/Case/500Vm00000AB072IAD/view