return $filter;
}
- # always add NotificationFilterProblem
+ # always add NotificationFilterProblem|Custom
push @{$filter->{'type'}}, 'NotificationFilterProblem';
+ push @{$filter->{'type'}}, 'NotificationFilterCustom';
if (grep /a/, @options) {
foreach my $by (keys %{$filter_by}) {
#Icinga2::Utils::debug("2x Command: $command_2x->{'check_command'}");
# detect $USERn$ macros and replace them too XXX - this should be a global macro?
- if ($commands_1x->{$command_1x_key}->{'command_line'} =~ /\$(USER\d+)\$/) {
- $command_2x->{'command_macros'}->{$1} = Icinga2::Utils::escape_str($user_macros_1x->{$1});
- #debug("\$$1\$=$command_2x->{'macros'}->{$1}");
+ if ($commands_1x->{$command_1x_key}->{'command_line'} =~ /\$(USER\d+)\$/ ||
+ $commands_1x->{$command_1x_key}->{'command_line'} =~ /\$(ADMIN\w+)\$/) {
+ my @user_macros = ($commands_1x->{$command_1x_key}->{'command_line'} =~ /\$(USER\d+)\$/g);
+ my @admin_macros = ($commands_1x->{$command_1x_key}->{'command_line'} =~ /\$(ADMIN\w+)\$/g);
+ push @user_macros, @admin_macros;
+
+ foreach my $macro_name (@user_macros) {
+ $command_2x->{'command_macros'}->{$macro_name} = Icinga2::Utils::escape_str($user_macros_1x->{$macro_name});
+ }
}
# save all command args as macros (we'll deal later with them in service definitions)
my ($icinga1_resource_file) = get_key_from_icinga1_main_cfg($icinga1_cfg, "resource_file");
+ # resource.cfg
my $user_macros = parse_icinga1_resource_cfg($icinga1_resource_file);
+ # special attributes in icinga.cfg (admin_*)
+ my ($admin_pager) = get_key_from_icinga1_main_cfg($icinga1_cfg, "admin_pager");
+ my ($admin_email) = get_key_from_icinga1_main_cfg($icinga1_cfg, "admin_email");
+
+ $user_macros->{'ADMINPAGER'} = $admin_pager;
+ $user_macros->{'ADMINEMAIL'} = $admin_email;
+
return $user_macros;
}