I have a requirement where check interval is 180 mins while notification interval is 10 mins. Means service owner wants if he miss any alert that usually comes after 180 mins if service is critical then Icinga keeps on checking and informing them every 10 mins until service goes back to normal.

i tried interval = 0 parameter in notification.conf but that is not fulfilling the requirement.

It sends alert every 10 mins if service is not okay but it doesn't check the service.

For eg. if service comes to normal before 180 mins(i.e. next check) , it'll keep on alerting till next check.

Found similar question here but it is for Nagios & i'm not able to merge it with Icinga2.

I'm sure it will be done using CHANGE_NORMAL_SVC_CHECK_INTERVAL parameter but don't know how to implement it.

I also found below Icinga page:

Icinga external commands link

Kindly help.

  • You can change configuration via the API on demand, but why do you not want to check the server every 5 or 10 minutes in the first place? – lazyfrosch May 31 '16 at 6:58
  • Actually it is a custom plugin through which we are monitoring if a log file is getting updated or not & that file gets updated after 180 mins approx.. – Manii May 31 '16 at 7:09
  • So I'd recommend to tune the script to check if the log has been modified in the last 180 min, and not rely on Icinga 2 to run the check at the right time. (It should always be able to evaluate what the status is) – lazyfrosch May 31 '16 at 7:11
  • Actually that script is in perl & i don't know much about perl. I'm taking this as last option as I have read it is possible within Icinga only through Event Handlers. So just curios to learn about that. – Manii May 31 '16 at 7:16
  • 1
    .I resolved it by myself with help of external commands given in link here – Manii Jun 2 '16 at 10:29

This is what I did to resolve my issue.

1. Created script /icinga/plugins/change_check_interval.sh


now=`date +%s`
case "$1" in
        /usr/bin/printf "[%lu] CHANGE_NORMAL_SVC_CHECK_INTERVAL;servername;servicename;180\n" $now >> $commandfile
        /usr/bin/printf "[%lu] CHANGE_NORMAL_SVC_CHECK_INTERVAL;servername;servicename;10\n" $now >> $commandfile

exit 0

2. Then used this script to define event_command in commands.conf

object EventCommand  "change_check_interval"{
  import "plugin-event-command"
    command = [ "/icinga/plugins/change_check_interval.sh", "$service.state$" ]

3. And used event_command in services.conf

apply Service "Service-Name" {
 import "template"
  check_command = "nrpe-arg"
  vars.remote_nrpe_command = "nrpe command"
  vars.remote_nrpe_arguments = "arg1"
  event_command = "change_check_interval"
  assign where host.name == "servername"

This eventhandler runs every 180 mins when service is okay while run every 10 mins when service is critical.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.