Notifications

Hello my Name Is Roberto.
I have made the installation of ICINGA2 and Icinga Director and I have it configured but the notifications do not work correctly.
I have created 2 period times but they do not work well.
I get this error (Not sending notifications for notification object ‘benecenvd10! Disk! NotificationService’: not in timeperiod ‘Work Hours’) I need help.

Thank you

Hello Roberto and Welcome

If you’d like to paste the rendered object configuration for the service, notification and time period you encounter issues with, it will be easier for us to provide any assistance.

Hello
thanks for the reply
My configuration is this
Service Template

template Service "disk" {
    check_command = "disk"
    check_period = "Horas Trabajo"
    command_endpoint = host_name
}

Service

Apply service

apply Service "disk" {
    import "disk"


    assign where "Linux Server" in host.templates

    import DirectorOverrideTemplate
}

Service group

object ServiceGroup "disk" {
    display_name = "disk"
    assign where service.name == "disk"
}

Notification Template

template Notification "NotificacionServicioP" {
    command = "NotificacionServicio"
    states = [ Critical, OK, Unknown, Warning ]
    types = [
        Acknowledgement,
        Custom,
        DowntimeEnd,
        DowntimeRemoved,
        DowntimeStart,
        FlappingEnd,
        FlappingStart,
        Problem,
        Recovery
    ]
    user_groups = [ "Tragsatec" ]
}

Apply Notification

apply Notification "NotificacionServicio" to Service {
    import "NotificacionServicioP"

    assign where "disk" in service.groups
    user_groups = [ "Tragsatec" ]
}

Timeperiod Template

template TimePeriod "workhour" {
    import "legacy-timeperiod"
    display_name = "workhour"
    ranges = {
        " thursday"	= "08:00-19:00"
        "friday"	= "08:00-15:00"
        "monday"	= "08:00-19:00"
        "tuesday"	= "08:00-19:00"
        "wednesday"	= "08:00-19:00"
    }
}

Timeperiod

object TimePeriod "Horas Trabajo" {
    import "legacy-timeperiod"
    import "workhour"

    display_name = "Horas Trabajo"
    ranges = {
    }
}

Other Information

zones.d/master/hosts.conf
object Host "benecenvd10" {
    import "Icinga Agent"
    import "Linux Server"

    display_name = "benecenvd10"
    address = "172.17.4.10"
    groups = [ "Fega-Host" ]
}

zones.d/master/agent_endpoints.conf
object Endpoint "benecenvd10" {
    host = "172.17.4.10"
    log_duration = 0s
}

zones.d/master/agent_zones.conf
object Zone "benecenvd10" {
    parent = "master"
    endpoints = [ "benecenvd10" ]
}

zones.d/master/agent_endpoints.conf

object Endpoint "benecenvd10" { host = "172.17.4.10" log_duration = 0s }

zones.d/master/agent_zones.conf

object Zone "benecenvd10" { parent = "master" endpoints = [ "benecenvd10" ] }

object Host "benecenvd10" {
    import "Icinga Agent"
    import "Linux Server"

    display_name = "benecenvd10"
    address = "172.17.4.10"
    groups = [ "Fega-Host" ]
}

zones.d/master/agent_endpoints.conf
object Endpoint "benecenvd10" {
    host = "172.17.4.10"
    log_duration = 0s
}

zones.d/master/agent_zones.conf
object Zone "benecenvd10" {
    parent = "master"
    endpoints = [ "benecenvd10" ]
}
object HostGroup "Fega-Host" {
    display_name = "Fega Host"
    assign where match("bene*", Host.name)
}


template Host "Linux Server" {
    check_command = "dummy"
}


template User "Standard" {
    enable_notifications = true
    states = [ Critical, Down, OK, Unknown, Up, Warning ]
    types = [
        Acknowledgement,
        Custom,
        DowntimeEnd,
        DowntimeRemoved,
        DowntimeStart,
        FlappingEnd,
        FlappingStart,
        Problem,
        Recovery
    ]
}



object User "rda" {
    import "Standard"

    display_name = "Roberto Diaz"
    email = "rda@tragsa.es"
    groups = [ "Tragsatec" ]
}



object UserGroup "Tragsatec" {
    display_name = "Tragsatec"
}

This is my configuration…

Thanks for your help…

Hi,

I’ve now formatted your post with markdown code blocks, please check Create topics and master Markdown formatting for future posts by yourself.

The configuration objects, especially the notifications, do not reference a period attribute which would explain the used timeperiod filter when it comes to notifications.

Please show the complete output of icinga2 object list --type Notification --name 'benecenvd10! Disk! NotificationService'.

Cheers,
Michael

Thanks for reply

I hope in the next post better. Sorry

The result is

Thanks

period is empty, so I don’t quite understand why the master log says different. Are you sure that this filter is logged in the event of expecting a notification?

Cheers,
Michael

In the notification had the period of time empty. I have modified and added the time period and it shows me this


I’ll run it again

It does not work after the last modification. Give the error

* Not sending reminder notifications for notification object 'benecenvd10!disk!NotificacionServicio': not in timeperiod 'Horas Trabajo'

Since Thursday is today, look at the rendered configuration - there is a leading space before thursday. Check the Timeperiod form in the Director, and remove this space.

Cheers,
Michael

I have corrected the error and continue the error
I had modified Templates Notification and I had added timeperiod


and Notification


Timeperiods modified

Hi. I continue with the problems. Any more help?

Hi,

did you verify the deployed timeperiod via the deployment tab, render config? You can also test whether the timeperiod is currently active with the debug console, something like this (change root:icinga to your basic auth credentials).

icinga2 console --connect 'https://root:icinga@localhost:5665/' --eval 'get_object(TimePeriod, "Horas Trabajo").is_inside'

If this returns false, the TP is not conforming the specs. Try to limit it just to one day and a shorter segment, to see whether there’s some problems with the ranges.

Cheers,
Michael

The first … Thank you very much for the help …
I have done what you have indicated to me …


and

ranges = {

}

is equal to never. So your notifications will never be sent. Either you specify some ranges inside, or you’ll delete the attribute entirely.

Cheers,
Michael

Hello
Michael. Thank you very much for the help. It seems that it works, I am doing tests with the periods and for the moment it is responding.

Thank you very very much

1 Like