How to raise alert if a tcp port is responding in Icinga2

icingaicinga2monitoring

I'm new to Icinga2. I have set up a couple of service checks. Now I want to check if a TCP port is responding, and if it does raise a down event. Basically I want to reverse the status, because normally this port should not be listening. How can I do that?

Best Answer

I found the solution. There is a plugin called "negate" that does exactly this. That's how you configure it:

object Host "hostname" {
        address  = "192.168.1.11"
        vars.negate_command = "/usr/lib/nagios/plugins/check_tcp"
        vars.negate_arguments["-p"] = "443"
        vars.negate_arguments["-t"] = "3"
        check_command = "negate"
}
Related Topic