*/ /* * Get module's components for a device */ $component = new LibreNMS\Component(); $components = $component->getComponents($device['device_id'], array('type' => 'cisco-qfp')); $components = $components[$device['device_id']]; foreach ($components as $component_id => $tmp_component) { $default_graph_array = array( 'from' => \LibreNMS\Config::get('time.day'), 'to' => \LibreNMS\Config::get('time.now'), 'id' => $component_id, 'page' => 'graphs' ); /* * Main container for QFP component * Header with system data */ switch ($tmp_component['system_state']) { case 'active': case 'activeSolo': case 'standby': case 'hotStandby': $state_label = 'label-success'; break; case 'reset': $state_label = 'label-danger'; break; case 'init': $state_label = 'label-warning'; break; default: $state_label = 'label-default'; } switch ($tmp_component['traffic_direction']) { case 'none': $direction_label = 'label-danger'; break; case 'ingress': case 'egress': $direction_label = 'label-wanring'; break; case 'both': $direction_label = 'label-success'; break; default: $direction_label = 'label-default'; } $text_descr = $tmp_component['name']; echo "

$text_descr
State: {$tmp_component['system_state']} Traffic direction: {$tmp_component['traffic_direction']}

Last system load at {$tmp_component['system_last_load']}
"; echo "
"; /* * QFP Utilization (Load) */ if ($tmp_component['utilization'] < 50) { $util_label = 'label-success'; } elseif ($tmp_component['utilization'] < 75) { $util_label = 'label-warning'; } else { $util_label = 'label-danger'; } $graph_array = $default_graph_array; $graph_array['type'] = 'qfp_util'; $text_descr = 'QFP Utilization'; echo "

$text_descr
{$tmp_component['utilization']} %

"; echo "
"; include 'includes/html/print-graphrow.inc.php'; echo "
"; /* * Relative QFP utilization to packets processed */ $graph_array = $default_graph_array; $graph_array['type'] = 'qfp_relativeutil'; $text_descr = 'QFP Relative utilization per kpps'; echo "

$text_descr

"; echo "
"; include 'includes/html/print-graphrow.inc.php'; echo "
"; /* * QFP Packets In/Out */ $packets_label = 'label-default'; $graph_array = $default_graph_array; $graph_array['type'] = 'qfp_packets'; $text_descr = 'QFP packets'; echo "

$text_descr
" . format_bi($tmp_component['packets']) . "pps

"; echo "
"; include 'includes/html/print-graphrow.inc.php'; echo "
"; /* * QFP Throughput In/Out */ $throughput_label = 'label-default'; $graph_array = $default_graph_array; $graph_array['type'] = 'qfp_throughput'; $text_descr = 'QFP Throughput'; echo "

$text_descr
" . format_bi($tmp_component['throughput']) . "bps

"; echo "
"; include 'includes/html/print-graphrow.inc.php'; echo "
"; /* * QFP Average packet size */ $psize_label = 'label-default'; $graph_array = $default_graph_array; $graph_array['type'] = 'qfp_avgpktsize'; $text_descr = 'QFP Average packet size'; echo "

$text_descr
" . ceil($tmp_component['average_packet']) . " Bytes

"; echo "
"; include 'includes/html/print-graphrow.inc.php'; echo "
"; /* * QFP Memory resources */ $mem_prec = $tmp_component['memory_used']*100/$tmp_component['memory_total']; if ($mem_prec < 75) { $mem_label = 'label-success'; } elseif ($mem_prec < 90) { $mem_label = 'label-warning'; } else { $mem_label = 'label-danger'; } $graph_array = $default_graph_array; $graph_array['type'] = 'qfp_memory'; $text_descr = 'QFP Memory'; $label_text = sprintf("%sB / %sB", format_bi($tmp_component['memory_used']), format_bi($tmp_component['memory_total'])); echo "

$text_descr
{$label_text}

"; echo "
"; include 'includes/html/print-graphrow.inc.php'; echo "
"; echo "
"; }