////////////////////////////////////////////////////////////////////// // // Program: snmp.php v0.5 // Programmer: Void Main // Date: 02/02/2004 // // Based on and replacement for // snmp.pl in NeDi. // // Put this in NeDi's document root // then in node.pl change this: // // HREF=$cgi/snmp.pl?ip=$rec[1] // // to this: // // HREF=$ht/snmp.php?host=$rec[1] // // NOTE: IP Address matching is broken on RHAS3 and Fedora because of // a bug in snmpd. I have reported to Red Hat and they are // working on it. // // Obviously requires php-snmp to be installed (or compiled in) // // DATE COMMENT // -------- ---------------------------------------------------------- // 02/03/04 v0.2 - cleanup and added services (stole from snmp.pl) // 02/04/04 v0.3 - Flawed IP->Interface logic fixed // 02/09/04 v0.4 - Fixed display when > 1 IPaddr on an intferace // 02/10/04 v0.5 - Converted to all numberic OIDs (RH9 likes them) // ////////////////////////////////////////////////////////////////////// // User defind VARs $communities = array ("public","mycommunitystring2"); // 1st = default $snmptimeout = 500000; // For initial check 1000000 = 1 second // Shouldn't have to set anything below here error_reporting(0); snmp_set_quick_print(1); if ($_REQUEST['community'] == "") { $community = $communities[0]; } else { $community = $_REQUEST['community']; } if (! $_REQUEST['host'] == "") { $host = $_REQUEST['host']; } function syssrv($sv) { if ($sv & 1) {$srv = " Repeater"; } if ($sv & 2) {$srv = "$srv Bridge"; } if ($sv & 4) {$srv = "$srv Router"; } if ($sv & 8) {$srv = "$srv Gateway"; } if ($sv & 16) {$srv = "$srv Session"; } if ($sv & 32) {$srv = "$srv Terminal"; } if ($sv & 64) {$srv = "$srv Application"; } if (!$sv) {$srv = "SNMP services not supported"; } return $srv; } ?>