Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

I would like to also monitor non-crucial services with nagios like for example our GitLab-server or phpMyAdmin instance. Is there any way to just create warnings instead of critical errors for some services?

At the moment I'm using the following:

define service {
    host_name localhost
    use generic-service
    service_description HTTP GitLab
    check_command check_www!git.example.com!'/users/sign_in'
}

define command {
    command_name check_www
    command_line /usr/lib/nagios/plugins/check_http -H '$ARG1$' -I '$HOSTADDRESS$' -e 'HTTP/1.1 200 OK' -u '$ARG2$'
}
share|improve this question

2 Answers 2

up vote 4 down vote accepted

The negate plugin exists for exactly this reason.

Using the -c option, you can change CRITICAL to WARNING. For example, you could do this:

define command {
    command_name check_www_no_crit
    command_line /usr/lib/nagios/plugins/negate -s -c WARNING /usr/lib/nagios/plugins/check_http -H '$ARG1$' -I '$HOSTADDRESS$' -e 'HTTP/1.1 200 OK' -u '$ARG2$'
}
share|improve this answer

The issue seems to be that you're using check_http with the -e flag, to check a return code. That plugin doesn't seem to offer the option of returning a WARNING (rather than a CRITICAL) error if the -e check fails.

You would need to write a small shell script wrapper around check_http that passed the output through unchanged, but checked the return code of the plugin, did an exit 1 if the plugin's return code was 2, and passed the return code through unchanged otherwise.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.