migrate all SNMP calls to use $config['mibdir']. automatically generated from install_dir if not present

git-svn-id: http://www.observium.org/svn/observer/trunk@1284 61d68cd4-352d-0410-923a-c4978735b2b8
This commit is contained in:
Adam Amstrong
2010-07-02 19:58:13 +00:00
parent b991efa9a6
commit c22e8493f7
53 changed files with 168 additions and 128 deletions

View File

@@ -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"); }

View File

@@ -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) {

View File

@@ -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);

View File

@@ -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) {

View File

@@ -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);

View File

@@ -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(" ( ");

View File

@@ -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;

View File

@@ -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);

View File

@@ -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;

View File

@@ -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);

View File

@@ -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

View File

@@ -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);

View File

@@ -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")
{

View File

@@ -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);

View File

@@ -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;

View File

@@ -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";

View File

@@ -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 ' '";

View File

@@ -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));

View File

@@ -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 ' '";

View File

@@ -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'] . "... ");

View File

@@ -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'])
{

View File

@@ -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;

View File

@@ -1,7 +1,7 @@
<?php
$hardware = trim(exec($config['snmpget'] . " -O Qv -" . $device['snmpver'] . " -c " . $device['community'] . " " .
$device['hostname'].":".$device['port'] . " hrDeviceDescr.1"));
$hardware = snmp_get($device, "hrDeviceDescr", "HOST-RESOURCES-MIB");
list(,$version) = split('Engine ',$sysDescr);
$version = "Engine " . trim($version,')');

View File

@@ -2,8 +2,10 @@
echo("Fortinet Fortigate Poller\n");
$fnSysVersion = shell_exec($config['snmpget']." -m FORTINET-MIB-280 -".$device['snmpver']." -Ovq -c ".$device['community']." ".$device['hostname'].":".$device['port']." fnSysVersion.0");
$serial = shell_exec($config['snmpget']." -m FORTINET-MIB-280 -".$device['snmpver']." -Ovq -c ".$device['community']." ".$device['hostname'].":".$device['port']." fnSysSerial.0");
## FIX ME - find some fortigate hardware to test this on, and to update and generify it
$fnSysVersion = shell_exec($config['snmpget']. " -M ".$config['mibdir']." -m FORTINET-MIB-280 -".$device['snmpver']." -Ovq -c ".$device['community']." ".$device['hostname'].":".$device['port']." fnSysVersion.0");
$serial = shell_exec($config['snmpget']. " -M ".$config['mibdir']." -m FORTINET-MIB-280 -".$device['snmpver']." -Ovq -c ".$device['community']." ".$device['hostname'].":".$device['port']." fnSysSerial.0");
$version = preg_replace("/(.+)\ (.+),(.+),(.+)/", "Fortinet \\1||\\2||\\3||\\4", $fnSysVersion);
list($hardware,$version,$features) = explode("||", $version);
@@ -12,7 +14,7 @@ $cpurrd = $config['rrd_dir'] . "/" . $device['hostname'] . "/fortigate-cpu.rrd
$memrrd = $config['rrd_dir'] . "/" . $device['hostname'] . "/fortigate-memory.rrd";
$sessrrd = $config['rrd_dir'] . "/" . $device['hostname'] . "/fortigate-sessions.rrd";
$cmd = $config['snmpget'] . " -m FORTINET-MIB-280 -O qv -" . $device['snmpver'] . " -c " . $device['community'] . " " . $device['hostname'];
$cmd = $config['snmpget'] . " -M ".$config['mibdir']. " -m FORTINET-MIB-280 -O qv -" . $device['snmpver'] . " -c " . $device['community'] . " " . $device['hostname'];
$cmd .= " fnSysCpuUsage.0 fnSysMemUsage.0 fnSysSesCount.0 fnSysMemCapacity.0";
$data = shell_exec($cmd);
list ($cpu, $mem, $ses, $memsize) = explode("\n", $data);

View File

@@ -15,7 +15,7 @@
list(,$features) = explode("(", $features);
list(,$features) = explode("-", $features);
$snmp_cmdb = $config['snmpget'] . " -m ENTITY-MIB:OLD-CISCO-CHASSIS-MIB -O Qv -" . $device['snmpver'] . " -c " . $device['community'] . " " .
$snmp_cmdb = $config['snmpget'] . " -M ".$config['mibdir'] . " -m ENTITY-MIB:OLD-CISCO-CHASSIS-MIB -O Qv -" . $device['snmpver'] . " -c " . $device['community'] . " " .
$device['hostname'].":".$device['port'];
$snmp_cmdb .= " entPhysicalModelName.1 entPhysicalContainedIn.1 entPhysicalName.1 entPhysicalSoftwareRev.1 ";
$snmp_cmdb .= " entPhysicalModelName.1001 entPhysicalContainedIn.1001";
@@ -32,7 +32,7 @@
if($ciscomodel) { $hardware = $ciscomodel; unset($ciscomodel); }
$cpu5m = shell_exec($config['snmpget'] . " -m OLD-CISCO-CPU-MIB -O qv -$snmpver -c $community $hostname:$port avgBusy5.0");
$cpu5m = shell_exec($config['snmpget'] . " -M ".$config['mibdir'] . " -m OLD-CISCO-CPU-MIB -O qv -$snmpver -c $community $hostname:$port avgBusy5.0");
$cpu5m = $cpu5m + 0;
echo("$hostname\n");
@@ -58,7 +58,7 @@
$mem_get = ".1.3.6.1.4.1.9.9.48.1.1.1.6.2 .1.3.6.1.4.1.9.9.48.1.1.1.6.1 .1.3.6.1.4.1.9.9.48.1.1.1.6.3";
$mem_get .= ".1.3.6.1.4.1.9.9.48.1.1.1.5.2 .1.3.6.1.4.1.9.9.48.1.1.1.5.1 .1.3.6.1.4.1.9.9.48.1.1.1.5.3";
$mem_raw = shell_exec($config['snmpget'] . " -O qv -".$device['snmpver']." -c $community $hostname:$port $mem_get");
$mem_raw = shell_exec($config['snmpget'] . " -M ".$config['mibdir'] . " -O qv -".$device['snmpver']." -c $community $hostname:$port $mem_get");
$mem_raw = str_replace("No Such Instance currently exists at this OID", "0", $mem_raw);
list ($memfreeio, $memfreeproc, $memfreeprocb, $memusedio, $memusedproc, $memusedprocb) = explode("\n", $mem_raw);
$memfreeproc = $memfreeproc + $memfreeprocb;

View File

@@ -1,11 +1,11 @@
<?php
$hardware = trim(exec($config['snmpget'] . " -O vqs -m FOUNDRY-SN-AGENT-MIB:FOUNDRY-SN-ROOT-MIB -" . $device['snmpver'] . " -c " . $device['community'] . " " .
$hardware = trim(exec($config['snmpget'] . " -M ".$config['mibdir'] . " -O vqs -m FOUNDRY-SN-AGENT-MIB:FOUNDRY-SN-ROOT-MIB -" . $device['snmpver'] . " -c " . $device['community'] . " " .
$device['hostname'].":".$device['port'] . " sysObjectID.0"));
$hardware = rewrite_ironware_hardware($hardware);
$version = trim(exec($config['snmpget'] . " -O vqs -m FOUNDRY-SN-AGENT-MIB:FOUNDRY-SN-ROOT-MIB -" . $device['snmpver'] . " -c " . $device['community'] . " " .
$version = trim(exec($config['snmpget'] . " -M ".$config['mibdir'] . " -O vqs -m FOUNDRY-SN-AGENT-MIB:FOUNDRY-SN-ROOT-MIB -" . $device['snmpver'] . " -c " . $device['community'] . " " .
$device['hostname'].":".$device['port'] . " snAgBuildVer.0"));
$version = str_replace("V", "", $version);

View File

@@ -1,8 +1,8 @@
<?php
echo("Doing Juniper JunOS ");
$jun_ver = trim(str_replace("\"", "", shell_exec($config['snmpget'] . " -m HOST-RESOURCES-MIB -".$device['snmpver']." -Oqv -c ".$device['community']." ".$device['hostname'].":".$device['port']." .1.3.6.1.2.1.25.6.3.1.2.2")));
## FIX ME below
$jun_ver = trim(str_replace("\"", "", shell_exec($config['snmpget'] . " -M ".$config['mibdir'] . " -m HOST-RESOURCES-MIB -".$device['snmpver']." -Oqv -c ".$device['community']." ".$device['hostname'].":".$device['port']." .1.3.6.1.2.1.25.6.3.1.2.2")));
if(strpos($sysDescr, "olive")) {
$hardware = "Olive";
$serial = "";

View File

@@ -1,6 +1,6 @@
<?php
$version = trim(snmp_get($device, "1.3.6.1.4.1.705.1.1.4.0", "-OQv", "", ""),'"');
$version = trim(snmp_get($device, "1.3.6.1.4.1.705.1.1.4.0", "-OQv"),'"');
$hardware = $sysDescr;
?>

View File

@@ -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) {

View File

@@ -1,7 +1,7 @@
<?php
$snmp_cmd = $config['snmpget'] . " -m Dell-Vendor-MIB -O Qv -" . $device['snmpver'] . " -c " . $device['community'] . " " .
$snmp_cmd = $config['snmpget'] . " -M ".$config['mibdir'] . " -m Dell-Vendor-MIB -O Qv -" . $device['snmpver'] . " -c " . $device['community'] . " " .
$device['hostname'].":".$device['port'];
$snmp_cmd .= " productIdentificationDisplayName.0 productIdentificationVersion.0 productIdentificationDescription.0";
@@ -14,7 +14,7 @@ if (strstr($hardware,"No Such Object available"))
$cpurrd = $config['rrd_dir'] . "/" . $device['hostname'] . "/powerconnect-cpu.rrd";
$cpu_cmd = $config['snmpget'] . " -m RADLAN-rndMng -O qv -" . $device['snmpver'] . " -c " . $device['community'] . " " . $device['hostname'].":".$device['port'];
$cpu_cmd = $config['snmpget'] . " -M ".$config['mibdir'] . " -m RADLAN-rndMng -O qv -" . $device['snmpver'] . " -c " . $device['community'] . " " . $device['hostname'].":".$device['port'];
$cpu_cmd .= " RADLAN-rndMng::rlCpuUtilDuringLastSecond.0";
$cpu_usage = trim(shell_exec($cpu_cmd));

View File

@@ -6,10 +6,10 @@ list($version) = explode("(", $version);
$cpurrd = $config['rrd_dir'] . "/" . $device['hostname'] . "/procurve-cpu.rrd";
$memrrd = $config['rrd_dir'] . "/" . $device['hostname'] . "/procurve-mem.rrd";
$cpu_cmd = $config['snmpget'] . " -O qv -" . $device['snmpver'] . " -c " . $device['community'] . " " . $device['hostname'].":".$device['port'] . " 1.3.6.1.4.1.11.2.14.11.5.1.9.6.1.0";
$cpu_cmd = $config['snmpget'] . " -M ".$config['mibdir'] . " -O qv -" . $device['snmpver'] . " -c " . $device['community'] . " " . $device['hostname'].":".$device['port'] . " 1.3.6.1.4.1.11.2.14.11.5.1.9.6.1.0";
$cpu = shell_exec($cpu_cmd);
$mem_cmd = $config['snmpget'] . " -O qv -" . $device['snmpver'] . " -c " . $device['community'] . " " . $device['hostname'].":".$device['port'];
$mem_cmd = $config['snmpget'] . " -M ".$config['mibdir'] . " -O qv -" . $device['snmpver'] . " -c " . $device['community'] . " " . $device['hostname'].":".$device['port'];
$mem_cmd .= " 1.3.6.1.4.1.11.2.14.11.5.1.1.2.2.1.1.5.1 1.3.6.1.4.1.11.2.14.11.5.1.1.2.2.1.1.6.1 1.3.6.1.4.1.11.2.14.11.5.1.1.2.2.1.1.7.1";
$mem = shell_exec($mem_cmd);

View File

@@ -10,18 +10,18 @@ $cpurrd = $rrd_dir . "/" . $device['hostname'] . "/netscreen-cpu.rrd";
$memrrd = $rrd_dir . "/" . $device['hostname'] . "/netscreen-memory.rrd";
$sessrrd = $rrd_dir . "/" . $device['hostname'] . "/netscreen-sessions.rrd";
$cpu_cmd = $config['snmpget'] . " -O qv -" . $device['snmpver'] . " -c " . $device['community'] . " " . $device['hostname'];
$cpu_cmd = $config['snmpget'] . " -M ".$config['mibdir'] . " -O qv -" . $device['snmpver'] . " -c " . $device['community'] . " " . $device['hostname'];
$cpu_cmd .= " .1.3.6.1.4.1.3224.16.1.1.0 .1.3.6.1.4.1.3224.16.1.3.0";
$cpu_data = shell_exec($cpu_cmd);
list ($cpuav, $cpu5m) = explode("\n", $cpu_data);
$mem_cmd = $config['snmpget'] . " -O qv -" . $device['snmpver'] . " -c " . $device['community'] . " " . $device['hostname'];
$mem_cmd = $config['snmpget'] . " -M ".$config['mibdir'] . " -O qv -" . $device['snmpver'] . " -c " . $device['community'] . " " . $device['hostname'];
$mem_cmd .= " .1.3.6.1.4.1.3224.16.2.1.0 .1.3.6.1.4.1.3224.16.2.2.0 .1.3.6.1.4.1.3224.16.2.3.0";
$mem_data = shell_exec($mem_cmd);
list ($memalloc, $memfree, $memfrag) = explode("\n", $mem_data);
$sess_cmd = $config['snmpget'] . " -O qv -" . $device['snmpver'] . " -c " . $device['community'] . " " . $device['hostname'];
$sess_cmd = $config['snmpget'] . " -M ".$config['mibdir'] . " -O qv -" . $device['snmpver'] . " -c " . $device['community'] . " " . $device['hostname'];
$sess_cmd .= " .1.3.6.1.4.1.3224.16.3.2.0 .1.3.6.1.4.1.3224.16.3.3.0 .1.3.6.1.4.1.3224.16.3.4.0";
$sess_data = shell_exec($sess_cmd);
list ($sessalloc, $sessmax, $sessfailed) = explode("\n", $sess_data);

View File

@@ -4,6 +4,8 @@
// Get SNOM specific version string from silly SNOM location. Silly SNOM!
## Lol fixme?
$cmd = "snmpget -O qv -" . $device['snmpver'] . " -c " . $device['community'] . " " . $device['hostname'].":".$device['port'] . " 1.3.6.1.2.1.7526.2.4";
$sysDescr = `$cmd`;
$sysDescr = str_replace("-", " ", $sysDescr);

View File

@@ -10,7 +10,7 @@ $features = "";
### Filthy hack to get software version. may not work on anything but 585v7 :)
$loop = shell_exec($config['snmpget'] . ' -Ovq -v1 -c '.$device['community'].' '.$device['hostname'].' ifDescr.101');
$loop = shell_exec($config['snmpget'] . " -M ".$config['mibdir'] . ' -Ovq -v1 -c '.$device['community'].' '.$device['hostname'].' ifDescr.101');
if($loop) {
preg_match('@([0-9]+\.[0-9]+\.[0-9]+\.[0-9]+)@i',
$loop, $matches);

View File

@@ -29,19 +29,19 @@
else if(strstr($sysDescr, "sparc64")) { $hardware = "Generic SPARC 64-bit"; }
# Distro "extend" support
$cmd = $config['snmpget'] . " -m UCD-SNMP-MIB -O qv -" . $device['snmpver'] . " -c " . $device['community'] . " " . $device['hostname'].":".$device['port']. " .1.3.6.1.4.1.2021.7890.1.3.1.1.6.100.105.115.116.114.111|grep -v 'No Such Instance'";
$cmd = $config['snmpget'] . " -M ".$config['mibdir'] . " -m UCD-SNMP-MIB -O qv -" . $device['snmpver'] . " -c " . $device['community'] . " " . $device['hostname'].":".$device['port']. " .1.3.6.1.4.1.2021.7890.1.3.1.1.6.100.105.115.116.114.111|grep -v 'No Such Instance'";
$features = trim(`$cmd`);
$features = str_replace("\"", "", $features);
if (!$features) # No "extend" support, try "exec" support
{
$cmd = $config['snmpget'] . " -m UCD-SNMP-MIB -O qv -" . $device['snmpver'] . " -c " . $device['community'] . " " . $device['hostname'].":".$device['port']. " .1.3.6.1.4.1.2021.7890.1.101.1|grep -v 'No Such Instance'";
$cmd = $config['snmpget'] . " -M ".$config['mibdir'] . " -m UCD-SNMP-MIB -O qv -" . $device['snmpver'] . " -c " . $device['community'] . " " . $device['hostname'].":".$device['port']. " .1.3.6.1.4.1.2021.7890.1.101.1|grep -v 'No Such Instance'";
$features = trim(`$cmd`);
$features = str_replace("\"", "", $features);
}
if(preg_match("@No\ Such@", $features)||preg_match("@No\ such@", $features)) { unset($features); }
// Detect Dell hardware via OpenManage SNMP
$cmd = $config['snmpget'] . " -m MIB-Dell-10892 -O qv -" . $device['snmpver'] . " -c " . $device['community'] . " " . $device['hostname'].":".$device['port'] . " .1.3.6.1.4.1.674.10892.1.300.10.1.9.1";
$cmd = $config['snmpget'] . " -M ".$config['mibdir'] . " -m MIB-Dell-10892 -O qv -" . $device['snmpver'] . " -c " . $device['community'] . " " . $device['hostname'].":".$device['port'] . " .1.3.6.1.4.1.674.10892.1.300.10.1.9.1";
$hw = trim(str_replace("\"", "", `$cmd`));
if(strpos($hw, "No") !== FALSE) { unset($hw); } else { $hardware = "Dell " . $hw; }
}

View File

@@ -6,8 +6,11 @@ while($fanspeed = mysql_fetch_array($fan_data)) {
echo("Checking fan " . $fanspeed['sensor_descr'] . "... ");
$fan_cmd = $config['snmpget'] . " -m SNMPv2-MIB -O Uqnv -" . $device['snmpver'] . " -c " . $device['community'] . " " . $device['hostname'].":".$device['port'] . " " . $fanspeed['sensor_oid'] . "|grep -v \"No Such Instance\"";
$fan = trim(str_replace("\"", "", shell_exec($fan_cmd)));
#$fan_cmd = $config['snmpget'] . " -M ".$config['mibdir'] . " -m SNMPv2-MIB -O Uqnv -" . $device['snmpver'] . " -c " . $device['community'] . " " . $device['hostname'].":".$device['port'] . " " . $fanspeed['sensor_oid'] . "|grep -v \"No Such Instance\"";
#$fan = trim(str_replace("\"", "", shell_exec($fan_cmd)));
$fan = snmp_get($device, $fanspeed['sensor_oid'], "SNMPv2-MIB");
if ($fanspeed['sensor_precision']) { $fan = $fan / $fanspeed['sensor_precision']; }
$fanrrd = $config['rrd_dir'] . "/" . $device['hostname'] . "/" . safename("fan-" . $fanspeed['sensor_descr'] . ".rrd");

View File

@@ -6,8 +6,11 @@ while($frequency = mysql_fetch_array($freq_data)) {
echo("Checking frequency " . $frequency['freq_descr'] . "... ");
$freq_cmd = $config['snmpget'] . " -m SNMPv2-MIB -O Uqnv -" . $device['snmpver'] . " -c " . $device['community'] . " " . $device['hostname'].":".$device['port'] . " " . $frequency['freq_oid'] . "|grep -v \"No Such Instance\"";
$freq = trim(str_replace("\"", "", shell_exec($freq_cmd)));
#$freq_cmd = $config['snmpget'] . " -M ".$config['mibdir'] . " -m SNMPv2-MIB -O Uqnv -" . $device['snmpver'] . " -c " . $device['community'] . " " . $device['hostname'].":".$device['port'] . " " . $frequency['freq_oid'] . "|grep -v \"No Such Instance\"";
#$freq = trim(str_replace("\"", "", shell_exec($freq_cmd)));
$freq = snmp_get($device, $frequency['freq_oid'], "SNMPv2-MIB");
if ($frequency['freq_precision'])
{

View File

@@ -4,7 +4,7 @@
// Generic System Statistics
$hrSystem_rrd = $config['rrd_dir'] . "/" . $device['hostname'] . "/hrSystem.rrd";
$hrSystem_cmd = $config['snmpget'] ." -m HOST-RESOURCES-MIB -O qv -" . $device['snmpver'] . " -c " . $device['community'] . " " . $device['hostname'].":".$device['port'];
$hrSystem_cmd = $config['snmpget'] . " -M ".$config['mibdir']." -m HOST-RESOURCES-MIB -O qv -" . $device['snmpver'] . " -c " . $device['community'] . " " . $device['hostname'].":".$device['port'];
$hrSystem_cmd .= " hrSystemProcesses.0 hrSystemNumUsers.0 hrMemorySize.0";
$hrSystem = `$hrSystem_cmd`;
list ($hrSystemProcesses, $hrSystemNumUsers, $hrMemorySize) = explode("\n", $hrSystem);

View File

@@ -8,7 +8,7 @@ while ($dr = mysql_fetch_array($dq)) {
$storage_units = $dr['storage_units'];
$storage_size = $dr['storage_units'] * $dr['storage_size'];
$storage_descr = $dr['storage_descr'];
$cmd = $config['snmpget'] . " -m HOST-RESOURCES-MIB -O qv -" . $device['snmpver'] . " -c " . $device['community'] . " " . $device['hostname'].":".$device['port'] . " storage_used.$storage_index";
$cmd = $config['snmpget'] . " -M ".$config['mibdir']. " -m HOST-RESOURCES-MIB -O qv -" . $device['snmpver'] . " -c " . $device['community'] . " " . $device['hostname'].":".$device['port'] . " storage_used.$storage_index";
$used_units = trim(shell_exec($cmd));
$used = $used_units * $storage_units;
$perc = round($used / $storage_size * 100, 2);

View File

@@ -6,7 +6,7 @@ while($humidity = mysql_fetch_array($hum_data)) {
echo("Checking humidity " . $humidity['sensor_descr'] . "... ");
$hum_cmd = $config['snmpget'] . " -m SNMPv2-MIB -O Uqnv -" . $device['snmpver'] . " -c " . $device['community'] . " " . $device['hostname'].":".$device['port'] . " " . $humidity['sensor_oid'] . "|grep -v \"No Such Instance\"";
$hum_cmd = $config['snmpget'] . " -M ".$config['mibdir']. " -m SNMPv2-MIB -O Uqnv -" . $device['snmpver'] . " -c " . $device['community'] . " " . $device['hostname'].":".$device['port'] . " " . $humidity['sensor_oid'] . "|grep -v \"No Such Instance\"";
$hum = trim(str_replace("\"", "", shell_exec($hum_cmd)));
if ($humidity['sensor_precision'])

View File

@@ -2,7 +2,7 @@
if($device['os_group'] == "ios") {
$portifIndex = array();
$cmd = ($device['snmpver'] == 'v1' ? $config['snmpwalk'] : $config['snmpbulkwalk']) . " -CI -m CISCO-STACK-MIB -O q -" . $device['snmpver'] . " -c " . $device['community'] . " " . $device['hostname'].":".$device['port'] . " portIfIndex";
$cmd = ($device['snmpver'] == 'v1' ? $config['snmpwalk'] : $config['snmpbulkwalk']) . " -M ".$config['mibdir']. " -CI -m CISCO-STACK-MIB -O q -" . $device['snmpver'] . " -c " . $device['community'] . " " . $device['hostname'].":".$device['port'] . " portIfIndex";
#echo("$cmd");
$portifIndex_output = trim(shell_exec($cmd));
foreach(explode("\n", $portifIndex_output) as $entry){
@@ -31,7 +31,7 @@ while ($interface = mysql_fetch_array($interface_query)) {
echo("Looking at " . $interface['ifDescr'] . " on " . $device['hostname'] . "\n");
$snmp_cmd = $config['snmpget'] . " -m IF-MIB -O qv -" . $device['snmpver'] . " -c " . $device['community'] . " " . $device['hostname'].":".$device['port'];
$snmp_cmd = $config['snmpget'] . " -M ".$config['mibdir'] . " -m IF-MIB -O qv -" . $device['snmpver'] . " -c " . $device['community'] . " " . $device['hostname'].":".$device['port'];
$snmp_cmd .= " ifAdminStatus." . $interface['ifIndex'] . " ifOperStatus." . $interface['ifIndex'] . " ifAlias." . $interface['ifIndex'] . " ifName." . $interface['ifIndex'];
$snmp_cmd .= " ifDescr." . $interface['ifIndex'];
@@ -54,7 +54,7 @@ while ($interface = mysql_fetch_array($interface_query)) {
$ifIndex = $interface['ifIndex'];
if($portifIndex[$ifIndex]) {
if($device['os'] == "CatOS") {
$cmd = $config['snmpget'] . " -m CISCO-STACK-MIB -O qv -" . $device['snmpver'] . " -c " . $device['community'] . " " . $device['hostname'].":".$device['port'] . " portName." . $portifIndex[$ifIndex];
$cmd = $config['snmpget'] . " -M ".$config['mibdir'] . " -m CISCO-STACK-MIB -O qv -" . $device['snmpver'] . " -c " . $device['community'] . " " . $device['hostname'].":".$device['port'] . " portName." . $portifIndex[$ifIndex];
$ifAlias = trim(shell_exec($cmd));
}
}
@@ -126,7 +126,7 @@ while ($interface = mysql_fetch_array($interface_query)) {
if($ifOperStatus == "up") {
$snmp_data_cmd = $config['snmpget'] . " -m IF-MIB -O qv -" . $device['snmpver'] . " -c " . $device['community'] . " " . $device['hostname'].":".$device['port'];
$snmp_data_cmd = $config['snmpget'] . " -M ".$config['mibdir'] . " -m IF-MIB -O qv -" . $device['snmpver'] . " -c " . $device['community'] . " " . $device['hostname'].":".$device['port'];
$snmp_data_cmd .= " ifHCInOctets." . $interface['ifIndex'] . " ifHCOutOctets." . $interface['ifIndex'] . " ifInErrors." . $interface['ifIndex'];
$snmp_data_cmd .= " ifOutErrors." . $interface['ifIndex'] . " ifInUcastPkts." . $interface['ifIndex'] . " ifOutUcastPkts." . $interface['ifIndex'];
$snmp_data_cmd .= " ifInNUcastPkts." . $interface['ifIndex'] . " ifOutNUcastPkts." . $interface['ifIndex'];
@@ -138,7 +138,7 @@ while ($interface = mysql_fetch_array($interface_query)) {
list($ifHCInOctets, $ifHCOutOctets, $ifInErrors, $ifOutErrors, $ifInUcastPkts, $ifOutUcastPkts, $ifInNUcastPkts, $ifOutNUcastPkts) = explode("\n", $snmp_data);
if($ifHCInOctets == "" || strpos($ifHCInOctets, "No") !== FALSE ) {
$octets_cmd = $config['snmpget'] . " -m IF-MIB -O qv -" . $device['snmpver'] . " -c " . $device['community'] . " " . $device['hostname'].":".$device['port'];
$octets_cmd = $config['snmpget'] . " -M ".$config['mibdir'] . " -m IF-MIB -O qv -" . $device['snmpver'] . " -c " . $device['community'] . " " . $device['hostname'].":".$device['port'];
$octets_cmd .= " ifInOctets." . $interface['ifIndex'] . " ifOutOctets." . $interface['ifIndex'];
$octets = shell_exec($octets_cmd);
list ($ifHCInOctets, $ifHCOutOctets) = explode("\n", $octets);

View File

@@ -2,11 +2,11 @@
$oid = $mempool['mempool_index'];
$pool_cmd = $config['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";
$pool_cmd .= " | cut -f 1 -d ' '";
echo("$pool_cmd");
if($debug) {echo("SNMP [ $pool_cmd ]\n");}
$pool = shell_exec($pool_cmd);

View File

@@ -2,7 +2,7 @@
$oid = $mempool['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 ' '";

View File

@@ -1,6 +1,8 @@
<?php
## Simple hard-coded poller for Brocade Ironware Dynamic Memory (old style)
## Yes, it really can be this simple.
$mempool['total'] = snmp_get($device, "snAgGblDynMemTotal.0", "-OvQ", "FOUNDRY-SN-AGENT-MIB");
$mempool['free'] = snmp_get($device, "snAgGblDynMemFree.0", "-OvQ", "FOUNDRY-SN-AGENT-MIB");

View File

@@ -1,6 +1,6 @@
<?php
/// HOST-RESOURCES-MIB - Storage Objects
### HOST-RESOURCES-MIB - Storage Objects
if(!is_array($storage_cache['hrstorage'])) {
$storage_cache['hrstorage'] = snmp_cache_oid("hrStorageEntry", $device, array(), "HOST-RESOURCES-MIB:HOST-RESOURCES-TYPES");

View File

@@ -9,7 +9,7 @@ while($temperature = mysql_fetch_array($temp_data)) {
for ($i = 0;$i < 5;$i++) # Try 5 times to get a valid temp reading
{
if ($debug) echo "Attempt $i ";
$temp_cmd = $config['snmpget'] . " -m SNMPv2-MIB -O Uqnv -" . $device['snmpver'] . " -c " . $device['community'] . " " . $device['hostname'].":".$device['port'] . " " . $temperature['sensor_oid'] . "|grep -v \"No Such Instance\"";
$temp_cmd = $config['snmpget'] . " -M ".$config['mibdir'] . " -m SNMPv2-MIB -O Uqnv -" . $device['snmpver'] . " -c " . $device['community'] . " " . $device['hostname'].":".$device['port'] . " " . $temperature['sensor_oid'] . "|grep -v \"No Such Instance\"";
$temp = trim(str_replace("\"", "", shell_exec($temp_cmd)));
if ($temp != 9999) break; # TME sometimes sends 999.9 when it is right in the middle of an update;

View File

@@ -9,7 +9,7 @@ if ($config['enable_printers'])
{
echo("Checking toner " . $toner['toner_descr'] . "... ");
$toner_cmd = $config['snmpget'] . " -O Uqnv -" . $device['snmpver'] . " -c " . $device['community'] . " " . $device['hostname'].":".$device['port'] . " " . $toner['toner_oid'] . "|grep -v \"No Such Instance\"";
$toner_cmd = $config['snmpget'] . " -M ".$config['mibdir'] . " -O Uqnv -" . $device['snmpver'] . " -c " . $device['community'] . " " . $device['hostname'].":".$device['port'] . " " . $toner['toner_oid'] . "|grep -v \"No Such Instance\"";
$tonerperc = trim(str_replace("\"", "", shell_exec($toner_cmd)));
$tonerperc = $tonerperc / $toner['toner_capacity'] * 100;

View File

@@ -57,6 +57,8 @@ if(mysql_affected_rows()) {
}
echo("\n");
}
unset($diskio_data);

View File

@@ -12,7 +12,7 @@ $oid_ssCpuRawIdle = ".1.3.6.1.4.1.2021.11.53.0";
$oid_ssCpuUser = ".1.3.6.1.4.1.2021.11.9.0";
$oid_ssCpuSystem = ".1.3.6.1.4.1.2021.11.10.0";
$cpu_cmd = $config['snmpget'] ." -m UCD-SNMP-MIB -O qv -" . $device['snmpver'] . " -c " . $device['community'] . " " . $device['hostname'].":".$device['port'];
$cpu_cmd = $config['snmpget'] . " -M ".$config['mibdir']." -m UCD-SNMP-MIB -O qv -" . $device['snmpver'] . " -c " . $device['community'] . " " . $device['hostname'].":".$device['port'];
$cpu_cmd .= " $oid_ssCpuRawUser $oid_ssCpuRawSystem $oid_ssCpuRawNice $oid_ssCpuRawIdle $oid_ssCpuUser $oid_ssCpuSystem";
$cpu = `$cpu_cmd`;
list ($cpuUser, $cpuSystem, $cpuNice, $cpuIdle, $UsageUser, $UsageSystem) = explode("\n", $cpu);
@@ -77,14 +77,14 @@ rrdtool_update($cpurrd, "N:".($cpuUser+0).":".($cpuSystem+0).":".($cpuNice+0)."
RRA:MAX:0.5:288:800");
} // end create load rrd
$mem_cmd = $config['snmpget'] . " -m UCD-SNMP-MIB -O qv -" . $device['snmpver'] . " -c " . $device['community'] . " " . $device['hostname'].":".$device['port'];
$mem_cmd = $config['snmpget'] . " -M ".$config['mibdir']. " -m UCD-SNMP-MIB -O qv -" . $device['snmpver'] . " -c " . $device['community'] . " " . $device['hostname'].":".$device['port'];
$mem_cmd .= " memTotalSwap.0 memAvailSwap.0 memTotalReal.0 memAvailReal.0 memTotalFree.0 memShared.0 memBuffer.0 memCached.0";
$mem_raw = shell_exec($mem_cmd);
list($memTotalSwap, $memAvailSwap, $memTotalReal, $memAvailReal, $memTotalFree, $memShared, $memBuffer, $memCached) = explode("\n", str_replace(" kB", "", $mem_raw));
$load_get = "laLoadInt.1 laLoadInt.2 laLoadInt.3";
$load_cmd = "snmpget -m UCD-SNMP-MIB -O qv -" . $device['snmpver'] . " -c " . $device['community'] . " " . $device['hostname'].":".$device['port'] . " " . $load_get;
$load_cmd = $config['snmpget']. " -M ".$config['mibdir']." -m UCD-SNMP-MIB -O qv -" . $device['snmpver'] . " -c " . $device['community'] . " " . $device['hostname'].":".$device['port'] . " " . $load_get;
$load_raw = `$load_cmd`;
list ($load1, $load5, $load10) = explode ("\n", $load_raw);

View File

@@ -6,8 +6,10 @@ while($voltage = mysql_fetch_array($volt_data)) {
echo("Checking voltage " . $voltage['volt_descr'] . "... ");
$volt_cmd = $config['snmpget'] . " -m SNMPv2-MIB -O Uqnv -" . $device['snmpver'] . " -c " . $device['community'] . " " . $device['hostname'].":".$device['port'] . " " . $voltage['volt_oid'] . "|grep -v \"No Such Instance\"";
$volt = trim(str_replace("\"", "", shell_exec($volt_cmd)));
#$volt_cmd = $config['snmpget'] . " -M ".$config['mibdir'] . " -m SNMPv2-MIB -O Uqnv -" . $device['snmpver'] . " -c " . $device['community'] . " " . $device['hostname'].":".$device['port'] . " " . $voltage['volt_oid'] . "|grep -v \"No Such Instance\"";
#$volt = trim(str_replace("\"", "", shell_exec($volt_cmd)));
$volt = snmp_get($device, $voltage['volt_oid'], "SNMPv2-MIB");
if ($voltage['volt_precision'])
{

View File

@@ -12,7 +12,7 @@ function snmp_get ($device, $oid, $options = NULL, $mib = NULL, $mibdir = NULL)
$cmd = $config['snmpget'] . " -" . $device['snmpver'] . " -c " . $device['community'] . " " . $device['hostname'].":".$device['port'];
if($options) { $cmd .= " " . $options; }
if($mib) { $cmd .= " -m " . $mib; }
if($mibdir) { $cmd .= " -M " . $mibdir; }
if($mibdir) { $cmd .= " -M " . $mibdir; } else { $cmd .= " -M ".$config['mibdir']; }
$cmd .= " -t " . $config['snmp']['timeout'] . " -r " . $config['snmp']['retries'];
$cmd .= " ".$oid;
if($debug) { echo("$cmd\n"); }
@@ -37,7 +37,7 @@ function snmp_walk($device, $oid, $options = NULL, $mib = NULL, $mibdir = NULL)
$cmd = $snmpcommand . " -" . $device['snmpver'] . " -c " . $device['community'] . " " . $device['hostname'].":".$device['port'];
if($options) { $cmd .= " $options "; }
if($mib) { $cmd .= " -m $mib"; }
if($mibdir) { $cmd .= " -M " . $mibdir; }
if($mibdir) { $cmd .= " -M " . $mibdir; } else { $cmd .= " -M ".$config['mibdir']; }
$cmd .= " -t " . $config['snmp']['timeout'] . " -r " . $config['snmp']['retries'];
$cmd .= " ".$oid;
if($debug) { echo("$cmd\n"); }
@@ -61,6 +61,7 @@ function snmp_cache_cip($oid, $device, $array, $mib = 0)
}
$cmd = $snmpcommand . " -O snQ -" . $device['snmpver'] . " -c " . $device['community'] . " " . $device['hostname'].":".$device['port'];
if($mib) { $cmd .= " -m $mib"; }
$cmd .= " -M ".$config['install_dir']."/mibs/";
$cmd .= " -t " . $config['snmp']['timeout'] . " -r " . $config['snmp']['retries'];
$cmd .= " ".$oid;
$data = trim(shell_exec($cmd));
@@ -98,6 +99,7 @@ function snmp_cache_ifIndex($device) {
$snmpcommand = $config['snmpbulkwalk'];
}
$cmd = $snmpcommand . " -O Qs -" . $device['snmpver'] . " -c " . $device['community'] . " " . $device['hostname'].":".$device['port'];
$cmd .= " -M ".$config['install_dir']."/mibs/";
$cmd .= " -m IF-MIB ifIndex";
$cmd .= " -t " . $config['snmp']['timeout'] . " -r " . $config['snmp']['retries'];
$data = trim(shell_exec($cmd));
@@ -192,6 +194,7 @@ function snmpwalk_cache_twopart_oid($oid, $device, $array, $mib = 0) {
$snmpcommand = $config['snmpbulkwalk'];
}
$cmd = $snmpcommand . " -O QUs -" . $device['snmpver'] . " -c " . $device['community'] . " " . $device['hostname'].":".$device['port'];
$cmd .= " -M ".$config['install_dir']."/mibs/";
if($mib) { $cmd .= " -m $mib"; }
$cmd .= " -t " . $config['snmp']['timeout'] . " -r " . $config['snmp']['retries'];
$cmd .= " ".$oid;
@@ -219,6 +222,7 @@ function snmpwalk_cache_threepart_oid($oid, $device, $array, $mib = 0) {
$snmpcommand = $config['snmpbulkwalk'];
}
$cmd = $snmpcommand . " -O QUs -" . $device['snmpver'] . " -c " . $device['community'] . " " . $device['hostname'].":".$device['port'];
$cmd .= " -M ".$config['install_dir']."/mibs/";
if($mib) { $cmd .= " -m $mib"; }
$cmd .= " -t " . $config['snmp']['timeout'] . " -r " . $config['snmp']['retries'];
$cmd .= " ".$oid;
@@ -248,6 +252,7 @@ function snmp_cache_slotport_oid($oid, $device, $array, $mib = 0) {
}
$cmd = $snmpcommand . " -O QUs -" . $device['snmpver'] . " -c " . $device['community'] . " " . $device['hostname'].":".$device['port'];
if($mib) { $cmd .= " -m $mib"; }
$cmd .= " -M ".$config['install_dir']."/mibs/";
$cmd .= " -t " . $config['snmp']['timeout'] . " -r " . $config['snmp']['retries'];
$cmd .= " ".$oid;
$data = trim(shell_exec($cmd));
@@ -278,6 +283,7 @@ function snmp_cache_oid($oid, $device, $array, $mib = 0) {
}
$cmd = $snmpcommand . " -O UQs -" . $device['snmpver'] . " -c " . $device['community'] . " " . $device['hostname'].":".$device['port'];
if($mib) { $cmd .= " -m $mib"; }
$cmd .= " -M ".$config['install_dir']."/mibs/";
$cmd .= " -t " . $config['snmp']['timeout'] . " -r " . $config['snmp']['retries'];
$cmd .= " ".$oid;
$data = trim(shell_exec($cmd));
@@ -303,6 +309,7 @@ function snmp_cache_port_oids($oids, $port, $device, $array, $mib=0) {
$string .= " $oid.$port";
}
$cmd = $config['snmpget'] . " -O vq -" . $device['snmpver'] . " -c " . $device['community'] . " " . $device['hostname'].":".$device['port'];
$cmd .= " -M ".$config['install_dir']."/mibs/";
if($mib) { $cmd .= " -m $mib"; }
$cmd .= " -t " . $config['snmp']['timeout'] . " -r " . $config['snmp']['retries'];
$cmd .= " ".$string;
@@ -322,6 +329,7 @@ function snmp_cache_port_oids($oids, $port, $device, $array, $mib=0) {
function snmp_cache_portIfIndex ($device, $array) {
global $config;
$cmd = $config['snmpwalk'] . " -CI -m CISCO-STACK-MIB -O q -" . $device['snmpver'] . " -c " . $device['community'] . " " . $device['hostname'].":".$device['port'];
$cmd .= " -M ".$config['install_dir']."/mibs/";
$cmd .= " -t " . $config['snmp']['timeout'] . " -r " . $config['snmp']['retries'];
$cmd .= " portIfIndex";
$output = trim(shell_exec($cmd));
@@ -340,6 +348,7 @@ function snmp_cache_portIfIndex ($device, $array) {
function snmp_cache_portName ($device, $array) {
global $config;
$cmd = $config['snmpwalk'] . " -CI -m CISCO-STACK-MIB -O Qs -" . $device['snmpver'] . " -c " . $device['community'] . " " . $device['hostname'].":".$device['port'];
$cmd .= " -M ".$config['install_dir']."/mibs/";
$cmd .= " -t " . $config['snmp']['timeout'] . " -r " . $config['snmp']['retries'];
$cmd .= " portName";
$output = trim(shell_exec($cmd));

View File

@@ -191,6 +191,11 @@ $config['version'] = "0.10";
$config['rrd_opts_array'] = explode(" ", trim($config['rrdgraph_def_text']));
if(!$config['mibdir'])
{
$config['mibdir'] = $config['install_dir']."/mibs/";
}
if(isset($config['enable_nagios']) && $config['enable_nagios']) {
$nagios_link = mysql_connect($config['nagios_db_host'], $config['nagios_db_user'], $config['nagios_db_pass']);
if (!$nagios_link) {