updates and fixes

git-svn-id: http://www.observium.org/svn/observer/trunk@519 61d68cd4-352d-0410-923a-c4978735b2b8
This commit is contained in:
Adam Amstrong
2009-11-12 17:51:36 +00:00
parent d8155aacff
commit 17f74b5aa4
7 changed files with 1503 additions and 20 deletions
+4 -4
View File
@@ -10,7 +10,7 @@
if($bgpLocalAs && !strstr($bgpLocalAs, " ")) {
echo("AS$bgpLocalAs \n");
echo("AS$bgpLocalAs ");
if($bgpLocalAs != $device['bgpLocalAs']) { mysql_query("UPDATE devices SET bgpLocalAs = '$bgpLocalAs' WHERE device_id = '".$device['device_id']."'"); echo("Updated AS\n"); }
@@ -26,7 +26,7 @@
$astext = trim(str_replace("\"", "", shell_exec("/usr/bin/dig +short AS$peer_as.asn.cymru.com TXT | cut -d '|' -f 5 | sed s/\\\"//g")));
echo(str_pad($peer_ip, 40) . " AS$peer_as ");
# echo(str_pad($peer_ip, 40) . " AS$peer_as ");
#echo("$peer_ip AS$peer_as ");
if(mysql_result(mysql_query("SELECT COUNT(*) FROM `bgpPeers` WHERE `device_id` = '".$device['device_id']."' AND bgpPeerIdentifier = '$peer_ip'"),0) < '1') {
@@ -46,7 +46,7 @@
list($afisafi, $text) = explode(" = ", $af);
list($afi, $safi) = explode(".", $afisafi);
if($afi && $safi) {
echo("($afi:$safi)");
# echo("($afi:$safi)");
$af_list['$afi']['$safi'] = 1;
if(mysql_result(mysql_query("SELECT COUNT(*) FROM `bgpPeers_cbgp` WHERE `device_id` = '".$device['device_id']."' AND bgpPeerIdentifier = '$peer_ip' AND afi = '$afi' AND safi = '$safi'"),0) == 0) {
mysql_query("INSERT INTO `bgpPeers_cbgp` (device_id,bgpPeerIdentifier, afi, safi) VALUES ('".$device['device_id']."','$peer_ip','$afi','$safi')");
@@ -62,7 +62,6 @@
}
} # AF list
} # if IOS
echo("\n");
} # If Peer
} # Foreach
} else {
@@ -92,6 +91,7 @@ while ($entry = mysql_fetch_array($query)) {
}
}
echo("\n");
?>
+1 -3
View File
@@ -10,8 +10,6 @@
$entity_array = snmpwalk_cache_oid("entityPhysical", $device, $empty, "ENTITY-MIB");
$entity_array = snmpwalk_cache_oid("entSensorValues", $device, $entity_array, "CISCO-ENTITY-SENSOR-MIB");
print_r($entity_array);
foreach($entity_array[$device[device_id]] as $entPhysicalIndex => $entry) {
$entPhysicalDescr = $entry['entPhysicalDescr'];
@@ -79,7 +77,7 @@
$sql = "UPDATE `entPhysical` SET entSensorType = '', entSensorScale = '', entSensorPrecision = '', entSensorMeasuredEntity = ''";
$sql .= " WHERE device_id = '".$device['device_id']."' AND entPhysicalIndex = '$entPhysicalIndex'";
}
echo("$sql\n");
# echo("$sql\n");
mysql_query($sql);
}
$valid[$entPhysicalIndex] = 1;
+12 -6
View File
@@ -20,15 +20,13 @@
list(,$features) = explode("(", $features);
list(,$features) = explode("-", $features);
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"));
$cpu5m = shell_exec($config['snmpget'] . " -m OLD-CISCO-CPU-MIB -O qv -$snmpver -c $community $hostname:$port avgBusy5.0");
$cpu5m = $cpu5m + 0;
$cpu5s = $cpu5s + 0;
echo("$hostname\n");
if (!is_file($cpurrd)) {
$rrdcreate = shell_exec($config['rrdtool'] . " create $cpurrd --step 300 \
DS:LOAD5S:GAUGE:600:-1:100 \
DS:LOAD5M:GAUGE:600:-1:100 \
RRA:AVERAGE:0.5:1:2000 \
RRA:AVERAGE:0.5:6:2000 \
@@ -37,10 +35,14 @@
RRA:MAX:0.5:1:2000 \
RRA:MAX:0.5:6:2000 \
RRA:MAX:0.5:24:2000 \
RRA:MAX:0.5:288:2000");
RRA:MAX:0.5:288:2000 \
RRA:MIN:0.5:1:2000 \
RRA:MIN:0.5:6:2000 \
RRA:MIN:0.5:24:2000 \
RRA:MIN:0.5:288:2000");
}
shell_exec($config['rrdtool'] . " update $cpurrd N:$cpu5s:$cpu5m");
shell_exec($config['rrdtool'] . " update $cpurrd N:$cpu5m");
$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";
@@ -68,7 +70,11 @@
RRA:MAX:0.5:1:2000 \
RRA:MAX:0.5:6:2000 \
RRA:MAX:0.5:24:2000 \
RRA:MAX:0.5:288:2000");
RRA:MAX:0.5:288:2000 \
RRA:MIN:0.5:1:2000 \
RRA:MIN:0.5:6:2000 \
RRA:MIN:0.5:24:2000 \
RRA:MIN:0.5:288:2000");
}
rrdtool_update ($memrrd, "N:$memfreeio:$memusedio:$memfreeproc:$memusedproc:$memtotal");
+3 -6
View File
@@ -17,8 +17,7 @@ if($device[os] != "Snom") {
$oids['snmp'] = array ('snmpInPkts','snmpOutPkts','snmpInBadVersions','snmpInBadCommunityNames','snmpInBadCommunityUses','snmpInASNParseErrs',
'snmpInTooBigs','snmpInNoSuchNames','snmpInBadValues','snmpInReadOnlys','snmpInGenErrs','snmpInTotalReqVars','snmpInTotalSetVars',
'snmpInGetRequests','snmpInGetNexts','snmpInSetRequests','snmpInGetResponses','snmpInTraps','snmpOutTooBigs','snmpOutNoSuchNames',
'snmpOutBadValues','snmpOutGenErrs','snmpOutGetRequests','snmpOutGetNexts','snmpOutSetRequests','snmpOutGetResponses','snmpOutTraps',
'snmpEnableAuthenTraps','snmpSilentDrops','snmpProxyDrops');
'snmpOutBadValues','snmpOutGenErrs','snmpOutGetRequests','snmpOutGetNexts','snmpOutSetRequests','snmpOutGetResponses','snmpOutTraps','snmpSilentDrops','snmpProxyDrops');
$oids['tcp'] = array ('tcpActiveOpens', 'tcpPassiveOpens', 'tcpAttemptFails', 'tcpEstabResets', 'tcpCurrEstab',
'tcpInSegs', 'tcpOutSegs', 'tcpRetransSegs', 'tcpInErrs', 'tcpOutRsts', 'tcpHCInSegs', 'tcpHCOutSegs');
@@ -40,14 +39,12 @@ if($device[os] != "Snom") {
$rrd_create .= " DS:$oid_ds:COUNTER:600:U:100000000000";
$snmpstring .= " $oid.0";
}
if(!file_exists($rrdfile)) { shell_exec($rrd_create); }
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 = trim(shell_exec($snmpdata_cmd));
$rrdupdate = "N";
foreach(explode("\n", $snmpdata) as $data) {
if(strstr($data, "No") || strstr($data, "d") || strstr($data, "s")) { $data = ""; }
if(strstr($data, "No") || strstr($data, "d") || strstr($data, "s")) { $data = "0"; }
$rrdupdate .= ":$data";
}
unset($snmpstring);