mirror of
https://github.com/pandorafms/pandorafms.git
synced 2025-07-31 01:35:36 +02:00
#9167 Fixed macros
This commit is contained in:
parent
06be85e044
commit
193ef3171c
@ -160,28 +160,35 @@ sub data_consumer ($$) {
|
|||||||
if($timeout <= 0) {
|
if($timeout <= 0) {
|
||||||
$timeout = 15;
|
$timeout = 15;
|
||||||
}
|
}
|
||||||
|
|
||||||
# Build command to execute
|
# Build command to execute
|
||||||
my $command = $plugin->{'execute'};
|
my $command = $plugin->{'execute'};
|
||||||
|
|
||||||
if (!defined($plugin->{'parameters'})){
|
if (!defined($plugin->{'parameters'})){
|
||||||
$plugin->{'parameters'} = "";
|
$plugin->{'parameters'} = "";
|
||||||
}
|
}
|
||||||
|
|
||||||
my $parameters = $plugin->{'parameters'};
|
my $parameters = $plugin->{'parameters'};
|
||||||
my %plugin_macros_for_alert_processing;
|
my %plugin_macros_for_alert_processing;
|
||||||
|
|
||||||
if (!defined($module->{'macros'})){
|
if (!defined($module->{'macros'})){
|
||||||
$module->{'macros'} = "";
|
$module->{'macros'} = "";
|
||||||
}
|
}
|
||||||
|
|
||||||
# Plugin macros
|
# Plugin macros
|
||||||
eval {
|
eval {
|
||||||
if ($module->{'macros'} ne '') {
|
if ($module->{'macros'} ne '') {
|
||||||
logger ($pa_config, "Decoding json macros from # $module_id plugin command '$command'", 10);
|
logger ($pa_config, "Decoding json macros from # $module_id plugin command '$command'", 10);
|
||||||
my $macros = p_decode_json($pa_config, encode_utf8($module->{'macros'}));
|
my $macros = p_decode_json($pa_config, encode_utf8($module->{'macros'}));
|
||||||
my %macros = %{$macros};
|
my %macros;
|
||||||
if(ref($macros) eq "HASH") {
|
if(ref($macros) eq "ARRAY") {
|
||||||
|
my $count = 1;
|
||||||
|
%macros = map { $count++ => $_ } @$macros;
|
||||||
|
} else {
|
||||||
|
%macros = %{$macros};
|
||||||
|
}
|
||||||
|
|
||||||
|
if(ref(\%macros) eq "HASH") {
|
||||||
foreach my $macro_id (keys(%macros))
|
foreach my $macro_id (keys(%macros))
|
||||||
{
|
{
|
||||||
my $macro_field = safe_output($macros{$macro_id}{'macro'});
|
my $macro_field = safe_output($macros{$macro_id}{'macro'});
|
||||||
|
Loading…
x
Reference in New Issue
Block a user