mirror of
https://github.com/stylersnico/librenms.git
synced 2026-08-04 00:11:51 +02:00
only poll cisco CEF and cisco mac accounting on cisco devices + some small fixes
git-svn-id: http://www.observium.org/svn/observer/trunk@2999 61d68cd4-352d-0410-923a-c4978735b2b8
This commit is contained in:
@@ -346,7 +346,7 @@ foreach (array('fanspeed','humidity','temperature') as $item)
|
|||||||
{
|
{
|
||||||
if ($menu_sensors[$item])
|
if ($menu_sensors[$item])
|
||||||
{
|
{
|
||||||
echo('<li><a href="health/metric='.$item.'/"><img src="images/icons/'.$item.'.png" border="0" align="absmiddle" /> '.ucfirst($item).'</a></li>');
|
echo('<li><a href="health/metric='.$item.'/"><img src="images/icons/'.$item.'.png" border="0" align="absmiddle" /> '.nicecase($item).'</a></li>');
|
||||||
unset($menu_sensors[$item]);$sep++;
|
unset($menu_sensors[$item]);$sep++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -361,7 +361,7 @@ foreach (array('current','frequency','power','voltage') as $item)
|
|||||||
{
|
{
|
||||||
if ($menu_sensors[$item])
|
if ($menu_sensors[$item])
|
||||||
{
|
{
|
||||||
echo('<li><a href="health/metric='.$item.'/"><img src="images/icons/'.$item.'.png" border="0" align="absmiddle" /> '.ucfirst($item).'</a></li>');
|
echo('<li><a href="health/metric='.$item.'/"><img src="images/icons/'.$item.'.png" border="0" align="absmiddle" /> '.nicecase($item).'</a></li>');
|
||||||
unset($menu_sensors[$item]);$sep++;
|
unset($menu_sensors[$item]);$sep++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+1
-1
@@ -134,7 +134,7 @@ if (isset($config['branding']) && is_array($config['branding']))
|
|||||||
<meta http-equiv="X-UA-Compatible" content="IE=EmulateIE7" />
|
<meta http-equiv="X-UA-Compatible" content="IE=EmulateIE7" />
|
||||||
<meta http-equiv="content-language" content="en-us" />
|
<meta http-equiv="content-language" content="en-us" />
|
||||||
<?php
|
<?php
|
||||||
if ($config['page_refresh']) { echo("<meta http-equiv='refresh' content='".$config['page_refresh']."'>"); }
|
if ($config['page_refresh']) { echo(' <meta http-equiv="refresh" content="'.$config['page_refresh'].'" />' . "\n"); }
|
||||||
?>
|
?>
|
||||||
<link href="<?php echo($config['stylesheet']); ?>" rel="stylesheet" type="text/css" />
|
<link href="<?php echo($config['stylesheet']); ?>" rel="stylesheet" type="text/css" />
|
||||||
<link rel="shortcut icon" href="<?php echo($config['favicon']); ?>" />
|
<link rel="shortcut icon" href="<?php echo($config['favicon']); ?>" />
|
||||||
|
|||||||
@@ -69,7 +69,7 @@ $config['stylesheet'] = "css/styles.css";
|
|||||||
$config['mono_font'] = "DejaVuSansMono";
|
$config['mono_font'] = "DejaVuSansMono";
|
||||||
$config['favicon'] = "images/observium-icon.png";
|
$config['favicon'] = "images/observium-icon.png";
|
||||||
$config['header_color'] = "#1F334E";
|
$config['header_color'] = "#1F334E";
|
||||||
$config['page_refresh'] = "300"; ## Refresh the page every xx seconds
|
$config['page_refresh'] = "300"; ## Refresh the page every xx seconds, 0 to disable
|
||||||
$config['front_page'] = "pages/front/default.php";
|
$config['front_page'] = "pages/front/default.php";
|
||||||
$config['page_title'] = "Observium :: Network Observation and Monitoring";
|
$config['page_title'] = "Observium :: Network Observation and Monitoring";
|
||||||
$config['timestamp_format'] = 'd-m-Y H:i:s';
|
$config['timestamp_format'] = 'd-m-Y H:i:s';
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
echo(" ENTITY-SENSOR ");
|
echo(" ENTITY-SENSOR: ");
|
||||||
|
|
||||||
echo("\nCaching OIDs:");
|
echo("\nCaching OIDs:");
|
||||||
|
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ if ($device['os'] == "linux")
|
|||||||
$oids = snmp_walk($device, "lmTempSensorsDevice", "-Osqn", "LM-SENSORS-MIB");
|
$oids = snmp_walk($device, "lmTempSensorsDevice", "-Osqn", "LM-SENSORS-MIB");
|
||||||
if ($debug) { echo($oids."\n"); }
|
if ($debug) { echo($oids."\n"); }
|
||||||
$oids = trim($oids);
|
$oids = trim($oids);
|
||||||
if ($oids) echo("LM-SENSORS-MIB ");
|
if ($oids) echo("LM-SENSORS-MIB: ");
|
||||||
foreach (explode("\n", $oids) as $data)
|
foreach (explode("\n", $oids) as $data)
|
||||||
{
|
{
|
||||||
$data = trim($data);
|
$data = trim($data);
|
||||||
|
|||||||
@@ -1,22 +1,24 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
echo("Cisco CEF Switching Path: ");
|
if ($device['os_group'] == "cisco")
|
||||||
|
|
||||||
$cefs = array();
|
|
||||||
$cefs = snmpwalk_cache_threepart_oid($device, "CISCO-CEF-MIB::cefSwitchingStatsEntry", $cefs, "CISCO-CEF-MIB");
|
|
||||||
$polled = time();
|
|
||||||
|
|
||||||
$cefs_query = dbFetchRows("SELECT * FROM `cef_switching` WHERE `device_id` = ?", array($device['device_id']));
|
|
||||||
foreach ($cefs_query as $ceftmp)
|
|
||||||
{
|
{
|
||||||
|
echo("Cisco CEF Switching Path: ");
|
||||||
|
|
||||||
|
$cefs = array();
|
||||||
|
$cefs = snmpwalk_cache_threepart_oid($device, "CISCO-CEF-MIB::cefSwitchingStatsEntry", $cefs, "CISCO-CEF-MIB");
|
||||||
|
$polled = time();
|
||||||
|
|
||||||
|
$cefs_query = dbFetchRows("SELECT * FROM `cef_switching` WHERE `device_id` = ?", array($device['device_id']));
|
||||||
|
foreach ($cefs_query as $ceftmp)
|
||||||
|
{
|
||||||
$cef_id = $device['device_id']."-".$ceftmp['entPhysicalIndex']."-".$ceftmp['afi']."-".$ceftmp['cef_index'];
|
$cef_id = $device['device_id']."-".$ceftmp['entPhysicalIndex']."-".$ceftmp['afi']."-".$ceftmp['cef_index'];
|
||||||
$cefs_db[$cef_id] = $ceftmp['cef_switching_id'];
|
$cefs_db[$cef_id] = $ceftmp['cef_switching_id'];
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($debug) { print_r($cefs); }
|
if ($debug) { print_r($cefs); }
|
||||||
|
|
||||||
if (is_array($cefs))
|
if (is_array($cefs))
|
||||||
{
|
{
|
||||||
if (!is_array($entity_array))
|
if (!is_array($entity_array))
|
||||||
{
|
{
|
||||||
echo("Caching OIDs: ");
|
echo("Caching OIDs: ");
|
||||||
@@ -41,7 +43,7 @@ if (is_array($cefs))
|
|||||||
|
|
||||||
$cef_id = $device['device_id']."-".$entity."-".$afi."-".$path;
|
$cef_id = $device['device_id']."-".$entity."-".$afi."-".$path;
|
||||||
|
|
||||||
# if (dbFetchCell("SELECT COUNT(*) FROM `cef_switching` WHERE `device_id` = ? AND `entPhysicalIndex` = ? AND `afi` = ? AND `cef_index` = ?", array($device['device_id'], $entity, $afi, $path)) != "1")
|
# if (dbFetchCell("SELECT COUNT(*) FROM `cef_switching` WHERE `device_id` = ? AND `entPhysicalIndex` = ? AND `afi` = ? AND `cef_index` = ?", array($device['device_id'], $entity, $afi, $path)) != "1")
|
||||||
if (!isset($cefs_db[$cef_id]))
|
if (!isset($cefs_db[$cef_id]))
|
||||||
{
|
{
|
||||||
dbInsert(array('device_id' => $device['device_id'], 'entPhysicalIndex' => $entity, 'afi' => $afi, 'cef_index' => $path, 'cef_path' => $cef_stat['cefSwitchingPath']), 'cef_switching');
|
dbInsert(array('device_id' => $device['device_id'], 'entPhysicalIndex' => $entity, 'afi' => $afi, 'cef_index' => $path, 'cef_path' => $cef_stat['cefSwitchingPath']), 'cef_switching');
|
||||||
@@ -91,18 +93,19 @@ if (is_array($cefs))
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
## FIXME - need to delete old ones. FIXME REALLY.
|
## FIXME - need to delete old ones. FIXME REALLY.
|
||||||
|
|
||||||
print_r($cefs_db);
|
print_r($cefs_db);
|
||||||
|
|
||||||
foreach ($cefs_db as $cef_switching_id)
|
foreach ($cefs_db as $cef_switching_id)
|
||||||
{
|
{
|
||||||
dbDelete("cef_switching", "`cef_switching_id` = ?", array($cef_switching_id));
|
dbDelete("cef_switching", "`cef_switching_id` = ?", array($cef_switching_id));
|
||||||
echo("-");
|
echo("-");
|
||||||
}
|
}
|
||||||
|
|
||||||
echo("\n");
|
echo("\n");
|
||||||
|
} # os_group = cisco
|
||||||
|
|
||||||
?>
|
?>
|
||||||
|
|||||||
@@ -2,24 +2,26 @@
|
|||||||
|
|
||||||
## FIXME -- we're walking, so we can discover here too.
|
## FIXME -- we're walking, so we can discover here too.
|
||||||
|
|
||||||
$cip_oids = array('cipMacHCSwitchedBytes', 'cipMacHCSwitchedPkts');
|
if ($device['os_group'] == "cisco")
|
||||||
echo("Cisco MAC - Caching OID: ");
|
|
||||||
$cip_array = array();
|
|
||||||
|
|
||||||
foreach ($cip_oids as $oid)
|
|
||||||
{
|
{
|
||||||
|
$cip_oids = array('cipMacHCSwitchedBytes', 'cipMacHCSwitchedPkts');
|
||||||
|
echo("Cisco MAC - Caching OID: ");
|
||||||
|
$cip_array = array();
|
||||||
|
|
||||||
|
foreach ($cip_oids as $oid)
|
||||||
|
{
|
||||||
echo("$oid ");
|
echo("$oid ");
|
||||||
$cip_array = snmpwalk_cache_cip($device, $oid, $cip_array, "CISCO-IP-STAT-MIB");
|
$cip_array = snmpwalk_cache_cip($device, $oid, $cip_array, "CISCO-IP-STAT-MIB");
|
||||||
}
|
}
|
||||||
|
|
||||||
$polled = time();
|
$polled = time();
|
||||||
|
|
||||||
$mac_entries = 0;
|
$mac_entries = 0;
|
||||||
|
|
||||||
$acc_rows = dbFetchRows("SELECT *, A.poll_time AS poll_time FROM `mac_accounting` as A, `ports` AS I where A.interface_id = I.interface_id AND I.device_id = ?", array($device['device_id']));
|
$acc_rows = dbFetchRows("SELECT *, A.poll_time AS poll_time FROM `mac_accounting` as A, `ports` AS I where A.interface_id = I.interface_id AND I.device_id = ?", array($device['device_id']));
|
||||||
|
|
||||||
foreach ($acc_rows as $acc)
|
foreach ($acc_rows as $acc)
|
||||||
{
|
{
|
||||||
$device_id = $acc['device_id'];
|
$device_id = $acc['device_id'];
|
||||||
$ifIndex = $acc['ifIndex'];
|
$ifIndex = $acc['ifIndex'];
|
||||||
$mac = $acc['mac'];
|
$mac = $acc['mac'];
|
||||||
@@ -88,12 +90,13 @@ foreach ($acc_rows as $acc)
|
|||||||
dbUpdate($acc['update'], 'mac_accounting', '`ma_id` = ?', array($acc['ma_id']));
|
dbUpdate($acc['update'], 'mac_accounting', '`ma_id` = ?', array($acc['ma_id']));
|
||||||
} /// End Updates
|
} /// End Updates
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
unset($cip_array);
|
||||||
|
|
||||||
|
if ($mac_entries) { echo(" $mac_entries MAC accounting entries\n"); }
|
||||||
|
|
||||||
|
echo("\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
unset($cip_array);
|
|
||||||
|
|
||||||
if ($mac_entries) { echo(" $mac_entries MAC accounting entries\n"); }
|
|
||||||
|
|
||||||
echo("\n");
|
|
||||||
|
|
||||||
?>
|
?>
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
$version = snmp_get($device, "sysConfFirmwareVersion.0 ", "-Ovq", "AIRPORT-BASESTATION-3-MIB");
|
$version = snmp_get($device, "sysConfFirmwareVersion.0", "-Ovq", "AIRPORT-BASESTATION-3-MIB");
|
||||||
|
|
||||||
?>
|
?>
|
||||||
Reference in New Issue
Block a user