2012-02-13 Ramon Novoa <rnovoa@artica.es>

* bin/pandora_exec: Quote command line arguments. Thanks to Junichi
	  Satoh.

	* lib/PandoraFMS/Core.pm: Small fixes to pandora_event.



git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@5578 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
This commit is contained in:
ramonn 2012-02-13 17:05:44 +00:00
parent 40832fad46
commit 3c13485b5a
3 changed files with 19 additions and 11 deletions

View File

@ -1,3 +1,10 @@
2012-02-13 Ramon Novoa <rnovoa@artica.es>
* bin/pandora_exec: Quote command line arguments. Thanks to Junichi
Satoh.
* lib/PandoraFMS/Core.pm: Small fixes to pandora_event.
2012-02-13 Vanessa Gil <vanessa.gil@artica.es> 2012-02-13 Vanessa Gil <vanessa.gil@artica.es>
* util/pandora_manage.pl * util/pandora_manage.pl

View File

@ -34,7 +34,11 @@ if ($#ARGV < 1) {
my @opts = @ARGV; my @opts = @ARGV;
my $timeout = shift(@opts); my $timeout = shift(@opts);
my $command = join(' ', @opts); my $command;
foreach my $arg (@opts) {
$command .= quotemeta ($arg) . ' ';
}
chomp ($command);
my $output = ''; my $output = '';
my $ReturnCode = 0; my $ReturnCode = 0;

View File

@ -1539,18 +1539,12 @@ Generate an event.
=cut =cut
########################################################################## ##########################################################################
sub pandora_event ($$$$$$$$$$;$;$;$;$;$) { sub pandora_event ($$$$$$$$$$;$$$$) {
my ($pa_config, $evento, $id_grupo, $id_agente, $severity, my ($pa_config, $evento, $id_grupo, $id_agente, $severity,
$id_alert_am, $id_agentmodule, $event_type, $event_status, $dbh, $source, $user_name, $criticity, $comment, $id_extra) = @_; $id_alert_am, $id_agentmodule, $event_type, $event_status, $dbh, $source, $user_name, $comment, $id_extra) = @_;
logger($pa_config, "Generating event '$evento' for agent ID $id_agente module ID $id_agentmodule.", 15); logger($pa_config, "Generating event '$evento' for agent ID $id_agente module ID $id_agentmodule.", 10);
if (!defined ($comment)) {
$comment = '';
}
if (!defined ($id_extra)) {
$id_extra = '';
}
# Get module tags # Get module tags
my $module_tags = ''; my $module_tags = '';
if (defined ($id_agentmodule) && $id_agentmodule > 0) { if (defined ($id_agentmodule) && $id_agentmodule > 0) {
@ -1559,7 +1553,10 @@ sub pandora_event ($$$$$$$$$$;$;$;$;$;$) {
# Set default values for optional parameters # Set default values for optional parameters
$source = 'Pandora' unless defined ($source); $source = 'Pandora' unless defined ($source);
$comment = '' unless defined ($comment);
$id_extra = '' unless defined ($id_extra);
$user_name = '' unless defined ($user_name);
my $utimestamp = time (); my $utimestamp = time ();
my $timestamp = strftime ("%Y-%m-%d %H:%M:%S", localtime ($utimestamp)); my $timestamp = strftime ("%Y-%m-%d %H:%M:%S", localtime ($utimestamp));
$id_agentmodule = 0 unless defined ($id_agentmodule); $id_agentmodule = 0 unless defined ($id_agentmodule);