2010-01-07 18:27:33 +00:00
< ? php
echo ( " <table width=100%> " );
2010-07-17 16:54:06 +00:00
$hrdevices = mysql_query ( " SELECT * FROM `hrDevice` WHERE `device_id` = ' " . $device [ 'device_id' ] . " ' ORDER BY `hrDeviceIndex` " );
2011-04-06 13:54:50 +00:00
while ( $hrdevice = mysql_fetch_assoc ( $hrdevices ))
2011-03-16 23:10:10 +00:00
{
2010-01-07 18:27:33 +00:00
echo ( " <tr><td> " . $hrdevice [ 'hrDeviceIndex' ] . " </td> " );
2011-03-16 23:10:10 +00:00
if ( $hrdevice [ 'hrDeviceType' ] == " hrDeviceProcessor " )
{
$proc_id = mysql_result ( mysql_query ( " SELECT processor_id FROM processors WHERE device_id = ' " . $device [ 'device_id' ] . " ' AND hrDeviceIndex = ' " . $hrdevice [ 'hrDeviceIndex' ] . " ' " ), 0 );
$proc_url = $config [ 'base_url' ] . " /device/ " . $device [ 'device_id' ] . " /health/processors/ " ;
$proc_popup = " onmouseover= \" return overlib('<div class=list-large> " . $device [ 'hostname' ] . " - " . $hrdevice [ 'hrDeviceDescr' ];
2011-03-28 09:11:05 +00:00
$proc_popup .= " </div><img src= \ ' " . $config [ 'base_url' ] . " /graph.php?id= " . $proc_id . " &type=processor_usage&from= $month &to= $now &width=400&height=125 \ '> " ;
2011-03-16 23:10:10 +00:00
$proc_popup .= " ', RIGHT " . $config [ 'overlib_defaults' ] . " ); \" onmouseout= \" return nd(); \" " ;
echo ( " <td><a href=' $proc_url ' $proc_popup > " . $hrdevice [ 'hrDeviceDescr' ] . " </a></td> " );
$graph_array [ 'height' ] = " 20 " ;
$graph_array [ 'width' ] = " 100 " ;
$graph_array [ 'to' ] = $now ;
$graph_array [ 'id' ] = $proc_id ;
$graph_array [ 'type' ] = 'processor_usage' ;
$graph_array [ 'from' ] = $day ;
$graph_array_zoom = $graph_array ; $graph_array_zoom [ 'height' ] = " 150 " ; $graph_array_zoom [ 'width' ] = " 400 " ;
$mini_graph = overlib_link ( $_SERVER [ 'REQUEST_URI' ], generate_graph_tag ( $graph_array ), generate_graph_tag ( $graph_array_zoom ), NULL );
echo ( '<td>' . $mini_graph . '</td>' );
} elseif ( $hrdevice [ 'hrDeviceType' ] == " hrDeviceNetwork " ) {
$int = str_replace ( " network interface " , " " , $hrdevice [ 'hrDeviceDescr' ]);
2011-04-06 13:54:50 +00:00
$interface = mysql_fetch_assoc ( mysql_query ( " SELECT * FROM ports WHERE device_id = ' " . $device [ 'device_id' ] . " ' AND ifDescr = ' " . $int . " ' " ));
if ( $interface [ 'ifIndex' ])
{
2011-03-16 23:10:10 +00:00
echo ( " <td> " . generate_port_link ( $interface ) . " </td> " );
$graph_array [ 'height' ] = " 20 " ;
$graph_array [ 'width' ] = " 100 " ;
$graph_array [ 'to' ] = $now ;
$graph_array [ 'id' ] = $interface [ 'interface_id' ];
$graph_array [ 'type' ] = 'port_bits' ;
$graph_array [ 'from' ] = $day ;
$graph_array_zoom = $graph_array ; $graph_array_zoom [ 'height' ] = " 150 " ; $graph_array_zoom [ 'width' ] = " 400 " ;
$mini_graph = overlib_link ( $_SERVER [ 'REQUEST_URI' ], generate_graph_tag ( $graph_array ), generate_graph_tag ( $graph_array_zoom ), NULL );
echo ( " <td> $mini_graph </td> " );
} else {
echo ( " <td> " . $hrdevice [ 'hrDeviceDescr' ] . " </td> " );
echo ( " <td></td> " );
}
2010-01-07 18:27:33 +00:00
} else {
echo ( " <td> " . $hrdevice [ 'hrDeviceDescr' ] . " </td> " );
2010-06-13 14:39:09 +00:00
echo ( " <td></td> " );
2010-01-07 18:27:33 +00:00
}
echo ( " <td> " . $hrdevice [ 'hrDeviceType' ] . " </td><td> " . $hrdevice [ 'hrDeviceStatus' ] . " </td> " );
echo ( " <td> " . $hrdevice [ 'hrDeviceErrors' ] . " </td><td> " . $hrdevice [ 'hrProcessorLoad' ] . " </td> " );
echo ( " </tr> " );
}
echo ( " </table> " );
2011-03-16 23:10:10 +00:00
?>