Monitor a computer by using IP Address

Discussion about recent product features & solutions!
3 posts • Page 1 of 1
cofelyhoogland
Posts:13
Joined: Mon May 21, 2012 9:39 am

Monitor a computer by using IP Address

Post by cofelyhoogland »

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.

agruber
Posts:147
Joined: Tue Sep 07, 2010 2:52 pm

Re: Monitor a computer by using IP Address

Post by agruber »

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

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

Post by Gertjan van Schijndel »

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.

3 posts • Page 1 of 1