Service with manual change status only

Hi,

I would like to know if it’s possible to create a service who when the status change from OK to anything else than OK, will not go back to OK whatever the next check result. And need a manual change (through the webui for example).

Regards

Hi,

Icinga process only the return code and performance data from a script or a binary which the CheckCommand is calling. (look here https://icinga.com/docs/icinga-2/latest/doc/03-monitoring-basics/#check-result-state-mapping. )
So that means for you:

  • if it is a script you wrote, the exit code should never be 0 (OK).
  • if it is a script you download e.g. from Git, you could fork it and chance the script in that way, that the return code is never 0 (OK)
  • if it is a binary you installed (like monitoring plugins), you could write a wrapper script (e.g. a bash script), which intercept the return value and chance it in that way you like.

To set the service check result in icinga to ok, you have to define the service with the option

enable_active_checks = true
enable_passive_checks = true

or in the director:

Thanks…

No sure I understand. So if it’s not I return 2 and critical. But otherwise I return what ? 3 and ‘empty’ ?

Regards

Here is an small example what we use for some test servers with a http check. The colleague responsible would only like to receive warnings on certain servers, even if the check is critical. So I chance the return code in this case from critical (2) to warning (1)

#/bin/bash
/usr/lib64/nagios/plugins/check_http  $*
RESULT="$?"
if [ "$RESULT" = "2" ]; then
    exit 1;
else
    exit $RESULT
fi