2010-01-07 18:27:33 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								< ? php 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2015-07-13 20:10:26 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								echo  '<table width="100%">' ; 
							 
						 
					
						
							
								
									
										
										
										
											2010-01-07 18:27:33 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2012-05-25 12:24:34 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								// FIXME missing heading
 
							 
						 
					
						
							
								
									
										
										
										
											2015-07-13 20:10:26 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								foreach  ( dbFetchRows ( 'SELECT * FROM `hrDevice` WHERE `device_id` = ? ORDER BY `hrDeviceIndex`' ,  array ( $device [ 'device_id' ]))  as  $hrdevice )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    echo  " <tr class='list'><td> " . $hrdevice [ 'hrDeviceIndex' ] . '</td>' ; 
							 
						 
					
						
							
								
									
										
										
										
											2012-04-10 17:21:49 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2015-07-13 20:10:26 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								    if  ( $hrdevice [ 'hrDeviceType' ]  ==  'hrDeviceProcessor' )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        $proc_id      =  dbFetchCell ( " SELECT processor_id FROM processors WHERE device_id = ' " . $device [ 'device_id' ] . " ' AND hrDeviceIndex = ' " . $hrdevice [ 'hrDeviceIndex' ] . " ' " ); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        $proc_url     =  'device/device=' . $device [ 'device_id' ] . '/tab=health/metric=processor/' ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        $proc_popup   =  " onmouseover= \" return overlib('<div class=list-large> " . $device [ 'hostname' ] . ' - ' . $hrdevice [ 'hrDeviceDescr' ]; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        $proc_popup  .=  " </div><img src= \ 'graph.php?id= " . $proc_id . '&type=processor_usage&from=' . $config [ 'time' ][ 'month' ] . '&to=' . $config [ 'time' ][ 'now' ] . " &width=400&height=125 \ '> " ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        $proc_popup  .=  " ', RIGHT " . $config [ 'overlib_defaults' ] . ');" onmouseout="return nd();"' ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        echo  " <td><a href=' $proc_url '  $proc_popup > " . $hrdevice [ 'hrDeviceDescr' ] . '</a></td>' ; 
							 
						 
					
						
							
								
									
										
										
										
											2010-01-07 18:27:33 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2015-07-13 20:10:26 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        $graph_array [ 'height' ]       =  '20' ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        $graph_array [ 'width' ]        =  '100' ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        $graph_array [ 'to' ]           =  $config [ 'time' ][ 'now' ]; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        $graph_array [ 'id' ]           =  $proc_id ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        $graph_array [ 'type' ]         =  'processor_usage' ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        $graph_array [ 'from' ]         =  $config [ 'time' ][ 'day' ]; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        $graph_array_zoom            =  $graph_array ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        $graph_array_zoom [ 'height' ]  =  '150' ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        $graph_array_zoom [ 'width' ]   =  '400' ; 
							 
						 
					
						
							
								
									
										
										
										
											2011-03-16 23:10:10 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2015-07-13 20:10:26 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        $mini_graph  =  overlib_link ( $proc_url ,  generate_graph_tag ( $graph_array ),  generate_graph_tag ( $graph_array_zoom ),  null ); 
							 
						 
					
						
							
								
									
										
										
										
											2011-03-16 23:10:10 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2015-07-13 20:10:26 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        echo  '<td>' . $mini_graph . '</td>' ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    else  if  ( $hrdevice [ 'hrDeviceType' ]  ==  'hrDeviceNetwork' )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        $int        =  str_replace ( 'network interface ' ,  '' ,  $hrdevice [ 'hrDeviceDescr' ]); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        $interface  =  dbFetchRow ( 'SELECT * FROM ports WHERE device_id = ? AND ifDescr = ?' ,  array ( $device [ 'device_id' ],  $int )); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        if  ( $interface [ 'ifIndex' ])  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								            echo  '<td>' . generate_port_link ( $interface ) . '</td>' ; 
							 
						 
					
						
							
								
									
										
										
										
											2011-03-16 23:10:10 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2015-07-13 20:10:26 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								            $graph_array [ 'height' ]       =  '20' ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								            $graph_array [ 'width' ]        =  '100' ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								            $graph_array [ 'to' ]           =  $config [ 'time' ][ 'now' ]; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								            $graph_array [ 'id' ]           =  $interface [ 'port_id' ]; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								            $graph_array [ 'type' ]         =  'port_bits' ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								            $graph_array [ 'from' ]         =  $config [ 'time' ][ 'day' ]; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								            $graph_array_zoom            =  $graph_array ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								            $graph_array_zoom [ 'height' ]  =  '150' ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								            $graph_array_zoom [ 'width' ]   =  '400' ; 
							 
						 
					
						
							
								
									
										
										
										
											2011-03-16 23:10:10 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2015-07-13 20:10:26 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								            // FIXME click on graph should also link to port, but can't use generate_port_link here...
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								            $mini_graph  =  overlib_link ( generate_port_url ( $interface ),  generate_graph_tag ( $graph_array ),  generate_graph_tag ( $graph_array_zoom ),  null ); 
							 
						 
					
						
							
								
									
										
										
										
											2011-03-16 23:10:10 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2015-07-13 20:10:26 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								            echo  " <td> $mini_graph </td> " ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        else  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								            echo  '<td>' . stripslashes ( $hrdevice [ 'hrDeviceDescr' ]) . '</td>' ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								            echo  '<td></td>' ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        } 
							 
						 
					
						
							
								
									
										
										
										
											2011-03-16 23:10:10 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								    } 
							 
						 
					
						
							
								
									
										
										
										
											2015-07-13 20:10:26 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								    else  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        echo  '<td>' . stripslashes ( $hrdevice [ 'hrDeviceDescr' ]) . '</td>' ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        echo  '<td></td>' ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    } //end if
 
							 
						 
					
						
							
								
									
										
										
										
											2010-01-07 18:27:33 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2015-07-13 20:10:26 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								    echo  '<td>' . $hrdevice [ 'hrDeviceType' ] . '</td><td>' . $hrdevice [ 'hrDeviceStatus' ] . '</td>' ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    echo  '<td>' . $hrdevice [ 'hrDeviceErrors' ] . '</td><td>' . $hrdevice [ 'hrProcessorLoad' ] . '</td>' ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    echo  '</tr>' ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								} //end foreach
 
							 
						 
					
						
							
								
									
										
										
										
											2010-01-07 18:27:33 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2015-07-13 20:10:26 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								echo  '</table>' ; 
							 
						 
					
						
							
								
									
										
										
										
											2011-10-18 14:27:21 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2015-07-13 20:10:26 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								$pagetitle []  =  'Inventory' ;