mirror of
				https://github.com/librenms/librenms.git
				synced 2024-10-07 16:52:45 +00:00 
			
		
		
		
	Use data_update instead of rrd_update/rrd_create and influx_update Centralize rrd file check so we can check against a remote rrdcached server too Use rrd_name() to generate rrd file names
		
			
				
	
	
		
			61 lines
		
	
	
		
			1.9 KiB
		
	
	
	
		
			PHP
		
	
	
	
	
	
			
		
		
	
	
			61 lines
		
	
	
		
			1.9 KiB
		
	
	
	
		
			PHP
		
	
	
	
	
	
<?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',
 | 
						|
);
 | 
						|
 | 
						|
if ($this_port['dot3StatsIndex'] && $port['ifType'] == 'ethernetCsmacd') {
 | 
						|
    $rrd_name = getPortRrdName($port_id, 'poe');
 | 
						|
    $rrd_def = array(
 | 
						|
        'DS:PortPwrAllocated:GAUGE:600:0:U',
 | 
						|
        'DS:PortPwrAvailable:GAUGE:600:0:U',
 | 
						|
        'DS:PortConsumption:DERIVE:600:0:U',
 | 
						|
        'DS:PortMaxPwrDrawn:GAUGE:600:0:U'
 | 
						|
    );
 | 
						|
 | 
						|
    $upd = "$polled:".$port['cpeExtPsePortPwrAllocated'].':'.$port['cpeExtPsePortPwrAvailable'].':'.$port['cpeExtPsePortPwrConsumption'].':'.$port['cpeExtPsePortMaxPwrDrawn'];
 | 
						|
 | 
						|
    $fields = array(
 | 
						|
        'PortPwrAllocated'   => $port['cpeExtPsePortPwrAllocated'],
 | 
						|
        'PortPwrAvailable'   => $port['cpeExtPsePortPwrAvailable'],
 | 
						|
        'PortConsumption'    => $port['cpeExtPsePortPwrConsumption'],
 | 
						|
        'PortMaxPwrDrawn'    => $port['cpeExtPsePortMaxPwrDrawn'],
 | 
						|
    );
 | 
						|
 | 
						|
    $tags = compact('ifName', 'rrd_name', 'rrd_def');
 | 
						|
    data_update($device,'poe',$tags,$fields);
 | 
						|
 | 
						|
    echo 'PoE ';
 | 
						|
}//end if
 |