diff --git a/includes/discovery/bgp-peers.inc.php b/includes/discovery/bgp-peers.inc.php index b5e9e259d0..4b59683556 100755 --- a/includes/discovery/bgp-peers.inc.php +++ b/includes/discovery/bgp-peers.inc.php @@ -4,7 +4,7 @@ echo("BGP Sessions : "); - $as_cmd = $config['snmpwalk'] . " -m BGP4-MIB -CI -Oqvn -" . $device['snmpver'] . " -c" . $device['community'] . " " . $device['hostname'].":".$device['port'] . " "; + $as_cmd = $config['snmpwalk'] . " -M " . $config['mibdir'] . " -m BGP4-MIB -CI -Oqvn -" . $device['snmpver'] . " -c" . $device['community'] . " " . $device['hostname'].":".$device['port'] . " "; $as_cmd .= ".1.3.6.1.2.1.15.2"; $bgpLocalAs = trim(shell_exec($as_cmd)); @@ -17,7 +17,7 @@ mysql_query("UPDATE devices SET bgpLocalAs = '$bgpLocalAs' WHERE device_id = '".$device['device_id']."'"); echo("Updated AS "); } - $peers_cmd = $config['snmpwalk'] . " -m BGP4-MIB -CI -Oq -" . $device['snmpver'] . " -c" . $device['community'] . " " . $device['hostname'].":".$device['port'] . " "; + $peers_cmd = $config['snmpwalk'] . " -M " . $config['mibdir'] . " -m BGP4-MIB -CI -Oq -" . $device['snmpver'] . " -c" . $device['community'] . " " . $device['hostname'].":".$device['port'] . " "; $peers_cmd .= "BGP4-MIB::bgpPeerRemoteAs"; $peers_data = shell_exec($peers_cmd); if($debug) { echo("Peers : $peers_cmd --> \n$peers_data \n"); } @@ -37,7 +37,7 @@ if ($device['os'] == "junos") { ## Juniper BGP4-V2 MIB, ipv6 only for now, because v4 should be covered in BGP4-MIB above - $peers_cmd = $config['snmpwalk'] . " -M +".$config['install_dir']."/mibs/junos -m BGP4-V2-MIB-JUNIPER -CI -Onq -" . $device['snmpver'] . " -c" . $device['community'] . " " . $device['hostname'].":".$device['port'] . " "; + $peers_cmd = $config['snmpwalk'] . " -M " . $config['mibdir'] . " -M +".$config['install_dir']."/mibs/junos -m BGP4-V2-MIB-JUNIPER -CI -Onq -" . $device['snmpver'] . " -c" . $device['community'] . " " . $device['hostname'].":".$device['port'] . " "; $peers_cmd .= "jnxBgpM2PeerRemoteAs.0.ipv6"; # FIXME: is .0 the only possible value here? $peers = trim(str_replace(".1.3.6.1.4.1.2636.5.1.1.2.1.1.1.13.0.","", `$peers_cmd`)); foreach (explode("\n", $peers) as $peer) @@ -82,7 +82,7 @@ if (isset($peerlist)) if ($device['os'] == "ios") { unset($af_list); - $af_cmd = $config['snmpwalk'] . " -CI -m CISCO-BGP4-MIB -OsQ -" . $device['snmpver'] . " -c" . $device['community'] . " " . $device['hostname'].":".$device['port'] . " "; + $af_cmd = $config['snmpwalk'] . " -M " . $config['mibdir'] . " -CI -m CISCO-BGP4-MIB -OsQ -" . $device['snmpver'] . " -c" . $device['community'] . " " . $device['hostname'].":".$device['port'] . " "; $af_cmd .= "cbgpPeerAddrFamilyName." . $peer['ip']; $af_data = shell_exec($af_cmd); if($debug) { echo("afi data :: $af_cmd --> \n $af_data \n"); } diff --git a/includes/discovery/cisco-mac-accounting.inc.php b/includes/discovery/cisco-mac-accounting.inc.php index 9f2b944166..d39468072e 100755 --- a/includes/discovery/cisco-mac-accounting.inc.php +++ b/includes/discovery/cisco-mac-accounting.inc.php @@ -5,7 +5,7 @@ if($device['os_group'] == "ios") { echo("Cisco MAC Accounting : "); - $datas = shell_exec($config['snmpbulkwalk'] . " -m CISCO-IP-STAT-MIB -Oqn -".$device['snmpver']." -c ".$device['community']." ".$device['hostname']." cipMacSwitchedBytes"); + $datas = shell_exec($config['snmpbulkwalk'] . " -M ".$config['mibdir']." -m CISCO-IP-STAT-MIB -Oqn -".$device['snmpver']." -c ".$device['community']." ".$device['hostname']." cipMacSwitchedBytes"); #echo("$datas\n"); #echo("done\n"); foreach(explode("\n", $datas) as $data) { diff --git a/includes/discovery/cisco-processors.inc.php b/includes/discovery/cisco-processors.inc.php index 582a8d7998..15eea30280 100755 --- a/includes/discovery/cisco-processors.inc.php +++ b/includes/discovery/cisco-processors.inc.php @@ -9,7 +9,7 @@ ## Cisco Processors if($device['os'] == "ios") { - $oids = shell_exec($config['snmpwalk'] . " -m CISCO-PROCESS-MIB -".$device['snmpver']." -CI -Osqn -c ".$community." ".$hostname.":".$port." .1.3.6.1.4.1.9.9.109.1.1.1.1.2 | sed s/.1.3.6.1.4.1.9.9.109.1.1.1.1.2.//g"); + $oids = shell_exec($config['snmpwalk'] . " -M " . $config['mibdir'] . " -m CISCO-PROCESS-MIB -".$device['snmpver']." -CI -Osqn -c ".$community." ".$hostname.":".$port." .1.3.6.1.4.1.9.9.109.1.1.1.1.2 | sed s/.1.3.6.1.4.1.9.9.109.1.1.1.1.2.//g"); $oids = trim($oids); foreach(explode("\n", $oids) as $data) { $data = trim($data); @@ -17,8 +17,8 @@ list($oid, $entPhysicalIndex) = explode(" ", $data); $usage_oid = "cpmCPUTotal5minRev.$oid"; $descr_oid = "entPhysicalName.$entPhysicalIndex"; - $descr = trim(shell_exec($config['snmpget'] . " -m ENTITY-MIB -O qv -".$device['snmpver']." -c $community $hostname:$port $descr_oid")); - $usage = trim(shell_exec($config['snmpget'] . " -m CISCO-PROCESS-MIB -O qv -".$device['snmpver']." -c $community $hostname:$port $usage_oid")); + $descr = trim(shell_exec($config['snmpget'] . " -M " . $config['mibdir'] . " -m ENTITY-MIB -O qv -".$device['snmpver']." -c $community $hostname:$port $descr_oid")); + $usage = trim(shell_exec($config['snmpget'] . " -M " . $config['mibdir'] . " -m CISCO-PROCESS-MIB -O qv -".$device['snmpver']." -c $community $hostname:$port $usage_oid")); if($entPhysicalIndex == "0") { $descr = "Proc $oid"; } if(!strstr($descr, "No") && !strstr($usage, "No") && $descr != "" ) { $descr = str_replace("\"", "", $descr); diff --git a/includes/discovery/cisco-pw.inc.php b/includes/discovery/cisco-pw.inc.php index 8a994a20f9..da757b5171 100755 --- a/includes/discovery/cisco-pw.inc.php +++ b/includes/discovery/cisco-pw.inc.php @@ -7,7 +7,7 @@ if($config['enable_pseudowires'] && $device['os_group'] == "ios") { echo("Cisco Pseudowires : "); - $oids = shell_exec($config['snmpwalk'] . " -m CISCO-IETF-PW-MIB -CI -Ln -Osqn -" . $device['snmpver'] . " -c " . $device['community'] . " " . $device['hostname'].":".$device['port'] . " cpwVcID"); + $oids = shell_exec($config['snmpwalk'] . " -M " . $config['mibdir'] . " -m CISCO-IETF-PW-MIB -CI -Ln -Osqn -" . $device['snmpver'] . " -c " . $device['community'] . " " . $device['hostname'].":".$device['port'] . " cpwVcID"); $oids = str_replace(".1.3.6.1.4.1.9.10.106.1.2.1.10.", "", $oids); @@ -16,8 +16,8 @@ if($config['enable_pseudowires'] && $device['os_group'] == "ios") { if($oid) { list($cpwOid, $cpwVcID) = explode(" ", $oid); if($cpwOid) { - list($cpw_remote_id) = split(":", shell_exec($config['snmpget'] . " -m CISCO-IETF-PW-MPLS-MIB -Ln -Osqnv -" . $device['snmpver'] . " -c " . $device['community'] . " " . $device['hostname'].":".$device['port'] . " cpwVcMplsPeerLdpID." . $cpwOid)); - $interface_descr = trim(shell_exec($config['snmpwalk'] . " -m CISCO-IETF-PW-MIB -Oqvn -" . $device['snmpver'] . " -c " . $device['community'] . " " . $device['hostname'].":".$device['port'] . " cpwVcName." . $cpwOid)); + list($cpw_remote_id) = split(":", shell_exec($config['snmpget'] . " -M " . $config['mibdir'] . " -m CISCO-IETF-PW-MPLS-MIB -Ln -Osqnv -" . $device['snmpver'] . " -c " . $device['community'] . " " . $device['hostname'].":".$device['port'] . " cpwVcMplsPeerLdpID." . $cpwOid)); + $interface_descr = trim(shell_exec($config['snmpwalk'] . " -M " . $config['mibdir'] . " -m CISCO-IETF-PW-MIB -Oqvn -" . $device['snmpver'] . " -c " . $device['community'] . " " . $device['hostname'].":".$device['port'] . " cpwVcName." . $cpwOid)); $cpw_remote_device = @mysql_result(mysql_query("SELECT device_id FROM ipv4_addresses AS A, ports AS I WHERE A.ipv4_address = '".$cpw_remote_id."' AND A.interface_id = I.interface_id"),0); $if_id = @mysql_result(mysql_query("SELECT `interface_id` FROM `ports` WHERE `ifDescr` = '$interface_descr' AND `device_id` = '".$device['device_id']."'"),0); if($cpw_remote_device && $if_id) { diff --git a/includes/discovery/cisco-vlans.inc.php b/includes/discovery/cisco-vlans.inc.php index f8e8fd054b..e298b41c34 100755 --- a/includes/discovery/cisco-vlans.inc.php +++ b/includes/discovery/cisco-vlans.inc.php @@ -4,26 +4,26 @@ if($device['os_group'] == "ios") { echo("Cisco VLANs : "); - $vtpversion_cmd = $config['snmpget'] . " -m CISCO-VTP-MIB -Oqv -" . $device['snmpver'] . " -c " . $device['community'] . " "; + $vtpversion_cmd = $config['snmpget'] . " -M " . $config['mibdir'] . " -m CISCO-VTP-MIB -Oqv -" . $device['snmpver'] . " -c " . $device['community'] . " "; $vtpversion_cmd .= $device['hostname'].":".$device['port'] . " .1.3.6.1.4.1.9.9.46.1.1.1.0"; $vtpversion = trim(`$vtpversion_cmd 2>/dev/null`); if($vtpversion == '1' || $vtpversion == '2' || $vtpversion == 'two' || $vtpversion == 'three') { - $vtp_domain_cmd = $config['snmpget'] . " -m CISCO-VTP-MIB -Oqv -" . $device['snmpver'] . " -c " . $device['community'] . " " . $device['hostname'].":".$device['port']; + $vtp_domain_cmd = $config['snmpget'] . " -M " . $config['mibdir'] . " -m CISCO-VTP-MIB -Oqv -" . $device['snmpver'] . " -c " . $device['community'] . " " . $device['hostname'].":".$device['port']; $vtp_domain_cmd .= " .1.3.6.1.4.1.9.9.46.1.2.1.1.2.1"; $vtp_domain = trim(str_replace("\"", "", `$vtp_domain_cmd 2>/dev/null`)); echo("VTP v$vtpversion $vtp_domain "); - $vlans_cmd = $config['snmpwalk'] . " -m CISCO-VTP-MIB -O qn -" . $device['snmpver'] . " -c " . $device['community'] . " " . $device['hostname'].":".$device['port'] . " "; + $vlans_cmd = $config['snmpwalk'] . " -M " . $config['mibdir'] . " -m CISCO-VTP-MIB -O qn -" . $device['snmpver'] . " -c " . $device['community'] . " " . $device['hostname'].":".$device['port'] . " "; $vlans_cmd .= "1.3.6.1.4.1.9.9.46.1.3.1.1.2.1 | sed s/.1.3.6.1.4.1.9.9.46.1.3.1.1.2.1.//g | cut -f 1 -d\" \""; $vlans = trim(`$vlans_cmd | grep -v o`); foreach(explode("\n", $vlans) as $vlan) { - $vlan_descr_cmd = $config['snmpget'] . " -m CISCO-VTP-MIB -O nvq -" . $device['snmpver'] . " -c " . $device['community'] . " " . $device['hostname'].":".$device['port'] . " "; + $vlan_descr_cmd = $config['snmpget'] . " -M " . $config['mibdir'] . " -m CISCO-VTP-MIB -O nvq -" . $device['snmpver'] . " -c " . $device['community'] . " " . $device['hostname'].":".$device['port'] . " "; $vlan_descr_cmd .= ".1.3.6.1.4.1.9.9.46.1.3.1.1.4.1." . $vlan; $vlan_descr = shell_exec($vlan_descr_cmd); diff --git a/includes/discovery/cisco-vrf.inc.php b/includes/discovery/cisco-vrf.inc.php index 4c2e4b7b36..8a18959961 100755 --- a/includes/discovery/cisco-vrf.inc.php +++ b/includes/discovery/cisco-vrf.inc.php @@ -7,7 +7,7 @@ echo("VRFs : "); - $oid_cmd = $config['snmpwalk'] . " -m MPLS-VPN-MIB -CI -Ln -Osqn -" . $device['snmpver'] . " -c " . $device['community'] . " " . $device['hostname'].":".$device['port'] . " mplsVpnVrfRouteDistinguisher"; + $oid_cmd = $config['snmpwalk'] . " -M " . $config['mibdir'] . " -m MPLS-VPN-MIB -CI -Ln -Osqn -" . $device['snmpver'] . " -c " . $device['community'] . " " . $device['hostname'].":".$device['port'] . " mplsVpnVrfRouteDistinguisher"; $oids = shell_exec($oid_cmd); if($debug) { echo("$oid_cmd -> $oids \n"); } @@ -20,9 +20,9 @@ foreach ( explode("\n", $oids) as $oid ) { if($oid) { list($vrf['oid'], $vrf['mplsVpnVrfRouteDistinguisher']) = explode("||", $oid); - $vrf['name'] = trim(shell_exec($config['snmpget'] . " -m MPLS-VPN-MIB -Ln -Osq -" . $device['snmpver'] . " -c " . $device['community'] . " " . $device['hostname'].":".$device['port'] . " mplsVpnVrfRouteDistinguisher.".$vrf['oid'])); + $vrf['name'] = trim(shell_exec($config['snmpget'] . " -M " . $config['mibdir'] . " -m MPLS-VPN-MIB -Ln -Osq -" . $device['snmpver'] . " -c " . $device['community'] . " " . $device['hostname'].":".$device['port'] . " mplsVpnVrfRouteDistinguisher.".$vrf['oid'])); list(,$vrf['name'],, $vrf['mplsVpnVrfRouteDistinguisher']) = explode("\"", $vrf['name']); - $vrf['mplsVpnVrfDescription'] = trim(shell_exec($config['snmpget'] . " -m MPLS-VPN-MIB -Ln -Osqvn -" . $device['snmpver'] . " -c " . $device['community'] . " " . $device['hostname'].":".$device['port'] . " mplsVpnVrfDescription.".$vrf['oid'])); + $vrf['mplsVpnVrfDescription'] = trim(shell_exec($config['snmpget'] . " -M " . $config['mibdir'] . " -m MPLS-VPN-MIB -Ln -Osqvn -" . $device['snmpver'] . " -c " . $device['community'] . " " . $device['hostname'].":".$device['port'] . " mplsVpnVrfDescription.".$vrf['oid'])); if(@mysql_result(mysql_query("SELECT count(*) FROM vrfs WHERE `device_id` = '".$device['device_id']."' AND `vrf_oid`='".$vrf['oid']."'"),0)) { @@ -38,7 +38,7 @@ $valid_vrf[$vrf_id] = 1; echo("\nRD:".$vrf['mplsVpnVrfRouteDistinguisher']." ".$vrf['name']." ".$vrf['mplsVpnVrfDescription']." "); $ports_oid = ".1.3.6.1.3.118.1.2.1.1.2." . $vrf['oid']; - $ports = shell_exec($config['snmpwalk'] . " -m MPLS-VPN-MIB -CI -Ln -Osqn -" . $device['snmpver'] . " -c " . $device['community'] . " " . $device['hostname'].":".$device['port'] . " $ports_oid"); + $ports = shell_exec($config['snmpwalk'] . " -M " . $config['mibdir'] . " -m MPLS-VPN-MIB -CI -Ln -Osqn -" . $device['snmpver'] . " -c " . $device['community'] . " " . $device['hostname'].":".$device['port'] . " $ports_oid"); $ports = trim(str_replace($ports_oid . ".", "", $ports)); # list($ports) = explode(" ", $ports); echo(" ( "); diff --git a/includes/discovery/current.inc.php b/includes/discovery/current.inc.php index ad7879bd51..6db23adbfb 100644 --- a/includes/discovery/current.inc.php +++ b/includes/discovery/current.inc.php @@ -113,7 +113,8 @@ if ($device['os'] == "netmanplus") $current_id = $split_oid[count($split_oid)-1]; $current_oid = "1.3.6.1.2.1.33.1.2.6.$current_id"; $precision = 10; - $current = trim(shell_exec($config['snmpget'] . " -O qv -$snmpver -c $community $hostname:$port $current_oid")) / $precision; + $current = snmp_get($device, $current_oid, "-O vq") / $precision; + #$current = trim(shell_exec($config['snmpget'] . " -O qv -$snmpver -c $community $hostname:$port $current_oid")) / $precision; $descr = "Battery" . (count(explode("\n",$oids)) == 1 ? '' : ' ' . ($current_id+1)); $type = "netmanplus"; $index = 500+$current_id; diff --git a/includes/discovery/entity-physical.inc.php b/includes/discovery/entity-physical.inc.php index f2fb0c4589..30f82b3161 100755 --- a/includes/discovery/entity-physical.inc.php +++ b/includes/discovery/entity-physical.inc.php @@ -31,8 +31,8 @@ $entPhysicalAssetID = $entry['entPhysicalAssetID']; - $ent_data = $config['snmpget'] . " -m ENTITY-MIB:IF-MIB -Ovqs -"; - $ent_data .= $device['snmpver'] . " -c " . $device['community'] . " " . $device['hostname'] .":".$device['port']; + $ent_data = $config['snmpget'] . " -M ".$config['mibdir']." -m ENTITY-MIB:IF-MIB -Ovqs -"; + $ent_data .= $device['snmpver'] . " -M ".$config['mibdir']." -c " . $device['community'] . " " . $device['hostname'] .":".$device['port']; $ent_data .= " entAliasMappingIdentifier." . $entPhysicalIndex. ".0"; $ifIndex = shell_exec($ent_data); diff --git a/includes/discovery/host-physical.php b/includes/discovery/host-physical.php index 7d81fa33fe..2edefa6442 100755 --- a/includes/discovery/host-physical.php +++ b/includes/discovery/host-physical.php @@ -4,14 +4,14 @@ # if($config['enable_inventory']) { - $ents_cmd = $config['snmpwalk'] . " -m HOST-RESOURCES-MIB -O qn -" . $device['snmpver'] . " -c " . $device['community'] . " " . $device['hostname'].":".$device['$port'] . " "; + $ents_cmd = $config['snmpwalk'] . " -M " . $config['mibdir'] . " -m HOST-RESOURCES-MIB -O qn -" . $device['snmpver'] . " -c " . $device['community'] . " " . $device['hostname'].":".$device['$port'] . " "; $ents_cmd .= "hrDeviceIndex | sed s/.1.3.6.1.2.1.25.3.2.1.1.//g | cut -f 1 -d\" \""; $ents = trim(`$ents_cmd | grep -v o`); foreach(explode("\n", $ents) as $hrDeviceIndex) { - $ent_data = $config['snmpget'] ". -m HOST-RESOURCES-MIB:ENTITY-MIB -Ovqs -"; + $ent_data = $config['snmpget'] . " -M " . $config['mibdir'] ." -m HOST-RESOURCES-MIB:ENTITY-MIB -Ovqs -"; $ent_data .= $device['snmpver'] . " -c " . $device['community'] . " " . $device['hostname'] .":".$device['port']; $ent_data .= " hrDeviceType." . $entPhysicalIndex; $ent_data .= " hrDeviceDescr." . $entPhysicalIndex; diff --git a/includes/discovery/ipv4-addresses.inc.php b/includes/discovery/ipv4-addresses.inc.php index f1c37f5e20..95e6bcfaa5 100755 --- a/includes/discovery/ipv4-addresses.inc.php +++ b/includes/discovery/ipv4-addresses.inc.php @@ -2,13 +2,13 @@ echo("IP Addresses : "); - $oids = shell_exec($config['snmpwalk'] . " -m IP-MIB -".$device['snmpver']." -Osq -c ".$device['community']." ".$device['hostname'].":".$device['port']." ipAdEntIfIndex"); + $oids = shell_exec($config['snmpwalk'] . " -M " . $config['mibdir'] . " -m IP-MIB -".$device['snmpver']." -Osq -c ".$device['community']." ".$device['hostname'].":".$device['port']." ipAdEntIfIndex"); $oids = trim($oids); $oids = str_replace("ipAdEntIfIndex.", "", $oids); foreach(explode("\n", $oids) as $data) { $data = trim($data); list($oid,$ifIndex) = explode(" ", $data); - $mask = shell_exec($config['snmpget']." -m IP-MIB -O qv -".$device['snmpver']." -c ".$device['community']." ".$device['hostname'].":".$device['port']." ipAdEntNetMask.$oid"); + $mask = shell_exec($config['snmpget']. " -M " . $config['mibdir'] ." -m IP-MIB -O qv -".$device['snmpver']." -c ".$device['community']." ".$device['hostname'].":".$device['port']." ipAdEntNetMask.$oid"); $mask = trim($mask); $network = trim(shell_exec ($config['ipcalc'] . " $oid/$mask | grep Network | cut -d\" \" -f 4")); list($net,$cidr) = explode("/", $network); diff --git a/includes/discovery/ipv6-addresses.inc.php b/includes/discovery/ipv6-addresses.inc.php index 679b68aa6b..8d5105ebda 100644 --- a/includes/discovery/ipv6-addresses.inc.php +++ b/includes/discovery/ipv6-addresses.inc.php @@ -2,7 +2,7 @@ echo("IPv6 Addresses : "); - $cmd = $config['snmpwalk']." -m IP-MIB -".$device['snmpver']." -Ln -c ".$device['community']." ".$device['hostname'].":".$device['port']; + $cmd = $config['snmpwalk']. " -M " . $config['mibdir'] ." -m IP-MIB -".$device['snmpver']." -Ln -c ".$device['community']." ".$device['hostname'].":".$device['port']; $cmd .= " ipAddressIfIndex.ipv6 -Osq | grep -v No"; $oids = trim(trim(shell_exec($cmd))); $oids = str_replace("ipAddressIfIndex.ipv6.", "", $oids); $oids = str_replace("\"", "", $oids); $oids = trim($oids); @@ -22,8 +22,8 @@ echo("IPv6 Addresses : "); $do++; if($do == 2) { $adsep = ":"; $do = '0'; } else { $adsep = "";} } - $ipv6_prefixlen = trim(shell_exec($config['snmpget']." -m IP-MIB -".$device['snmpver']." -c ".$device['community']." ".$device['hostname'].":".$device['port']." .1.3.6.1.2.1.4.34.1.5.2.16.$oid | sed 's/.*\.//'")); - $ipv6_origin = trim(shell_exec($config['snmpget']." -m IP-MIB -Ovq -".$device['snmpver']." -c ".$device['community']." ".$device['hostname'].":".$device['port']." .1.3.6.1.2.1.4.34.1.6.2.16.$oid")); + $ipv6_prefixlen = trim(shell_exec($config['snmpget']. " -M " . $config['mibdir'] ." -m IP-MIB -".$device['snmpver']." -c ".$device['community']." ".$device['hostname'].":".$device['port']." .1.3.6.1.2.1.4.34.1.5.2.16.$oid | sed 's/.*\.//'")); + $ipv6_origin = trim(shell_exec($config['snmpget']. " -M " . $config['mibdir'] ." -m IP-MIB -Ovq -".$device['snmpver']." -c ".$device['community']." ".$device['hostname'].":".$device['port']." .1.3.6.1.2.1.4.34.1.6.2.16.$oid")); discover_process_ipv6($ifIndex,$ipv6_address,$ipv6_prefixlen,$ipv6_origin); } # if $data @@ -31,7 +31,7 @@ echo("IPv6 Addresses : "); if (!$oids) { - $cmd = $config['snmpwalk']." -m IPV6-MIB -".$device['snmpver']." -Ln -c ".$device['community']." ".$device['hostname'].":".$device['port']; + $cmd = $config['snmpwalk']. " -M " . $config['mibdir'] ." -m IPV6-MIB -".$device['snmpver']." -Ln -c ".$device['community']." ".$device['hostname'].":".$device['port']; $cmd .= " ipv6AddrPfxLength -Osq -OnU| grep -v No"; $oids = trim(trim(shell_exec($cmd))); $oids = str_replace(".1.3.6.1.2.1.55.1.8.1.2.", "", $oids); $oids = str_replace("\"", "", $oids); $oids = trim($oids); @@ -42,7 +42,7 @@ if (!$oids) list($ifIndex,$ipv6addr) = split("\\.",$if_ipv6addr,2); $ipv6_address = snmp2ipv6($ipv6addr); - $ipv6_origin = trim(shell_exec($config['snmpget']." -m IPV6-MIB -Ovq -".$device['snmpver']." -c ".$device['community']." ".$device['hostname'].":".$device['port']." IPV6-MIB::ipv6AddrType.$if_ipv6addr")); + $ipv6_origin = trim(shell_exec($config['snmpget']. " -M " . $config['mibdir'] ." -m IPV6-MIB -Ovq -".$device['snmpver']." -c ".$device['community']." ".$device['hostname'].":".$device['port']." IPV6-MIB::ipv6AddrType.$if_ipv6addr")); discover_process_ipv6($ifIndex,$ipv6_address,$ipv6_prefixlen,$ipv6_origin); } # if $data diff --git a/includes/discovery/q-bridge-mib.inc.php b/includes/discovery/q-bridge-mib.inc.php index c4caf3351d..a74903a017 100644 --- a/includes/discovery/q-bridge-mib.inc.php +++ b/includes/discovery/q-bridge-mib.inc.php @@ -2,7 +2,7 @@ echo("Q-BRIDGE-MIB VLANs : "); - $vlanversion_cmd = $config['snmpget'] . " -m Q-BRIDGE-MIB -Oqv -" . $device['snmpver'] . " -c " . $device['community'] . " "; + $vlanversion_cmd = $config['snmpget'] . " -M " . $config['mibdir'] . " -m Q-BRIDGE-MIB -Oqv -" . $device['snmpver'] . " -c " . $device['community'] . " "; $vlanversion_cmd .= $device['hostname'].":".$device['port'] . " Q-BRIDGE-MIB::dot1qVlanVersionNumber.0"; $vlanversion = trim(`$vlanversion_cmd 2>/dev/null`); @@ -10,7 +10,7 @@ echo("VLAN $vlanversion "); - $vlans_cmd = $config['snmpwalk'] . " -m Q-BRIDGE-MIB -O qn -" . $device['snmpver'] . " -c " . $device['community'] . " " . $device['hostname'].":".$device['port'] . " "; + $vlans_cmd = $config['snmpwalk'] . " -M " . $config['mibdir'] . " -m Q-BRIDGE-MIB -O qn -" . $device['snmpver'] . " -c " . $device['community'] . " " . $device['hostname'].":".$device['port'] . " "; $vlans_cmd .= "dot1qVlanFdbId"; $vlans = trim(`$vlans_cmd | grep -v o`); @@ -21,7 +21,7 @@ $oid_ex = explode('.',$oid); $oid = $oid_ex[count($oid_ex)-1]; - $vlan_descr_cmd = $config['snmpget'] . " -m Q-BRIDGE-MIB -O nvq -" . $device['snmpver'] . " -c " . $device['community'] . " " . $device['hostname'].":".$device['port'] . " "; + $vlan_descr_cmd = $config['snmpget'] . " -M " . $config['mibdir'] . " -m Q-BRIDGE-MIB -O nvq -" . $device['snmpver'] . " -c " . $device['community'] . " " . $device['hostname'].":".$device['port'] . " "; $vlan_descr_cmd .= "dot1qVlanStaticName.$oid|grep -v \"No Such Instance currently exists at this OID\""; $vlan_descr = shell_exec($vlan_descr_cmd); diff --git a/includes/discovery/temperatures-adva.inc.php b/includes/discovery/temperatures-adva.inc.php index 747ad8aa0f..3c10aa4f8f 100755 --- a/includes/discovery/temperatures-adva.inc.php +++ b/includes/discovery/temperatures-adva.inc.php @@ -13,10 +13,10 @@ $descr_hss1 = "hss1"; $oid_hss2 = "1.3.6.1.4.1.2544.1.9.2.4.1.5.1.1.14"; $descr_hss2 = "hss2"; - $temp_chassis = trim(shell_exec($config['snmpget'] . " -O qv -$snmpver -c $community $hostname:$port $oid_chassis")); - $temp_stm16 = trim(shell_exec($config['snmpget'] . " -O qv -$snmpver -c $community $hostname:$port $oid_stm16")); - $temp_hss1 = trim(shell_exec($config['snmpget'] . " -O qv -$snmpver -c $community $hostname:$port $oid_hss1")); - $temp_hss2 = trim(shell_exec($config['snmpget'] . " -O qv -$snmpver -c $community $hostname:$port $oid_hss2")); + $temp_chassis = trim(shell_exec($config['snmpget'] . " -M " . $config['mibdir'] . " -O qv -$snmpver -c $community $hostname:$port $oid_chassis")); + $temp_stm16 = trim(shell_exec($config['snmpget'] . " -M " . $config['mibdir'] . " -O qv -$snmpver -c $community $hostname:$port $oid_stm16")); + $temp_hss1 = trim(shell_exec($config['snmpget'] . " -M " . $config['mibdir'] . " -O qv -$snmpver -c $community $hostname:$port $oid_hss1")); + $temp_hss2 = trim(shell_exec($config['snmpget'] . " -M " . $config['mibdir'] . " -O qv -$snmpver -c $community $hostname:$port $oid_hss2")); echo("Adva Chassis "); if($temp_chassis != "0") { diff --git a/includes/discovery/temperatures.inc.php b/includes/discovery/temperatures.inc.php index 8a3403892f..2f93476e90 100755 --- a/includes/discovery/temperatures.inc.php +++ b/includes/discovery/temperatures.inc.php @@ -15,7 +15,7 @@ switch ($device['os']) { case "ironware": echo("IronWare "); - $oids = shell_exec($config['snmpwalk'] . " -$snmpver -CI -Osqn -m FOUNDRY-SN-AGENT-MIB:FOUNDRY-SN-ROOT-MIB -c $community $hostname:$port snAgentTempSensorDescr"); + $oids = shell_exec($config['snmpwalk'] . " -M " . $config['mibdir'] . " -$snmpver -CI -Osqn -m FOUNDRY-SN-AGENT-MIB:FOUNDRY-SN-ROOT-MIB -c $community $hostname:$port snAgentTempSensorDescr"); $oids = trim($oids); $oids = str_replace(".1.3.6.1.4.1.1991.1.1.2.13.1.1.3.", "", $oids); foreach(explode("\n", $oids) as $data) @@ -26,8 +26,8 @@ switch ($device['os']) list($oid) = explode(" ", $data); $temp_oid = ".1.3.6.1.4.1.1991.1.1.2.13.1.1.4.$oid"; $descr_oid = ".1.3.6.1.4.1.1991.1.1.2.13.1.1.3.$oid"; - $descr = trim(shell_exec($config['snmpget'] . " -O qv -$snmpver -c $community $hostname:$port $descr_oid")); - $temp = trim(shell_exec($config['snmpget'] . " -O qv -$snmpver -c $community $hostname:$port $temp_oid")); + $descr = trim(shell_exec($config['snmpget'] . " -M " . $config['mibdir'] . " -O qv -$snmpver -c $community $hostname:$port $descr_oid")); + $temp = trim(shell_exec($config['snmpget'] . " -M " . $config['mibdir'] . " -O qv -$snmpver -c $community $hostname:$port $temp_oid")); if (!strstr($descr, "No") && !strstr($temp, "No") && $descr != "" && $temp != "0") { $descr = str_replace("\"", "", $descr); @@ -46,7 +46,7 @@ switch ($device['os']) break; case "areca": - $oids = shell_exec($config['snmpwalk'] . " -$snmpver -CI -Osqn -c $community $hostname:$port SNMPv2-SMI::enterprises.18928.1.1.2.14.1.2"); + $oids = shell_exec($config['snmpwalk'] . " -M " . $config['mibdir'] . " -$snmpver -CI -Osqn -c $community $hostname:$port SNMPv2-SMI::enterprises.18928.1.1.2.14.1.2"); if ($debug) { echo($oids."\n"); } $oids = trim($oids); if ($oids) echo("Areca Harddisk "); @@ -59,7 +59,7 @@ switch ($device['os']) $split_oid = explode('.',$oid); $temp_id = $split_oid[count($split_oid)-1]; $temp_oid = "1.3.6.1.4.1.18928.1.1.2.14.1.2.$temp_id"; - $temp = trim(shell_exec($config['snmpget'] . " -O qv -$snmpver -c $community $hostname:$port $temp_oid")); + $temp = trim(shell_exec($config['snmpget'] . " -M " . $config['mibdir'] . " -O qv -$snmpver -c $community $hostname:$port $temp_oid")); $descr = "Hard disk $temp_id"; if ($temp != -128) # -128 = not measured/present { @@ -90,8 +90,8 @@ switch ($device['os']) case "papouch-tme": echo("Papouch TME "); - $descr = trim(shell_exec($config['snmpget'] . " -O qv -$snmpver -c $community $hostname:$port SNMPv2-SMI::enterprises.18248.1.1.3.0")); - $temp = trim(shell_exec($config['snmpget'] . " -O qv -$snmpver -c $community $hostname:$port SNMPv2-SMI::enterprises.18248.1.1.1.0")) / 10; + $descr = trim(shell_exec($config['snmpget'] . " -M " . $config['mibdir'] . " -O qv -$snmpver -c $community $hostname:$port SNMPv2-SMI::enterprises.18248.1.1.3.0")); + $temp = trim(shell_exec($config['snmpget'] . " -M " . $config['mibdir'] . " -O qv -$snmpver -c $community $hostname:$port SNMPv2-SMI::enterprises.18248.1.1.1.0")) / 10; if (!strstr($descr, "No") && !strstr($temp, "No") && $descr != "" && $temp != "0") { $temp_oid = ".1.3.6.1.4.1.18248.1.1.1.0"; @@ -102,7 +102,7 @@ switch ($device['os']) case "linux": # Observer-style temperature - $oids = shell_exec($config['snmpwalk'] . " -$snmpver -m SNMPv2-SMI -Osqn -CI -c $community $hostname:$port .1.3.6.1.4.1.2021.7891 | sed s/.1.3.6.1.4.1.2021.7891.// | grep '.1.1 ' | grep -v '.101.' | cut -d'.' -f 1"); + $oids = shell_exec($config['snmpwalk'] . " -M " . $config['mibdir'] . " -M " . $config['mibdir'] . " -$snmpver -m SNMPv2-SMI -Osqn -CI -c $community $hostname:$port .1.3.6.1.4.1.2021.7891 | sed s/.1.3.6.1.4.1.2021.7891.// | grep '.1.1 ' | grep -v '.101.' | cut -d'.' -f 1"); $oids = trim($oids); if ($oids) echo("Observer-Style "); foreach(explode("\n",$oids) as $oid) @@ -110,7 +110,7 @@ switch ($device['os']) $oid = trim($oid); if ($oid != "") { - $descr_query = $config['snmpget'] . " -$snmpver -m SNMPv2-SMI -Osqn -c $community $hostname:$port .1.3.6.1.4.1.2021.7891.$oid.2.1 | sed s/.1.3.6.1.4.1.2021.7891.$oid.2.1\ //"; + $descr_query = $config['snmpget'] . " -M " . $config['mibdir'] . " -$snmpver -m SNMPv2-SMI -Osqn -c $community $hostname:$port .1.3.6.1.4.1.2021.7891.$oid.2.1 | sed s/.1.3.6.1.4.1.2021.7891.$oid.2.1\ //"; $descr = trim(str_replace("\"", "", shell_exec($descr_query))); $fulloid = ".1.3.6.1.4.1.2021.7891.$oid.101.1"; discover_temperature($valid_temp, $device, $fulloid, $oid, "observer", $descr, "1", NULL, NULL, NULL); @@ -118,7 +118,7 @@ switch ($device['os']) } # LM-Sensors - $oids = shell_exec($config['snmpwalk'] . " -m LM-SENSORS-MIB -$snmpver -CI -Osqn -c $community $hostname:$port lmTempSensorsDevice"); + $oids = shell_exec($config['snmpwalk'] . " -M " . $config['mibdir'] . " -m LM-SENSORS-MIB -$snmpver -CI -Osqn -c $community $hostname:$port lmTempSensorsDevice"); if ($debug) { echo($oids."\n"); } $oids = trim($oids); if ($oids) echo("LM-SENSORS "); @@ -131,7 +131,7 @@ switch ($device['os']) $split_oid = explode('.',$oid); $temp_id = $split_oid[count($split_oid)-1]; $temp_oid = "1.3.6.1.4.1.2021.13.16.2.1.3.$temp_id"; - $temp = trim(shell_exec($config['snmpget'] . " -m LM-SENSORS-MIB -O qv -$snmpver -c $community $hostname:$port $temp_oid")) / 1000; + $temp = trim(shell_exec($config['snmpget'] . " -M " . $config['mibdir'] . " -m LM-SENSORS-MIB -O qv -$snmpver -c $community $hostname:$port $temp_oid")) / 1000; $descr = str_ireplace("temp-", "", $descr); $descr = trim($descr); if($temp != "0" && $temp <= "1000") @@ -142,7 +142,10 @@ switch ($device['os']) } # Supermicro sensors - $oids = shell_exec($config['snmpwalk'] . " -m SUPERMICRO-HEALTH-MIB -$snmpver -CI -Osqn -c $community $hostname:$port 1.3.6.1.4.1.10876.2.1.1.1.1.3 | sed s/1.3.6.1.4.1.10876.2.1.1.1.1.3.//g"); + ## Fix this shit if you can test it. + $oids = snmp_walk($device, "1.3.6.1.4.1.10876.2.1.1.1.1.3", "-Osqn", "SUPERMICRO-HEALTH-MIB"); + + $oids = shell_exec($config['snmpwalk'] . " -M " . $config['mibdir'] . " -m SUPERMICRO-HEALTH-MIB -$snmpver -CI -Osqn -c $community $hostname:$port 1.3.6.1.4.1.10876.2.1.1.1.1.3 | sed s/1.3.6.1.4.1.10876.2.1.1.1.1.3.//g"); $oids = trim($oids); if ($oids) echo("Supermicro "); foreach(explode("\n", $oids) as $data) @@ -158,11 +161,11 @@ switch ($device['os']) $limit_oid = "1.3.6.1.4.1.10876.2.1.1.1.1.5$oid"; $divisor_oid = "1.3.6.1.4.1.10876.2.1.1.1.1.9$oid"; $monitor_oid = "1.3.6.1.4.1.10876.2.1.1.1.1.10$oid"; - $descr = trim(shell_exec($config['snmpget'] . " -m SUPERMICRO-HEALTH-MIB -O qv -$snmpver -c $community $hostname:$port $descr_oid")); - $temp = trim(shell_exec($config['snmpget'] . " -m SUPERMICRO-HEALTH-MIB -O qv -$snmpver -c $community $hostname:$port $temp_oid")); - $limit = trim(shell_exec($config['snmpget'] . " -m SUPERMICRO-HEALTH-MIB -O qv -$snmpver -c $community $hostname:$port $limit_oid")); - $divisor = trim(shell_exec($config['snmpget'] . " -m SUPERMICRO-HEALTH-MIB -O qv -$snmpver -c $community $hostname:$port $divisor_oid")); - $monitor = trim(shell_exec($config['snmpget'] . " -m SUPERMICRO-HEALTH-MIB -O qv -$snmpver -c $community $hostname:$port $monitor_oid")); + $descr = trim(shell_exec($config['snmpget'] . " -M " . $config['mibdir'] . " -m SUPERMICRO-HEALTH-MIB -O qv -$snmpver -c $community $hostname:$port $descr_oid")); + $temp = trim(shell_exec($config['snmpget'] . " -M " . $config['mibdir'] . " -m SUPERMICRO-HEALTH-MIB -O qv -$snmpver -c $community $hostname:$port $temp_oid")); + $limit = trim(shell_exec($config['snmpget'] . " -M " . $config['mibdir'] . " -m SUPERMICRO-HEALTH-MIB -O qv -$snmpver -c $community $hostname:$port $limit_oid")); + $divisor = trim(shell_exec($config['snmpget'] . " -M " . $config['mibdir'] . " -m SUPERMICRO-HEALTH-MIB -O qv -$snmpver -c $community $hostname:$port $divisor_oid")); + $monitor = trim(shell_exec($config['snmpget'] . " -M " . $config['mibdir'] . " -m SUPERMICRO-HEALTH-MIB -O qv -$snmpver -c $community $hostname:$port $monitor_oid")); if ($monitor == 'true') { $descr = trim(str_ireplace("temperature", "", $descr)); @@ -175,7 +178,7 @@ switch ($device['os']) case "ios": echo("Cisco "); - $oids = shell_exec($config['snmpwalk'] . " -m CISCO-ENVMON-MIB -$snmpver -CI -Osqn -c $community $hostname:$port .1.3.6.1.4.1.9.9.13.1.3.1.2 | sed s/.1.3.6.1.4.1.9.9.13.1.3.1.2.//g"); + $oids = shell_exec($config['snmpwalk'] . " -M " . $config['mibdir'] . " -m CISCO-ENVMON-MIB -$snmpver -CI -Osqn -c $community $hostname:$port .1.3.6.1.4.1.9.9.13.1.3.1.2 | sed s/.1.3.6.1.4.1.9.9.13.1.3.1.2.//g"); $oids = trim($oids); foreach(explode("\n", $oids) as $data) { @@ -213,7 +216,7 @@ switch ($device['os']) $split_oid = explode('.',$oid); $temp_id = $split_oid[count($split_oid)-1]; $temp_oid = "1.3.6.1.2.1.33.1.2.7.$temp_id"; - $temp = trim(shell_exec($config['snmpget'] . " -O qv -$snmpver -c $community $hostname:$port $temp_oid")); + $temp = trim(shell_exec($config['snmpget'] . " -M " . $config['mibdir'] . " -O qv -$snmpver -c $community $hostname:$port $temp_oid")); $descr = "Battery" . (count(explode("\n",$oids)) == 1 ? '' : ' ' . ($temp_id+1)); discover_temperature($valid_temp, $device, $temp_oid, $temp_id, "netmanplus", $descr, 1, NULL, NULL, $temp); } @@ -260,7 +263,7 @@ switch ($device['os']) if ($device['os'] == "junos" || $device['os_group'] == "junos") { echo("JunOS "); - $oids = shell_exec($config['snmpwalk'] . " -M +".$config['install_dir']."/mibs/junos -m JUNIPER-MIB -$snmpver -CI -Osqn -c $community $hostname:$port 1.3.6.1.4.1.2636.3.1.13.1.7"); + $oids = shell_exec($config['snmpwalk'] . " -M " . $config['mibdir'] . " -M +".$config['install_dir']."/mibs/junos -m JUNIPER-MIB -$snmpver -CI -Osqn -c $community $hostname:$port 1.3.6.1.4.1.2636.3.1.13.1.7"); $oids = trim($oids); foreach(explode("\n", $oids) as $data) { @@ -271,8 +274,8 @@ if ($device['os'] == "junos" || $device['os_group'] == "junos") list($oid) = explode(" ", $data); $temp_oid = "1.3.6.1.4.1.2636.3.1.13.1.7.$oid"; $descr_oid = "1.3.6.1.4.1.2636.3.1.13.1.5.$oid"; - $descr = trim(shell_exec($config['snmpget'] . " -M +".$config['install_dir']."/mibs/junos -m JUNIPER-MIB -O qv -$snmpver -c $community $hostname:$port $descr_oid")); - $temp = trim(shell_exec($config['snmpget'] . " -M +".$config['install_dir']."/mibs/junos -m JUNIPER-MIB -O qv -$snmpver -c $community $hostname:$port $temp_oid")); + $descr = trim(shell_exec($config['snmpget'] . " -M " . $config['mibdir'] . " -M +".$config['install_dir']."/mibs/junos -m JUNIPER-MIB -O qv -$snmpver -c $community $hostname:$port $descr_oid")); + $temp = trim(shell_exec($config['snmpget'] . " -M " . $config['mibdir'] . " -M +".$config['install_dir']."/mibs/junos -m JUNIPER-MIB -O qv -$snmpver -c $community $hostname:$port $temp_oid")); if (!strstr($descr, "No") && !strstr($temp, "No") && $descr != "" && $temp != "0") { $descr = str_replace("\"", "", $descr); @@ -291,7 +294,7 @@ if ($device['os'] == "junos" || $device['os_group'] == "junos") ## Dell Temperatures if (strstr($device['hardware'], "dell")) { - $oids = shell_exec($config['snmpwalk'] . " -m MIB-Dell-10892 -$snmpver -CI -Osqn -c $community $hostname:$port .1.3.6.1.4.1.674.10892.1.700.20.1.8"); + $oids = shell_exec($config['snmpwalk'] . " -M " . $config['mibdir'] . " -m MIB-Dell-10892 -$snmpver -CI -Osqn -c $community $hostname:$port .1.3.6.1.4.1.674.10892.1.700.20.1.8"); $oids = trim($oids); if ($oids) echo("Dell OMSA "); foreach(explode("\n",$oids) as $oid) @@ -300,7 +303,7 @@ if (strstr($device['hardware'], "dell")) list($oid) = explode(" ", $oid); if ($oid != "") { - $descr_query = $config['snmpget'] . " -m MIB-Dell-10892 -$snmpver -Onvq -c $community $hostname:$port .1.3.6.1.4.1.674.10892.1.700.20.1.8.$oid"; + $descr_query = $config['snmpget'] . " -M " . $config['mibdir'] . " -m MIB-Dell-10892 -$snmpver -Onvq -c $community $hostname:$port .1.3.6.1.4.1.674.10892.1.700.20.1.8.$oid"; $descr = trim(str_replace("\"", "", shell_exec($descr_query))); $fulloid = ".1.3.6.1.4.1.674.10892.1.700.20.1.6.$oid"; discover_temperature($valid_temp, $device, $fulloid, $oid, "dell", $descr, "10", NULL, NULL, NULL); diff --git a/includes/discovery/voltages.inc.php b/includes/discovery/voltages.inc.php index 620d8de988..8bf4165515 100755 --- a/includes/discovery/voltages.inc.php +++ b/includes/discovery/voltages.inc.php @@ -161,7 +161,8 @@ if ($device['os'] == "netmanplus") $volt_id = $split_oid[count($split_oid)-1]; $volt_oid = "1.3.6.1.2.1.33.1.2.5.$volt_id"; $precision = 10; - $volt = trim(shell_exec($config['snmpget'] . " -O qv -$snmpver -c $community $hostname:$port $volt_oid")) / $precision; + $volt = snmp_get($device, $volt_oid, "-O vq") / $precision; + #$volt = trim(shell_exec($config['snmpget'] . " -O qv -$snmpver -c $community $hostname:$port $volt_oid")) / $precision; $descr = "Battery" . (count(explode("\n",$oids)) == 1 ? '' : ' ' . ($volt_id+1)); $type = "netmanplus"; $index = 500+$volt_id; diff --git a/includes/polling/bgpPeer.inc.php b/includes/polling/bgpPeer.inc.php index add09f3232..8dcd953f92 100755 --- a/includes/polling/bgpPeer.inc.php +++ b/includes/polling/bgpPeer.inc.php @@ -15,7 +15,8 @@ while($peer = mysql_fetch_array($peers)) { if (!strstr($peer['bgpPeerIdentifier'],':')) { # v4 BGP4 MIB - $peer_cmd = $config['snmpget'] . " -m BGP4-MIB -Ovq -" . $device['snmpver'] . " -c" . $device['community'] . " " . $device['hostname'].":".$device['port'] . " "; + ## FIX ME - needs moved to function + $peer_cmd = $config['snmpget'] . " -M ".$config['mibdir'] . " -m BGP4-MIB -Ovq -" . $device['snmpver'] . " -c" . $device['community'] . " " . $device['hostname'].":".$device['port'] . " "; $peer_cmd .= "bgpPeerState." . $peer['bgpPeerIdentifier'] . " bgpPeerAdminStatus." . $peer['bgpPeerIdentifier'] . " bgpPeerInUpdates." . $peer['bgpPeerIdentifier'] . " bgpPeerOutUpdates." . $peer['bgpPeerIdentifier'] . " bgpPeerInTotalMessages." . $peer['bgpPeerIdentifier'] . " "; $peer_cmd .= "bgpPeerOutTotalMessages." . $peer['bgpPeerIdentifier'] . " bgpPeerFsmEstablishedTime." . $peer['bgpPeerIdentifier'] . " bgpPeerInUpdateElapsedTime." . $peer['bgpPeerIdentifier'] . " "; $peer_cmd .= "bgpPeerLocalAddr." . $peer['bgpPeerIdentifier'] . ""; @@ -31,7 +32,8 @@ if ($device['os'] == "junos") if (!isset($junos_v6)) { echo "\nCaching Oids..."; - $peer_cmd = $config['snmpwalk'] . " -m BGP4-V2-MIB-JUNIPER -Onq -" . $device['snmpver'] . " -c" . $device['community'] . " " . $device['hostname'].":".$device['port']; + ## FIX ME - needs moved to function + $peer_cmd = $config['snmpwalk'] . " -M ".$config['mibdir'] . " -m BGP4-V2-MIB-JUNIPER -Onq -" . $device['snmpver'] . " -c" . $device['community'] . " " . $device['hostname'].":".$device['port']; $peer_cmd .= " jnxBgpM2PeerStatus.0.ipv6"; foreach (explode("\n",trim(`$peer_cmd`)) as $oid) { @@ -40,8 +42,8 @@ if ($device['os'] == "junos") $junos_v6[implode('.',array_slice($peer_id,35))] = implode('.',array_slice($peer_id,18)); } } - - $peer_cmd = $config['snmpget'] . " -m BGP4-V2-MIB-JUNIPER -Ovq -" . $device['snmpver'] . " -c" . $device['community'] . " " . $device['hostname'].":".$device['port']; + ## FIX ME - move to fucntion (and clean up, wtf?) + $peer_cmd = $config['snmpget'] . " -M ".$config['mibdir'] . " -m BGP4-V2-MIB-JUNIPER -Ovq -" . $device['snmpver'] . " -c" . $device['community'] . " " . $device['hostname'].":".$device['port']; $peer_cmd .= " jnxBgpM2PeerState.0.ipv6." . $junos_v6[$peer_ip]; $peer_cmd .= " jnxBgpM2PeerStatus.0.ipv6." . $junos_v6[$peer_ip]; # Should be jnxBgpM2CfgPeerAdminStatus but doesn't seem to be implemented? $peer_cmd .= " jnxBgpM2PeerInUpdates.0.ipv6." . $junos_v6[$peer_ip]; @@ -130,8 +132,8 @@ if ($device['os'] == "junos") $afi = $peer_afi['afi']; $safi = $peer_afi['safi']; if($debug) { echo("$afi $safi". $config['afi'][$afi][$safi]. "\n"); } - - $cbgp_cmd = $config['snmpget'] . " -m CISCO-BGP4-MIB -Ovq -" . $device['snmpver'] . " -c" . $device['community'] . " " . $device['hostname'].":".$device['port']; + ## FIX ME - move to function + $cbgp_cmd = $config['snmpget'] . " -M ".$config['mibdir'] . " -m CISCO-BGP4-MIB -Ovq -" . $device['snmpver'] . " -c" . $device['community'] . " " . $device['hostname'].":".$device['port']; $cbgp_cmd .= " cbgpPeerAcceptedPrefixes." . $peer['bgpPeerIdentifier'] . ".$afi.$safi"; $cbgp_cmd .= " cbgpPeerDeniedPrefixes." . $peer['bgpPeerIdentifier'] . ".$afi.$safi"; $cbgp_cmd .= " cbgpPeerPrefixAdminLimit." . $peer['bgpPeerIdentifier'] . ".$afi.$safi"; diff --git a/includes/polling/cisco-enhanced-mempool.inc.php b/includes/polling/cisco-enhanced-mempool.inc.php index 086559cc59..a51c8ac177 100755 --- a/includes/polling/cisco-enhanced-mempool.inc.php +++ b/includes/polling/cisco-enhanced-mempool.inc.php @@ -14,7 +14,7 @@ while($mempool = mysql_fetch_array($pool_data)) { $oid = $mempool['entPhysicalIndex'] . "." . $mempool['Index']; - $pool_cmd = "snmpget -m CISCO-ENHANCED-MEMPOOL-MIB -O Uqnv -" . $device['snmpver'] . " -c " . $device['community'] . " " . $device['hostname'].":".$device['port']; + $pool_cmd = $config['snmpget']. " -M ".$config['mibdir'] . " -m CISCO-ENHANCED-MEMPOOL-MIB -O Uqnv -" . $device['snmpver'] . " -c " . $device['community'] . " " . $device['hostname'].":".$device['port']; $pool_cmd .= " cempMemPoolUsed.$oid cempMemPoolFree.$oid cempMemPoolLargestFree.$oid cempMemPoolLowestFree.$oid"; $pool_cmd .= " | cut -f 1 -d ' '"; diff --git a/includes/polling/cisco-entity-sensors.inc.php b/includes/polling/cisco-entity-sensors.inc.php index e38912131e..9795e29238 100755 --- a/includes/polling/cisco-entity-sensors.inc.php +++ b/includes/polling/cisco-entity-sensors.inc.php @@ -8,7 +8,7 @@ while($sensor = mysql_fetch_array($sensors)) { $oid = $sensor['entPhysicalIndex']; - $sensor_cmd = $config['snmpget'] . " -m CISCO-ENTITY-SENSOR-MIB -O Uqnv -" . $device['snmpver'] . " -c " . $device['community'] . " " . $device['hostname'].":".$device['port']; + $sensor_cmd = $config['snmpget'] . " -M ".$config['mibdir']." -m CISCO-ENTITY-SENSOR-MIB -O Uqnv -" . $device['snmpver'] . " -c " . $device['community'] . " " . $device['hostname'].":".$device['port']; $sensor_cmd .= " entSensorValue.$oid entSensorStatus.$oid"; $sensor_data = trim(shell_exec($sensor_cmd)); diff --git a/includes/polling/cisco-mempool.inc.php b/includes/polling/cisco-mempool.inc.php index 4780afcb02..8ef4a3ebd6 100755 --- a/includes/polling/cisco-mempool.inc.php +++ b/includes/polling/cisco-mempool.inc.php @@ -10,7 +10,7 @@ while($mempool = mysql_fetch_array($pool_data)) { $oid = $mempool['Index']; - $pool_cmd = $config['snmpget'] . " -m CISCO-MEMORY-POOL-MIB -O Uqnv -" . $device['snmpver'] . " -c " . $device['community'] . " " . $device['hostname'].":".$device['port']; + $pool_cmd = $config['snmpget'] . " -M ".$config['mibdir'] . " -m CISCO-MEMORY-POOL-MIB -O Uqnv -" . $device['snmpver'] . " -c " . $device['community'] . " " . $device['hostname'].":".$device['port']; $pool_cmd .= " ciscoMemoryPoolUsed.$oid ciscoMemoryPoolFree.$oid ciscoMemoryPoolLargestFree.$oid"; $pool_cmd .= " | cut -f 1 -d ' '"; diff --git a/includes/polling/cisco-processors.inc.php b/includes/polling/cisco-processors.inc.php index 3984d0a534..5c7ed98853 100755 --- a/includes/polling/cisco-processors.inc.php +++ b/includes/polling/cisco-processors.inc.php @@ -4,7 +4,7 @@ $query = "SELECT * FROM cpmCPU WHERE device_id = '" . $device['device_id'] . "'" $proc_data = mysql_query($query); while($processor = mysql_fetch_array($proc_data)) { - $proc_cmd = "snmpget -m CISCO-PROCESS-MIB -O Uqnv -" . $device['snmpver'] . " -c " . $device['community'] . " " . $device['hostname'].":".$device['port'] . " cpmCPUTotal5minRev." . $processor['cpmCPU_oid']; + $proc_cmd = $config['snmpget'] . " -M ".$config['mibdir'] . " -m CISCO-PROCESS-MIB -O Uqnv -" . $device['snmpver'] . " -c " . $device['community'] . " " . $device['hostname'].":".$device['port'] . " cpmCPUTotal5minRev." . $processor['cpmCPU_oid']; $proc = shell_exec($proc_cmd); echo("Checking CPU " . $processor['entPhysicalDescr'] . "... "); diff --git a/includes/polling/current.inc.php b/includes/polling/current.inc.php index b73fcf0b60..29a8311b16 100644 --- a/includes/polling/current.inc.php +++ b/includes/polling/current.inc.php @@ -6,8 +6,11 @@ while($dbcurrent = mysql_fetch_array($current_data)) { echo("Checking current " . $dbcurrent['current_descr'] . "... "); - $current_cmd = $config['snmpget'] . " -m SNMPv2-MIB -O Uqnv -" . $device['snmpver'] . " -c " . $device['community'] . " " . $device['hostname'].":".$device['port'] . " " . $dbcurrent['current_oid'] . "|grep -v \"No Such Instance\""; - $current = trim(shell_exec($current_cmd)); + #$current_cmd = $config['snmpget'] . " -M ".$config['mibdir'] . " -m SNMPv2-MIB -O Uqnv -" . $device['snmpver'] . " -c " . $device['community'] . " " . $device['hostname'].":".$device['port'] . " " . $dbcurrent['current_oid'] . "|grep -v \"No Such Instance\""; + #$current = trim(shell_exec($current_cmd)); + + $current = snmp_get($device, $dbcurrent['current_oid'], "SNMPv2-MIB"); + if ($dbcurrent['current_precision']) { diff --git a/includes/polling/device-catos.inc.php b/includes/polling/device-catos.inc.php index c47c5171a8..ee55322220 100755 --- a/includes/polling/device-catos.inc.php +++ b/includes/polling/device-catos.inc.php @@ -25,7 +25,7 @@ - list ($cpu5m, $cpu5s) = explode("\n", shell_exec($config['snmpget'] . " -m OLD-CISCO-CPU-MIB -O qv -$snmpver -c $community $hostname:$port 1.3.6.1.4.1.9.2.1.58.0 1.3.6.1.4.1.9.2.1.56.0")); + list ($cpu5m, $cpu5s) = explode("\n", shell_exec($config['snmpget'] . " -M ".$config['mibdir'] . " -m OLD-CISCO-CPU-MIB -O qv -$snmpver -c $community $hostname:$port 1.3.6.1.4.1.9.2.1.58.0 1.3.6.1.4.1.9.2.1.56.0")); $cpu5m = $cpu5m + 0; $cpu5s = $cpu5s + 0; diff --git a/includes/polling/device-dell-laser.inc.php b/includes/polling/device-dell-laser.inc.php index 3382b42e6a..305a4abb35 100644 --- a/includes/polling/device-dell-laser.inc.php +++ b/includes/polling/device-dell-laser.inc.php @@ -1,7 +1,7 @@ diff --git a/includes/polling/device-netstats.inc.php b/includes/polling/device-netstats.inc.php index b7c62e72af..ed5b468b4a 100755 --- a/includes/polling/device-netstats.inc.php +++ b/includes/polling/device-netstats.inc.php @@ -51,7 +51,7 @@ if($device[os] != "Snom") { $snmpstring .= " $oid.0"; } if(!file_exists($rrdfile)) { shell_exec($rrd_create); } - $snmpdata_cmd = "snmpget -m IP-MIB:SNMPv2-MIB:UDP-MIB:TCP-MIB:IP-MIB -O qv -" . $device['snmpver'] . " -c " . $device['community'] . " " . $device['hostname'].":".$device['port'] . " $snmpstring"; + $snmpdata_cmd = $config['snmpget'] . " -M ".$config['mibdir'] . " -m IP-MIB:SNMPv2-MIB:UDP-MIB:TCP-MIB:IP-MIB -O qv -" . $device['snmpver'] . " -c " . $device['community'] . " " . $device['hostname'].":".$device['port'] . " $snmpstring"; $snmpdata = trim(shell_exec($snmpdata_cmd)); $rrdupdate = "N"; foreach(explode("\n", $snmpdata) as $data) { diff --git a/includes/polling/device-powerconnect.inc.php b/includes/polling/device-powerconnect.inc.php index a6c74c4ea2..3c001c488f 100644 --- a/includes/polling/device-powerconnect.inc.php +++ b/includes/polling/device-powerconnect.inc.php @@ -1,7 +1,7 @@