Page 1 of 6

Possible to get ping status from private ip machines

Posted: Thu Dec 19, 2019 8:09 am
by epixelitsupport
I'm using a public IP machine and private IP machine, Private Ip machine have access only from the Public IP Machine. So is there any option to keep the live status of the private IP machine, That won't have any communication from outside except the public IP machine in the same network. Just want to know an update if the private ip machine goes down.

Please let me a solution

Re: Possible to get ping status from private ip machines

Posted: Thu Dec 19, 2019 1:40 pm
by mbellerue
The public IP machine could have an agent on it, like NCPA, that runs a ping check against the private IP machine. Would something like that work?

Re: Possible to get ping status from private ip machines

Posted: Thu Dec 19, 2019 3:43 pm
by epixelitsupport
Yes that's also fine for me.. just wanna keep track of live status of the machine in private ip
Please suggest a solution and script for the same

Re: Possible to get ping status from private ip machines

Posted: Fri Dec 20, 2019 3:18 pm
by mbellerue
Here is the link to NCPA. This would go on the system with the external IP address.
https://www.nagios.org/ncpa/

And this is a link to a Powershell script that will allow you to ping a server. This would go in the plugins directory for NCPA.
https://exchange.nagios.org/directory/P ... ll/details

Since you are dealing with public IP addresses, make sure you read the documentation for what ports will be open, and how you can secure your NCPA installation.

Re: Possible to get ping status from private ip machines

Posted: Sat Dec 21, 2019 12:57 pm
by epixelitsupport
Can you please give me the procedure which i need to do it in the ncpa installed machine

Re: Possible to get ping status from private ip machines

Posted: Mon Dec 23, 2019 7:02 am
by epixelitsupport
Thanks That one is worked...!

Absolutely super Support you Guys

Re: Possible to get ping status from private ip machines

Posted: Mon Dec 23, 2019 1:58 pm
by epixelitsupport
It was working ... but when the remote server goes offline also its not giving a response

I have installed ncpa in the main server, from main server im checking a ping status to the other server .. But when im pinging its working,

But the script not giving an exact output as my expectation ,
My concern is when it's pinging well I need ok status, if the ping fails it should show as Critical status

Can you make a script for me?

Thanks in Advance

Re: Possible to get ping status from private ip machines

Posted: Mon Dec 23, 2019 2:49 pm
by mbellerue
I can't custom write a script for you. We can troubleshoot this one, though. Can you show me the check command that you're running to execute this script?

Also, did your plugin return a critical, or did it just timeout? On mine, I try to ping a machine with the firewall up, so it doesn't respond to pings, it fails, and the plugin returns a critical.

Re: Possible to get ping status from private ip machines

Posted: Mon Dec 23, 2019 3:05 pm
by epixelitsupport
here is my script :

((count = 5))
while [[ $count -ne 0 ]] ; do
ping -c 1 10.1.1.2
rc=$?
if [[ $rc -eq 0 ]] ; then
((count = 1))
fi
((count = count - 1))
done

if [[ $rc -eq 0 ]] ; then
exit 0
else
exit2
fi

and im getting output like : https://prnt.sc/qevim8

Re: Possible to get ping status from private ip machines

Posted: Mon Dec 23, 2019 3:30 pm
by mbellerue
When setting a variable in Bash, the = needs to be next to the variable and the value.

E.g.
((count=5))

Also it looks like you're missing a space on your second exit command.