Check TCP or UDP connection

Script: check_conn

It is a plugin to check oe or mmultiple tcp and udp connections to localhost or a remote system.

Standalone installation

From this repository you need next to this script:

  • inc_pluginfunctions shared function for all IML checks written in bash

Syntax

______________________________________________________________________

CHECK_CONN
v1.3

(c) Institute for Medical Education - University of Bern
Licence: GNU GPL 3

https://os-docs.iml.unibe.ch/icinga-checks/Checks/check_conn.html
______________________________________________________________________

SYNTAX:
check_conn OPTIONS

You can create a file named ./check_conn.cfg
and add your connections there. 
To start you can copy the file ./check_conn.cfg.dist

OPTIONS:

    -h or --help   show this help.
    -t CONNECTION  test given connection; This param ignores entries
                   in the config file. For multiple connection tests
                   quote the parameter value and set spaces between
                   the connections.

PARAMETERS:

    CONNECTION     Connection in the same syntax like in the config:
                   tcp/host/port
                   udp/host/port
EXAMPLES:

check_conn         If no param is given it checks entries in ./check_conn.cfg

check_conn -t "tcp/api.example.com/443"
                   Check a single connection

check_conn -t "tcp/api.example.com/443 tcp/localhost/3306"
                   Check multiple connections.


Examples

Check a single tcp port which is currently open:

./check_conn -t "tcp/localhost/80"
OK: tcp check - 1 checks - 1 OK; 0 warnings; 0 errors 
tcp/localhost/80 OK

Check multiple connections - one port is open the other closed:

./check_conn -t "tcp/localhost/22 tcp/localhost/443"
CRITICAL: tcp check - 2 checks - 1 OK; 0 warnings; 1 errors 
tcp/localhost/22 FAILED
tcp/localhost/443 OK