Multiple Service Check Results using process-check-result

Problem Statement - We are performing Passive Checks on the hosts for all required services. We would like to send all the Checks result using process-check-result through REST API. I can successfully send the result using python with the data -
data = {
“type”: “Service”,
“filter”: “host.name=="host-name" && service.name=="Service-Name"”,
“exit_status”: 2,
“plugin_output”: “Service Plugin output”
}

As we have so many servers and services , we would like to send the result of all services on a host in One Rest API call.
Is there a way we can send data for multiple services in One REST API call , using process-check-result

  • Version used (icinga2 --version)
    Icinga Web 2 Version 2.12.1
  • Operating System and version - Ubuntu
  • Enabled features (icinga2 feature list) - api is enabled

Hi @a7pQad ,
This is indeed possible, you “just” have to create a fitting filter expression, e.g. “filter”: “service.name=="Service-Name"”, should match the same service on ALL Hosts.

1 Like

Hi @lorenz ,
Thank you for providing your valuable suggestions.
In the case whihc you mentioned, If I have same service name on N number of hosts then , process check result can be posted.

In My Requirement -
I have a Host and it has multiple services. I was thinking if I can send all the CHeck results in One go.

As @lorenz wrote in his earlier answer, you can specify the process-check-result’s target via the filter parameter, which allows the same flexibility as the apply rules.

Thus, you should be able to filter all services on a single host via "filter": "host.name==\"example.com\"".

In case you want to script this, you may want to consider using filter_vars, like the following:

{
  "filter": "host.name==hostname",
  "filter_vars": { "hostname": "example.com" }
}
1 Like