Possible to get ping status from private ip machines

Support forum for Nagios Core, Nagios Plugins, NCPA, NRPE, NSCA, NDOUtils and more. Engage with the community of users including those using the open source solutions.
epixelitsupport
Posts: 85
Joined: Fri Nov 08, 2019 2:40 am

Possible to get ping status from private ip machines

Post 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
User avatar
mbellerue
Posts: 1403
Joined: Fri Jul 12, 2019 11:10 am

Re: Possible to get ping status from private ip machines

Post 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?
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.

Be sure to check out our Knowledgebase for helpful articles and solutions!
epixelitsupport
Posts: 85
Joined: Fri Nov 08, 2019 2:40 am

Re: Possible to get ping status from private ip machines

Post 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
User avatar
mbellerue
Posts: 1403
Joined: Fri Jul 12, 2019 11:10 am

Re: Possible to get ping status from private ip machines

Post 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.
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.

Be sure to check out our Knowledgebase for helpful articles and solutions!
epixelitsupport
Posts: 85
Joined: Fri Nov 08, 2019 2:40 am

Re: Possible to get ping status from private ip machines

Post by epixelitsupport »

Can you please give me the procedure which i need to do it in the ncpa installed machine
epixelitsupport
Posts: 85
Joined: Fri Nov 08, 2019 2:40 am

Re: Possible to get ping status from private ip machines

Post by epixelitsupport »

Thanks That one is worked...!

Absolutely super Support you Guys
epixelitsupport
Posts: 85
Joined: Fri Nov 08, 2019 2:40 am

Re: Possible to get ping status from private ip machines

Post 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
User avatar
mbellerue
Posts: 1403
Joined: Fri Jul 12, 2019 11:10 am

Re: Possible to get ping status from private ip machines

Post 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.
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.

Be sure to check out our Knowledgebase for helpful articles and solutions!
epixelitsupport
Posts: 85
Joined: Fri Nov 08, 2019 2:40 am

Re: Possible to get ping status from private ip machines

Post 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
User avatar
mbellerue
Posts: 1403
Joined: Fri Jul 12, 2019 11:10 am

Re: Possible to get ping status from private ip machines

Post 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.
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.

Be sure to check out our Knowledgebase for helpful articles and solutions!
Locked