Added realtime graph button to agent view
This commit is contained in:
parent
2885885cc4
commit
32822054d6
|
@ -1083,6 +1083,9 @@ if ($list_modules) {
|
|||
$url = 'include/procesos.php?agente='.$module["id_agente_modulo"];
|
||||
$win_handle=dechex(crc32($module["id_agente_modulo"].$module["nombre"]));
|
||||
|
||||
// Try to display the SNMP module realtime graph
|
||||
$data[8] .= get_module_realtime_link_graph($module);
|
||||
|
||||
# Show events for boolean modules by default.
|
||||
if ($graph_type == 'boolean') {
|
||||
$draw_events = 1;
|
||||
|
@ -1099,9 +1102,8 @@ if ($list_modules) {
|
|||
base64_encode($module["nombre"]))) . "&" .
|
||||
"refresh=" . SECONDS_10MINUTES . "&" .
|
||||
"draw_events=$draw_events', 'day_".$win_handle."')";
|
||||
|
||||
if(!is_snapshot_data($module['datos'])){
|
||||
$data[8] .= '<a href="javascript:'.$link.'">' . html_print_image("images/chart_curve.png", true, array("border" => '0', "alt" => "")) . '</a> ';
|
||||
if(!is_snapshot_data($module['datos'])){
|
||||
$data[8] .= '<a href="javascript:'.$link.'">' . html_print_image("images/chart_curve.png", true, array("border" => '0', "alt" => "")) . '</a> ';
|
||||
}
|
||||
$server_name = '';
|
||||
$data[8] .= "<a href='javascript: " .
|
||||
|
|
|
@ -153,6 +153,17 @@ function extensions_get_extensions ($enterprise = false) {
|
|||
return $extensions;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Check if an extension is enabled
|
||||
*
|
||||
* @param string Extension name (ended with .php)
|
||||
* @return True if enabled
|
||||
*/
|
||||
function extensions_is_enabled_extension($name) {
|
||||
global $config;
|
||||
return isset($config['extensions'][$name]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get disabled open and enterprise extensions
|
||||
*/
|
||||
|
|
|
@ -2684,4 +2684,49 @@ function recursive_get_dt_from_modules_tree (&$f_modules, $modules, $deep) {
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Get the button with the link to open realtime stats into a new window
|
||||
* Only to native (not satellite discovered) snmp modules.
|
||||
*
|
||||
* @param array With all the module info
|
||||
* @return string All the HTML code to paint the button
|
||||
*/
|
||||
function get_module_realtime_link_graph ($module) {
|
||||
|
||||
// Realtime graph is an extension and it should be enabled
|
||||
if (!extensions_is_enabled_extension("realtime_graphs.php")) return '';
|
||||
// Only to remote_snmp, remote_snmp_proc. snmp_snmp_inc
|
||||
if ($module['id_tipo_modulo'] != 15 && $module['id_tipo_modulo'] != 16 && $module['id_tipo_modulo'] != 18) {
|
||||
return '';
|
||||
}
|
||||
// Only version 1, 2 and 2c
|
||||
if ($module['tcp_send'] != "1" && $module['tcp_send'] != "2" && $module['tcp_send'] != "2c") {
|
||||
return '';
|
||||
}
|
||||
|
||||
$params = array(
|
||||
'graph' => 'snmp_module',
|
||||
'agent_alias' => modules_get_agentmodule_agent_alias($module['id_agente_modulo']),
|
||||
'module_name' => $module['nombre'],
|
||||
'snmp_address' => $module['ip_target'],
|
||||
'snmp_community' => $module['snmp_community'],
|
||||
'snmp_oid' => $module['snmp_oid'],
|
||||
'snmp_ver' => $module['tcp_send']
|
||||
);
|
||||
// Incremental type
|
||||
if ($module['id_tipo_modulo'] == 16) $params['incremental'] = 1;
|
||||
$link = "index.php?sec=view&sec2=extensions/realtime_graphs&"; //FIXME: Not definitive URL
|
||||
foreach ($params as $p_key => $p_value) {
|
||||
$link .= "$p_key=" . urlencode(io_safe_output($p_value)) . "&";
|
||||
}
|
||||
$link = substr($link, 0, -1);
|
||||
|
||||
$win_handle = "realtime_" . dechex(crc32($module["id_agente_modulo"].$module["nombre"]));
|
||||
|
||||
$link_button = '<a href="javascript:winopeng(\''.$link.'\',\''.$win_handle.'\')">' .
|
||||
html_print_image("images/chart_curve.png", true, array("border" => '0', "alt" => "")) . //FIXME: Not definitive image
|
||||
'</a> ';
|
||||
|
||||
return $link_button;
|
||||
}
|
||||
?>
|
||||
|
|
Loading…
Reference in New Issue