Check_requirements

Script: check_requirements

check_requirements is a plugin to run different check to show the ability to run an application. You can these checks

  • Check if a process exists
  • Check an open udp or tcp port (local or on given host/ ip)

You can insert a label to create multiple blocks.

Requirements

  • ps
  • top

Standalone installation

From this repository ypu need next to this script:

  • inc_pluginfunctions shared function for all IML checks written in bash

Syntax

______________________________________________________________________

CHECK_REQUIREMENTS
v1.2

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

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

Check if a list requirements regarding processes and network 
connections do exist.

The check returns OK if all given requirements match.

SYNTAX:
check_requirements [-h] [-v] [PARAMETERS]

OPTIONS:

    -h|--help            show this help.
    -v|--verbose         show more data: processes and port numbers from
                         /etc/services; add it as first param

PARAMETERS:

    -c|--connect TYPE TARGET PORT        
                         check if connect to a server to a given port
                         is reachable
                         TYPE    string  one of tcp|udp
                         TARGET  string  target host
                         PORT    int     port number
    -l|--label STRING    add label to divide the output in multiple sections
    -p|--process STRING  check if a process with given regex exists in the
                         output of 'ps aux'
    -t|--tcp PORT        check if connect on local tcp port is reachable;
                         This is a shortcut for '-c tcp localhost PORT'

The parameters can be repeated multiple times. Checks will be executed in
the given order.

EXAMPLES

check_requirements -p httpd -p mysqld -t 22 -t 80 -t 443 -t 3306
     Check if
     - a process httpd and a process mysqld exist
     - localhost listens to ports 22, 80, 443 and 3306

check_requirements -l "webservice" -p httpd -t 80 -t 443 -l "database" -p mysqld -t 3306
     Use output with multiple sections

Parameters

(none)

Examples

Check a webservice as process and 2 ports: check_requirements -p nginx -t 443 -t 80

OK: 3 Requirement checks - errors: 0

STATUS  TYPE        RESULT
OK      process     nginx (2 x)
OK      connection  tcp to localhost on port 443
OK      connection  tcp to localhost on port 80