| 
									
										
										
										
											2009-11-24 23:58:56 +00:00
										 |  |  | <?php | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2011-03-16 01:11:27 +00:00
										 |  |  | if ($port_stats[$port['ifIndex']] && $port['ifType'] == "ethernetCsmacd" | 
					
						
							|  |  |  |    && isset($port_stats[$port['ifIndex']]['dot3StatsIndex'])) | 
					
						
							|  |  |  | { // Check to make sure Port data is cached.
 | 
					
						
							| 
									
										
										
										
											2009-11-24 23:58:56 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2011-03-16 01:11:27 +00:00
										 |  |  |   $this_port = &$port_stats[$port[ifIndex]]; | 
					
						
							| 
									
										
										
										
											2009-11-24 23:58:56 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2011-03-16 01:11:27 +00:00
										 |  |  |   $old_rrdfile = $config['rrd_dir'] . "/" . $device['hostname'] . "/" . safename("etherlike-".$port['ifIndex'].".rrd"); | 
					
						
							|  |  |  |   $rrdfile = $config['rrd_dir'] . "/" . $device['hostname'] . "/" . safename("port-".$port['ifIndex']."-dot3.rrd"); | 
					
						
							| 
									
										
										
										
											2009-11-24 23:58:56 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2012-04-20 17:37:58 +00:00
										 |  |  |   $rrd_create = $config['rrd_rra']; | 
					
						
							| 
									
										
										
										
											2011-03-16 01:11:27 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  |   if (!file_exists($rrdfile)) | 
					
						
							|  |  |  |   { | 
					
						
							|  |  |  |     if (file_exists($old_rrdfile)) | 
					
						
							|  |  |  |     { | 
					
						
							|  |  |  |       rename($old_rrdfile,$rrd_file); | 
					
						
							| 
									
										
										
										
											2009-11-24 23:58:56 +00:00
										 |  |  |     } | 
					
						
							| 
									
										
										
										
											2011-03-16 01:11:27 +00:00
										 |  |  |     else | 
					
						
							|  |  |  |     { | 
					
						
							|  |  |  |       foreach ($etherlike_oids as $oid) | 
					
						
							|  |  |  |       { | 
					
						
							|  |  |  |         $oid = truncate(str_replace("dot3Stats", "", $oid), 19, ''); | 
					
						
							|  |  |  |         $rrd_create .= " DS:$oid:COUNTER:600:U:100000000000"; | 
					
						
							|  |  |  |       } | 
					
						
							| 
									
										
										
										
											2011-03-21 11:44:17 +00:00
										 |  |  |       rrdtool_create($rrdfile, $rrd_create); | 
					
						
							| 
									
										
										
										
											2011-03-16 01:11:27 +00:00
										 |  |  |     } | 
					
						
							|  |  |  |   } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   $rrdupdate = "N"; | 
					
						
							|  |  |  |   foreach ($etherlike_oids as $oid) | 
					
						
							|  |  |  |   { | 
					
						
							|  |  |  |     $data = $this_port[$oid] + 0; | 
					
						
							|  |  |  |     $rrdupdate .= ":$data"; | 
					
						
							|  |  |  |   } | 
					
						
							|  |  |  |   rrdtool_update($rrdfile, $rrdupdate); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   echo("EtherLike "); | 
					
						
							|  |  |  | } | 
					
						
							| 
									
										
										
										
											2009-11-24 23:58:56 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2011-05-03 21:17:04 +00:00
										 |  |  | ?>
 |