Updates styling
This commit is contained in:
parent
92ca217800
commit
9a12b34847
|
@ -888,10 +888,10 @@ foreach ($fields as $field) {
|
|||
);
|
||||
};
|
||||
|
||||
$table->rowid[] = 'name_field-'.$i;
|
||||
$table->rowid[] = 'name_field-'.$id_custom_field;
|
||||
$table->data[] = $data;
|
||||
|
||||
$table->rowid[] = 'field-'.($i + 1);
|
||||
$table->rowid[] = 'field-'.$id_custom_field;
|
||||
$table->data[] = $data_field;
|
||||
$i += 2;
|
||||
}
|
||||
|
|
|
@ -1,17 +1,32 @@
|
|||
<?php
|
||||
/**
|
||||
* Configure agents.
|
||||
*
|
||||
* @category Agents view - management.
|
||||
* @package Pandora FMS
|
||||
* @subpackage User interface.
|
||||
* @version 1.0.0
|
||||
* @license See below
|
||||
*
|
||||
* ______ ___ _______ _______ ________
|
||||
* | __ \.-----.--.--.--| |.-----.----.-----. | ___| | | __|
|
||||
* | __/| _ | | _ || _ | _| _ | | ___| |__ |
|
||||
* |___| |___._|__|__|_____||_____|__| |___._| |___| |__|_|__|_______|
|
||||
*
|
||||
* ============================================================================
|
||||
* Copyright (c) 2005-2019 Artica Soluciones Tecnologicas
|
||||
* Please see http://pandorafms.org for full contribution list
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation for version 2.
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
* ============================================================================
|
||||
*/
|
||||
|
||||
// Pandora FMS - http://pandorafms.com
|
||||
// ==================================================
|
||||
// Copyright (c) 2005-2010 Artica Soluciones Tecnologicas
|
||||
// Please see http://pandorafms.org for full contribution list
|
||||
// This program is free software; you can redistribute it and/or
|
||||
// modify it under the terms of the GNU General Public License
|
||||
// as published by the Free Software Foundation for version 2.
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
// Load global vars.
|
||||
// Begin.
|
||||
global $config;
|
||||
|
||||
enterprise_include('godmode/agentes/configurar_agente.php');
|
||||
|
@ -325,7 +340,7 @@ if ($create_agent) {
|
|||
$unsafe_alias = io_safe_output($alias);
|
||||
db_pandora_audit(
|
||||
'Agent management',
|
||||
"Created agent $unsafe_alias",
|
||||
'Created agent '.$unsafe_alias,
|
||||
false,
|
||||
true,
|
||||
$info
|
||||
|
@ -489,7 +504,7 @@ if ($id_agente) {
|
|||
$agent_name = io_safe_output($agent_name);
|
||||
$agent_md5 = md5($agent_name, false);
|
||||
|
||||
$remote_configuration_tab['text'] = '<a href="index.php?'.'sec=gagente&'.'sec2=godmode/agentes/configurar_agente&'.'tab=remote_configuration&'.'id_agente='.$id_agente.'&'.'disk_conf='.$agent_md5.'">'.html_print_image(
|
||||
$remote_configuration_tab['text'] = '<a href="index.php?sec=gagente&sec2=godmode/agentes/configurar_agente&tab=remote_configuration&id_agente='.$id_agente.'&disk_conf='.$agent_md5.'">'.html_print_image(
|
||||
'images/remote_configuration.png',
|
||||
true,
|
||||
['title' => __('Remote configuration')]
|
||||
|
@ -996,7 +1011,7 @@ if ($update_agent) {
|
|||
[
|
||||
$id_agente,
|
||||
'standby',
|
||||
$disabled ? '1' : '0',
|
||||
($disabled) ? '1' : '0',
|
||||
]
|
||||
);
|
||||
// Validate alerts for disabled agents.
|
||||
|
@ -1082,7 +1097,7 @@ if ($update_agent) {
|
|||
ui_print_success_message(__('Successfully updated'));
|
||||
db_pandora_audit(
|
||||
'Agent management',
|
||||
"Updated agent $alias",
|
||||
'Updated agent '.$alias,
|
||||
false,
|
||||
false,
|
||||
$info
|
||||
|
@ -1224,7 +1239,7 @@ if ($update_module || $create_module) {
|
|||
}
|
||||
|
||||
if ($id_module_type == 25) {
|
||||
// web analysis, from MODULE_WUX.
|
||||
// Web analysis, from MODULE_WUX.
|
||||
$custom_string_1 = base64_encode((string) get_parameter('custom_string_1', $custom_string_1_default));
|
||||
$custom_integer_1 = (int) get_parameter('custom_integer_1', $custom_integer_1_default);
|
||||
} else {
|
||||
|
@ -1261,12 +1276,11 @@ if ($update_module || $create_module) {
|
|||
|
||||
foreach ($conf_array as $line) {
|
||||
if (preg_match('/^module_name\s*(.*)/', $line, $match)) {
|
||||
$new_configuration_data .= 'module_name '.io_safe_output($name)."\n";
|
||||
}
|
||||
|
||||
// We delete from conf all the module macros starting with _field.
|
||||
else if (!preg_match('/^module_macro_field.*/', $line, $match)) {
|
||||
$new_configuration_data .= "$line\n";
|
||||
$new_configuration_data .= 'module_name ';
|
||||
$new_configuration_data .= io_safe_output($name)."\n";
|
||||
} else if (!preg_match('/^module_macro_field.*/', $line, $match)) {
|
||||
// We delete from conf all the module macros starting with _field.
|
||||
$new_configuration_data .= $line."\n";
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1428,9 +1442,13 @@ if ($update_module || $create_module) {
|
|||
}
|
||||
|
||||
$active_snmp_v3 = get_parameter('active_snmp_v3');
|
||||
if ($active_snmp_v3) {
|
||||
// LOST CODE?
|
||||
}
|
||||
|
||||
/*
|
||||
* if ($active_snmp_v3) {
|
||||
* // LOST CODE?.
|
||||
*
|
||||
* }
|
||||
*/
|
||||
|
||||
$throw_unknown_events = (bool) get_parameter('throw_unknown_events', false);
|
||||
// Set the event type that can show.
|
||||
|
@ -1614,7 +1632,7 @@ if ($update_module) {
|
|||
|
||||
db_pandora_audit(
|
||||
'Agent management',
|
||||
"Fail to try update module '$name' for agent ".$agent['alias']
|
||||
"Fail to try update module '".$name."' for agent ".$agent['alias']
|
||||
);
|
||||
} else {
|
||||
if ($prediction_module == 3) {
|
||||
|
@ -1638,7 +1656,7 @@ if ($update_module) {
|
|||
|
||||
db_pandora_audit(
|
||||
'Agent management',
|
||||
"Updated module '$name' for agent ".$agent['alias'],
|
||||
"Updated module '".$name."' for agent ".$agent['alias'],
|
||||
false,
|
||||
false,
|
||||
io_json_mb_encode($values)
|
||||
|
@ -1657,12 +1675,13 @@ if ($create_module) {
|
|||
}
|
||||
|
||||
$id_module = (int) get_parameter('id_module');
|
||||
// Commented because can't create prediction modules
|
||||
|
||||
/*
|
||||
if ($id_module == 5) {
|
||||
$prediction_module = 1;
|
||||
}
|
||||
*/
|
||||
* Commented because can't create prediction modules
|
||||
* if ($id_module == 5) {
|
||||
* $prediction_module = 1;
|
||||
* }
|
||||
*/
|
||||
|
||||
switch ($config['dbtype']) {
|
||||
case 'oracle':
|
||||
|
@ -1792,7 +1811,7 @@ if ($create_module) {
|
|||
$moduletype = $id_module;
|
||||
db_pandora_audit(
|
||||
'Agent management',
|
||||
"Fail to try added module '$name' for agent ".$agent['alias']
|
||||
"Fail to try added module '".$name."' for agent ".$agent['alias']
|
||||
);
|
||||
} else {
|
||||
if ($prediction_module == 3) {
|
||||
|
@ -1811,7 +1830,7 @@ if ($create_module) {
|
|||
$agent = db_get_row('tagente', 'id_agente', $id_agente);
|
||||
db_pandora_audit(
|
||||
'Agent management',
|
||||
"Added module '$name' for agent ".$agent['alias'],
|
||||
"Added module '".$name."' for agent ".$agent['alias'],
|
||||
false,
|
||||
true,
|
||||
io_json_mb_encode($values)
|
||||
|
|
|
@ -562,7 +562,7 @@ class DiscoveryTaskList extends Wizard
|
|||
if ($task['status'] <= 0 || $task['status'] > 100) {
|
||||
$data[7] = '-';
|
||||
} else {
|
||||
$data[7] = ui_progress($task['status'], '100%', 1.5, '#333');
|
||||
$data[7] = ui_progress($task['status'], '100%', 1.5);
|
||||
}
|
||||
|
||||
if ($task['utimestamp'] > 0) {
|
||||
|
|
|
@ -1,17 +1,33 @@
|
|||
<?php
|
||||
/**
|
||||
* Module management.
|
||||
*
|
||||
* @category Ajax library.
|
||||
* @package Pandora FMS
|
||||
* @subpackage Modules.
|
||||
* @version 1.0.0
|
||||
* @license See below
|
||||
*
|
||||
* ______ ___ _______ _______ ________
|
||||
* | __ \.-----.--.--.--| |.-----.----.-----. | ___| | | __|
|
||||
* | __/| _ | | _ || _ | _| _ | | ___| |__ |
|
||||
* |___| |___._|__|__|_____||_____|__| |___._| |___| |__|_|__|_______|
|
||||
*
|
||||
* ============================================================================
|
||||
* Copyright (c) 2005-2019 Artica Soluciones Tecnologicas
|
||||
* Please see http://pandorafms.org for full contribution list
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation for version 2.
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
* ============================================================================
|
||||
*/
|
||||
|
||||
// Begin.
|
||||
if (check_login()) {
|
||||
// Pandora FMS- http://pandorafms.com
|
||||
// ==================================================
|
||||
// Copyright (c) 2005-2010 Artica Soluciones Tecnologicas
|
||||
// Please see http://pandorafms.org for full contribution list
|
||||
// This program is free software; you can redistribute it and/or
|
||||
// modify it under the terms of the GNU Lesser General Public License
|
||||
// as published by the Free Software Foundation; version 2
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
global $config;
|
||||
|
||||
include_once $config['homedir'].'/include/functions_agents.php';
|
||||
|
@ -76,7 +92,7 @@ if (check_login()) {
|
|||
$id_agents = json_decode(io_safe_output(get_parameter('id_agents')));
|
||||
$filter = '%'.get_parameter('q', '').'%';
|
||||
$other_filter = json_decode(io_safe_output(get_parameter('other_filter')), true);
|
||||
// TODO TAGS agents_get_modules
|
||||
// TODO TAGS agents_get_modules.
|
||||
$modules = agents_get_modules(
|
||||
$id_agents,
|
||||
false,
|
||||
|
@ -96,7 +112,7 @@ if (check_login()) {
|
|||
}
|
||||
|
||||
if ($get_module_detail) {
|
||||
// This script is included manually to be included after jquery and avoid error
|
||||
// This script is included manually to be included after jquery and avoid error.
|
||||
ui_include_time_picker();
|
||||
ui_require_jquery_file('ui.datepicker-'.get_user_language(), 'include/javascript/i18n/');
|
||||
|
||||
|
@ -307,7 +323,7 @@ if (check_login()) {
|
|||
if (empty($module_data)) {
|
||||
$result = [];
|
||||
} else {
|
||||
// Paginate the result
|
||||
// Paginate the result.
|
||||
$result = array_slice($module_data, $offset, $block_size);
|
||||
}
|
||||
|
||||
|
@ -366,10 +382,10 @@ if (check_login()) {
|
|||
$data[] = html_print_result_div($row[$attr[0]]);
|
||||
} else if ($is_web_content_string) {
|
||||
// Fixed the goliat sends the strings from web
|
||||
// without HTML entities
|
||||
// without HTML entities.
|
||||
$data[] = io_safe_input($row[$attr[0]]);
|
||||
} else {
|
||||
// Fixed the data from Selenium Plugin
|
||||
// Fixed the data from Selenium Plugin.
|
||||
if ($row[$attr[0]] != strip_tags($row[$attr[0]])) {
|
||||
$data[] = html_print_result_div($row[$attr[0]]);
|
||||
} else if (is_numeric($row[$attr[0]]) && !modules_is_string_type($row['module_type'])) {
|
||||
|
@ -523,7 +539,8 @@ if (check_login()) {
|
|||
$agent_w = check_acl($config['id_user'], 0, 'AW');
|
||||
$access = ($agent_a == true) ? 'AR' : (($agent_w == true) ? 'AW' : 'AR');
|
||||
|
||||
$id_agente = $id_agent = (int) get_parameter('id_agente', 0);
|
||||
$id_agent = (int) get_parameter('id_agente', 0);
|
||||
$id_agente = $id_agent;
|
||||
$show_notinit = (int) get_parameter('show_notinit', 0);
|
||||
$cluster_list = (int) get_parameter('cluster_list', 0);
|
||||
$url = 'index.php?sec=estado&sec2=operation/agentes/ver_agente&id_agente='.$id_agent;
|
||||
|
@ -549,6 +566,7 @@ if (check_login()) {
|
|||
case 'type':
|
||||
switch ($sort) {
|
||||
case 'up':
|
||||
default:
|
||||
$selectTypeUp = $selected;
|
||||
$order[] = [
|
||||
'field' => 'tagente_modulo.id_modulo',
|
||||
|
@ -583,6 +601,10 @@ if (check_login()) {
|
|||
'order' => 'DESC',
|
||||
];
|
||||
break;
|
||||
|
||||
default:
|
||||
// Ignore.
|
||||
break;
|
||||
}
|
||||
break;
|
||||
|
||||
|
@ -603,6 +625,10 @@ if (check_login()) {
|
|||
'order' => '',
|
||||
];
|
||||
break;
|
||||
|
||||
default:
|
||||
// Ignore.
|
||||
break;
|
||||
}
|
||||
break;
|
||||
|
||||
|
@ -623,6 +649,10 @@ if (check_login()) {
|
|||
'order' => 'DESC',
|
||||
];
|
||||
break;
|
||||
|
||||
default:
|
||||
// Ignore.
|
||||
break;
|
||||
}
|
||||
break;
|
||||
|
||||
|
@ -645,7 +675,8 @@ if (check_login()) {
|
|||
break;
|
||||
}
|
||||
|
||||
// Fix: for tag functionality groups have to be all user_groups (propagate ACL funct!)
|
||||
// Fix: for tag functionality groups have to be all user_groups
|
||||
// (propagate ACL funct!).
|
||||
$groups = users_get_groups($config['id_user'], $access);
|
||||
|
||||
$tags_join = '';
|
||||
|
@ -669,7 +700,7 @@ if (check_login()) {
|
|||
|
||||
$status_filter_sql = '1 = 1';
|
||||
if ($status_filter_monitor == AGENT_MODULE_STATUS_NOT_NORMAL) {
|
||||
// Not normal
|
||||
// Not normal.
|
||||
$status_filter_sql = ' tagente_estado.estado <> 0';
|
||||
} else if ($status_filter_monitor != -1) {
|
||||
$status_filter_sql = 'tagente_estado.estado = '.$status_filter_monitor;
|
||||
|
@ -693,7 +724,7 @@ if (check_login()) {
|
|||
}
|
||||
|
||||
// Count monitors/modules
|
||||
// Build the order sql
|
||||
// Build the order sql.
|
||||
$first = true;
|
||||
foreach ($order as $ord) {
|
||||
if ($first) {
|
||||
|
@ -936,12 +967,12 @@ if (check_login()) {
|
|||
}
|
||||
}
|
||||
|
||||
// Adds tag context information
|
||||
// Adds tag context information.
|
||||
if (tags_get_modules_tag_count($module['id_agente_modulo']) > 0) {
|
||||
$data[3] .= ' <a class="tag_details" href="ajax.php?page=operation/agentes/estado_monitores&get_tag_tooltip=1&id_agente_modulo='.$module['id_agente_modulo'].'">'.html_print_image('images/tag_red.png', true, ['id' => 'tag-details-'.$module['id_agente_modulo'], 'class' => 'img_help']).'</a> ';
|
||||
}
|
||||
|
||||
// Adds relations context information
|
||||
// Adds relations context information.
|
||||
if (modules_relation_exists($module['id_agente_modulo'])) {
|
||||
$data[3] .= ' <a class="relations_details" href="ajax.php?page=operation/agentes/estado_monitores&get_relations_tooltip=1&id_agente_modulo='.$module['id_agente_modulo'].'">'.html_print_image('images/link2.png', true, ['id' => 'relations-details-'.$module['id_agente_modulo'], 'class' => 'img_help']).'</a> ';
|
||||
}
|
||||
|
@ -964,7 +995,7 @@ if (check_login()) {
|
|||
$title
|
||||
);
|
||||
|
||||
$data[5] = ui_print_status_image($status, $title, true, false, false, true);
|
||||
$data[5] = ui_print_module_status($module['estado'], $title, true, false, true);
|
||||
if (!$show_context_help_first_time) {
|
||||
$show_context_help_first_time = true;
|
||||
|
||||
|
@ -973,122 +1004,85 @@ if (check_login()) {
|
|||
}
|
||||
}
|
||||
|
||||
if ($module['id_tipo_modulo'] == 24) {
|
||||
// log4x
|
||||
switch ($module['datos']) {
|
||||
case 10:
|
||||
$salida = 'TRACE';
|
||||
$style = 'font-weight:bold; color:darkgreen;';
|
||||
break;
|
||||
if (is_numeric($module['datos']) && !modules_is_string_type($module['id_tipo_modulo'])) {
|
||||
if ($config['render_proc']) {
|
||||
switch ($module['id_tipo_modulo']) {
|
||||
case 2:
|
||||
case 6:
|
||||
case 9:
|
||||
case 18:
|
||||
case 21:
|
||||
case 31:
|
||||
if ($module['datos'] >= 1) {
|
||||
$salida = $config['render_proc_ok'];
|
||||
} else {
|
||||
$salida = $config['render_proc_fail'];
|
||||
}
|
||||
break;
|
||||
|
||||
case 20:
|
||||
$salida = 'DEBUG';
|
||||
$style = 'font-weight:bold; color:darkgreen;';
|
||||
break;
|
||||
|
||||
case 30:
|
||||
$salida = 'INFO';
|
||||
$style = 'font-weight:bold; color:darkgreen;';
|
||||
break;
|
||||
|
||||
case 40:
|
||||
$salida = 'WARN';
|
||||
$style = 'font-weight:bold; color:darkorange;';
|
||||
break;
|
||||
|
||||
case 50:
|
||||
$salida = 'ERROR';
|
||||
$style = 'font-weight:bold; color:red;';
|
||||
break;
|
||||
|
||||
case 60:
|
||||
$salida = 'FATAL';
|
||||
$style = 'font-weight:bold; color:red;';
|
||||
break;
|
||||
}
|
||||
|
||||
$salida = "<span style='$style'>$salida</span>";
|
||||
} else {
|
||||
if (is_numeric($module['datos']) && !modules_is_string_type($module['id_tipo_modulo'])) {
|
||||
if ($config['render_proc']) {
|
||||
switch ($module['id_tipo_modulo']) {
|
||||
case 2:
|
||||
case 6:
|
||||
case 9:
|
||||
case 18:
|
||||
case 21:
|
||||
case 31:
|
||||
if ($module['datos'] >= 1) {
|
||||
$salida = $config['render_proc_ok'];
|
||||
} else {
|
||||
$salida = $config['render_proc_fail'];
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
switch ($module['id_tipo_modulo']) {
|
||||
case 15:
|
||||
$value = db_get_value('snmp_oid', 'tagente_modulo', 'id_agente_modulo', $module['id_agente_modulo']);
|
||||
if ($value == '.1.3.6.1.2.1.1.3.0' || $value == '.1.3.6.1.2.1.25.1.1.0') {
|
||||
if ($module['post_process'] > 0) {
|
||||
$salida = human_milliseconds_to_string(($module['datos'] / $module['post_process']));
|
||||
} else {
|
||||
$salida = human_milliseconds_to_string($module['datos']);
|
||||
}
|
||||
default:
|
||||
switch ($module['id_tipo_modulo']) {
|
||||
case 15:
|
||||
$value = db_get_value('snmp_oid', 'tagente_modulo', 'id_agente_modulo', $module['id_agente_modulo']);
|
||||
if ($value == '.1.3.6.1.2.1.1.3.0' || $value == '.1.3.6.1.2.1.25.1.1.0') {
|
||||
if ($module['post_process'] > 0) {
|
||||
$salida = human_milliseconds_to_string(($module['datos'] / $module['post_process']));
|
||||
} else {
|
||||
$salida = remove_right_zeros(number_format($module['datos'], $config['graph_precision']));
|
||||
$salida = human_milliseconds_to_string($module['datos']);
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
$salida = remove_right_zeros(number_format($module['datos'], $config['graph_precision']));
|
||||
break;
|
||||
}
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
switch ($module['id_tipo_modulo']) {
|
||||
case 15:
|
||||
$value = db_get_value('snmp_oid', 'tagente_modulo', 'id_agente_modulo', $module['id_agente_modulo']);
|
||||
if ($value == '.1.3.6.1.2.1.1.3.0' || $value == '.1.3.6.1.2.1.25.1.1.0') {
|
||||
if ($module['post_process'] > 0) {
|
||||
$salida = human_milliseconds_to_string(($module['datos'] / $module['post_process']));
|
||||
} else {
|
||||
$salida = human_milliseconds_to_string($module['datos']);
|
||||
$salida = remove_right_zeros(number_format($module['datos'], $config['graph_precision']));
|
||||
}
|
||||
} else {
|
||||
break;
|
||||
|
||||
default:
|
||||
$salida = remove_right_zeros(number_format($module['datos'], $config['graph_precision']));
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
$salida = remove_right_zeros(number_format($module['datos'], $config['graph_precision']));
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// Show units ONLY in numeric data types
|
||||
if (isset($module['unit'])) {
|
||||
$data_macro = modules_get_unit_macro($module['datos'], $module['unit']);
|
||||
if ($data_macro) {
|
||||
$salida = $data_macro;
|
||||
} else {
|
||||
$salida .= ' '.'<i>'.io_safe_output($module['unit']).'</i>';
|
||||
}
|
||||
break;
|
||||
}
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
switch ($module['id_tipo_modulo']) {
|
||||
case 15:
|
||||
$value = db_get_value('snmp_oid', 'tagente_modulo', 'id_agente_modulo', $module['id_agente_modulo']);
|
||||
if ($value == '.1.3.6.1.2.1.1.3.0' || $value == '.1.3.6.1.2.1.25.1.1.0') {
|
||||
if ($module['post_process'] > 0) {
|
||||
$salida = human_milliseconds_to_string(($module['datos'] / $module['post_process']));
|
||||
} else {
|
||||
$salida = human_milliseconds_to_string($module['datos']);
|
||||
}
|
||||
} else {
|
||||
$salida = remove_right_zeros(number_format($module['datos'], $config['graph_precision']));
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
$salida = remove_right_zeros(number_format($module['datos'], $config['graph_precision']));
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// Show units ONLY in numeric data types
|
||||
if (isset($module['unit'])) {
|
||||
$data_macro = modules_get_unit_macro($module['datos'], $module['unit']);
|
||||
if ($data_macro) {
|
||||
$salida = $data_macro;
|
||||
} else {
|
||||
$salida = ui_print_module_string_value(
|
||||
$module['datos'],
|
||||
$module['id_agente_modulo'],
|
||||
$module['current_interval'],
|
||||
$module['module_name']
|
||||
);
|
||||
$salida .= ' '.'<i>'.io_safe_output($module['unit']).'</i>';
|
||||
}
|
||||
}
|
||||
} else {
|
||||
$data_macro = modules_get_unit_macro($module['datos'], $module['unit']);
|
||||
if ($data_macro) {
|
||||
$salida = $data_macro;
|
||||
} else {
|
||||
$salida = ui_print_module_string_value(
|
||||
$module['datos'],
|
||||
$module['id_agente_modulo'],
|
||||
$module['current_interval'],
|
||||
$module['module_name']
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
if ($module['id_tipo_modulo'] != 25) {
|
||||
|
@ -1230,5 +1224,3 @@ if (check_login()) {
|
|||
return;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -1519,43 +1519,8 @@ class NetworkMap
|
|||
*/
|
||||
public static function getColorByStatus($status)
|
||||
{
|
||||
if (isset($status) === false) {
|
||||
return COL_UNKNOWN;
|
||||
}
|
||||
|
||||
switch ($status) {
|
||||
case AGENT_MODULE_STATUS_NORMAL:
|
||||
case AGENT_STATUS_NORMAL:
|
||||
return COL_NORMAL;
|
||||
|
||||
case AGENT_MODULE_STATUS_NOT_INIT:
|
||||
case AGENT_STATUS_NOT_INIT:
|
||||
return COL_NOTINIT;
|
||||
|
||||
case AGENT_MODULE_STATUS_CRITICAL_BAD:
|
||||
case AGENT_STATUS_CRITICAL:
|
||||
return COL_CRITICAL;
|
||||
|
||||
case AGENT_MODULE_STATUS_WARNING:
|
||||
case AGENT_STATUS_WARNING:
|
||||
return COL_WARNING;
|
||||
|
||||
case AGENT_MODULE_STATUS_CRITICAL_ALERT:
|
||||
case AGENT_MODULE_STATUS_WARNING_ALERT:
|
||||
case AGENT_STATUS_ALERT_FIRED:
|
||||
return COL_ALERTFIRED;
|
||||
|
||||
case AGENT_MODULE_STATUS_UNKNOWN:
|
||||
case AGENT_STATUS_UNKNOWN:
|
||||
return COL_UNKNOWN;
|
||||
|
||||
default:
|
||||
// Ignored.
|
||||
break;
|
||||
}
|
||||
|
||||
return COL_IGNORED;
|
||||
|
||||
include_once __DIR__.'/../functions_modules.php';
|
||||
return modules_get_color_status($status);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -2294,6 +2294,54 @@ function modules_get_modulegroup_name($modulegroup_id)
|
|||
}
|
||||
|
||||
|
||||
/**
|
||||
* Returns target color to be used based on the status received.
|
||||
*
|
||||
* @param integer $status Source information.
|
||||
*
|
||||
* @return string HTML tag for color.
|
||||
*/
|
||||
function modules_get_color_status($status)
|
||||
{
|
||||
if (isset($status) === false) {
|
||||
return COL_UNKNOWN;
|
||||
}
|
||||
|
||||
switch ($status) {
|
||||
case AGENT_MODULE_STATUS_NORMAL:
|
||||
case AGENT_STATUS_NORMAL:
|
||||
return COL_NORMAL;
|
||||
|
||||
case AGENT_MODULE_STATUS_NOT_INIT:
|
||||
case AGENT_STATUS_NOT_INIT:
|
||||
return COL_NOTINIT;
|
||||
|
||||
case AGENT_MODULE_STATUS_CRITICAL_BAD:
|
||||
case AGENT_STATUS_CRITICAL:
|
||||
return COL_CRITICAL;
|
||||
|
||||
case AGENT_MODULE_STATUS_WARNING:
|
||||
case AGENT_STATUS_WARNING:
|
||||
return COL_WARNING;
|
||||
|
||||
case AGENT_MODULE_STATUS_CRITICAL_ALERT:
|
||||
case AGENT_MODULE_STATUS_WARNING_ALERT:
|
||||
case AGENT_STATUS_ALERT_FIRED:
|
||||
return COL_ALERTFIRED;
|
||||
|
||||
case AGENT_MODULE_STATUS_UNKNOWN:
|
||||
case AGENT_STATUS_UNKNOWN:
|
||||
return COL_UNKNOWN;
|
||||
|
||||
default:
|
||||
// Ignored.
|
||||
break;
|
||||
}
|
||||
|
||||
return COL_IGNORED;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Gets a module status an modify the status and title reference variables
|
||||
*
|
||||
|
|
|
@ -9642,39 +9642,39 @@ function reporting_tiny_stats(
|
|||
$out .= '<div id="bullets_modules">';
|
||||
// $out .='<span id="total_count_'.$uniq_id.'" class="forced_title" style="font-size: 13pt">'.$total_count.$separator.'</span>';
|
||||
if (isset($fired_count) && $fired_count > 0) {
|
||||
$out .= '<div><div class="bullet_modules orange_background"></div>';
|
||||
$out .= '<span class="forced_title" id="fired_count_'.$uniq_id.'" style="font-size: 12pt">'.$fired_count.'</span></div>';
|
||||
$out .= '<div><div id="fired_count_'.$uniq_id.'" class="forced_title bullet_modules orange_background"></div>';
|
||||
$out .= '<span style="font-size: 12pt">'.$fired_count.'</span></div>';
|
||||
}
|
||||
|
||||
if (isset($critical_count) && $critical_count > 0) {
|
||||
$out .= '<div><div class="bullet_modules red_background"></div>';
|
||||
$out .= '<span class="forced_title" id="critical_count_'.$uniq_id.'" style="font-size: 12pt">'.$critical_count.'</span></div>';
|
||||
$out .= '<div><div id="critical_count_'.$uniq_id.'" class="forced_title bullet_modules red_background"></div>';
|
||||
$out .= '<span style="font-size: 12pt">'.$critical_count.'</span></div>';
|
||||
}
|
||||
|
||||
if (isset($warning_count) && $warning_count > 0) {
|
||||
$out .= '<div><div class="bullet_modules yellow_background"></div>';
|
||||
$out .= '<span class="forced_title" id="warning_count_'.$uniq_id.'" style="font-size: 12pt">'.$warning_count.'</span></div>';
|
||||
$out .= '<div><div id="warning_count_'.$uniq_id.'" class="forced_title bullet_modules yellow_background"></div>';
|
||||
$out .= '<span style="font-size: 12pt">'.$warning_count.'</span></div>';
|
||||
}
|
||||
|
||||
if (isset($unknown_count) && $unknown_count > 0) {
|
||||
$out .= '<div><div class="bullet_modules grey_background"></div>';
|
||||
$out .= '<span class="forced_title" id="unknown_count_'.$uniq_id.'" style="font-size: 12pt">'.$unknown_count.'</span></div>';
|
||||
$out .= '<div><div id="unknown_count_'.$uniq_id.'" class="forced_title bullet_modules grey_background"></div>';
|
||||
$out .= '<span style="font-size: 12pt">'.$unknown_count.'</span></div>';
|
||||
}
|
||||
|
||||
if (isset($not_init_count) && $not_init_count > 0) {
|
||||
$out .= '<div><div class="bullet_modules blue_background"></div>';
|
||||
$out .= '<span class="forced_title" id="not_init_count_'.$uniq_id.'" style="font-size: 12pt">'.$not_init_count.'</span></div>';
|
||||
$out .= '<div><div id="not_init_count_'.$uniq_id.'" class="forced_title bullet_modules blue_background"></div>';
|
||||
$out .= '<span style="font-size: 12pt">'.$not_init_count.'</span></div>';
|
||||
}
|
||||
|
||||
if (isset($normal_count) && $normal_count > 0) {
|
||||
$out .= '<div><div class="bullet_modules green_background"></div>';
|
||||
$out .= '<span class="forced_title" id="normal_count_'.$uniq_id.'" style="font-size: 12pt">'.$normal_count.'</span></div>';
|
||||
$out .= '<div><div id="normal_count_'.$uniq_id.'" class="forced_title bullet_modules green_background"></div>';
|
||||
$out .= '<span style="font-size: 12pt">'.$normal_count.'</span></div>';
|
||||
}
|
||||
|
||||
$out .= '</div>';
|
||||
} else {
|
||||
// Classic ones.
|
||||
$out .= '<b>'.'<span id="total_count_'.$uniq_id.'" class="forced_title" style="font-size: 7pt">'.$total_count.'</span>';
|
||||
$out .= '<b><span id="total_count_'.$uniq_id.'" class="forced_title" style="font-size: 7pt">'.$total_count.'</span>';
|
||||
if (isset($fired_count) && $fired_count > 0) {
|
||||
$out .= ' '.$separator.' <span class="orange forced_title" id="fired_count_'.$uniq_id.'" style="font-size: 7pt">'.$fired_count.'</span>';
|
||||
}
|
||||
|
|
|
@ -2647,6 +2647,62 @@ function ui_print_status_image(
|
|||
}
|
||||
|
||||
|
||||
/**
|
||||
* Prints an image representing a status.
|
||||
*
|
||||
* @param string $status Module status.
|
||||
* @param string $title Title.
|
||||
* @param boolean $return Whether to return an output string or echo now (optional, echo by default).
|
||||
* @param array $options Options to set image attributes: I.E.: style.
|
||||
* @param boolean $rounded_image Round.
|
||||
*
|
||||
* @return string HTML.
|
||||
*/
|
||||
function ui_print_module_status(
|
||||
$status,
|
||||
$title='',
|
||||
$return=false,
|
||||
$options=false,
|
||||
$rounded_image=false
|
||||
) {
|
||||
global $config;
|
||||
|
||||
if ($options === false) {
|
||||
$options = [];
|
||||
}
|
||||
|
||||
$options['style'] .= 'width: 50px;';
|
||||
$options['style'] .= 'height: 2em;';
|
||||
|
||||
include_once __DIR__.'/functions_modules.php';
|
||||
$options['style'] .= 'background: '.modules_get_color_status($status).';';
|
||||
|
||||
if ($rounded_image === true) {
|
||||
$options['style'] .= 'border-radius: 5px;';
|
||||
}
|
||||
|
||||
$options['title'] = $title;
|
||||
$options['data-title'] = $title;
|
||||
$options['data-use_title_for_force_title'] = 1;
|
||||
$options['class'] = 'forced_title';
|
||||
|
||||
$output = '<div ';
|
||||
foreach ($options as $k => $v) {
|
||||
$output .= $k.'="'.$v.'"';
|
||||
}
|
||||
|
||||
$output .= '>';
|
||||
$output .= '</div>';
|
||||
|
||||
if ($return === false) {
|
||||
echo $output;
|
||||
}
|
||||
|
||||
return $output;
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Generates a progress bar CSS based.
|
||||
* Requires css progress.css
|
||||
|
|
|
@ -722,23 +722,36 @@ function print_clock_digital_1($time_format, $timezone, $clock_animation, $width
|
|||
}
|
||||
|
||||
|
||||
function print_donut_narrow_graph($colors, $width, $height, $data, $data_total)
|
||||
{
|
||||
/**
|
||||
* Print dougnhnut.
|
||||
*
|
||||
* @param array $colors Colors.
|
||||
* @param integer $width Width.
|
||||
* @param integer $height Height.
|
||||
* @param array $data Data.
|
||||
* @param mixed $data_total Data_total.
|
||||
*
|
||||
* @return string HTML.
|
||||
*/
|
||||
function print_donut_narrow_graph(
|
||||
array $colors,
|
||||
$width,
|
||||
$height,
|
||||
array $data,
|
||||
$data_total
|
||||
) {
|
||||
if (empty($data)) {
|
||||
return graph_nodata_image($width, $height, 'pie');
|
||||
}
|
||||
|
||||
$data = json_encode($data);
|
||||
$data = json_decode(json_encode($data));
|
||||
|
||||
$colors = json_encode($colors);
|
||||
$colors = json_decode(json_encode($colors));
|
||||
|
||||
$series = count($data);
|
||||
if (($series != count($colors)) || ($series == 0)) {
|
||||
return;
|
||||
return '';
|
||||
}
|
||||
|
||||
$data = json_encode($data);
|
||||
$colors = json_encode($colors);
|
||||
|
||||
$graph_id = uniqid('graph_');
|
||||
|
||||
$out = "<div id='$graph_id'></div>";
|
||||
|
|
Loading…
Reference in New Issue