Freshness check not executed

Hi there!

I have a passive check for backups:

apply Service "backup" {
  import "generic-service"

  check_command = "passive"
  command_endpoint = host.vars.client_endpoint

  enable_active_checks = false
  enable_passive_checks = true
  check_interval = 24h

  assign where host.vars.backup_required == "true" && host.vars.client_endpoint

}

If a backup on a host is done successfully, I use the REST API to process the check result.

If the backup fails for some reason, the API call is not made and I expect the service to go to an UNKNOWN or CRITICAL state but the service remains in the OK state:

It was expected to update on 28 Mar but nothing changed:

What am I missing?

Hello and welcome,

for passive checks you need active also. If there is no passive check result, Icinga will call the check command you defined. You should also set the passive state (critical/warning or unknown) to be returned by the plugin and the output text if there is no passive check result.

Regards,
Carsten

Hi Carsten

Thanks for your reply. I am a bit confused since the documentation says the following:

“In Icinga 2 active check freshness is enabled by default. It is determined by the check_interval attribute and no incoming check results in that period of time.”

From the above, I assumed that Icinga will check freshness after the check_interval and if no results were received for that period, it will transition the state of the service to something other than OK.

If I understand you correctly I need to define an additional service in addition to my “backup” service, let’s call it “check-backup” for argument sake, that checks the freshness of my “backup” service. If that is the case then it doesn’t seem like Icinga is performing any freshness checks?

How would I check the freshness of the “backup” service inside the “check-backup” service?

Hi,

you dont need to setup a second service. Just enable active checks and you get a notification if no passive result is received in the freshness period.

Regards,
Carsten

1 Like

Aha, that simple :smile: Thank you!

2 Likes

Hello there!
Also welcome to the community from my side :slight_smile:

If there was an answer that works for you, could you mark that reply as the solution?
This helps others figure out whether a question still needs an answer and where to look if someone has a similar issue.

Thank you and have a nice day!
Feu

Hi there!

I marked Carsten’s reply as the solution.

Have great day!
Roché

1 Like