mirror of
https://github.com/librenms/librenms.git
synced 2024-10-07 16:52:45 +00:00
reworking poe polling a bit, but still unpolished or even unfinished
git-svn-id: http://www.observium.org/svn/observer/trunk@1633 61d68cd4-352d-0410-923a-c4978735b2b8
This commit is contained in:
@ -129,6 +129,7 @@ $config['enable_ports_Xbcmc'] = 1; # Enable ifXEntry broadcast/multica
|
||||
$config['enable_ports_etherlike'] = 0; # Enable Polling EtherLike-MIB (doubles interface processing time)
|
||||
$config['enable_ports_junoseatmvp'] = 0; # Enable JunOSe ATM VC Discovery/Poller
|
||||
$config['enable_ports_adsl'] = 1; # Enable ADSL-LINE-MIB
|
||||
$config['enable_ports_poe'] = 0; # Enable PoE stats collection
|
||||
|
||||
### Billing System Configuration
|
||||
|
||||
|
@ -1,63 +0,0 @@
|
||||
<?php
|
||||
|
||||
if($device['os_group'] == "ios") {
|
||||
|
||||
$array = snmp_cache_portIfIndex ($device, $array);
|
||||
|
||||
$cpe_oids = array("cpeExtPsePortEnable", "cpeExtPsePortDiscoverMode", "cpeExtPsePortDeviceDetected", "cpeExtPsePortIeeePd",
|
||||
"cpeExtPsePortAdditionalStatus", "cpeExtPsePortPwrMax", "cpeExtPsePortPwrAllocated", "cpeExtPsePortPwrAvailable", "cpeExtPsePortPwrConsumption",
|
||||
"cpeExtPsePortMaxPwrDrawn", "cpeExtPsePortEntPhyIndex", "cpeExtPsePortEntPhyIndex", "cpeExtPsePortPolicingCapable", "cpeExtPsePortPolicingEnable",
|
||||
"cpeExtPsePortPolicingAction", "cpeExtPsePortPwrManAlloc");
|
||||
|
||||
$peth_oids = array("pethPsePortAdminEnable", "pethPsePortPowerPairsControlAbility", "pethPsePortPowerPairs", "pethPsePortDetectionStatus",
|
||||
"pethPsePortPowerPriority", "pethPsePortMPSAbsentCounter", "pethPsePortType", "pethPsePortPowerClassifications", "pethPsePortInvalidSignatureCounter",
|
||||
"pethPsePortPowerDeniedCounter", "pethPsePortOverLoadCounter", "pethPsePortShortCounter");
|
||||
|
||||
$sub_start = utime();
|
||||
echo("Caching Oids: ");
|
||||
foreach ($cpe_oids as $oid) { echo("$oid "); $array = snmp_cache_slotport_oid($oid, $device, $array, "CISCO-POWER-ETHERNET-EXT-MIB"); }
|
||||
foreach ($peth_oids as $oid) { echo("$oid "); $array = snmp_cache_slotport_oid($oid, $device, $array, "POWER-ETHERNET-MIB"); }
|
||||
$end = utime(); $run = $end - $sub_start; $proctime = substr($run, 0, 5);
|
||||
echo("\n$proctime secs\n");
|
||||
|
||||
$polled = time();
|
||||
|
||||
$port_query = mysql_query("SELECT * FROM `ports` WHERE `device_id` = '".$device['device_id']."'");
|
||||
while ($port = mysql_fetch_array($port_query)) {
|
||||
|
||||
if($array[$device[device_id]][$port[ifIndex]]) { // Check to make sure Port data is cached.
|
||||
|
||||
echo(" --> " . $port['ifDescr'] . " POE");
|
||||
|
||||
/// Update RRDs
|
||||
$rrdfile = $host_rrd . "/" . safename($port['ifIndex'] . ".rrd");
|
||||
if(!is_file($rrdfile)) {
|
||||
$woo = shell_exec($config['rrdtool'] . " create $rrdfile -s 300 \
|
||||
DS:PortPwrAllocated:GAUGE:600:0:12500000000 \
|
||||
DS:PortPwrAvailable:GAUGE:600:0:12500000000 \
|
||||
DS:PortConsumption:DERIVE:600:0:12500000000 \
|
||||
DS:PortMaxPwrDrawn:GAUGE:600:0:12500000000 \
|
||||
RRA:AVERAGE:0.5:1:600 \
|
||||
RRA:AVERAGE:0.5:6:700 \
|
||||
RRA:AVERAGE:0.5:24:775 \
|
||||
RRA:AVERAGE: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");
|
||||
}
|
||||
|
||||
$woo = "$polled:".$port['cpeExtPsePortPwrAllocated'].":".$port['cpeExtPsePortPwrAvailable'].":".$port['cpeExtPsePortPwrConsumption'].":".$port['cpeExtPsePortMaxPwrDrawn'];
|
||||
$ret = rrdtool_update("$rrdfile", $woo);
|
||||
|
||||
/// End Update POE-RRD
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
?>
|
@ -40,9 +40,9 @@
|
||||
# adslAturPerfValidIntervals.1 = 0
|
||||
# adslAturPerfInvalidIntervals.1 = 0
|
||||
|
||||
if(isset($port_stats[$device[device_id]][$port[ifIndex]]['adslLineCoding'])) { // Check to make sure Port data is cached.
|
||||
if(isset($port_stats[$device['device_id']][$port['ifIndex']]['adslLineCoding'])) { // Check to make sure Port data is cached.
|
||||
|
||||
$this_port = &$port_stats[$device[device_id]][$port[ifIndex]];
|
||||
$this_port = &$port_stats[$device['device_id']][$port['ifIndex']];
|
||||
|
||||
$rrdfile = $config['rrd_dir'] . "/" . $device['hostname'] . "/" . safename("port-".$port['ifIndex']."-adsl.rrd");
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
<?php
|
||||
|
||||
if($port_stats[$device[device_id]][$port[ifIndex]] && $port['ifType'] == "ethernetCsmacd"
|
||||
&& isset($port_stats[$device[device_id]][$port[ifIndex]]['dot3StatsIndex'])) { // Check to make sure Port data is cached.
|
||||
if($port_stats[$device['device_id']][$port['ifIndex']] && $port['ifType'] == "ethernetCsmacd"
|
||||
&& isset($port_stats[$device['device_id']][$port['ifIndex']]['dot3StatsIndex'])) { // Check to make sure Port data is cached.
|
||||
|
||||
$this_port = &$port_stats[$device[device_id]][$port[ifIndex]];
|
||||
|
||||
|
43
includes/polling/port-poe.inc.php
Executable file
43
includes/polling/port-poe.inc.php
Executable file
@ -0,0 +1,43 @@
|
||||
<?php
|
||||
|
||||
$cpe_oids = array('cpeExtPsePortEnable', 'cpeExtPsePortDiscoverMode', 'cpeExtPsePortDeviceDetected', 'cpeExtPsePortIeeePd',
|
||||
'cpeExtPsePortAdditionalStatus', 'cpeExtPsePortPwrMax', 'cpeExtPsePortPwrAllocated', 'cpeExtPsePortPwrAvailable', 'cpeExtPsePortPwrConsumption',
|
||||
'cpeExtPsePortMaxPwrDrawn', 'cpeExtPsePortEntPhyIndex', 'cpeExtPsePortEntPhyIndex', 'cpeExtPsePortPolicingCapable', 'cpeExtPsePortPolicingEnable',
|
||||
'cpeExtPsePortPolicingAction', 'cpeExtPsePortPwrManAlloc');
|
||||
|
||||
$peth_oids = array('pethPsePortAdminEnable', 'pethPsePortPowerPairsControlAbility', 'pethPsePortPowerPairs', 'pethPsePortDetectionStatus',
|
||||
'pethPsePortPowerPriority', 'pethPsePortMPSAbsentCounter', 'pethPsePortType', 'pethPsePortPowerClassifications', 'pethPsePortInvalidSignatureCounter',
|
||||
'pethPsePortPowerDeniedCounter', 'pethPsePortOverLoadCounter', 'pethPsePortShortCounter', 'pethMainPseConsumptionPower');
|
||||
|
||||
$port_stats = snmpwalk_cache_oid($device, "pethPsePortEntry", $port_stats, "POWER-ETHERNET-MIB");
|
||||
$port_stats = snmpwalk_cache_oid($device, "cpeExtPsePortEntry", $port_stats, "CISCO-POWER-ETHERNET-EXT-MIB");
|
||||
|
||||
if($port_stats[$device['device_id']][$port['ifIndex']] && $port['ifType'] == "ethernetCsmacd"
|
||||
&& isset($port_stats[$device['device_id']][$port['ifIndex']]['dot3StatsIndex']))
|
||||
{ // Check to make sure Port data is cached.
|
||||
|
||||
$this_port = &$port_stats[$device['device_id']][$port['ifIndex']];
|
||||
|
||||
$rrdfile = $config['rrd_dir'] . "/" . $device['hostname'] . "/" . safename("port-".$port['ifIndex']."-poe.rrd");
|
||||
|
||||
if(!file_exists($rrdfile))
|
||||
{
|
||||
$rrd_create = $config['rrdtool'] . " create $rrdfile ";
|
||||
$rrd_create .= "RRA:AVERAGE:0.5:1:600 RRA:AVERAGE:0.5:6:700 RRA:AVERAGE:0.5:24:775 RRA:AVERAGE: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";
|
||||
|
||||
# FIXME CISCOSPECIFIC
|
||||
$rrd_create .= " DS:PortPwrAllocated:GAUGE:600:0:U";
|
||||
$rrd_create .= " DS:PortPwrAvailable:GAUGE:600:0:U";
|
||||
$rrd_create .= " DS:PortConsumption:DERIVE:600:0:U";
|
||||
$rrd_create .= " DS:PortMaxPwrDrawn:GAUGE:600:0:U ";
|
||||
|
||||
shell_exec($rrd_create);*/
|
||||
}
|
||||
|
||||
$upd = "$polled:".$port['cpeExtPsePortPwrAllocated'].":".$port['cpeExtPsePortPwrAvailable'].":".$port['cpeExtPsePortPwrConsumption'].":".$port['cpeExtPsePortMaxPwrDrawn'];
|
||||
$ret = rrdtool_update("$rrdfile", $upd);
|
||||
|
||||
echo("PoE ");
|
||||
}
|
||||
?>
|
@ -1,4 +1,4 @@
|
||||
<?php
|
||||
[B<?php
|
||||
|
||||
unset($ports);
|
||||
$ports = snmp_cache_ifIndex($device); // Cache Port List
|
||||
@ -145,7 +145,6 @@
|
||||
|
||||
if(isset($config['port_descr_parser']) && is_file($config['install_dir'] . "/" . $config['port_descr_parser']))
|
||||
{
|
||||
|
||||
$port_attribs = array('type','descr','circuit','speed','notes');
|
||||
include($config['install_dir'] . "/" . $config['port_descr_parser']);
|
||||
|
||||
@ -245,8 +244,12 @@
|
||||
|
||||
/// Do EtherLike-MIB
|
||||
if($config['enable_ports_etherlike']) { include("port-etherlike.inc.php"); }
|
||||
|
||||
/// Do ADSL MIB
|
||||
if($config['enable_ports_adsl']) { include("port-adsl.inc.php"); }
|
||||
|
||||
|
||||
/// Do PoE MIBs
|
||||
if($config['enable_ports_poe']) { include("port-poe.inc.php"); }
|
||||
|
||||
// Update MySQL
|
||||
if ($update) {
|
||||
|
Reference in New Issue
Block a user