Can anyone tell me how I can monitor a computer using IP Address. Normally i use SNMP address for monitoring but now i have only the IP Address.
someone with a great idea.
Monitor a computer by using IP Address
- agruber
- Posts:147
- Joined: Tue Sep 07, 2010 2:52 pm
Re: Monitor a computer by using IP Address
You can easily do that with a system call and the ping command. Be aware, if the router returns "host unreachable", the error code of ping is 0 (=OK), so you need to check the output of the ping command too.
See example below.
BR,
Andreas
Customer Care
See example below.
BR,
Andreas
Customer Care
Code: Select all
bool checkPingWithTTL(string ip)
{
bool ret = false;
string sout = "";
int irc = 0;
irc = system("ping -n 1 " + ip, sout);
// error code is 0 if host is unreachable, so check for output if TTL
if (irc == 0 && strpos(sout, "TTL=") >= 0 )
{
ret = true;
}
return ret;
}- Gertjan van Schijndel
- Posts:634
- Joined: Mon Aug 02, 2010 10:37 am
Re: Monitor a computer by using IP Address
Just enable and configure the snmp service/daemon. Then you can also use snmp for monitoring. See also this topic: use SNMP to monitor Windows computers.