Conversion: Fix notification attributes.

This commit is contained in:
Michael Friedrich 2013-10-09 18:54:09 +02:00
parent 103a0a715e
commit 4c6f4261ee
2 changed files with 12 additions and 11 deletions

View File

@ -2348,9 +2348,15 @@ sub convert_2x {
foreach my $notification_key (keys %{$notification}) { foreach my $notification_key (keys %{$notification}) {
next if $notification->{$notification_key}->{'type'} ne 'service'; next if $notification->{$notification_key}->{'type'} ne 'service';
my $notifications_enabled = obj_1x_get_service_attr($cfg_obj_2x, $obj_2x_service, $obj_2x_service->{'__I2CONVERT_SERVICE_HOSTNAME'}, 'notifications_enabled');
my $notification_interval = obj_1x_get_service_attr($cfg_obj_2x, $obj_2x_service, $obj_2x_service->{'__I2CONVERT_SERVICE_HOSTNAME'}, 'notification_internval');
my $notification_period = obj_1x_get_service_attr($cfg_obj_2x, $obj_2x_service, $obj_2x_service->{'__I2CONVERT_SERVICE_HOSTNAME'}, 'notification_period');
$notification->{$notification_key}->{'__I2CONVERT_NOTIFICATION_FILTERS'} = $cfg_obj_2x->{'service'}->{$service_obj_2x_key}->{'__I2CONVERT_NOTIFICATION_FILTERS'}; $notification->{$notification_key}->{'__I2CONVERT_NOTIFICATION_FILTERS'} = $cfg_obj_2x->{'service'}->{$service_obj_2x_key}->{'__I2CONVERT_NOTIFICATION_FILTERS'};
$notification->{$notification_key}->{'__I2CONVERT_NOTIFICATION_INTERVAL'} = $cfg_obj_2x->{'service'}->{$service_obj_2x_key}->{'notification_interval'}; $notification->{$notification_key}->{'__I2CONVERT_NOTIFICATION_INTERVAL'} = $notification_interval;
$notification->{$notification_key}->{'__I2CONVERT_NOTIFICATION_PERIOD'} = $cfg_obj_2x->{'service'}->{$service_obj_2x_key}->{'notification_period'}; $notification->{$notification_key}->{'__I2CONVERT_NOTIFICATION_PERIOD'} = $notification_period;
$notification->{$notification_key}->{'__I2CONVERT_NOTIFICATION_ENABLED'} = $notifications_enabled;
#say Dumper($notification->{$notification_key});
} }
} }
#say Dumper($obj_2x_service); #say Dumper($obj_2x_service);

View File

@ -433,10 +433,6 @@ sub dump_service_2x {
} }
} }
if(defined($service_2x->{'notifications_enabled'})) {
dump_config_line($icinga2_cfg, "\tenable_notifications = $service_2x->{'notifications_enabled'},");
}
#################################################### ####################################################
# other service attributes, if set # other service attributes, if set
#################################################### ####################################################
@ -729,10 +725,6 @@ sub dump_host_2x {
} }
} }
if(defined($service_2x->{'notifications_enabled'})) {
dump_config_line($icinga2_cfg, "\tenable_notifications = $service_2x->{'notifications_enabled'},");
}
#################################################### ####################################################
# other service attributes, if set # other service attributes, if set
#################################################### ####################################################
@ -845,6 +837,9 @@ sub dump_user_2x {
} }
} }
if(defined($user_2x->{'notifications_enabled'})) {
dump_config_line($icinga2_cfg, "\tenable_notifications = \"$user_2x->{'notifications_enabled'}\",");
}
#################################################### ####################################################
# usergroups # usergroups
#################################################### ####################################################
@ -953,7 +948,7 @@ sub dump_notification_2x {
} }
if(defined($notification_2x->{'__I2CONVERT_NOTIFICATION_PERIOD'})) { if(defined($notification_2x->{'__I2CONVERT_NOTIFICATION_PERIOD'})) {
dump_config_line($icinga2_cfg, "\tnotification_period = $notification_2x->{'__I2CONVERT_NOTIFICATION_PERIOD'},"); dump_config_line($icinga2_cfg, "\tnotification_period = \"$notification_2x->{'__I2CONVERT_NOTIFICATION_PERIOD'}\",");
} }
# this is set for escalations # this is set for escalations