2013-05-29 Miguel de Dios <miguel.dedios@artica.es>
* operation/agentes/ver_agente.php: cleaned source code style. * operation/agentes/alerts_status.php: added the text for the main tab in agent view. * operation/agentes/estado_monitores.php: fixed the filter and added a option to filter "not normal" modules. Fixes: #2247 git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@8224 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
This commit is contained in:
parent
84cc57d157
commit
7fb7981c90
|
@ -1,3 +1,15 @@
|
|||
2013-05-29 Miguel de Dios <miguel.dedios@artica.es>
|
||||
|
||||
* operation/agentes/ver_agente.php: cleaned source code style.
|
||||
|
||||
* operation/agentes/alerts_status.php: added the text for the main
|
||||
tab in agent view.
|
||||
|
||||
* operation/agentes/estado_monitores.php: fixed the filter and
|
||||
added a option to filter "not normal" modules.
|
||||
|
||||
Fixes: #2247
|
||||
|
||||
2013-05-28 Sergio Martin <sergio.martin@artica.es>
|
||||
|
||||
* include/functions_ui.php
|
||||
|
|
|
@ -90,6 +90,13 @@ if ($idAgent != 0) {
|
|||
$idGroup = false;
|
||||
|
||||
$print_agent = false;
|
||||
|
||||
$tab = get_parameter ("tab", "main");
|
||||
|
||||
if ($tab == 'main') {
|
||||
echo "<h4 style='padding-top:0px !important;'>" .
|
||||
__('Full list of alerts') . "</h4>";
|
||||
}
|
||||
}
|
||||
else {
|
||||
if (!check_acl ($config["id_user"], 0, "AR")) {
|
||||
|
@ -98,7 +105,10 @@ else {
|
|||
return;
|
||||
}
|
||||
|
||||
$agents = array_keys(agents_get_group_agents(array_keys(users_get_groups($config["id_user"], 'AR', false))));
|
||||
$agents = array_keys(
|
||||
agents_get_group_agents(
|
||||
array_keys(
|
||||
users_get_groups($config["id_user"], 'AR', false))));
|
||||
|
||||
$idGroup = $id_group;
|
||||
|
||||
|
|
|
@ -158,11 +158,16 @@ $tags_sql = tags_get_acl_tags($config['id_user'],
|
|||
$status_filter_monitor = (int)get_parameter('status_filter_monitor', -1);
|
||||
$status_text_monitor = get_parameter('status_text_monitor', '');
|
||||
$filter_monitors = (bool)get_parameter('filter_monitors', false);
|
||||
$monitors_change_filter = (bool)get_parameter('monitors_change_filter', false);
|
||||
|
||||
$status_filter_sql = '1 = 1';
|
||||
if ($status_filter_monitor != -1) {
|
||||
if ($status_filter_monitor == AGENT_MODULE_STATUS_NOT_NORMAL) { //Not normal
|
||||
$status_filter_sql = " tagente_estado.estado <> 0";
|
||||
}
|
||||
elseif ($status_filter_monitor != -1) {
|
||||
$status_filter_sql = 'tagente_estado.estado = ' . $status_filter_monitor;
|
||||
}
|
||||
|
||||
$status_text_monitor_sql = '%';
|
||||
if (!empty($status_text_monitor)) {
|
||||
$status_text_monitor_sql .= $status_text_monitor . '%';
|
||||
|
@ -252,7 +257,13 @@ switch ($config["dbtype"]) {
|
|||
break;
|
||||
}
|
||||
|
||||
if ($monitors_change_filter) {
|
||||
$limit = " LIMIT " . $config['block_size'] . " OFFSET 0";
|
||||
}
|
||||
else {
|
||||
$limit = " LIMIT " . $config['block_size'] . " OFFSET " . get_parameter ('offset',0);
|
||||
}
|
||||
|
||||
|
||||
$modules = db_get_all_rows_sql ($sql . $limit);
|
||||
if (empty ($modules)) {
|
||||
|
@ -569,7 +580,7 @@ foreach ($modules as $module) {
|
|||
echo "<h4 style='padding-top:0px !important;'>" .
|
||||
__('Full list of monitors') . "</h4>";
|
||||
|
||||
print_form_filter_monitors($status_filter_monitor, $status_text_monitor);
|
||||
print_form_filter_monitors($id_agente, $status_filter_monitor, $status_text_monitor);
|
||||
if (empty ($table->data)) {
|
||||
if ($filter_monitors) {
|
||||
echo '<div class="nf">' . __('Any monitors aren\'t with this filter.') . '</div>';
|
||||
|
@ -579,9 +590,17 @@ if (empty ($table->data)) {
|
|||
}
|
||||
}
|
||||
else {
|
||||
ui_pagination ($count_modules);
|
||||
$url = "index.php?" .
|
||||
"sec=estado&" .
|
||||
"sec2=operation/agentes/ver_agente&" .
|
||||
"id_agente=" . $id_agente . "&" .
|
||||
"refr=&filter_monitors=1&" .
|
||||
"status_filter_monitor=" . $status_filter_monitor . "&" .
|
||||
"status_text_monitor=" . $status_text_monitor;
|
||||
|
||||
ui_pagination ($count_modules, $url);
|
||||
html_print_table ($table);
|
||||
ui_pagination ($count_modules);
|
||||
ui_pagination ($count_modules, $url);
|
||||
}
|
||||
|
||||
unset ($table);
|
||||
|
@ -604,18 +623,20 @@ ui_require_jquery_file ('cluetip');
|
|||
/* ]]> */
|
||||
</script>
|
||||
<?php
|
||||
function print_form_filter_monitors($status_filter_monitor = -1,
|
||||
function print_form_filter_monitors($id_agent, $status_filter_monitor = -1,
|
||||
$status_text_monitor = '') {
|
||||
|
||||
$form_text = '<form action="" method="post">';
|
||||
$form_text = '<form action="index.php?sec=estado&sec2=operation/agentes/ver_agente&id_agente=' . $id_agent . '" method="post">';
|
||||
|
||||
$table->data[0][0] = html_print_input_hidden('filter_monitors', 1, true);
|
||||
$table->data[0][0] .= html_print_input_hidden('monitors_change_filter', 1, true);
|
||||
$table->data[0][0] .= __('Status:');
|
||||
$status_list = array(
|
||||
-1 => __('All'),
|
||||
AGENT_MODULE_STATUS_CRITICAL_BAD => __('Critical'),
|
||||
AGENT_MODULE_STATUS_CRITICAL_ALERT => __('Alert'),
|
||||
AGENT_MODULE_STATUS_NORMAL => __('Normal'),
|
||||
AGENT_MODULE_STATUS_NOT_NORMAL => __('Not Normal'),
|
||||
AGENT_MODULE_STATUS_WARNING => __('Warning'),
|
||||
AGENT_MODULE_STATUS_UNKNOW => __('Unknow'));
|
||||
$table->data[0][1] = html_print_select ($status_list,
|
||||
|
|
|
@ -79,8 +79,10 @@ if (is_ajax ()) {
|
|||
if ($get_agent_modules_json_for_multiple_agents_id) {
|
||||
$idAgents = get_parameter('id_agent');
|
||||
|
||||
$modules = db_get_all_rows_sql('SELECT nombre, id_agente_modulo
|
||||
FROM tagente_modulo WHERE id_agente IN (' . implode(',', $idAgents) . ')');
|
||||
$modules = db_get_all_rows_sql('
|
||||
SELECT nombre, id_agente_modulo
|
||||
FROM tagente_modulo
|
||||
WHERE id_agente IN (' . implode(',', $idAgents) . ')');
|
||||
|
||||
$return = array();
|
||||
foreach ($modules as $module) {
|
||||
|
|
Loading…
Reference in New Issue