mirror of
				https://github.com/librenms/librenms.git
				synced 2024-10-07 16:52:45 +00:00 
			
		
		
		
	
		
			
				
	
	
		
			57 lines
		
	
	
		
			1.6 KiB
		
	
	
	
		
			PHP
		
	
	
	
	
	
			
		
		
	
	
			57 lines
		
	
	
		
			1.6 KiB
		
	
	
	
		
			PHP
		
	
	
	
	
	
| <?php
 | |
| 
 | |
| if ($device['os'] != 'Snom') {
 | |
|     echo ' ICMP';
 | |
| 
 | |
|     // Below have more oids, and are in trees by themselves, so we can snmpwalk_cache_oid them
 | |
|     $oids = array(
 | |
|         'icmpInMsgs',
 | |
|         'icmpOutMsgs',
 | |
|         'icmpInErrors',
 | |
|         'icmpOutErrors',
 | |
|         'icmpInEchos',
 | |
|         'icmpOutEchos',
 | |
|         'icmpInEchoReps',
 | |
|         'icmpOutEchoReps',
 | |
|         'icmpInDestUnreachs',
 | |
|         'icmpOutDestUnreachs',
 | |
|         'icmpInParmProbs',
 | |
|         'icmpInTimeExcds',
 | |
|         'icmpInSrcQuenchs',
 | |
|         'icmpInRedirects',
 | |
|         'icmpInTimestamps',
 | |
|         'icmpInTimestampReps',
 | |
|         'icmpInAddrMasks',
 | |
|         'icmpInAddrMaskReps',
 | |
|         'icmpOutTimeExcds',
 | |
|         'icmpOutParmProbs',
 | |
|         'icmpOutSrcQuenchs',
 | |
|         'icmpOutRedirects',
 | |
|         'icmpOutTimestamps',
 | |
|         'icmpOutTimestampReps',
 | |
|         'icmpOutAddrMasks',
 | |
|         'icmpOutAddrMaskReps',
 | |
|     );
 | |
| 
 | |
|     $data = snmpwalk_cache_oid($device, 'icmp', array(), 'IP-MIB');
 | |
|     $data = $data[0];
 | |
| 
 | |
|     if (isset($data['icmpInMsgs']) && isset($data['icmpOutMsgs'])) {
 | |
|         $rrd_def = array();
 | |
|         $fields = array();
 | |
|         foreach ($oids as $oid) {
 | |
|             $oid_ds    = truncate($oid, 19, '');
 | |
|             $rrd_def[] = "DS:$oid_ds:COUNTER:600:U:100000000000";
 | |
|             $fields[$oid] = isset($data[$oid]) ? $data[$oid] : 'U';
 | |
|         }
 | |
| 
 | |
|         $tags = compact('rrd_def');
 | |
|         data_update($device, 'netstats-icmp', $tags, $fields);
 | |
| 
 | |
|         $graphs['netstat_icmp']      = true;
 | |
|         $graphs['netstat_icmp_info'] = true;
 | |
|     }
 | |
| 
 | |
|     unset($oids, $data, $rrd_def, $fields, $tags);
 | |
| }//end if
 |