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

Invoke-IcingaCheckService - Add option to define OK state if service not found

log1-c opened this issue · comments

Hi,

I'd like to propose the following feature: If the service that should be checked is not found as an installed service, there should be a parameter to define wether this is OK or not.

Use case:
Checking for a service the should NOT run, in case it is installed. If it is not installed, that is OK as well.
I tried using -MitigateUnknown but that didn't help.

Invoke-IcingaCheckService -Service @(msmq) -Exclude @() -Status Stopped -FilterStartupType @() -Verbosity 2 -MitigateUnknown -NoPerfData

Returns CRITICAL (as expected) if the service is running.

 Services: 1 Critical  Service "Message Queuing (msmq)" (Running)
\_  Service "Message Queuing (msmq)": Running is not matching threshold Stopped

Returns UNKNOWN if the service is not found (here I'd like the option to say "that's ok")

 Services: 1 Unknown  msmq: Service not found (0)
\_  msmq: Service not found: 0

This could be done with an additional parameter like --ServiceNotFound.

might be combined with this: #378

Thank you for the feedback. I'm honestly not sure if this is a good feature or not. Let's assume you check a certain service and - for some reason - the application or the service is being removed from the system, while it should be there in general.

Now with the proposed feature, you will have no idea of this happening, because your monitoring is simply reporting "OK", while it should be "CRITICAL" or "UNKNOWN".

I get the idea of a simplified and easy configuration, but wouldn't this feature cause more issues in the future?

Thank you for the feedback. I'm honestly not sure if this is a good feature or not. Let's assume you check a certain service and - for some reason - the application or the service is being removed from the system, while it should be there in general.

Now with the proposed feature, you will have no idea of this happening, because your monitoring is simply reporting "OK", while it should be "CRITICAL" or "UNKNOWN".

I get the idea of a simplified and easy configuration, but wouldn't this feature cause more issues in the future?

This is true, but that is why it needs to be configurable. I don’t need to monitor whether a service is present, only if it is down. So effectively we are referring to a separate check.

I was thinking of an additional parameter (1st post updated).
With an additional parameter like --ServiceNotFound one could tell the check what the outcome should be, in case the Service was not found (OK; WARN; CRIT; UNKNOWN)

I'm still not happy about the idea, because this will probably cause many issues in the future for monitoring environments.
Because the flag is there, people will use it and real service problems will not get reported or notified because of that.

I have updated the linked PR to include -OverrideNotFound as an argument. This allows to specify if the outcome of the Plugin should be Ok, Warning, Critical or Unknown in case the service was not found.