mirror of
https://github.com/librenms/librenms.git
synced 2024-10-07 16:52:45 +00:00
updates
git-svn-id: http://www.observium.org/svn/observer/trunk@481 61d68cd4-352d-0410-923a-c4978735b2b8
This commit is contained in:
55
includes/polling/device-catos.inc.php
Executable file
55
includes/polling/device-catos.inc.php
Executable file
@@ -0,0 +1,55 @@
|
||||
<?php
|
||||
|
||||
$community = $device['community'];
|
||||
$id = $device['device_id'];
|
||||
$hostname = $device['hostname'];
|
||||
$port = $device['port'];
|
||||
$snmpver = $device['snmpver'];
|
||||
|
||||
$temprrd = $config['rrd_dir'] . "/" . $hostname . "/temp.rrd";
|
||||
$cpurrd = $config['rrd_dir'] . "/" . $hostname . "/cpu.rrd";
|
||||
$memrrd = $config['rrd_dir'] . "/" . $hostname . "/mem.rrd";
|
||||
|
||||
if(strstr($ciscomodel, "OID")){ unset($ciscomodel); }
|
||||
if(!strstr($ciscomodel, " ") && strlen($ciscomodel) >= '3') {
|
||||
$hardware = $ciscomodel;
|
||||
}
|
||||
|
||||
$sysDescr = str_replace("IOS (tm)", "IOS (tm),", $sysDescr);
|
||||
list(,$features,$version) = explode(",", $sysDescr);
|
||||
$version = str_replace("Copyright", "", $version);
|
||||
list(,$version,) = explode(" ", trim($version));
|
||||
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 = $cpu5m + 0;
|
||||
$cpu5s = $cpu5s + 0;
|
||||
|
||||
echo("$hostname\n");
|
||||
|
||||
if (!is_file($cpurrd)) {
|
||||
$rrdcreate = `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 \
|
||||
RRA:AVERAGE:0.5:24:2000 \
|
||||
RRA:AVERAGE:0.5:288:2000 \
|
||||
RRA:MAX:0.5:1:2000 \
|
||||
RRA:MAX:0.5:6:2000 \
|
||||
RRA:MAX:0.5:24:2000 \
|
||||
RRA:MAX:0.5:288:2000`;
|
||||
}
|
||||
|
||||
`rrdtool update $cpurrd N:$cpu5s:$cpu5m`;
|
||||
|
||||
include("includes/polling/bgpPeer.inc.php");
|
||||
include("includes/polling/cisco-processors.inc.php");
|
||||
include("includes/polling/cisco-mempool.inc.php");
|
||||
include("includes/polling/cisco-entity-sensors.inc.php");
|
||||
|
||||
?>
|
@@ -1,5 +1,18 @@
|
||||
<?php
|
||||
|
||||
if($device['os'] == "CatOS" || $device['os'] == "IOS") {
|
||||
$portifIndex = array();
|
||||
$cmd = $config['snmpwalk'] . " -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){
|
||||
$entry = str_replace("CISCO-STACK-MIB::portIfIndex.", "", $entry);
|
||||
list($slotport, $ifIndex) = explode(" ", $entry);
|
||||
$portifIndex[$ifIndex] = $slotport;
|
||||
}
|
||||
# print_r($portifIndex);
|
||||
}
|
||||
|
||||
$interface_query = mysql_query("SELECT * FROM `interfaces` $where");
|
||||
while ($interface = mysql_fetch_array($interface_query)) {
|
||||
|
||||
@@ -38,6 +51,14 @@ while ($interface = mysql_fetch_array($interface_query)) {
|
||||
$ifDescr = trim(str_replace("\"", "", $ifDescr));
|
||||
$ifDescr = trim($ifDescr);
|
||||
|
||||
$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];
|
||||
$ifAlias = trim(shell_exec($cmd));
|
||||
}
|
||||
}
|
||||
|
||||
if($config[ifname][$device[os]]) { $ifDescr = $ifName; }
|
||||
|
||||
$rrdfile = $host_rrd . "/" . $interface['ifIndex'] . ".rrd";
|
||||
@@ -97,7 +118,7 @@ while ($interface = mysql_fetch_array($interface_query)) {
|
||||
$update_query = "UPDATE `interfaces` SET ";
|
||||
$update_query .= $update;
|
||||
$update_query .= " WHERE `interface_id` = '" . $interface['interface_id'] . "'";
|
||||
echo("Updating : " . $device['hostname'] . " $ifDescr\nSQL :$update_query\n\n");
|
||||
# echo("Updating : " . $device['hostname'] . " $ifDescr\nSQL :$update_query\n\n");
|
||||
$update_result = mysql_query($update_query);
|
||||
} else {
|
||||
# echo("Not Updating : " . $device['hostname'] ." $ifDescr ( " . $interface['ifDescr'] . " )\n\n");
|
||||
@@ -135,5 +156,7 @@ while ($interface = mysql_fetch_array($interface_query)) {
|
||||
|
||||
}
|
||||
|
||||
unset($portifIndex);
|
||||
|
||||
?>
|
||||
|
||||
|
Reference in New Issue
Block a user