Icinga / icinga-powershell-plugins

A collection of Windows check plugins for the Icinga PowerShell Framework

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Feature request Invoke-IcingaCheckService

drapiti opened this issue · comments

It would be very helpful if the service check contained a switch which allows the check to return an Ok state even when the services in the include array are not present on the server. At the moment the check goes into an unknown state.
To give a little context, we have thousands of windows servers and we have a precise list of services which are to be addressed to a specific support department. They are interested only in this list of services and no other. The issue that we are running into is that the list of services is not present on every single server so at the moment many of the checks are going into an unknown state. But if the service is not found that is not a real isssue we would like it simply to return an Ok state. We don't send tickets for unknown states therefore if a real service is down and one is missing the whole service is in an unknown state which is not what we would like.
We are trying at the moment to use an exclude list which does not care if the service is present or not however it is not a clean solution because every day a new server turns up with maybe new software and services which need to be excluded and our departments are irritated when they recieve a ticket for services of no interest before we have visibilty of the new services to exclude.
Thanks.

For those interested we have modified the original check to integrate the above behaviour. Adding continue in the following block. Together with the -MitigateUnknown option works perfectly.

# Check our included services and add an unknown state for each service which was not found on the system foreach ($ServiceArg in $Service) { if ($null -eq $FetchedServices -Or $FetchedServices.ContainsKey($ServiceArg) -eq $FALSE) { if ($ServiceArg.Contains('*')) { continue; } continue; #Return Ok if service/s not found