prepare($query); if($sth) { $res = $sth->execute(); $result = $sth->fetchrow_hash(); $name = $result["name"]; $ip = $result["ip"]; } { // PRINT "Could not prepare query: ".$sth->errstr."
\n"; PRINT "Experimental.
\n"; } if ($ip == "" OR $ip == "dhcp" OR $ip == "DHCP") { return FALSE; } $mib = snmpget($ip, $cfg_snmp_rcommunity, $object); return $mib; } function SNMPwalkComputer($computer, $object) { error_reporting(0); global $cfg_snmp_rcommunity, $adb; $query = "SELECT ip FROM computers WHERE ID = $computer"; $sth = $adb->prepare($query); if($sth) { $res = $sth->execute(); $result = $sth->fetchrow_hash(); $ip = $result["ip"]; } else { PRINT "Could not prepare query: ".$sth->errstr."
\n"; } if ($ip == "" OR $ip == "dhcp" OR $ip == "DHCP") { return "Cannot talk to server."; } $mib = snmpwalkoid($ip, $cfg_snmp_rcommunity, $object); return $mib; } function SNMPwalkComputerData($computer, $object) { global $cfg_snmp_rcommunity, $adb; $query = "SELECT ip FROM computers WHERE ID = $computer"; $sth = $adb->prepare($query); if($sth) { $res = $sth->execute(); $result = $sth->fetchrow_hash(); $ip = $result["ip"]; } else { PRINT "Could not prepare query: ".$sth->errstr."
\n"; } if ($ip == "" OR $ip == "dhcp" OR $ip == "DHCP") { return "Cannot talk to server."; } $mib = snmpwalk($ip, $cfg_snmp_rcommunity, $object); return $mib; } function SNMPHTMLping($computer) { global $cfg_snmp_rcommunity, $adb; $query = "SELECT ip FROM computers WHERE ID = $computer"; $sth = $adb->prepare($query); if($sth) { $res = $sth->execute(); $result = $sth->fetchrow_hash(); $ip = $result["ip"]; } else { PRINT "Could not prepare query: ".$sth->errstr."
\n"; } if ($ip != "" OR $ip != "DHCP" OR $ip != "dhcp") { $out = exec(EscapeShellCmd("ping -c 1 -n -i 1 -w 3 $ip"),$dummy_array, $ping_return); } if ($ping_return == 2) { $hstatus = "DOWN"; } else if ($ping_return == 0) { $hstatus = "UP"; } else { $hstatus = "UNKNOWN ERROR"; } return $hstatus; } ?>