mirror of
https://github.com/stylersnico/librenms.git
synced 2026-07-12 16:06:25 +02:00
syntaxer run
git-svn-id: http://www.observium.org/svn/observer/trunk@3008 61d68cd4-352d-0410-923a-c4978735b2b8
This commit is contained in:
+1
-1
@@ -46,7 +46,7 @@ if (isset($argv[1]) && $argv[1])
|
|||||||
{
|
{
|
||||||
$config['snmp']['community'] = array($community);
|
$config['snmp']['community'] = array($community);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($snmpver)
|
if ($snmpver)
|
||||||
{
|
{
|
||||||
$snmpversions[] = $snmpver;
|
$snmpversions[] = $snmpver;
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ $sla_types = array('all' => 'All');
|
|||||||
foreach ($slas as $sla)
|
foreach ($slas as $sla)
|
||||||
{
|
{
|
||||||
$sla_type = $sla['rtt_type'];
|
$sla_type = $sla['rtt_type'];
|
||||||
|
|
||||||
if (!in_array($sla_type, $sla_types))
|
if (!in_array($sla_type, $sla_types))
|
||||||
if (isset($config['sla_type_labels'][$sla_type]))
|
if (isset($config['sla_type_labels'][$sla_type]))
|
||||||
{
|
{
|
||||||
@@ -21,7 +21,7 @@ foreach ($slas as $sla)
|
|||||||
{
|
{
|
||||||
$text = ucfirst($sla_type);
|
$text = ucfirst($sla_type);
|
||||||
}
|
}
|
||||||
|
|
||||||
$sla_types[$sla_type] = $text;
|
$sla_types[$sla_type] = $text;
|
||||||
}
|
}
|
||||||
asort($sla_types);
|
asort($sla_types);
|
||||||
@@ -30,7 +30,7 @@ $sep = "";
|
|||||||
foreach ($sla_types as $sla_type => $text)
|
foreach ($sla_types as $sla_type => $text)
|
||||||
{
|
{
|
||||||
if (!$vars['view']) { $vars['view'] = $sla_type; }
|
if (!$vars['view']) { $vars['view'] = $sla_type; }
|
||||||
|
|
||||||
echo($sep);
|
echo($sep);
|
||||||
if ($vars['view'] == $sla_type)
|
if ($vars['view'] == $sla_type)
|
||||||
{
|
{
|
||||||
@@ -59,7 +59,7 @@ foreach ($slas as $sla)
|
|||||||
$name .= ": ".$sla['tag'];
|
$name .= ": ".$sla['tag'];
|
||||||
if ($sla['owner'])
|
if ($sla['owner'])
|
||||||
$name .= " (Owner: ". $sla['owner'] .")";
|
$name .= " (Owner: ". $sla['owner'] .")";
|
||||||
|
|
||||||
$graph_array['type'] = "device_sla";
|
$graph_array['type'] = "device_sla";
|
||||||
$graph_array['id'] = $sla['sla_id'];
|
$graph_array['id'] = $sla['sla_id'];
|
||||||
echo('<tr><td>');
|
echo('<tr><td>');
|
||||||
|
|||||||
@@ -182,6 +182,7 @@ $config['enable_inventory'] = 1; # Enable Inventory
|
|||||||
$config['enable_pseudowires'] = 1; # Enable Pseudowires
|
$config['enable_pseudowires'] = 1; # Enable Pseudowires
|
||||||
$config['enable_vrfs'] = 1; # Enable VRFs
|
$config['enable_vrfs'] = 1; # Enable VRFs
|
||||||
$config['enable_printers'] = 0; # Enable Printer support
|
$config['enable_printers'] = 0; # Enable Printer support
|
||||||
|
$config['enable_sla'] = 0; # Enable Cisco SLA collection and display
|
||||||
|
|
||||||
### Ports extension modules
|
### Ports extension modules
|
||||||
|
|
||||||
|
|||||||
@@ -5,26 +5,27 @@ if ($config['enable_sla'] && $device['os_group'] == "cisco")
|
|||||||
echo("SLAs : ");
|
echo("SLAs : ");
|
||||||
|
|
||||||
$slas = snmp_walk($device, "ciscoRttMonMIB.ciscoRttMonObjects.rttMonCtrl", "-Osq", "+CISCO-RTTMON-MIB");
|
$slas = snmp_walk($device, "ciscoRttMonMIB.ciscoRttMonObjects.rttMonCtrl", "-Osq", "+CISCO-RTTMON-MIB");
|
||||||
|
|
||||||
$sla_table = array();
|
$sla_table = array();
|
||||||
foreach (explode("\n", $slas) as $sla) {
|
foreach (explode("\n", $slas) as $sla)
|
||||||
|
{
|
||||||
$key_val = explode(" ", $sla, 2);
|
$key_val = explode(" ", $sla, 2);
|
||||||
if (count($key_val) != 2)
|
if (count($key_val) != 2)
|
||||||
$key_val[] = "";
|
$key_val[] = "";
|
||||||
|
|
||||||
$key = $key_val[0];
|
$key = $key_val[0];
|
||||||
$value = $key_val[1];
|
$value = $key_val[1];
|
||||||
|
|
||||||
$prop_id = explode(".", $key);
|
$prop_id = explode(".", $key);
|
||||||
if ((count($prop_id) != 2) || !ctype_digit($prop_id[1]))
|
if ((count($prop_id) != 2) || !ctype_digit($prop_id[1]))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
$property = $prop_id[0];
|
$property = $prop_id[0];
|
||||||
$id = intval($prop_id[1]);
|
$id = intval($prop_id[1]);
|
||||||
|
|
||||||
$sla_table[$id][$property] = trim($value);
|
$sla_table[$id][$property] = trim($value);
|
||||||
}
|
}
|
||||||
|
|
||||||
#var_dump($sla_table);
|
#var_dump($sla_table);
|
||||||
|
|
||||||
// Get existing SLAs
|
// Get existing SLAs
|
||||||
@@ -37,7 +38,7 @@ if ($config['enable_sla'] && $device['os_group'] == "cisco")
|
|||||||
'sla_nr' => $sla_nr,
|
'sla_nr' => $sla_nr,
|
||||||
);
|
);
|
||||||
$sla_id = dbFetchCell("SELECT `sla_id` FROM `slas` WHERE `device_id` = :device_id AND `sla_nr` = :sla_nr", $query_data);
|
$sla_id = dbFetchCell("SELECT `sla_id` FROM `slas` WHERE `device_id` = :device_id AND `sla_nr` = :sla_nr", $query_data);
|
||||||
|
|
||||||
$data = array(
|
$data = array(
|
||||||
'device_id' => $device['device_id'],
|
'device_id' => $device['device_id'],
|
||||||
'sla_nr' => $sla_nr,
|
'sla_nr' => $sla_nr,
|
||||||
@@ -47,7 +48,7 @@ if ($config['enable_sla'] && $device['os_group'] == "cisco")
|
|||||||
'status' => ($sla_config['rttMonCtrlAdminStatus'] == 'active') ? 1 : 0,
|
'status' => ($sla_config['rttMonCtrlAdminStatus'] == 'active') ? 1 : 0,
|
||||||
'deleted' => 0,
|
'deleted' => 0,
|
||||||
);
|
);
|
||||||
|
|
||||||
// Some fallbacks for when the tag is empty
|
// Some fallbacks for when the tag is empty
|
||||||
if (!$data['tag'])
|
if (!$data['tag'])
|
||||||
{
|
{
|
||||||
@@ -56,11 +57,11 @@ if ($config['enable_sla'] && $device['os_group'] == "cisco")
|
|||||||
case 'http':
|
case 'http':
|
||||||
$data['tag'] = $sla_config['rttMonEchoAdminURL'];
|
$data['tag'] = $sla_config['rttMonEchoAdminURL'];
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'dns':
|
case 'dns':
|
||||||
$data['tag'] = $sla_config['rttMonEchoAdminTargetAddressString'];
|
$data['tag'] = $sla_config['rttMonEchoAdminTargetAddressString'];
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'echo':
|
case 'echo':
|
||||||
$parts = explode(" ", $sla_config['rttMonEchoAdminTargetAddress']);
|
$parts = explode(" ", $sla_config['rttMonEchoAdminTargetAddress']);
|
||||||
if (count($parts) == 4)
|
if (count($parts) == 4)
|
||||||
@@ -77,8 +78,8 @@ if ($config['enable_sla'] && $device['os_group'] == "cisco")
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if( !$sla_id )
|
if (!$sla_id)
|
||||||
{
|
{
|
||||||
$sla_id = dbInsert($data, 'slas');
|
$sla_id = dbInsert($data, 'slas');
|
||||||
echo "+";
|
echo "+";
|
||||||
@@ -92,14 +93,14 @@ if ($config['enable_sla'] && $device['os_group'] == "cisco")
|
|||||||
echo ".";
|
echo ".";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Mark all remaining SLAs as deleted
|
// Mark all remaining SLAs as deleted
|
||||||
foreach ($existing_slas as $existing_sla)
|
foreach ($existing_slas as $existing_sla)
|
||||||
{
|
{
|
||||||
dbUpdate(array('deleted' => 1), 'slas', "`sla_id` = :sla_id", array('sla_id' => $existing_sla));
|
dbUpdate(array('deleted' => 1), 'slas', "`sla_id` = :sla_id", array('sla_id' => $existing_sla));
|
||||||
echo "-";
|
echo "-";
|
||||||
}
|
}
|
||||||
|
|
||||||
echo("\n");
|
echo("\n");
|
||||||
} # enable_sla && cisco
|
} # enable_sla && cisco
|
||||||
|
|
||||||
|
|||||||
@@ -129,7 +129,7 @@ function discover_sensor(&$valid, $class, $device, $oid, $index, $type, $descr,
|
|||||||
// Fix high/low thresholds (i.e. on negative numbers)
|
// Fix high/low thresholds (i.e. on negative numbers)
|
||||||
list($warn_limit, $low_warn_limit) = array($low_warn_limit, $warn_limit);
|
list($warn_limit, $low_warn_limit) = array($low_warn_limit, $warn_limit);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (dbFetchCell("SELECT COUNT(sensor_id) FROM `sensors` WHERE `poller_type`= ? AND `sensor_class` = ? AND `device_id` = ? AND sensor_type = ? AND `sensor_index` = ?", array($poller_type, $class, $device['device_id'], $type, $index)) == '0')
|
if (dbFetchCell("SELECT COUNT(sensor_id) FROM `sensors` WHERE `poller_type`= ? AND `sensor_class` = ? AND `device_id` = ? AND sensor_type = ? AND `sensor_index` = ?", array($poller_type, $class, $device['device_id'], $type, $index)) == '0')
|
||||||
{
|
{
|
||||||
if (!$high_limit) { $high_limit = sensor_limit($class, $current); }
|
if (!$high_limit) { $high_limit = sensor_limit($class, $current); }
|
||||||
|
|||||||
@@ -3,20 +3,20 @@
|
|||||||
if ($device['os_group'] == "cisco")
|
if ($device['os_group'] == "cisco")
|
||||||
{
|
{
|
||||||
echo("Cisco CEF Switching Path: ");
|
echo("Cisco CEF Switching Path: ");
|
||||||
|
|
||||||
$cefs = array();
|
$cefs = array();
|
||||||
$cefs = snmpwalk_cache_threepart_oid($device, "CISCO-CEF-MIB::cefSwitchingStatsEntry", $cefs, "CISCO-CEF-MIB");
|
$cefs = snmpwalk_cache_threepart_oid($device, "CISCO-CEF-MIB::cefSwitchingStatsEntry", $cefs, "CISCO-CEF-MIB");
|
||||||
$polled = time();
|
$polled = time();
|
||||||
|
|
||||||
$cefs_query = dbFetchRows("SELECT * FROM `cef_switching` WHERE `device_id` = ?", array($device['device_id']));
|
$cefs_query = dbFetchRows("SELECT * FROM `cef_switching` WHERE `device_id` = ?", array($device['device_id']));
|
||||||
foreach ($cefs_query as $ceftmp)
|
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))
|
||||||
@@ -40,9 +40,9 @@ if ($device['os_group'] == "cisco")
|
|||||||
foreach ($paths as $path => $cef_stat)
|
foreach ($paths as $path => $cef_stat)
|
||||||
{
|
{
|
||||||
echo(" | |-".$path.": ".$cef_stat['cefSwitchingPath']);
|
echo(" | |-".$path.": ".$cef_stat['cefSwitchingPath']);
|
||||||
|
|
||||||
$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]))
|
||||||
{
|
{
|
||||||
@@ -50,11 +50,11 @@ if ($device['os_group'] == "cisco")
|
|||||||
echo("+");
|
echo("+");
|
||||||
}
|
}
|
||||||
unset($cefs_db[$cef_id]);
|
unset($cefs_db[$cef_id]);
|
||||||
|
|
||||||
$cef_entry = dbFetchRow("SELECT * FROM `cef_switching` WHERE `device_id` = ? AND `entPhysicalIndex = ? AND `afi` = ? AND `cef_index` = ?", array($device['device_id'], $entity, $afi, $path));
|
$cef_entry = dbFetchRow("SELECT * FROM `cef_switching` WHERE `device_id` = ? AND `entPhysicalIndex = ? AND `afi` = ? AND `cef_index` = ?", array($device['device_id'], $entity, $afi, $path));
|
||||||
|
|
||||||
$filename = $config['rrd_dir'] . "/" . $device['hostname'] . "/" . safename("cefswitching-".$entity."-".$afi."-".$path.".rrd");
|
$filename = $config['rrd_dir'] . "/" . $device['hostname'] . "/" . safename("cefswitching-".$entity."-".$afi."-".$path.".rrd");
|
||||||
|
|
||||||
if (!is_file($filename))
|
if (!is_file($filename))
|
||||||
{
|
{
|
||||||
rrdtool_create($filename, "--step 300 \
|
rrdtool_create($filename, "--step 300 \
|
||||||
@@ -66,12 +66,12 @@ if ($device['os_group'] == "cisco")
|
|||||||
RRA:MAX:0.5:1:600 RRA:MAX:0.5:6:700 RRA:MAX:0.5:24:775 RRA:MAX:0.5:288:797 \
|
RRA:MAX:0.5:1:600 RRA:MAX:0.5:6:700 RRA:MAX:0.5:24:775 RRA:MAX:0.5:288:797 \
|
||||||
RRA:LAST:0.5:1:600 RRA:LAST:0.5:6:700 RRA:LAST:0.5:24:775 RRA:LAST:0.5:288:797");
|
RRA:LAST:0.5:1:600 RRA:LAST:0.5:6:700 RRA:LAST:0.5:24:775 RRA:LAST:0.5:288:797");
|
||||||
}
|
}
|
||||||
|
|
||||||
### Copy HC to non-HC if they exist
|
### Copy HC to non-HC if they exist
|
||||||
if (is_numeric($cef_stat['cefSwitchingHCDrop'])) { $cef_stat['cefSwitchingDrop'] = $cef_stat['cefSwitchingHCDrop']; }
|
if (is_numeric($cef_stat['cefSwitchingHCDrop'])) { $cef_stat['cefSwitchingDrop'] = $cef_stat['cefSwitchingHCDrop']; }
|
||||||
if (is_numeric($cef_stat['cefSwitchingHCPunt'])) { $cef_stat['cefSwitchingPunt'] = $cef_stat['cefSwitchingHCPunt']; }
|
if (is_numeric($cef_stat['cefSwitchingHCPunt'])) { $cef_stat['cefSwitchingPunt'] = $cef_stat['cefSwitchingHCPunt']; }
|
||||||
if (is_numeric($cef_stat['cefSwitchingHCPunt2Host'])) { $cef_stat['cefSwitchingPunt2Host'] = $cef_stat['cefSwitchingHCPunt2Host']; }
|
if (is_numeric($cef_stat['cefSwitchingHCPunt2Host'])) { $cef_stat['cefSwitchingPunt2Host'] = $cef_stat['cefSwitchingHCPunt2Host']; }
|
||||||
|
|
||||||
$cef_stat['update']['drop'] = $cef_stat['cefSwitchingDrop'];
|
$cef_stat['update']['drop'] = $cef_stat['cefSwitchingDrop'];
|
||||||
$cef_stat['update']['punt'] = $cef_stat['cefSwitchingPunt'];
|
$cef_stat['update']['punt'] = $cef_stat['cefSwitchingPunt'];
|
||||||
$cef_stat['update']['punt2host'] = $cef_stat['cefSwitchingPunt2Host'];
|
$cef_stat['update']['punt2host'] = $cef_stat['cefSwitchingPunt2Host'];
|
||||||
@@ -80,25 +80,25 @@ if ($device['os_group'] == "cisco")
|
|||||||
$cef_stat['update']['punt2host_prev'] = $cef_entry['punt2host'];
|
$cef_stat['update']['punt2host_prev'] = $cef_entry['punt2host'];
|
||||||
$cef_stat['update']['updated'] = $polled;
|
$cef_stat['update']['updated'] = $polled;
|
||||||
$cef_stat['update']['updated_prev'] = $cef_entry['updated'];
|
$cef_stat['update']['updated_prev'] = $cef_entry['updated'];
|
||||||
|
|
||||||
dbUpdate($cef_stat['update'], 'cef_switching', '`device_id` = ? AND `entPhysicalIndex` = ? AND `afi` = ? AND `cef_index` = ?', array($device['device_id'], $entity, $afi, $path));
|
dbUpdate($cef_stat['update'], 'cef_switching', '`device_id` = ? AND `entPhysicalIndex` = ? AND `afi` = ? AND `cef_index` = ?', array($device['device_id'], $entity, $afi, $path));
|
||||||
|
|
||||||
$rrd_update = "N:".$cef_stat['cefSwitchingDrop'].":".$cef_stat['cefSwitchingPunt'].":".$cef_stat['cefSwitchingPunt2Host'];
|
$rrd_update = "N:".$cef_stat['cefSwitchingDrop'].":".$cef_stat['cefSwitchingPunt'].":".$cef_stat['cefSwitchingPunt2Host'];
|
||||||
$ret = rrdtool_update("$filename", $rrd_update);
|
$ret = rrdtool_update("$filename", $rrd_update);
|
||||||
|
|
||||||
if ($debug) { echo(" Values: ".$cef_stat['cefSwitchingDrop'].":".$cef_stat['cefSwitchingPunt'].":".$cef_stat['cefSwitchingPunt2Host']); }
|
if ($debug) { echo(" Values: ".$cef_stat['cefSwitchingDrop'].":".$cef_stat['cefSwitchingPunt'].":".$cef_stat['cefSwitchingPunt2Host']); }
|
||||||
|
|
||||||
echo("\n");
|
echo("\n");
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
## 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));
|
||||||
@@ -107,5 +107,5 @@ if ($device['os_group'] == "cisco")
|
|||||||
|
|
||||||
echo("\n");
|
echo("\n");
|
||||||
} # os_group = cisco
|
} # os_group = cisco
|
||||||
|
|
||||||
?>
|
?>
|
||||||
|
|||||||
@@ -7,42 +7,42 @@ if ($device['os_group'] == "cisco")
|
|||||||
$cip_oids = array('cipMacHCSwitchedBytes', 'cipMacHCSwitchedPkts');
|
$cip_oids = array('cipMacHCSwitchedBytes', 'cipMacHCSwitchedPkts');
|
||||||
echo("Cisco MAC - Caching OID: ");
|
echo("Cisco MAC - Caching OID: ");
|
||||||
$cip_array = array();
|
$cip_array = array();
|
||||||
|
|
||||||
foreach ($cip_oids as $oid)
|
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'];
|
||||||
|
|
||||||
$polled_period = $polled - $acc['poll_time'];
|
$polled_period = $polled - $acc['poll_time'];
|
||||||
|
|
||||||
if ($cip_array[$ifIndex][$mac])
|
if ($cip_array[$ifIndex][$mac])
|
||||||
{
|
{
|
||||||
$acc['update']['poll_time'] = $polled;
|
$acc['update']['poll_time'] = $polled;
|
||||||
$acc['update']['poll_prev'] = $acc['poll_time'];
|
$acc['update']['poll_prev'] = $acc['poll_time'];
|
||||||
$acc['update']['poll_period'] = $polled_period;
|
$acc['update']['poll_period'] = $polled_period;
|
||||||
|
|
||||||
$mac_entries++;
|
$mac_entries++;
|
||||||
|
|
||||||
$b_in = $cip_array[$ifIndex][$mac]['cipMacHCSwitchedBytes']['input'];
|
$b_in = $cip_array[$ifIndex][$mac]['cipMacHCSwitchedBytes']['input'];
|
||||||
$b_out = $cip_array[$ifIndex][$mac]['cipMacHCSwitchedBytes']['output'];
|
$b_out = $cip_array[$ifIndex][$mac]['cipMacHCSwitchedBytes']['output'];
|
||||||
$p_in = $cip_array[$ifIndex][$mac]['cipMacHCSwitchedPkts']['input'];
|
$p_in = $cip_array[$ifIndex][$mac]['cipMacHCSwitchedPkts']['input'];
|
||||||
$p_out = $cip_array[$ifIndex][$mac]['cipMacHCSwitchedPkts']['output'];
|
$p_out = $cip_array[$ifIndex][$mac]['cipMacHCSwitchedPkts']['output'];
|
||||||
|
|
||||||
$this_ma = &$cip_array[$ifIndex][$mac];
|
$this_ma = &$cip_array[$ifIndex][$mac];
|
||||||
|
|
||||||
/// Update metrics
|
/// Update metrics
|
||||||
foreach ($cip_oids as $oid)
|
foreach ($cip_oids as $oid)
|
||||||
{
|
{
|
||||||
@@ -62,11 +62,11 @@ if ($device['os_group'] == "cisco")
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($debug) { echo("\n" . $acc['hostname']." ".$acc['ifDescr'] . " $mac -> $b_in:$b_out:$p_in:$p_out "); }
|
if ($debug) { echo("\n" . $acc['hostname']." ".$acc['ifDescr'] . " $mac -> $b_in:$b_out:$p_in:$p_out "); }
|
||||||
|
|
||||||
$rrdfile = $config['rrd_dir'] . "/" . $device['hostname'] . "/" . safename("cip-" . $acc['ifIndex'] . "-" . $acc['mac'] . ".rrd");
|
$rrdfile = $config['rrd_dir'] . "/" . $device['hostname'] . "/" . safename("cip-" . $acc['ifIndex'] . "-" . $acc['mac'] . ".rrd");
|
||||||
|
|
||||||
if (!is_file($rrdfile))
|
if (!is_file($rrdfile))
|
||||||
{
|
{
|
||||||
rrdtool_create($rrdfile,"DS:IN:COUNTER:600:0:12500000000 \
|
rrdtool_create($rrdfile,"DS:IN:COUNTER:600:0:12500000000 \
|
||||||
@@ -84,19 +84,19 @@ if ($device['os_group'] == "cisco")
|
|||||||
}
|
}
|
||||||
$woo = "N:".($b_in+0).":".($b_out+0).":".($p_in+0).":".($p_out+0);
|
$woo = "N:".($b_in+0).":".($b_out+0).":".($p_in+0).":".($p_out+0);
|
||||||
$ret = rrdtool_update("$rrdfile", $woo);
|
$ret = rrdtool_update("$rrdfile", $woo);
|
||||||
|
|
||||||
if ($acc['update'])
|
if ($acc['update'])
|
||||||
{ /// Do Updates
|
{ /// Do Updates
|
||||||
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);
|
unset($cip_array);
|
||||||
|
|
||||||
if ($mac_entries) { echo(" $mac_entries MAC accounting entries\n"); }
|
if ($mac_entries) { echo(" $mac_entries MAC accounting entries\n"); }
|
||||||
|
|
||||||
echo("\n");
|
echo("\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
?>
|
?>
|
||||||
|
|||||||
@@ -60,5 +60,4 @@ if (is_numeric($cpu_usage))
|
|||||||
#$mem=snmp_get($device, "FORTINET-FORTIGATE-MIB::fgSysMemUsage.0", "-Ovq");
|
#$mem=snmp_get($device, "FORTINET-FORTIGATE-MIB::fgSysMemUsage.0", "-Ovq");
|
||||||
#$memsize=snmp_get($device, "FORTINET-FORTIGATE-MIB::fgSysMemCapacity", "-Ovq");
|
#$memsize=snmp_get($device, "FORTINET-FORTIGATE-MIB::fgSysMemCapacity", "-Ovq");
|
||||||
|
|
||||||
|
|
||||||
?>
|
?>
|
||||||
|
|||||||
@@ -446,7 +446,7 @@ foreach ($ports as $port)
|
|||||||
elseif ($port['disabled'] != "1")
|
elseif ($port['disabled'] != "1")
|
||||||
{
|
{
|
||||||
echo("Port Deleted"); ### Port missing from SNMP cache.
|
echo("Port Deleted"); ### Port missing from SNMP cache.
|
||||||
if($port['deleted'] != "1")
|
if ($port['deleted'] != "1")
|
||||||
{
|
{
|
||||||
dbUpdate(array('deleted' => '1'), 'ports', '`device_id` = ? AND `ifIndex` = ?', array($device['device_id'], $port['ifIndex']));
|
dbUpdate(array('deleted' => '1'), 'ports', '`device_id` = ? AND `ifIndex` = ?', array($device['device_id'], $port['ifIndex']));
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -14,7 +14,7 @@ function snmp_get_multi($device, $oids, $options = "-OQUs", $mib = NULL, $mibdir
|
|||||||
{
|
{
|
||||||
global $debug,$config,$runtime_stats,$mibs_loaded;
|
global $debug,$config,$runtime_stats,$mibs_loaded;
|
||||||
|
|
||||||
if(!$options) { $options = "-OQUs"; }
|
if (!$options) { $options = "-OQUs"; }
|
||||||
|
|
||||||
if (is_numeric($device['timeout']) && $device['timeout'] > 0)
|
if (is_numeric($device['timeout']) && $device['timeout'] > 0)
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user