Skip to content
Snippets Groups Projects
Commit 51585abc authored by Hahn Axel (hahn)'s avatar Hahn Axel (hahn)
Browse files

update help for check_requirements

parent 36f19dca
No related branches found
No related tags found
1 merge request!292Simple task/7546 icinga check für ablaufende gitlab tokens
......@@ -6,13 +6,16 @@ Script: `check_requirements`
* Check if a process exists
* Check an open udp or tcp port (local or on given host/ ip)
* Ping a target system (new in v1.3)
You can insert a label to create multiple blocks.
## Requirements
* `ps`
* `top`
* Linux GNU tools
* `ps`
* `top`
* `ping`
## Standalone installation
......@@ -26,7 +29,7 @@ From this repository ypu need next to this script:
______________________________________________________________________
CHECK_REQUIREMENTS
v1.2
v1.3
(c) Institute for Medical Education - University of Bern
Licence: GNU GPL 3
......@@ -40,7 +43,7 @@ connections do exist.
The check returns OK if all given requirements match.
SYNTAX:
check_requirements [-h] [-v] [PARAMETERS]
check_requirements [-h] [PARAMETERS]
OPTIONS:
......@@ -56,6 +59,7 @@ PARAMETERS:
TYPE string one of tcp|udp
TARGET string target host
PORT int port number
-i|--ping TARGET ping a target system
-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'
......@@ -83,7 +87,9 @@ check_requirements -l "webservice" -p httpd -t 80 -t 443 -l "database" -p mysqld
## Examples
Check a webservice as process and 2 ports: ``check_requirements -p nginx -t 443 -t 80``
### 3 checks
Check a locally rtunning webservice as process and 2 ports: ``check_requirements -p nginx -t 443 -t 80``
```txt
OK: 3 Requirement checks - errors: 0
......@@ -93,3 +99,48 @@ OK process nginx (2 x)
OK connection tcp to localhost on port 443
OK connection tcp to localhost on port 80
```
### Verbose mode
The verbose mode can be activated with `-v`. The checks are execeuted parameter by parameter. The debug begins where you add `-v` - so the best option is to add it at the beginning.
This is the same list of checks again that you can compare both outputs: ``check_requirements -v -p nginx -t 443 -t 80``
```txt
OK: 3 Requirement checks - errors: 0
STATUS TYPE RESULT
OK process nginx (2 x)
> root 1211 0.0 0.0 16468 3436 ? Ss 13:34 0:00 nginx: master process /usr/bin/nginx
> http 1212 0.0 0.0 16476 5188 ? S 13:34 0:00 nginx: worker process
OK connection tcp to localhost on port 443
> https 443/tcp
OK connection tcp to localhost on port 80
> http 80/tcp
> www 80/tcp
> www-http 80/tcp
```
### Labels
The `-l <TEXT>` parameter adds a label. With it you can visually group some checks.
When executing this: `/check_requirements -l "webservice" -p nginx -t 443 -t 80 -l "network" -c tcp www.example.com 443` then we get 2 sections with a table of executed checks inside:
```txt
OK: 4 Requirement checks - errors: 0
========== webservice
STATUS TYPE RESULT
OK process nginx (2 x)
OK connection tcp to localhost on port 443
OK connection tcp to localhost on port 80
========== network
STATUS TYPE RESULT
OK connection tcp to www.example.com on port 443
```
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment