Added realtime graph to monitor view

This commit is contained in:
fermin831 2018-05-07 12:53:12 +02:00
parent 0f4daee237
commit fd91ba63f6
3 changed files with 19 additions and 8 deletions

View File

@ -1084,7 +1084,8 @@ if ($list_modules) {
$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);
$rt_button .= get_module_realtime_link_graph($module);
if (!empty($rt_button)) $data[8] = $rt_button . "  ";
# Show events for boolean modules by default.
if ($graph_type == 'boolean') {

View File

@ -2692,7 +2692,14 @@ function recursive_get_dt_from_modules_tree (&$f_modules, $modules, $deep) {
* @return string All the HTML code to paint the button
*/
function get_module_realtime_link_graph ($module) {
global $config;
// Sometimes some parameters are renamed
if (!isset($module['id_tipo_modulo'])) $module['id_tipo_modulo'] = $module['module_type'];
if (!isset($module['nombre'])) $module['nombre'] = $module['module_name'];
// Avoid to show on metaconsole
if (is_metaconsole()) return '';
// 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
@ -2727,7 +2734,7 @@ function get_module_realtime_link_graph ($module) {
$link_button = '<a href="javascript:winopeng_var(\''.$link.'\',\''.$win_handle.'\', 850, 480)">' .
html_print_image("images/realtime_shortcut.png", true, array("border" => '0', "alt" => "")) .
'</a> &nbsp;&nbsp;';
'</a>';
return $link_button;
}

View File

@ -753,7 +753,11 @@ switch ($config['dbtype']) {
tagente.id_grupo AS id_group,
tagente.id_agente AS id_agent,
tagente_modulo.id_tipo_modulo AS module_type,
tagente_modulo.module_interval,
tagente_modulo.module_interval,
tagente_modulo.tcp_send,
tagente_modulo.ip_target,
tagente_modulo.snmp_community,
tagente_modulo.snmp_oid,
tagente_estado.datos,
tagente_estado.estado,
tagente_modulo.min_warning,
@ -1272,12 +1276,11 @@ if (!empty($result)) {
$graph_params_str = http_build_query($graph_params);
$link = 'winopeng(\''.$url.'?'.$graph_params_str.'\',\''.$win_handle.'\')';
$data[7] = '';
$data[7] = get_module_realtime_link_graph($row);
if(!is_snapshot_data($row['datos'])){
$data[7] = '<a href="javascript:'.$link.'">' . html_print_image('images/chart_curve.png', true, array('border' => '0', 'alt' => '')) . '</a>';
$data[7] .= '<a href="javascript:'.$link.'">' . html_print_image('images/chart_curve.png', true, array('border' => '0', 'alt' => '')) . '</a>';
}
$data[7] .= '<a href="javascript: ' .
'show_module_detail_dialog(' .