Added data precision to events. Ticket #288
This commit is contained in:
parent
f7fd67ca79
commit
89f0ec658c
|
@ -200,6 +200,7 @@ sub pandora_load_config {
|
|||
$pa_config->{"umask"} = "0007"; # environment settings umask applied over chmod (A & (not B))
|
||||
$pa_config->{"server_threshold"} = 30;
|
||||
$pa_config->{"alert_threshold"} = 60;
|
||||
$pa_config->{"graph_precision"} = 1;
|
||||
$pa_config->{"log_file"} = "/var/log/pandora_server.log";
|
||||
$pa_config->{"errorlog_file"} = "/var/log/pandora_server.error";
|
||||
$pa_config->{"networktimeout"} = 5; # By default, not in config file yet
|
||||
|
@ -692,6 +693,9 @@ sub pandora_load_config {
|
|||
elsif ($parametro =~ m/^alert_threshold\s+([0-9]*)/i) {
|
||||
$pa_config->{"alert_threshold"} = clean_blank($1);
|
||||
}
|
||||
elsif ($parametro =~ m/^graph_precision\s+([0-9]*)/i) {
|
||||
$pa_config->{"graph_precision"} = clean_blank($1);
|
||||
}
|
||||
elsif ($parametro =~ m/^network_timeout\s+([0-9]*)/i) {
|
||||
$pa_config->{'networktimeout'}= clean_blank($1);
|
||||
}
|
||||
|
|
|
@ -947,6 +947,13 @@ sub pandora_execute_action ($$$$$$$$$;$) {
|
|||
$group = get_db_single_row ($dbh, 'SELECT * FROM tgrupo WHERE id_grupo = ?', $agent->{'id_grupo'});
|
||||
}
|
||||
|
||||
if (is_numeric($data)) {
|
||||
my $data_precision = $pa_config->{'graph_precision'};
|
||||
$data = sprintf("%.$data_precision" . "f", $data);
|
||||
$data =~ s/0+$//;
|
||||
$data =~ s/\.+$//;
|
||||
}
|
||||
|
||||
# Thanks to people of Cordoba univ. for the patch for adding module and
|
||||
# id_agent macros to the alert.
|
||||
|
||||
|
@ -3965,6 +3972,13 @@ sub generate_status_event ($$$$$$$$) {
|
|||
return;
|
||||
}
|
||||
|
||||
if (is_numeric($data)) {
|
||||
my $data_precision = $pa_config->{'graph_precision'};
|
||||
$data = sprintf("%.$data_precision" . "f", $data);
|
||||
$data =~ s/0+$//;
|
||||
$data =~ s/\.+$//;
|
||||
}
|
||||
|
||||
# Replace macros
|
||||
my %macros = (
|
||||
_module_ => safe_output($module->{'nombre'}),
|
||||
|
|
Loading…
Reference in New Issue