syntaxer run

git-svn-id: http://www.observium.org/svn/observer/trunk@2964 61d68cd4-352d-0410-923a-c4978735b2b8
This commit is contained in:
Tom Laermans
2012-04-05 16:17:41 +00:00
parent 04ec17134b
commit ed6ffa6067
17 changed files with 56 additions and 77 deletions

View File

@@ -2,14 +2,14 @@
## Common Functions ## Common Functions
function format_number_short($number, $sf) function format_number_short($number, $sf)
{ {
// This formats a number so that we only send back three digits plus an optional decimal point. // This formats a number so that we only send back three digits plus an optional decimal point.
// Example: 723.42 -> 723 72.34 -> 72.3 2.23 -> 2.23 // Example: 723.42 -> 723 72.34 -> 72.3 2.23 -> 2.23
list($whole, $decimal) = explode (".", $number); list($whole, $decimal) = explode (".", $number);
if(strlen($whole) >= $sf || !is_numeric($decimal)) if (strlen($whole) >= $sf || !is_numeric($decimal))
{ {
$number = $whole; $number = $whole;
} elseif(strlen($whole) < $sf) { } elseif(strlen($whole) < $sf) {
@@ -460,7 +460,7 @@ function formatStorage($value, $round = '2', $sf = '3')
function format_si($value, $round = '2', $sf = '3') function format_si($value, $round = '2', $sf = '3')
{ {
if($value < "0") if ($value < "0")
{ {
$neg = 1; $neg = 1;
$value = $value * -1; $value = $value * -1;
@@ -479,14 +479,14 @@ function format_si($value, $round = '2', $sf = '3')
for ($i = 1; (($i < count($sizes)) && ($value != 0) && ($value <= 0.1)); $i++) { $value = $value * 1000; $ext = $sizes[$i]; } for ($i = 1; (($i < count($sizes)) && ($value != 0) && ($value <= 0.1)); $i++) { $value = $value * 1000; $ext = $sizes[$i]; }
} }
if($neg) { $value = $value * -1; } if ($neg) { $value = $value * -1; }
return format_number_short(round($value, $round),$sf).$ext; return format_number_short(round($value, $round),$sf).$ext;
} }
function format_bi($value, $round = '2', $sf = '3') function format_bi($value, $round = '2', $sf = '3')
{ {
if($value < "0") if ($value < "0")
{ {
$neg = 1; $neg = 1;
$value = $value * -1; $value = $value * -1;
@@ -495,14 +495,14 @@ function format_bi($value, $round = '2', $sf = '3')
$ext = $sizes[0]; $ext = $sizes[0];
for ($i = 1; (($i < count($sizes)) && ($value >= 1024)); $i++) { $value = $value / 1024; $ext = $sizes[$i]; } for ($i = 1; (($i < count($sizes)) && ($value >= 1024)); $i++) { $value = $value / 1024; $ext = $sizes[$i]; }
if($neg) { $value = $value * -1; } if ($neg) { $value = $value * -1; }
return format_number_short(round($value, $round), $sf).$ext; return format_number_short(round($value, $round), $sf).$ext;
} }
function format_number($value, $base = '1000', $round=2, $sf=3) function format_number($value, $base = '1000', $round=2, $sf=3)
{ {
if($base == '1000') if ($base == '1000')
{ {
return format_si($value, $round, $sf); return format_si($value, $round, $sf);
} else { } else {

View File

@@ -21,7 +21,7 @@ foreach (explode("\n", $ipNetToMedia_data) as $data)
$m_a = zeropad($m_a);$m_b = zeropad($m_b);$m_c = zeropad($m_c);$m_d = zeropad($m_d);$m_e = zeropad($m_e);$m_f = zeropad($m_f); $m_a = zeropad($m_a);$m_b = zeropad($m_b);$m_c = zeropad($m_c);$m_d = zeropad($m_d);$m_e = zeropad($m_e);$m_f = zeropad($m_f);
$md_a = hexdec($m_a);$md_b = hexdec($m_b);$md_c = hexdec($m_c);$md_d = hexdec($m_d);$md_e = hexdec($m_e);$md_f = hexdec($m_f); $md_a = hexdec($m_a);$md_b = hexdec($m_b);$md_c = hexdec($m_c);$md_d = hexdec($m_d);$md_e = hexdec($m_e);$md_f = hexdec($m_f);
$mac = "$m_a:$m_b:$m_c:$m_d:$m_e:$m_f"; $mac = "$m_a:$m_b:$m_c:$m_d:$m_e:$m_f";
$mac_table[$if][$mac]['ip'] = $ip; $mac_table[$if][$mac]['ip'] = $ip;
$mac_table[$if][$mac]['ciscomac'] = "$m_a$m_b.$m_c$m_d.$m_e$m_f"; $mac_table[$if][$mac]['ciscomac'] = "$m_a$m_b.$m_c$m_d.$m_e$m_f";
$clean_mac = $m_a . $m_b . $m_c . $m_d . $m_e . $m_f; $clean_mac = $m_a . $m_b . $m_c . $m_d . $m_e . $m_f;

View File

@@ -7,20 +7,19 @@ if ($config['enable_vrfs'])
unset($vrf_count); unset($vrf_count);
echo("VRFs : "); echo("VRFs : ");
/* /*
There are 2 MIBs for VPNs : MPLS-VPN-MIB (oldest) and MPLS-L3VPN-STD-MIB (newest) There are 2 MIBs for VPNs : MPLS-VPN-MIB (oldest) and MPLS-L3VPN-STD-MIB (newest)
Unfortunately, there is no simple way to find out which one to use, unless we reference Unfortunately, there is no simple way to find out which one to use, unless we reference
all the possible devices and check what they support. all the possible devices and check what they support.
Therefore we start testing the MPLS-L3VPN-STD-MIB that is prefered if available. Therefore we start testing the MPLS-L3VPN-STD-MIB that is prefered if available.
*/ */
// Grab all the info first, then use it in the code. // Grab all the info first, then use it in the code.
// It removes load on the device and makes things much faster // It removes load on the device and makes things much faster
$rds = snmp_walk($device, "mplsL3VpnVrfRD", "-Osqn", "MPLS-L3VPN-STD-MIB", NULL); $rds = snmp_walk($device, "mplsL3VpnVrfRD", "-Osqn", "MPLS-L3VPN-STD-MIB", NULL);
if (empty($rds)) if (empty($rds))
{ {
$rds = snmp_walk($device, "mplsVpnVrfRouteDistinguisher", "-Osqn", "MPLS-VPN-MIB", NULL); $rds = snmp_walk($device, "mplsVpnVrfRouteDistinguisher", "-Osqn", "MPLS-VPN-MIB", NULL);
@@ -34,13 +33,13 @@ if ($config['enable_vrfs'])
{ {
$vpnmib = "MPLS-L3VPN-STD-MIB"; $vpnmib = "MPLS-L3VPN-STD-MIB";
$rds = str_replace(".1.3.6.1.2.1.10.166.11.1.2.2.1.4.", "", $rds); $rds = str_replace(".1.3.6.1.2.1.10.166.11.1.2.2.1.4.", "", $rds);
$descrs_oid = ".1.3.6.1.2.1.10.166.11.1.2.2.1.3"; $descrs_oid = ".1.3.6.1.2.1.10.166.11.1.2.2.1.3";
$ports_oid = ".1.3.6.1.2.1.10.166.11.1.2.1.1.2"; $ports_oid = ".1.3.6.1.2.1.10.166.11.1.2.1.1.2";
} }
if ($debug) if ($debug)
{ {
echo("\n[DEBUG]\nUsing $vpnmib\n[/DEBUG]\n"); echo("\n[DEBUG]\nUsing $vpnmib\n[/DEBUG]\n");
echo("\n[DEBUG OIDS]\n$rds\n[/DEBUG]\n"); echo("\n[DEBUG OIDS]\n$rds\n[/DEBUG]\n");
} }
@@ -48,7 +47,7 @@ if ($config['enable_vrfs'])
$descrs = snmp_walk($device, $descrs_oid, "-Osqn", $vpnmib, NULL); $descrs = snmp_walk($device, $descrs_oid, "-Osqn", $vpnmib, NULL);
$ports = snmp_walk($device, $ports_oid, "-Osqn", $vpnmib, NULL); $ports = snmp_walk($device, $ports_oid, "-Osqn", $vpnmib, NULL);
$descrs = trim(str_replace("$descrs_oid.", "", $descrs)); $descrs = trim(str_replace("$descrs_oid.", "", $descrs));
$ports = trim(str_replace("$ports_oid.", "", $ports)); $ports = trim(str_replace("$ports_oid.", "", $ports));

View File

@@ -40,6 +40,7 @@ if ($device['os'] == "apc")
{ {
$descr = "Output"; $descr = "Output";
} }
discover_sensor($valid['sensor'], 'current', $device, $current_oid, $index, $type, $descr, '10', '1', $lowlimit, NULL, $warnlimit, $limit, $current); discover_sensor($valid['sensor'], 'current', $device, $current_oid, $index, $type, $descr, '10', '1', $lowlimit, NULL, $warnlimit, $limit, $current);
} }
} }
@@ -83,11 +84,11 @@ if ($device['os'] == "apc")
if ($index == "1") { $descr = "Bank Total"; } if ($index == "1") { $descr = "Bank Total"; }
} }
$current_oid = "1.3.6.1.4.1.318.1.1.12.2.3.1.1.2.".$index; #rPDULoadStatusLoad $current_oid = "1.3.6.1.4.1.318.1.1.12.2.3.1.1.2.".$index; #rPDULoadStatusLoad
$bank_oid = "1.3.6.1.4.1.318.1.1.12.2.3.1.1.5.".$index; #rPDULoadStatusBankNumber $bank_oid = "1.3.6.1.4.1.318.1.1.12.2.3.1.1.5.".$index; #rPDULoadStatusBankNumber
$limit_oid = "1.3.6.1.4.1.318.1.1.12.2.4.1.1.4.".$index; #rPDULoadBankConfigOverloadThreshold $limit_oid = "1.3.6.1.4.1.318.1.1.12.2.4.1.1.4.".$index; #rPDULoadBankConfigOverloadThreshold
$lowlimit_oid = "1.3.6.1.4.1.318.1.1.12.2.4.1.1.2.".$index; #rPDULoadBankConfigLowLoadThreshold $lowlimit_oid = "1.3.6.1.4.1.318.1.1.12.2.4.1.1.2.".$index; #rPDULoadBankConfigLowLoadThreshold
$warnlimit_oid = "1.3.6.1.4.1.318.1.1.12.2.4.1.1.3.".$index; #rPDULoadBankConfigNearOverloadThreshold $warnlimit_oid = "1.3.6.1.4.1.318.1.1.12.2.4.1.1.3.".$index; #rPDULoadBankConfigNearOverloadThreshold
$bank = snmp_get($device, $bank_oid, "-Oqv", ""); $bank = snmp_get($device, $bank_oid, "-Oqv", "");
$current = snmp_get($device, $current_oid, "-Oqv", "") / $precision; $current = snmp_get($device, $current_oid, "-Oqv", "") / $precision;
@@ -124,35 +125,28 @@ if ($device['os'] == "apc")
$index = $split_oid[count($split_oid)-1]; $index = $split_oid[count($split_oid)-1];
$voltage_oid = "1.3.6.1.4.1.318.1.1.26.6.3.1.6"; #rPDU2PhaseStatusVoltage $voltage_oid = "1.3.6.1.4.1.318.1.1.26.6.3.1.6"; #rPDU2PhaseStatusVoltage
$current_oid = "1.3.6.1.4.1.318.1.1.26.9.4.3.1.6.".$index; #rPDU2OutletMeteredStatusCurrent $current_oid = "1.3.6.1.4.1.318.1.1.26.9.4.3.1.6.".$index; #rPDU2OutletMeteredStatusCurrent
$limit_oid = "1.3.6.1.4.1.318.1.1.26.9.4.1.1.7.".$index; # rPDU2OutletMeteredConfigOverloadCurrentThreshold $limit_oid = "1.3.6.1.4.1.318.1.1.26.9.4.1.1.7.".$index; #rPDU2OutletMeteredConfigOverloadCurrentThreshold
$lowlimit_oid = "1.3.6.1.4.1.318.1.1.26.9.4.1.1.7.".$index; #rPDU2OutletMeteredConfigLowLoadCurrentThreshold $lowlimit_oid = "1.3.6.1.4.1.318.1.1.26.9.4.1.1.7.".$index; #rPDU2OutletMeteredConfigLowLoadCurrentThreshold
$warnlimit_oid = "1.3.6.1.4.1.318.1.1.26.9.4.1.1.6.".$index; #rPDU2OutletMeteredConfigNearOverloadCurrentThreshold $warnlimit_oid = "1.3.6.1.4.1.318.1.1.26.9.4.1.1.6.".$index; #rPDU2OutletMeteredConfigNearOverloadCurrentThreshold
$name_oid = "1.3.6.1.4.1.318.1.1.26.9.4.3.1.3.".$index; #rPDU2OutletMeteredStatusName $name_oid = "1.3.6.1.4.1.318.1.1.26.9.4.3.1.3.".$index; #rPDU2OutletMeteredStatusName
$voltage = snmp_get($device, $voltage_oid, "-Oqv", "");
$voltage = snmp_get($device, $voltage_oid, "-Oqv", "");
$current = snmp_get($device, $current_oid, "-Oqv", "") / $precision; $current = snmp_get($device, $current_oid, "-Oqv", "") / $precision;
$limit = snmp_get($device, $limit_oid, "-Oqv", "") / $voltage; $limit = snmp_get($device, $limit_oid, "-Oqv", "") / $voltage;
$lowlimit = snmp_get($device, $lowlimit_oid, "-Oqv", "") / $voltage; $lowlimit = snmp_get($device, $lowlimit_oid, "-Oqv", "") / $voltage;
$warnlimit = snmp_get($device, $warnlimit_oid, "-Oqv", "") / $voltage; $warnlimit = snmp_get($device, $warnlimit_oid, "-Oqv", "") / $voltage;
$descr = "Outlet " . $index . " - " . snmp_get($device, $name_oid, "-Oqv", ""); $descr = "Outlet " . $index . " - " . snmp_get($device, $name_oid, "-Oqv", "");
discover_sensor($valid['sensor'], 'current', $device, $current_oid, $index, $type, $descr, '10', '1', $lowlimit, NULL, $warnlimit, $limit, $current); discover_sensor($valid['sensor'], 'current', $device, $current_oid, $index, $type, $descr, '10', '1', $lowlimit, NULL, $warnlimit, $limit, $current);
} }
} }
} }
unset($oids);
unset($oids);
# ATS # ATS
$oids = snmp_walk($device, "atsConfigPhaseTableIndex", "-OsqnU", "PowerNet-MIB"); $oids = snmp_walk($device, "atsConfigPhaseTableIndex", "-OsqnU", "PowerNet-MIB");
@@ -162,16 +156,16 @@ if ($device['os'] == "apc")
if ($debug) { print_r($oids); } if ($debug) { print_r($oids); }
$oids = trim($oids); $oids = trim($oids);
if ($oids) echo("APC PowerNet-MIB ATS "); if ($oids) echo("APC PowerNet-MIB ATS ");
$current_oid = "1.3.6.1.4.1.318.1.1.8.5.4.3.1.4.1.1.1"; #atsOutputCurrent $current_oid = "1.3.6.1.4.1.318.1.1.8.5.4.3.1.4.1.1.1"; #atsOutputCurrent
$limit_oid = "1.3.6.1.4.1.318.1.1.8.4.16.1.5.1"; #atsConfigPhaseOverLoadThreshold $limit_oid = "1.3.6.1.4.1.318.1.1.8.4.16.1.5.1"; #atsConfigPhaseOverLoadThreshold
$lowlimit_oid = "1.3.6.1.4.1.318.1.1.8.4.16.1.3.1"; #atsConfigPhaseLowLoadThreshold $lowlimit_oid = "1.3.6.1.4.1.318.1.1.8.4.16.1.3.1"; #atsConfigPhaseLowLoadThreshold
$warnlimit_oid = "1.3.6.1.4.1.318.1.1.8.4.16.1.4.1"; #atsConfigPhaseNearOverLoadThreshold $warnlimit_oid = "1.3.6.1.4.1.318.1.1.8.4.16.1.4.1"; #atsConfigPhaseNearOverLoadThreshold
$index = 1; $index = 1;
$current = snmp_get($device, $current_oid, "-Oqv", "") / $precision; $current = snmp_get($device, $current_oid, "-Oqv", "") / $precision;
$limit = snmp_get($device, $limit_oid, "-Oqv", ""); # No / $precision here! Nice, APC! $limit = snmp_get($device, $limit_oid, "-Oqv", ""); # No / $precision here! Nice, APC!
$lowlimit = snmp_get($device, $lowlimit_oid, "-Oqv", ""); # No / $precision here! Nice, APC! $lowlimit = snmp_get($device, $lowlimit_oid, "-Oqv", ""); # No / $precision here! Nice, APC!
$warnlimit = snmp_get($device, $warnlimit_oid, "-Oqv", ""); # No / $precision here! Nice, APC! $warnlimit = snmp_get($device, $warnlimit_oid, "-Oqv", ""); # No / $precision here! Nice, APC!
$descr = "Output Feed"; $descr = "Output Feed";
discover_sensor($valid['sensor'], 'current', $device, $current_oid, $index, $type, $descr, '10', '1', $lowlimit, NULL, $warnlimit, $limit, $current); discover_sensor($valid['sensor'], 'current', $device, $current_oid, $index, $type, $descr, '10', '1', $lowlimit, NULL, $warnlimit, $limit, $current);

View File

@@ -31,8 +31,7 @@ $entitysensor['hertz'] = "freq";
$entitysensor['percentRH'] = "humidity"; $entitysensor['percentRH'] = "humidity";
$entitysensor['rpm'] = "fanspeed"; $entitysensor['rpm'] = "fanspeed";
$entitysensor['celsius'] = "temperature"; $entitysensor['celsius'] = "temperature";
$entitysensor['dBm'] = "dbm"; $entitysensor['dBm'] = "dbm";
if (is_array($oids)) if (is_array($oids))
{ {

View File

@@ -16,7 +16,7 @@ if ($device['os'] == "junos")
{ {
if ($entry['jnxOperatingDRAMSize'] || $entry['jnxOperatingMemory']) if ($entry['jnxOperatingDRAMSize'] || $entry['jnxOperatingMemory'])
{ {
if (stripos($entry['jnxOperatingDescr'], "sensor") || stripos($entry['jnxOperatingDescr'], "fan")) continue; if (stripos($entry['jnxOperatingDescr'], "sensor") || stripos($entry['jnxOperatingDescr'], "fan")) continue;
if ($debug) { echo($index . " " . $entry['jnxOperatingDescr'] . " -> " . $entry['jnxOperatingBuffer'] . " -> " . $entry['jnxOperatingDRAMSize'] . "\n"); } if ($debug) { echo($index . " " . $entry['jnxOperatingDescr'] . " -> " . $entry['jnxOperatingBuffer'] . " -> " . $entry['jnxOperatingDRAMSize'] . "\n"); }
$usage_oid = ".1.3.6.1.4.1.2636.3.1.13.1.8." . $index; $usage_oid = ".1.3.6.1.4.1.2636.3.1.13.1.8." . $index;
$descr = $entry['jnxOperatingDescr']; $descr = $entry['jnxOperatingDescr'];

View File

@@ -20,7 +20,6 @@ if ($device['os'] == "ipoman")
# $oids_in = array(); # $oids_in = array();
$oids_out = array(); $oids_out = array();
# echo("inletStatusWH "); # echo("inletStatusWH ");
# $oids_in = snmpwalk_cache_multi_oid($device, "inletStatusWH", $oids_in, "IPOMANII-MIB"); # $oids_in = snmpwalk_cache_multi_oid($device, "inletStatusWH", $oids_in, "IPOMANII-MIB");
echo("outletStatusWH "); echo("outletStatusWH ");
@@ -77,7 +76,6 @@ if ($device['os'] == "ipoman")
# $oids_in = array(); # $oids_in = array();
$oids_out = array(); $oids_out = array();
# echo("inletStatusWH "); # echo("inletStatusWH ");
# $oids_in = snmpwalk_cache_multi_oid($device, "inletStatusWH", $oids_in, "IPOMANII-MIB"); # $oids_in = snmpwalk_cache_multi_oid($device, "inletStatusWH", $oids_in, "IPOMANII-MIB");
echo("outletStatusWH "); echo("outletStatusWH ");

View File

@@ -4,7 +4,6 @@
#NS-ROOT-MIB::nsCPUname."cpu0" = STRING: "cpu0" #NS-ROOT-MIB::nsCPUname."cpu0" = STRING: "cpu0"
#NS-ROOT-MIB::nsCPUusage."cpu0" = Gauge32: 0 #NS-ROOT-MIB::nsCPUusage."cpu0" = Gauge32: 0
if($device['os'] == "netscaler") if($device['os'] == "netscaler")
{ {
echo(" NetScaler "); echo(" NetScaler ");
@@ -18,7 +17,7 @@ if($device['os'] == "netscaler")
$nsarray = snmpwalk_cache_multi_oid($device, "nsCPUTable", $nsarray, "NS-ROOT-MIB"); $nsarray = snmpwalk_cache_multi_oid($device, "nsCPUTable", $nsarray, "NS-ROOT-MIB");
} }
foreach($nsarray as $descr => $data) foreach ($nsarray as $descr => $data)
{ {
$current = $data['nsCPUusage']; $current = $data['nsCPUusage'];

View File

@@ -11,7 +11,7 @@ if ($vlanversion == 'version1')
$vlans = snmp_walk($device, "dot1qVlanFdbId", "-Oqn", "Q-BRIDGE-MIB"); $vlans = snmp_walk($device, "dot1qVlanFdbId", "-Oqn", "Q-BRIDGE-MIB");
$vlan_array = snmpwalk_cache_multi_oid($device, "dot1qVlanStaticName", $vlan_array, "Q-BRIDGE-MIB"); $vlan_array = snmpwalk_cache_multi_oid($device, "dot1qVlanStaticName", $vlan_array, "Q-BRIDGE-MIB");
foreach (explode("\n", $vlans) as $vlan_oid) foreach (explode("\n", $vlans) as $vlan_oid)
{ {
list($oid,$vlan_index) = explode(' ',$vlan_oid); list($oid,$vlan_index) = explode(' ',$vlan_oid);

View File

@@ -1,6 +1,5 @@
<?php <?php
echo(" NetScaler "); echo(" NetScaler ");
echo(" Caching OIDs:"); echo(" Caching OIDs:");
@@ -12,7 +11,7 @@ if (!is_array($ns_sensor_array))
$ns_sensor_array = snmpwalk_cache_multi_oid($device, "sysHealthCounterValue", $ns_sensor_array, "NS-ROOT-MIB"); $ns_sensor_array = snmpwalk_cache_multi_oid($device, "sysHealthCounterValue", $ns_sensor_array, "NS-ROOT-MIB");
} }
foreach($ns_sensor_array as $descr => $data) foreach ($ns_sensor_array as $descr => $data)
{ {
$current = $data['sysHealthCounterValue']; $current = $data['sysHealthCounterValue'];
@@ -24,13 +23,12 @@ foreach($ns_sensor_array as $descr => $data)
elseif (strpos($descr, "Volt") !== FALSE) { $divisor = 1000; $multiplier = 0; $type = "voltage"; } elseif (strpos($descr, "Volt") !== FALSE) { $divisor = 1000; $multiplier = 0; $type = "voltage"; }
elseif (strpos($descr, "Vtt") !== FALSE) { $divisor = 1000; $multiplier = 0; $type = "voltage"; } elseif (strpos($descr, "Vtt") !== FALSE) { $divisor = 1000; $multiplier = 0; $type = "voltage"; }
if($divisor) { $current = $current / $divisor; }; if ($divisor) { $current = $current / $divisor; };
discover_sensor($valid['sensor'], $type, $device, $oid, $descr, 'netscaler-health', $descr, $divisor, $multiplier, NULL, NULL, NULL, NULL, $current); discover_sensor($valid['sensor'], $type, $device, $oid, $descr, 'netscaler-health', $descr, $divisor, $multiplier, NULL, NULL, NULL, NULL, $current);
} }
unset($ns_sensor_array); unset($ns_sensor_array);
?> ?>

View File

@@ -8,7 +8,7 @@ include("includes/discovery/cisco-entity-sensor.inc.php");
include("includes/discovery/entity-sensor.inc.php"); include("includes/discovery/entity-sensor.inc.php");
include("includes/discovery/ipmi.inc.php"); include("includes/discovery/ipmi.inc.php");
if($device['os'] == "netscaler"){ include("includes/discovery/sensors-netscaler.inc.php"); } if($device['os'] == "netscaler") { include("includes/discovery/sensors-netscaler.inc.php"); }
include("includes/discovery/temperatures.inc.php"); include("includes/discovery/temperatures.inc.php");
include("includes/discovery/humidity.inc.php"); include("includes/discovery/humidity.inc.php");

View File

@@ -4,7 +4,7 @@ if ($device['os'] == "powerconnect")
{ {
$temps = snmp_walk($device, "boxServicesTempSensorTemperature", "-OsqnU", "FASTPATH-BOXSERVICES-PRIVATE-MIB"); $temps = snmp_walk($device, "boxServicesTempSensorTemperature", "-OsqnU", "FASTPATH-BOXSERVICES-PRIVATE-MIB");
if ($debug) { echo($temps."\n"); } if ($debug) { echo($temps."\n"); }
$index = 0; $index = 0;
foreach (explode("\n",$temps) as $oids) foreach (explode("\n",$temps) as $oids)
{ {

View File

@@ -7,17 +7,17 @@ $this_vlans = array();
include("includes/discovery/q-bridge-mib.inc.php"); include("includes/discovery/q-bridge-mib.inc.php");
include("includes/discovery/cisco-vlans.inc.php"); include("includes/discovery/cisco-vlans.inc.php");
foreach($this_vlans as $vlan) foreach ($this_vlans as $vlan)
{ {
/// Pull Tables for this VLAN /// Pull Tables for this VLAN
#/usr/bin/snmpbulkwalk -v2c -c kglk5g3l454@988 -OQUs -m BRIDGE-MIB -M /opt/observium/mibs/ udp:sw2.ahf:161 dot1dStpPortEntry #/usr/bin/snmpbulkwalk -v2c -c kglk5g3l454@988 -OQUs -m BRIDGE-MIB -M /opt/observium/mibs/ udp:sw2.ahf:161 dot1dStpPortEntry
#/usr/bin/snmpbulkwalk -v2c -c kglk5g3l454@988 -OQUs -m BRIDGE-MIB -M /opt/observium/mibs/ udp:sw2.ahf:161 dot1dBasePortEntry #/usr/bin/snmpbulkwalk -v2c -c kglk5g3l454@988 -OQUs -m BRIDGE-MIB -M /opt/observium/mibs/ udp:sw2.ahf:161 dot1dBasePortEntry
if(is_numeric($vlan) && ($vlan <1002 || $vlan > 1105)) /// Ignore reserved VLAN IDs if (is_numeric($vlan) && ($vlan <1002 || $vlan > 1105)) /// Ignore reserved VLAN IDs
{ {
if($device['os_group'] == "cisco" || $device['os'] == "ios") /// This shit only seems to work on IOS if ($device['os_group'] == "cisco" || $device['os'] == "ios") /// This shit only seems to work on IOS
{ {
$vlan_device = array_merge($device, array('community' => $device['community']."@".$vlan)); $vlan_device = array_merge($device, array('community' => $device['community']."@".$vlan));
$vlan_data = snmpwalk_cache_oid($vlan_device, "dot1dStpPortEntry", array(), "BRIDGE-MIB:Q-BRIDGE-MIB"); $vlan_data = snmpwalk_cache_oid($vlan_device, "dot1dStpPortEntry", array(), "BRIDGE-MIB:Q-BRIDGE-MIB");
@@ -32,7 +32,7 @@ foreach($this_vlans as $vlan)
str_pad("Priority", 10).str_pad("State", 15).str_pad("Cost", 10)."\n"); str_pad("Priority", 10).str_pad("State", 15).str_pad("Cost", 10)."\n");
} }
foreach($vlan_data as $vlan_port_id => $vlan_port) foreach ($vlan_data as $vlan_port_id => $vlan_port)
{ {
$port = get_port_by_index_cache($device, $vlan_port['dot1dBasePortIfIndex']); $port = get_port_by_index_cache($device, $vlan_port['dot1dBasePortIfIndex']);
echo(str_pad($vlan_port_id, 10).str_pad($vlan_port['dot1dBasePortIfIndex'], 10). echo(str_pad($vlan_port_id, 10).str_pad($vlan_port['dot1dBasePortIfIndex'], 10).
@@ -50,7 +50,7 @@ foreach($this_vlans as $vlan)
$from_db = dbFetchRow("SELECT * FROM `ports_vlans` WHERE device_id = ? AND interface_id = ? AND `vlan` = ?", array($device['device_id'], $port['interface_id'], $vlan)); $from_db = dbFetchRow("SELECT * FROM `ports_vlans` WHERE device_id = ? AND interface_id = ? AND `vlan` = ?", array($device['device_id'], $port['interface_id'], $vlan));
if($from_db['port_vlan_id']) if ($from_db['port_vlan_id'])
{ {
dbUpdate($db_a, 'ports_vlans', "`port_vlan_id` = ?", $from_db['port_vlan_id']); dbUpdate($db_a, 'ports_vlans', "`port_vlan_id` = ?", $from_db['port_vlan_id']);
echo("Updated"); echo("Updated");
@@ -68,7 +68,6 @@ foreach($this_vlans as $vlan)
} }
$device_vlans = mysql_query("SELECT * FROM `vlans` WHERE `device_id` = '" . $device['device_id'] . "'"); $device_vlans = mysql_query("SELECT * FROM `vlans` WHERE `device_id` = '" . $device['device_id'] . "'");
while ($dev_vlan = mysql_fetch_assoc($device_vlans)) while ($dev_vlan = mysql_fetch_assoc($device_vlans))
{ {
@@ -87,5 +86,4 @@ while ($dev_vlan = mysql_fetch_assoc($device_vlans))
unset($this_vlans); unset($this_vlans);
?> ?>

View File

@@ -87,7 +87,6 @@ if ($device['os'] == "apc")
discover_sensor($valid['sensor'], 'voltage', $device, $oid, $index, $type, $descr, $divisor, '1', NULL, NULL, NULL, NULL, $current); discover_sensor($valid['sensor'], 'voltage', $device, $oid, $index, $type, $descr, $divisor, '1', NULL, NULL, NULL, NULL, $current);
} }
$oids = snmp_walk($device, "1.3.6.1.4.1.318.1.1.26.6.3.1.6", "-OsqnU", "PowerNet-MIB"); $oids = snmp_walk($device, "1.3.6.1.4.1.318.1.1.26.6.3.1.6", "-OsqnU", "PowerNet-MIB");
if ($debug) { echo($oids."\n"); } if ($debug) { echo($oids."\n"); }
if ($oids) if ($oids)
@@ -102,9 +101,6 @@ if ($device['os'] == "apc")
discover_sensor($valid['sensor'], 'voltage', $device, $oid, $index, $type, $descr, $divisor, '1', NULL, NULL, NULL, NULL, $current); discover_sensor($valid['sensor'], 'voltage', $device, $oid, $index, $type, $descr, $divisor, '1', NULL, NULL, NULL, NULL, $current);
} }
} }
?> ?>

View File

@@ -1,6 +1,5 @@
<?php <?php
function string_to_oid($string) function string_to_oid($string)
{ {
$oid = strlen($string); $oid = strlen($string);

View File

@@ -26,7 +26,7 @@ class observiumbot
{ {
### ###
# HELP Function # HELP Function
### ###
function help_info(&$irc, &$data) function help_info(&$irc, &$data)
{ {
@@ -56,7 +56,7 @@ class observiumbot
} }
### ###
# LOG Function # LOG Function
### ###
function log_info(&$irc, &$data) function log_info(&$irc, &$data)
{ {
@@ -101,7 +101,7 @@ class observiumbot
} }
### ###
# DEVICE Function # DEVICE Function
### ###
function device_info(&$irc, &$data) function device_info(&$irc, &$data)
{ {
@@ -116,7 +116,6 @@ class observiumbot
mysql_close(); mysql_close();
if (!$device) { if (!$device) {
$irc->message(SMARTIRC_TYPE_CHANNEL, $data->channel, "Error: Bad or Missing hostname, use .listdevices to show all devices."); } else { $irc->message(SMARTIRC_TYPE_CHANNEL, $data->channel, "Error: Bad or Missing hostname, use .listdevices to show all devices."); } else {
@@ -132,7 +131,7 @@ if (!$device) {
} }
} }
### ###
# PORT Function # PORT Function
### ###
function port_info(&$irc, &$data) function port_info(&$irc, &$data)
{ {

View File

@@ -17,7 +17,7 @@ foreach (dbFetchRows("SELECT * FROM `bills`") as $bill_data)
# replace old bill_gb with bill_quota (we're now storing bytes, not gigabytes) # replace old bill_gb with bill_quota (we're now storing bytes, not gigabytes)
if($bill_data['bill_type'] == "quota" && !is_numeric($bill_data['bill_quota'])) if ($bill_data['bill_type'] == "quota" && !is_numeric($bill_data['bill_quota']))
{ {
$bill_data['bill_quota'] = $bill_data['bill_gb'] * $config['billing']['base'] * $config['billing']['base']; $bill_data['bill_quota'] = $bill_data['bill_gb'] * $config['billing']['base'] * $config['billing']['base'];
dbUpdate(array('bill_quota' => $bill_data['bill_quota']), 'bills', '`bill_id` = ?', array($bill_data['bill_id'])); dbUpdate(array('bill_quota' => $bill_data['bill_quota']), 'bills', '`bill_id` = ?', array($bill_data['bill_id']));