Merge remote-tracking branch 'origin/develop' into 339-No_cortar_elementos_en_PDF

Conflicts:
	pandora_console/include/functions_reporting_html.php
	pandora_console/install.php


Former-commit-id: 8f8f95cebc06d0a6802c6a7204a942658efa21f0
This commit is contained in:
Daniel Barbero 2019-02-13 08:02:46 +01:00
commit eeb5f0e296
37 changed files with 251 additions and 62 deletions

View File

@ -1,5 +1,5 @@
package: pandorafms-agent-unix
Version: 7.0NG.731-190207
Version: 7.0NG.731-190213
Architecture: all
Priority: optional
Section: admin

View File

@ -14,7 +14,7 @@
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
pandora_version="7.0NG.731-190207"
pandora_version="7.0NG.731-190213"
echo "Test if you has the tools for to make the packages."
whereis dpkg-deb | cut -d":" -f2 | grep dpkg-deb > /dev/null

View File

@ -42,7 +42,7 @@ my $Sem = undef;
my $ThreadSem = undef;
use constant AGENT_VERSION => '7.0NG.731';
use constant AGENT_BUILD => '190207';
use constant AGENT_BUILD => '190213';
# Agent log default file size maximum and instances
use constant DEFAULT_MAX_LOG_SIZE => 600000;

View File

@ -3,7 +3,7 @@
#
%define name pandorafms_agent_unix
%define version 7.0NG.731
%define release 190207
%define release 190213
Summary: Pandora FMS Linux agent, PERL version
Name: %{name}

View File

@ -3,7 +3,7 @@
#
%define name pandorafms_agent_unix
%define version 7.0NG.731
%define release 190207
%define release 190213
Summary: Pandora FMS Linux agent, PERL version
Name: %{name}

View File

@ -10,7 +10,7 @@
# **********************************************************************
PI_VERSION="7.0NG.731"
PI_BUILD="190207"
PI_BUILD="190213"
OS_NAME=`uname -s`
FORCE=0

View File

@ -186,7 +186,7 @@ UpgradeApplicationID
{}
Version
{190207}
{190213}
ViewReadme
{Yes}

View File

@ -30,7 +30,7 @@ using namespace Pandora;
using namespace Pandora_Strutils;
#define PATH_SIZE _MAX_PATH+1
#define PANDORA_VERSION ("7.0NG.731(Build 190207)")
#define PANDORA_VERSION ("7.0NG.731(Build 190213)")
string pandora_path;
string pandora_dir;

View File

@ -11,7 +11,7 @@ BEGIN
VALUE "LegalCopyright", "Artica ST"
VALUE "OriginalFilename", "PandoraAgent.exe"
VALUE "ProductName", "Pandora FMS Windows Agent"
VALUE "ProductVersion", "(7.0NG.731(Build 190207))"
VALUE "ProductVersion", "(7.0NG.731(Build 190213))"
VALUE "FileVersion", "1.0.0.0"
END
END

View File

@ -1,5 +1,5 @@
package: pandorafms-console
Version: 7.0NG.731-190207
Version: 7.0NG.731-190213
Architecture: all
Priority: optional
Section: admin

View File

@ -14,7 +14,7 @@
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
pandora_version="7.0NG.731-190207"
pandora_version="7.0NG.731-190213"
package_pear=0
package_pandora=1

View File

@ -320,6 +320,23 @@ $(document).ready( function() {
}
else {
$('div#title_menu').hide();
if(!click_display){
$('#menu').mouseenter(function() {
handsInMenu = 1;
openTimeMenu = new Date().getTime();
$('ul.submenu').css('left', '44px');
}).mouseleave(function() {
handsInMenu = 0;
setTimeout(function() {
openedMenu = new Date().getTime() - openTimeMenu;
if(openedMenu > 1000 && handsInMenu == 0) {
$('li.menu_icon').removeClass( " no_hidden_menu");
$('li.menu_icon').find('li').removeClass( " no_hidden_menu" );
$('ul.submenu').css('left', '44px');
}
}, 2500);
});
}
}
});
/* ]]> */
@ -332,7 +349,6 @@ $(document).ready( function() {
handsIn2 = 0;
if(!click_display){
if (autohidden_menu) {
$('.menu_icon').mouseenter(function() {
table_hover = $(this);
handsIn = 1;
@ -352,7 +368,6 @@ $(document).ready( function() {
}
}, 2500);
});
}
}else{
$(document).ready(function() {
if (autohidden_menu) {

View File

@ -945,6 +945,10 @@ if ($update_agent) {
$disabled ? '1' : '0',
]
);
// Validate alerts for disabled agents.
if ($disabled) {
alerts_validate_alert_agent($id_agente);
}
}
if ($tpolicy_group_old) {

View File

@ -538,17 +538,22 @@ if ($tab == 'tree') {
$url_delete = 'index.php?sec=gagente&sec2=godmode/groups/group_list&delete_group=1&id_group='.$group['id_grupo'];
$table->data[$key][0] = $group['id_grupo'];
$table->data[$key][1] = "<a href='$url'>".$group['nombre'].'</a>';
$table->data[$key][2] = html_print_image(
'images/groups_small/'.$group['icon'].'.png',
true,
[
'style' => '',
'class' => 'bot',
'alt' => $group['nombre'],
'title' => $group['nombre'],
false, false, false, true
]
);
if ($group['icon'] != '') {
$table->data[$key][2] = html_print_image(
'images/groups_small/'.$group['icon'].'.png',
true,
[
'style' => '',
'class' => 'bot',
'alt' => $group['nombre'],
'title' => $group['nombre'],
false, false, false, true
]
);
} else {
$table->data[$key][2] = '';
}
// reporting_get_group_stats
$table->data[$key][3] = $group['disabled'] ? __('Disabled') : __('Enabled');

View File

@ -205,6 +205,10 @@ if ($update_agents) {
$values['disabled'],
]
);
// Validate alerts for disabled agents.
if ($values['disabled'] == 1) {
alerts_validate_alert_agent($id_agent);
}
}
if ($group_old || $result) {

View File

@ -42,6 +42,7 @@ if (!$is_metaconsole) {
$url_visual_console_favorite = 'index.php?sec=screen&sec2=screens/screens&action=visualmap_favorite';
$url_visual_console_template = 'index.php?sec=screen&sec2=screens/screens&action=visualmap_template';
$url_visual_console_template_wizard = 'index.php?sec=screen&sec2=screens/screens&action=visualmap_wizard';
$url_visual_console_manager = 'index.php?sec=screen&sec2=enterprise/extensions/visual_console_manager';
}
$pure = (int) get_parameter('pure', 0);
@ -70,6 +71,12 @@ if ($is_enterprise && $vconsoles_manage) {
'active' => false,
'text' => '<a href="'.$url_visual_console_template_wizard.'">'.html_print_image('images/wand.png', true, ['title' => __('Visual Console Template Wizard')]).'</a>',
];
if ($is_metaconsole) {
$buttons['visual_console_manager'] = [
'active' => false,
'text' => '<a href="'.$url_visual_console_manager.'">'.html_print_image('images/builder.png', true, ['title' => __('Visual Console Manager')]).'</a>',
];
}
}
if (!$is_metaconsole) {

View File

@ -41,6 +41,7 @@ if (!$is_metaconsole) {
$url_visual_console_favorite = 'index.php?sec=screen&sec2=screens/screens&action=visualmap_favorite';
$url_visual_console_template = 'index.php?sec=screen&sec2=screens/screens&action=visualmap_template';
$url_visual_console_template_wizard = 'index.php?sec=screen&sec2=screens/screens&action=visualmap_wizard';
$url_visual_console_manager = 'index.php?sec=screen&sec2=enterprise/extensions/visual_console_manager';
}
$buttons['visual_console'] = [
@ -63,6 +64,13 @@ if ($is_enterprise && $vconsoles_manage) {
'active' => false,
'text' => '<a href="'.$url_visual_console_template_wizard.'">'.html_print_image('images/wand.png', true, ['title' => __('Visual Console Template Wizard')]).'</a>',
];
if ($is_metaconsole) {
$buttons['visual_console_manager'] = [
'active' => false,
'text' => '<a href="'.$url_visual_console_manager.'">'.html_print_image('images/builder.png', true, ['title' => __('Visual Console Manager')]).'</a>',
];
}
}
if (!$is_metaconsole) {

View File

@ -20,7 +20,7 @@
/**
* Pandora build version and version
*/
$build_version = 'PC190207';
$build_version = 'PC190213';
$pandora_version = 'v7.0NG.731';
// Do not overwrite default timezone set if defined.

View File

@ -1754,7 +1754,8 @@ function get_snmpwalk(
$quick_print=0,
$base_oid='',
$snmp_port='',
$server_to_exec=0
$server_to_exec=0,
$extra_arguments=''
) {
global $config;
@ -1805,15 +1806,15 @@ function get_snmpwalk(
case '3':
switch ($snmp3_security_level) {
case 'authNoPriv':
$command_str = $snmpwalk_bin.' -m ALL -Oa -v 3'.' -u '.escapeshellarg($snmp3_auth_user).' -A '.escapeshellarg($snmp3_auth_pass).' -l '.escapeshellarg($snmp3_security_level).' -a '.escapeshellarg($snmp3_auth_method).' '.escapeshellarg($ip_target).' '.$base_oid.' 2> '.$error_redir_dir;
$command_str = $snmpwalk_bin.' -m ALL -Oa '.$extra_arguments.' -v 3'.' -u '.escapeshellarg($snmp3_auth_user).' -A '.escapeshellarg($snmp3_auth_pass).' -l '.escapeshellarg($snmp3_security_level).' -a '.escapeshellarg($snmp3_auth_method).' '.escapeshellarg($ip_target).' '.$base_oid.' 2> '.$error_redir_dir;
break;
case 'noAuthNoPriv':
$command_str = $snmpwalk_bin.' -m ALL -Oa -v 3'.' -u '.escapeshellarg($snmp3_auth_user).' -l '.escapeshellarg($snmp3_security_level).' '.escapeshellarg($ip_target).' '.$base_oid.' 2> '.$error_redir_dir;
$command_str = $snmpwalk_bin.' -m ALL -Oa '.$extra_arguments.' -v 3'.' -u '.escapeshellarg($snmp3_auth_user).' -l '.escapeshellarg($snmp3_security_level).' '.escapeshellarg($ip_target).' '.$base_oid.' 2> '.$error_redir_dir;
break;
default:
$command_str = $snmpwalk_bin.' -m ALL -Oa -v 3'.' -u '.escapeshellarg($snmp3_auth_user).' -A '.escapeshellarg($snmp3_auth_pass).' -l '.escapeshellarg($snmp3_security_level).' -a '.escapeshellarg($snmp3_auth_method).' -x '.escapeshellarg($snmp3_privacy_method).' -X '.escapeshellarg($snmp3_privacy_pass).' '.escapeshellarg($ip_target).' '.$base_oid.' 2> '.$error_redir_dir;
$command_str = $snmpwalk_bin.' -m ALL -Oa '.$extra_arguments.' -v 3'.' -u '.escapeshellarg($snmp3_auth_user).' -A '.escapeshellarg($snmp3_auth_pass).' -l '.escapeshellarg($snmp3_security_level).' -a '.escapeshellarg($snmp3_auth_method).' -x '.escapeshellarg($snmp3_privacy_method).' -X '.escapeshellarg($snmp3_privacy_pass).' '.escapeshellarg($ip_target).' '.$base_oid.' 2> '.$error_redir_dir;
break;
}
break;
@ -1822,7 +1823,7 @@ function get_snmpwalk(
case '2c':
case '1':
default:
$command_str = $snmpwalk_bin.' -m ALL -Oa -v '.escapeshellarg($snmp_version).' -c '.escapeshellarg(io_safe_output($snmp_community)).' '.escapeshellarg($ip_target).' '.$base_oid.' 2> '.$error_redir_dir;
$command_str = $snmpwalk_bin.' -m ALL '.$extra_arguments.' -Oa -v '.escapeshellarg($snmp_version).' -c '.escapeshellarg(io_safe_output($snmp_community)).' '.escapeshellarg($ip_target).' '.$base_oid.' 2> '.$error_redir_dir;
break;
}

View File

@ -1700,6 +1700,43 @@ function alerts_get_effective_alert_actions($id_agent_module)
}
/**
* Validate alerts for the given module.
*
* @param int agent_module_id ID of the module
*/
function alerts_validate_alert_module($agent_module_id)
{
db_process_sql(
sprintf(
'UPDATE talert_template_modules
SET times_fired=0, internal_counter=0
WHERE id_agent_module = %d',
$agent_module_id
)
);
}
/**
* Validate alerts for the given agent.
*
* @param int agent_id ID of the agent
*/
function alerts_validate_alert_agent($agent_id)
{
db_process_sql(
sprintf(
'UPDATE talert_template_modules tm
INNER JOIN tagente_modulo am ON tm.id_agent_module = am.id_agente_modulo
SET tm.times_fired=0, tm.internal_counter=0
WHERE am.id_agente = %d',
$agent_id
)
);
}
/**
* Validates an alert id or an array of alert id's.
*

View File

@ -472,11 +472,12 @@ function api_get_module_last_value($idAgentModule, $trash1, $other=';', $returnT
DB column mapping table used by tree_agents (and get module_properties)
*/
// agent related field mappings (output field => column designation for 'tagente')
/*
* Agent related field mappings (output field => column designation for 'tagente').
* agent_id is not in this list (because it is mandatory).
* agent_id_group is not in this list.
*/
$agent_field_column_mapping = [
/*
agent_id is not in this list (because it is mandatory) */
// agent_id_group is not in this list
'agent_name' => 'nombre as agent_name',
'agent_direction' => 'direccion as agent_direction',
'agent_comentary' => 'comentarios as agent_comentary',
@ -496,8 +497,8 @@ $agent_field_column_mapping = [
];
// module related field mappings 1/2 (output field => column for 'tagente_modulo')
// module_id_agent_modulo is not in this list
$module_field_column_mampping = [
// module_id_agent_modulo is not in this list
'module_id_agent' => 'id_agente as module_id_agent',
'module_id_module_type' => 'id_tipo_modulo as module_id_module_type',
'module_description' => 'descripcion as module_description',
@ -541,8 +542,8 @@ $module_field_column_mampping = [
];
// module related field mappings 2/2 (output field => column for 'tagente_estado')
// module_id_agent_modulo is not in this list
$estado_fields_to_columns_mapping = [
// module_id_agent_modulo is not in this list
'module_id_agent_state' => 'id_agente_estado as module_id_agent_state',
'module_data' => 'datos as module_data',
'module_timestamp' => 'timestamp as module_timestamp',
@ -14609,3 +14610,67 @@ function api_get_users($thrash1, $thrash2, $other, $returnType)
}
}
/**
* Resets module counts and alert counts in the agents
*
* @param $id id of the agent you want to synchronize. Add "All" to synchronize all agents
* @param $trash1
* @param $trash2
* @param $trash3
*
* Example:
* api.php?op=set&op2=reset_agent_counts&apipass=1234&user=admin&pass=pandora&id=All
*/
function api_set_reset_agent_counts($id, $thrash1, $thrash2, $thrash3)
{
global $config;
if (!check_acl($config['id_user'], 0, 'AW')) {
returnError('forbidden', 'string');
return;
}
if ($id == '' || !$id) {
returnError('error_parameter', __('Error. Agent cannot be left blank.'));
return;
}
if ($id != 'All') {
$agent = db_get_row_filter('tagente', ['id_agente' => $id]);
if (empty($agent)) {
returnError('error_agent', __('This agent does not exist.'));
return;
} else {
$return = db_process_sql_update(
'tagente',
[
'update_module_count' => 1,
'update_alert_count' => 1,
],
['id_agente' => $id]
);
}
} else {
$return = db_process_sql_update(
'tagente',
[
'update_module_count' => 1,
'update_alert_count' => 1,
]
);
}
$data = __('Successfully updated module/alert count in id agent %d.', $id);
if ($id == 'All') {
$data = __('Successfully updated module/alert count in all agents');
}
if ($return === false) {
returnError('error_reset_agent_counts', 'Could not be updated module/alert counts in id agent %d.', $id);
} else {
returnData('string', ['type' => 'string', 'data' => $data]);
}
}

View File

@ -372,7 +372,7 @@ function menu_print_menu(&$menu)
}
// Print out the first level
$output .= '<li title="'.ucwords(str_replace(['oper-', 'god-'], '', $id)).'" class="'.implode(' ', $classes).' '.$seleccionado.'" id="icon_'.$id.'">';
$output .= '<li title="'.$main['text'].'" class="'.implode(' ', $classes).' '.$seleccionado.'" id="icon_'.$id.'">';
// onclick="location.href=\'index.php?sec='.$mainsec.'&amp;sec2='.$main["sec2"].($main["refr"] ? '&amp;refr='.$main["refr"] : '').'\'">';
$length = strlen(__($main['text']));
$padding_top = ( $length >= 18) ? 6 : 12;

View File

@ -329,6 +329,11 @@ function modules_change_disabled($id_agent_module, $new_value=1)
continue;
}
// Validate alerts for disabled modules.
if ($new_value == 1) {
alerts_validate_alert_module($id_module);
}
$id_agent_changed[] = modules_get_agentmodule_agent($id_module);
$id_agent_module_changed[] = $id_module;
}

View File

@ -1181,12 +1181,11 @@ function reporting_SLA(
}
}
// SLA items sorted descending ()
if ($content['top_n'] == 2) {
// SLA items sorted descending ()
arsort($return['data']['']);
}
// SLA items sorted ascending
else if ($content['top_n'] == 1) {
} else if ($content['top_n'] == 1) {
// SLA items sorted ascending
asort($sla_showed_values);
}
@ -6722,7 +6721,7 @@ function reporting_general($report, $content)
'id_agente_modulo',
$row['id_agent_module']
);
$id_module_type = db_get_value('id_tipo_modulo', 'tagente_modulo', 'nombre', $mod_name);
if ($content['period'] == 0) {
$data_res[$index] = modules_get_last_value($row['id_agent_module']);
} else {
@ -6769,16 +6768,31 @@ function reporting_general($report, $content)
$agent_name[$index] = $ag_name;
$module_name[$index] = $mod_name;
$units[$index] = $unit;
$id_module_types[$index] = $id_module_type;
$operations[$index] = $row['operation'];
break;
case REPORT_GENERAL_GROUP_BY_AGENT:
$id_module_types[$index] = $id_module_type;
if ($id_module_types[$index] == 2 || $id_module_types[$index] == 6 || $id_module_types[$index] == 9 || $id_module_types[$index] == 18) {
$data_res[$index] = round($data_res[$index], 0, PHP_ROUND_HALF_DOWN);
}
if ($id_module_types[$index] == 2 || $id_module_types[$index] == 6 || $id_module_types[$index] == 9 || $id_module_types[$index] == 18) {
if ($data_res[$index] == 1) {
$data_res[$index] = 'Up';
} else if ($data_res[$index] == 0) {
$data_res[$index] = 'Down';
}
}
if ($data_res[$index] === false) {
$return['data'][$ag_name][$mod_name] = null;
} else {
if (!is_numeric($data_res[$index])) {
$return['data'][$ag_name][$mod_name] = $data_res[$index];
} else {
hd($data_res[$index], true);
$return['data'][$ag_name][$mod_name] = format_for_graph($data_res[$index], 2).' '.$unit;
}
}
@ -6894,7 +6908,7 @@ function reporting_general($report, $content)
$data['module'] = $module_name[$i];
$data['id_agent_module'] = $id_agent_module[$i];
$data['id_agent'] = agents_get_agent_id_by_module_id($id_agent_module[$i]);
$data['id_module_type'] = $id_module_types[$i];
$data['operator'] = '';
if ($content['period'] != 0) {
switch ($operations[$i]) {

View File

@ -3104,6 +3104,16 @@ function reporting_html_general($table, $item, $pdf=0)
// End - Order by agent.
foreach ($item['data'] as $row) {
if ($row['id_module_type'] == 6 || $row['id_module_type'] == 9 || $row['id_module_type'] == 18 || $row['id_module_type'] == 2) {
$row['formated_value'] = round($row['formated_value'], 0, PHP_ROUND_HALF_DOWN);
}
if (($row['id_module_type'] == 6 || $row['id_module_type'] == 9 || $row['id_module_type'] == 18 || $row['id_module_type'] == 2) && $row['formated_value'] == 1) {
$row['formated_value'] = 'Up';
} else if (($row['id_module_type'] == 6 || $row['id_module_type'] == 9 || $row['id_module_type'] == 18 || $row['id_module_type'] == 2) && $row['formated_value'] == 0) {
$row['formated_value'] = 'Down';
}
if ($item['date']['period'] != 0) {
$table1->data[] = [
$row['agent'],
@ -3165,13 +3175,11 @@ function reporting_html_general($table, $item, $pdf=0)
}
$list_modules = array_keys($list_modules);
$table1->width = '99%';
$table1->data = [];
$table1->head = array_merge([__('Agent')], $list_modules);
foreach ($item['data'] as $agent => $modules) {
$row = [];
$row['agent'] = $agent;
$table1->style['agent'] = 'text-align: center;';
foreach ($list_modules as $name) {

View File

@ -3902,13 +3902,16 @@ function visual_map_translate_agent_status($agent_status)
{
switch ($agent_status) {
case AGENT_STATUS_NORMAL:
case AGENT_MODULE_STATUS_NORMAL_ALERT:
default:
return VISUAL_MAP_STATUS_NORMAL;
case AGENT_STATUS_CRITICAL:
case AGENT_MODULE_STATUS_CRITICAL_ALERT:
return VISUAL_MAP_STATUS_CRITICAL_BAD;
case AGENT_STATUS_WARNING:
case AGENT_MODULE_STATUS_WARNING_ALERT:
return VISUAL_MAP_STATUS_WARNING;
case AGENT_STATUS_NOT_INIT:

View File

@ -3,7 +3,7 @@
#
%define name pandorafms_console
%define version 7.0NG.731
%define release 190207
%define release 190213
# User and Group under which Apache is running
%define httpd_name httpd

View File

@ -3,7 +3,7 @@
#
%define name pandorafms_console
%define version 7.0NG.731
%define release 190207
%define release 190213
%define httpd_name httpd
# User and Group under which Apache is running
%define httpd_name apache2

View File

@ -1,5 +1,5 @@
package: pandorafms-server
Version: 7.0NG.731-190207
Version: 7.0NG.731-190213
Architecture: all
Priority: optional
Section: admin

View File

@ -14,7 +14,7 @@
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
pandora_version="7.0NG.731-190207"
pandora_version="7.0NG.731-190213"
package_cpan=0
package_pandora=1

View File

@ -45,7 +45,7 @@ our @EXPORT = qw(
# version: Defines actual version of Pandora Server for this module only
my $pandora_version = "7.0NG.731";
my $pandora_build = "190207";
my $pandora_build = "190213";
our $VERSION = $pandora_version." ".$pandora_build;
# Setup hash

View File

@ -32,7 +32,7 @@ our @ISA = qw(Exporter);
# version: Defines actual version of Pandora Server for this module only
my $pandora_version = "7.0NG.731";
my $pandora_build = "190207";
my $pandora_build = "190213";
our $VERSION = $pandora_version." ".$pandora_build;
our %EXPORT_TAGS = ( 'all' => [ qw() ] );

View File

@ -3,7 +3,7 @@
#
%define name pandorafms_server
%define version 7.0NG.731
%define release 190207
%define release 190213
Summary: Pandora FMS Server
Name: %{name}

View File

@ -3,7 +3,7 @@
#
%define name pandorafms_server
%define version 7.0NG.731
%define release 190207
%define release 190213
Summary: Pandora FMS Server
Name: %{name}

View File

@ -9,7 +9,7 @@
# **********************************************************************
PI_VERSION="7.0NG.731"
PI_BUILD="190207"
PI_BUILD="190213"
MODE=$1
if [ $# -gt 1 ]; then

View File

@ -34,7 +34,7 @@ use PandoraFMS::Config;
use PandoraFMS::DB;
# version: define current version
my $version = "7.0NG.731 PS190207";
my $version = "7.0NG.731 PS190213";
# Pandora server configuration
my %conf;
@ -171,11 +171,6 @@ sub pandora_purgedb ($$) {
if (!defined($conf->{'_string_purge'})){
$conf->{'_string_purge'} = 7;
}
# Update alert with last_fired older than today - time_threshold
my @templates = get_db_rows ($dbh, 'SELECT t1.id,t1.time_threshold FROM talert_templates t1 WHERE EXISTS ( SELECT * FROM talert_template_modules t2 WHERE t1.id = t2.id_alert_template );');
foreach my $template(@templates) {
db_do($dbh, 'UPDATE talert_template_modules SET times_fired = 0 WHERE id_alert_template = ? AND times_fired > 0 AND last_fired < (? - ?)',$template->{'id'},time(),$template->{'time_threshold'});
}
if ($conf->{'_string_purge'} > 0) {
$ulimit_access_timestamp = time() - 86400;

View File

@ -36,7 +36,7 @@ use Encode::Locale;
Encode::Locale::decode_argv;
# version: define current version
my $version = "7.0NG.731 PS190207";
my $version = "7.0NG.731 PS190213";
# save program name for logging
my $progname = basename($0);
@ -137,6 +137,7 @@ sub help_screen{
help_screen_line('--delete_cluster_item', '<id_item>', 'Deleting cluster item');
help_screen_line('--get_cluster_status', '<id_cluster>', 'Getting cluster status');
help_screen_line('--set_disabled_and_standby', '<id_agent> <id_node> <value>', 'Overwrite and disable and standby status');
help_screen_line('--reset_agent_counts', '<id_agent>', 'Resets module counts and alert counts in the agents');
print "\nMODULES:\n\n" unless $param ne '';
help_screen_line('--create_data_module', "<module_name> <module_type> <agent_name> [<description> <module_group> \n\t <min> <max> <post_process> <interval> <warning_min> <warning_max> <critical_min> <critical_max> \n\t <history_data> <definition_file> <warning_str> <critical_str>\n\t <unknown_events> <ff_threshold> <each_ff> <ff_threshold_normal>\n\t <ff_threshold_warning> <ff_threshold_critical> <ff_timeout> <warning_inverse> <critical_inverse>\n\t <critical_instructions> <warning_instructions> <unknown_instructions>]", 'Add data server module to agent');
help_screen_line('--create_web_module', "<module_name> <module_type> <agent_name> [<description> <module_group> \n\t <min> <max> <post_process> <interval> <warning_min> <warning_max> <critical_min> <critical_max> \n\t <history_data> <retries> <requests> <agent_browser_id> <auth_server> <auth_realm> <definition_file>\n\t <proxy_url> <proxy_auth_login> <proxy_auth_password> <warning_str> <critical_str>\n\t <unknown_events> <ff_threshold> <each_ff> <ff_threshold_normal>\n\t <ff_threshold_warning> <ff_threshold_critical> <ff_timeout> <warning_inverse> <critical_inverse>\n\t <critical_instructions> <warning_instructions> <unknown_instructions>].\n\t The valid data types are web_data, web_proc, web_content_data or web_content_string", 'Add web server module to agent');
@ -6375,6 +6376,10 @@ sub pandora_manage_main ($$$) {
param_check($ltotal, 3, 1);
cli_set_disabled_and_standby();
}
elsif ($param eq '--reset_agent_counts') {
param_check($ltotal, 1, 0);
cli_reset_agent_counts();
}
else {
print_log "[ERROR] Invalid option '$param'.\n\n";
$param = '';
@ -6978,4 +6983,17 @@ sub cli_set_disabled_and_standby() {
my $exit_code = (defined($result) && "$result" eq "1") ? "1" : "0";
print "\n$exit_code\n";
}
}
##############################################################################
# Resets module counts and alert counts in the agents.
# Related option: --reset_agent_counts
##############################################################################
sub cli_reset_agent_counts() {
my $agent_id = @ARGV[2];
my $result = api_call(\%conf,'set', 'reset_agent_counts', $agent_id);
print "$result \n\n ";
}