| 
									
										
										
										
											2011-11-29 10:34:18 +00:00
										 |  |  | <?php | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2012-05-25 12:24:34 +00:00
										 |  |  | // Generate a list of ports and then call the multi_bits grapher to generate from the list
 | 
					
						
							| 
									
										
										
										
											2015-07-10 13:36:21 +02:00
										 |  |  | $ds_in  = 'INOCTETS'; | 
					
						
							|  |  |  | $ds_out = 'OUTOCTETS'; | 
					
						
							| 
									
										
										
										
											2011-11-29 10:34:18 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-07-10 13:36:21 +02:00
										 |  |  | $i = 1; | 
					
						
							|  |  |  | foreach ($devices as $device) { | 
					
						
							| 
									
										
										
										
											2015-07-13 20:10:26 +02:00
										 |  |  |     foreach (dbFetchRows('SELECT * FROM `ports` WHERE `device_id` = ?', array($device['device_id'])) as $int) { | 
					
						
							| 
									
										
										
										
											2015-07-10 13:36:21 +02:00
										 |  |  |         $ignore = 0; | 
					
						
							|  |  |  |         if (is_array($config['device_traffic_iftype'])) { | 
					
						
							| 
									
										
										
										
											2015-07-13 20:10:26 +02:00
										 |  |  |             foreach ($config['device_traffic_iftype'] as $iftype) { | 
					
						
							| 
									
										
										
										
											2015-07-10 13:36:21 +02:00
										 |  |  |                 if (preg_match($iftype.'i', $int['ifType'])) { | 
					
						
							|  |  |  |                     $ignore = 1; | 
					
						
							|  |  |  |                 } | 
					
						
							|  |  |  |             } | 
					
						
							|  |  |  |         } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |         if (is_array($config['device_traffic_descr'])) { | 
					
						
							| 
									
										
										
										
											2015-07-13 20:10:26 +02:00
										 |  |  |             foreach ($config['device_traffic_descr'] as $ifdescr) { | 
					
						
							| 
									
										
										
										
											2015-07-10 13:36:21 +02:00
										 |  |  |                 if (preg_match($ifdescr.'i', $int['ifDescr']) || preg_match($ifdescr.'i', $int['ifName']) || preg_match($ifdescr.'i', $int['portName'])) { | 
					
						
							|  |  |  |                     $ignore = 1; | 
					
						
							|  |  |  |                 } | 
					
						
							|  |  |  |             } | 
					
						
							|  |  |  |         } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-08-18 20:28:22 -05:00
										 |  |  |         $rrd_file = get_port_rrdfile_path($device['hostname'], $int['port_id']); | 
					
						
							| 
									
										
										
										
											2016-07-08 15:09:11 -05:00
										 |  |  |         if (rrdtool_check_rrd_exists($rrd_file) && $ignore != 1) { | 
					
						
							| 
									
										
										
										
											2016-01-21 22:04:33 +01:00
										 |  |  |             $rrd_filename              = $rrd_file; // FIXME: Can this be unified without side-effects?
 | 
					
						
							| 
									
										
										
										
											2015-07-10 13:36:21 +02:00
										 |  |  |             $rrd_list[$i]['filename']  = $rrd_filename; | 
					
						
							|  |  |  |             $rrd_list[$i]['descr']     = $port['label']; | 
					
						
							|  |  |  |             $rrd_list[$i]['descr_in']  = $device['hostname']; | 
					
						
							|  |  |  |             $rrd_list[$i]['descr_out'] = $port['ifAlias']; | 
					
						
							|  |  |  |             $rrd_list[$i]['ds_in']     = $ds_in; | 
					
						
							|  |  |  |             $rrd_list[$i]['ds_out']    = $ds_out; | 
					
						
							|  |  |  |             $i++; | 
					
						
							|  |  |  |         } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |         unset($ignore); | 
					
						
							|  |  |  |     }//end foreach
 | 
					
						
							|  |  |  | }//end foreach
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | $units       = 'b'; | 
					
						
							|  |  |  | $total_units = 'B'; | 
					
						
							|  |  |  | $colours_in  = 'greens'; | 
					
						
							|  |  |  | $multiplier  = '8'; | 
					
						
							| 
									
										
										
										
											2011-11-29 10:46:02 +00:00
										 |  |  | $colours_out = 'blues'; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | $nototal = 1; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-07-10 13:36:21 +02:00
										 |  |  | $graph_title .= '::bits'; | 
					
						
							| 
									
										
										
										
											2011-11-29 10:34:18 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-07-10 13:36:21 +02:00
										 |  |  | $colour_line_in  = '006600'; | 
					
						
							|  |  |  | $colour_line_out = '000099'; | 
					
						
							|  |  |  | $colour_area_in  = 'CDEB8B'; | 
					
						
							|  |  |  | $colour_area_out = 'C3D9FF'; | 
					
						
							| 
									
										
										
										
											2011-11-29 10:34:18 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-07-10 13:36:21 +02:00
										 |  |  | require 'includes/graphs/generic_multi_bits_separated.inc.php'; |