2010-07-14 Sergio Martin <sergio.martin@artica.es>
* lib/PandoraFMS/Core.pm util/pandora_manage.pl: Added a create incident feature to CLI for pending task: 3019638 git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@3006 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
This commit is contained in:
parent
263416f343
commit
ba5c3aa0b9
pandora_server
|
@ -1,3 +1,9 @@
|
|||
2010-07-14 Sergio Martin <sergio.martin@artica.es>
|
||||
|
||||
* lib/PandoraFMS/Core.pm
|
||||
util/pandora_manage.pl: Added a create incident feature to
|
||||
CLI for pending task: 3019638
|
||||
|
||||
2010-07-08 Ramon Novoa <rnovoa@artica.es>
|
||||
|
||||
* lib/PandoraFMS/PluginServer.pm: Quote the command passed to
|
||||
|
|
|
@ -1013,14 +1013,17 @@ Create an internal Pandora incident.
|
|||
|
||||
=cut
|
||||
##########################################################################
|
||||
sub pandora_create_incident ($$$$$$$$) {
|
||||
sub pandora_create_incident ($$$$$$$$;$) {
|
||||
my ($pa_config, $dbh, $title, $text,
|
||||
$priority, $status, $origin, $id_group) = @_;
|
||||
$priority, $status, $origin, $id_group, $owner) = @_;
|
||||
|
||||
logger($pa_config, "Creating incident '$text' source '$origin'.", 8);
|
||||
|
||||
db_do($dbh, 'INSERT INTO tincidencia (`inicio`, `titulo`, `descripcion`, `origen`, `estado`, `prioridad`, `id_grupo`)
|
||||
VALUES (NOW(), ?, ?, ?, ?, ?, ?)', $title, $text, $origin, $status, $priority, $id_group);
|
||||
|
||||
# Initialize default parameters
|
||||
$owner = '' unless defined ($owner);
|
||||
|
||||
db_do($dbh, 'INSERT INTO tincidencia (`inicio`, `titulo`, `descripcion`, `origen`, `estado`, `prioridad`, `id_grupo`, `id_usuario`)
|
||||
VALUES (NOW(), ?, ?, ?, ?, ?, ?, ?)', $title, $text, $origin, $status, $priority, $id_group, $owner);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -463,6 +463,7 @@ sub help_screen{
|
|||
help_screen_line('--delete_profile', '<user_name> <profile_name> <group_name>', 'Delete perfil from user');
|
||||
help_screen_line('--create_event', '<event> <event_type> <agent_name> <module_name> <group_name> [<event_status> <severity> <template_name>]', '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('--create_incident', '<title> <description> <origin> <status> <priority 0 for Informative, 1 for Low, 2 for Medium, 3 for Serious, 4 for Very serious or 5 for Maintenance> <group> [<owner>]', 'Create incidents');
|
||||
print "\n";
|
||||
exit;
|
||||
}
|
||||
|
@ -1013,6 +1014,16 @@ sub pandora_manage_main ($$$) {
|
|||
pandora_validate_event_filter ($conf, $id_agentmodule, $id_agent, $datetime_min, $datetime_max, $user_name, $id_alert_agent_module, $criticity, $dbh);
|
||||
print "[INFO] Validating event for agent '$agent_name'\n\n";
|
||||
}
|
||||
elsif ($param =~ m/--create_incident/i) {
|
||||
param_check($ltotal, 7, 1);
|
||||
my ($title, $description, $origin, $status, $priority, $group_name, $owner) = @ARGV[2..8];
|
||||
|
||||
my $id_group = get_group_id($dbh,$group_name);
|
||||
exist_check($id_group,'group',$group_name);
|
||||
|
||||
pandora_create_incident ($conf, $dbh, $title, $description, $priority, $status, $origin, $id_group, $owner);
|
||||
print "[INFO] Creating incident '$title'\n\n";
|
||||
}
|
||||
}
|
||||
|
||||
print "[W] Nothing to do. Exiting !\n\n";
|
||||
|
|
Loading…
Reference in New Issue