Page 3 of 6

Re: Possible to get ping status from private ip machines

Posted: Mon Dec 30, 2019 2:21 pm
by mbellerue
That makes sense. Your Nagios system is outside of the network where your target machine resides. There is a machine that has an external IP address, and has access to your target machine. So we put NCPA on the machine with the external IP address, put the check_ping plugin in NCPA's plugins directory, and then have Nagios use the check_ncpa.py plugin like this.

Code: Select all

/usr/local/nagios/libexec/check_ncpa.py -H <external_IP> -t <secret_token> -M 'scripts/check_ping' -a '-H <internal_IP> -w <warning_threshold> -c <critical_threshold>'

Re: Possible to get ping status from private ip machines

Posted: Thu Jan 02, 2020 7:59 am
by epixelitsupport
I have updated as you said,
I have taken the check_ping plugin from Nagios plugins and put it in remote server ncpa plugin folder, after that i run the command from Nagios Server

Im getting an error UNKNOWN: An error occured connecting to API. (HTTP error: '500 INTERNAL SERVER ERROR')

https://prnt.sc/qigrrx

Re: Possible to get ping status from private ip machines

Posted: Thu Jan 02, 2020 2:37 pm
by mbellerue
That looks like you're not able to connect to the NCPA API at all. If you put the external IP address into your web browser followed by :5693 do you get a page asking for your token?

Re: Possible to get ping status from private ip machines

Posted: Fri Jan 03, 2020 1:25 am
by epixelitsupport
No that's not Working working for me, But other Plugins are working which is placed in ncpa/plugins folder

any other option?

Re: Possible to get ping status from private ip machines

Posted: Fri Jan 03, 2020 12:28 pm
by mbellerue
Alright, let's make sure we have the correct plugin installed. Previously, I saw that check_ping.c was copied over to the server. This is actually the source code for the check_ping plugin. We need the binary copied over. You should have a file called /usr/local/nagios/libexec/check_ping with no .c at the end. That's the one you need to transfer.

Re: Possible to get ping status from private ip machines

Posted: Sat Jan 04, 2020 2:47 am
by epixelitsupport
Your Right .. And I have changed the check_ping file as you said, but when I'm running those command in Nagios Server still it's not succeeding getting error like
https://prnt.sc/qj73ta

Thanks in advance for your support and help

Re: Possible to get ping status from private ip machines

Posted: Mon Jan 06, 2020 12:03 pm
by mbellerue
Perfect! We're getting closer. That is the output for check_ping, so we know the request is making it across. I think all you should have to do is encapsulate the command line switches for check_ping in single quotes. So your command will look something like this.

Code: Select all

/usr/local/nagios/libexec/check_ncpa.py -H <external_IP> -P 5693 -t <secret_token> -M 'plugins/check_ping' -a '-H <internal_IP> -w 70 -c 80'
The 70 and 80 for warning and crit may need a % after them. But let's try it like this first and see if it gets us what we need.

Re: Possible to get ping status from private ip machines

Posted: Mon Jan 06, 2020 2:22 pm
by epixelitsupport
Now its pinging and getting output for the following format , and what does this means in command -w 70,2% -c 80,5%' ?? please make me clear

https://prnt.sc/qk4cvx


So how should I write the service for reflecting the same in Nagios Dashboard GUI

Re: Possible to get ping status from private ip machines

Posted: Mon Jan 06, 2020 4:21 pm
by mbellerue
Looks good! Here is the threshold information from check_ping.

Code: Select all

THRESHOLD is <rta>,<pl>% where <rta> is the round trip average travel
time (ms) which triggers a WARNING or CRITICAL state, and <pl> is the
percentage of packet loss to trigger an alarm state.
So 70 and 80 are pretty high numbers. That would be 70 and 80 seconds to make the trip. In the screenshot, your round trip was 0.22. So you might want a warning of 0.8 and a critical of 0.9. Then adjust as you get alerts. Or you can leave the round trip average up at 70 and 80, which will pretty much guarantee you will not get an alert unless there is packet loss.

Packet loss is the second part of the pair. Your warning is set to 2% packet loss, and critical is 5% packet loss. The check_ping plugin sends 5 pings to the specified host. So if you lose 1 packet, you have a 20% packet loss.

Does that help clear things up?

Re: Possible to get ping status from private ip machines

Posted: Tue Jan 07, 2020 8:13 am
by epixelitsupport
Thats Cool, So how should i write the service command in cfg file in nagios server for this server?
in /usr/local/nagios/etc/servers/

for reflecting the same ping command?