2012-02-13 Vanessa Gil <vanessa.gil@artica.es>
* util/pandora_manage.pl lib/PandoraFMS/Core.pm: Added optional parameters to create events. git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@5572 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
This commit is contained in:
parent
da7091204b
commit
fb8d05d3e8
|
@ -1,3 +1,8 @@
|
|||
2012-02-13 Vanessa Gil <vanessa.gil@artica.es>
|
||||
|
||||
* util/pandora_manage.pl
|
||||
lib/PandoraFMS/Core.pm: Added optional parameters to create events.
|
||||
|
||||
2012-02-13 Vanessa Gil <vanessa.gil@artica.es>
|
||||
|
||||
* util/pandora_manage.pl: Changed Event validate given id.
|
||||
|
|
|
@ -1539,12 +1539,18 @@ Generate an event.
|
|||
|
||||
=cut
|
||||
##########################################################################
|
||||
sub pandora_event ($$$$$$$$$$;$) {
|
||||
sub pandora_event ($$$$$$$$$$;$;$;$;$;$) {
|
||||
my ($pa_config, $evento, $id_grupo, $id_agente, $severity,
|
||||
$id_alert_am, $id_agentmodule, $event_type, $event_status, $dbh, $source) = @_;
|
||||
$id_alert_am, $id_agentmodule, $event_type, $event_status, $dbh, $source, $user_name, $criticity, $comment, $id_extra) = @_;
|
||||
|
||||
logger($pa_config, "Generating event '$evento' for agent ID $id_agente module ID $id_agentmodule.", 10);
|
||||
logger($pa_config, "Generating event '$evento' for agent ID $id_agente module ID $id_agentmodule.", 15);
|
||||
|
||||
if (!defined ($comment)) {
|
||||
$comment = '';
|
||||
}
|
||||
if (!defined ($id_extra)) {
|
||||
$id_extra = '';
|
||||
}
|
||||
# Get module tags
|
||||
my $module_tags = '';
|
||||
if (defined ($id_agentmodule) && $id_agentmodule > 0) {
|
||||
|
@ -1558,8 +1564,8 @@ sub pandora_event ($$$$$$$$$$;$) {
|
|||
my $timestamp = strftime ("%Y-%m-%d %H:%M:%S", localtime ($utimestamp));
|
||||
$id_agentmodule = 0 unless defined ($id_agentmodule);
|
||||
|
||||
db_do ($dbh, 'INSERT INTO tevento (id_agente, id_grupo, evento, timestamp, estado, utimestamp, event_type, id_agentmodule, id_alert_am, criticity, user_comment, tags, source)
|
||||
VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)', $id_agente, $id_grupo, safe_input ($evento), $timestamp, $event_status, $utimestamp, $event_type, $id_agentmodule, $id_alert_am, $severity, '', $module_tags, $source);
|
||||
db_do ($dbh, 'INSERT INTO tevento (id_agente, id_grupo, evento, timestamp, estado, utimestamp, event_type, id_agentmodule, id_alert_am, criticity, user_comment, tags, source, id_extra)
|
||||
VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)', $id_agente, $id_grupo, safe_input ($evento), $timestamp, $event_status, $utimestamp, $event_type, $id_agentmodule, $id_alert_am, $severity, $comment, $module_tags, $source, $id_extra);
|
||||
}
|
||||
|
||||
##########################################################################
|
||||
|
|
|
@ -129,7 +129,7 @@ sub help_screen{
|
|||
help_screen_line('--disable_eacl', '', 'Disable enterprise ACL system');
|
||||
help_screen_line('--enable_eacl', '', 'Enable enterprise ACL system');
|
||||
print "EVENTS:\n\n" unless $param ne '';
|
||||
help_screen_line('--create_event', '<event> <event_type> <agent_name> <module_name> <group_name> [<event_status> <severity> <template_name>]', 'Add event');
|
||||
help_screen_line('--create_event', '<event> <event_type> <agent_name> <module_name> <group_name> [<event_status> <severity> <template_name> <user_name> <criticity> <comment> <source> <id_extra>]', 'Add event');
|
||||
help_screen_line('--validate_event', '<agent_name> <module_name> <datetime_min> <datetime_max> <user_name> <criticity> <template_name>', 'Validate events');
|
||||
help_screen_line('--validate_event_id', '<event_id>', 'Validate event given a event id');
|
||||
print "INCIDENTS:\n\n" unless $param ne '';
|
||||
|
@ -2246,7 +2246,7 @@ sub cli_delete_profile() {
|
|||
##############################################################################
|
||||
|
||||
sub cli_create_event() {
|
||||
my ($event,$event_type,$agent_name,$module_name,$group_name,$event_status,$severity,$template_name) = @ARGV[2..9];
|
||||
my ($event,$event_type,$agent_name,$module_name,$group_name,$event_status,$severity,$template_name, $user_name, $criticity, $comment, $source, $id_extra) = @ARGV[2..14];
|
||||
|
||||
$event_status = 0 unless defined($event_status);
|
||||
$severity = 0 unless defined($severity);
|
||||
|
@ -2296,7 +2296,7 @@ sub cli_create_event() {
|
|||
print "[INFO] Adding event '$event' for agent '$agent_name' \n\n";
|
||||
|
||||
pandora_event ($conf, $event, $id_group, $id_agent, $severity,
|
||||
$id_alert_agent_module, $id_agentmodule, $event_type, $event_status, $dbh);
|
||||
$id_alert_agent_module, $id_agentmodule, $event_type, $event_status, $dbh, $source, $user_name, $criticity, $comment, $id_extra);
|
||||
}
|
||||
|
||||
##############################################################################
|
||||
|
@ -3188,7 +3188,7 @@ sub pandora_manage_main ($$$) {
|
|||
cli_delete_profile();
|
||||
}
|
||||
elsif ($param eq '--create_event') {
|
||||
param_check($ltotal, 8, 3);
|
||||
param_check($ltotal, 13, 8);
|
||||
cli_create_event();
|
||||
}
|
||||
elsif ($param eq '--validate_event') {
|
||||
|
|
Loading…
Reference in New Issue