mirror of
				https://github.com/librenms/librenms.git
				synced 2024-10-07 16:52:45 +00:00 
			
		
		
		
	In 2c9df26bbf I broke the association of
  ports in the DB and ports just polled via SNMP for the adsl, etherlike
  and poe submodules and no one noticed. This fixes this issue. Sorry.
Signed-off-by: Maximilian Wilhelm <max@rfc2324.org>
		
	
		
			
				
	
	
		
			42 lines
		
	
	
		
			1.2 KiB
		
	
	
	
		
			PHP
		
	
	
	
	
	
			
		
		
	
	
			42 lines
		
	
	
		
			1.2 KiB
		
	
	
	
		
			PHP
		
	
	
	
	
	
<?php
 | 
						|
 | 
						|
if ($port_stats[$ifIndex] &&
 | 
						|
    $port['ifType'] == 'ethernetCsmacd' &&
 | 
						|
    isset($port_stats[$ifIndex]['dot3StatsIndex'])) {
 | 
						|
    // Check to make sure Port data is cached.
 | 
						|
    $this_port = &$port_stats[$ifIndex];
 | 
						|
 | 
						|
    // TODO: remove legacy check?
 | 
						|
    $old_rrdfile = $config['rrd_dir'].'/'.$device['hostname'].'/'.safename('etherlike-'.$port['ifIndex'].'.rrd');
 | 
						|
    $rrd_file    = get_port_rrdfile_path ($device['hostname'], $port_id, 'dot3');
 | 
						|
 | 
						|
    $rrd_create = $config['rrd_rra'];
 | 
						|
 | 
						|
    if (!file_exists($rrdfile)) {
 | 
						|
        if (file_exists($old_rrdfile)) {
 | 
						|
            rename($old_rrdfile, $rrd_file);
 | 
						|
        }
 | 
						|
        else {
 | 
						|
            foreach ($etherlike_oids as $oid) {
 | 
						|
                $oid         = truncate(str_replace('dot3Stats', '', $oid), 19, '');
 | 
						|
                $rrd_create .= " DS:$oid:COUNTER:600:U:100000000000";
 | 
						|
            }
 | 
						|
 | 
						|
            rrdtool_create($rrdfile, $rrd_create);
 | 
						|
        }
 | 
						|
    }
 | 
						|
 | 
						|
    $fields = array();
 | 
						|
    foreach ($etherlike_oids as $oid) {
 | 
						|
        $data           = ($this_port[$oid] + 0);
 | 
						|
        $fields[$oid] = $data;
 | 
						|
    }
 | 
						|
 | 
						|
    rrdtool_update($rrdfile, $fields);
 | 
						|
 | 
						|
    $tags = array('ifName' => $port['ifName']);
 | 
						|
    influx_update($device,'dot3',$tags,$fields);
 | 
						|
 | 
						|
    echo 'EtherLike ';
 | 
						|
}
 |