diff --git a/check_packages2install-pkgmanager/yum.sh b/check_packages2install-pkgmanager/yum.sh index ea7af3305a061545e33b5de05cf8ecda30129b06..4ce9e8d72e616e0437f2ed8e8145e5ced5d82a04 100644 --- a/check_packages2install-pkgmanager/yum.sh +++ b/check_packages2install-pkgmanager/yum.sh @@ -26,7 +26,8 @@ function yum.getUpdates(){ function yum.getPackageList(){ local iStart=3 # detect number of line containing "Obsoleting Packages" - typeset -i iEnd=$( echo "$packagemanOut" | grep -n '^Obsoleting Packages' | cut -f 1 -d ':' )-1 + typeset -i local iEnd + iEnd=$( echo "$packagemanOut" | grep -n '^Obsoleting Packages' | cut -f 1 -d ':' )-1 local sEnd=$iEnd test "$iEnd" = "-1" && sEnd='$' diff --git a/docs/20_Checks/_index.md b/docs/20_Checks/_index.md new file mode 100644 index 0000000000000000000000000000000000000000..71c13cdf3694023b2bee1eba3024f9c1a6d0a4d4 --- /dev/null +++ b/docs/20_Checks/_index.md @@ -0,0 +1,41 @@ +# Checks + +## Shared functions + +There is one include script used by all checks: +[inc_pluginfunctions](inc_pluginfunctions.md) + +## Check scripts + +* check_apache_requests +* check_backup_one +* check_ceph_diskfree +* check_ceph_osd +* check_ceph_status +* check_clientbackup +* check_couchdb-lb +* [check_cpu](check_cpu.md) +* check_cronstatus +* check_disk-io +* check_dns_responsetime +* [check_eol](check_eol.md) +* check_haproxy_health +* check_haproxy_status +* check_memory +* check_netio +* check_netstat +* check_opencpu +* check_packages2install +* check_proc_mem +* check_proc_ressources +* check_proc_zombie +* check_reboot_required +* check_sensuplugins +* check_smartstatus +* [check_snmp_data](check_snmp_data.md) +* check_snmp_synology +* check_ssl +* check_systemdservices +* check_timesync +* check_uptime +* hello diff --git a/check_cpu.md b/docs/20_Checks/check_cpu.md similarity index 91% rename from check_cpu.md rename to docs/20_Checks/check_cpu.md index 489e3f30a584a2b6527a9e034b8af283f8fc4324..58e5a909abc3e4e25c4c2e02bfdb6910029929b3 100644 --- a/check_cpu.md +++ b/docs/20_Checks/check_cpu.md @@ -1,12 +1,6 @@ -# IML Checks for Icinga / Nagios +# check CPU -[Home](readme.md) - ---- - -## check CPU - -### Introduction +## Introduction **check_cpu** is a plugin to check cpu usage and cpu io wait. It reads cpu data from output of top command and shows @@ -26,11 +20,11 @@ For all values it sends performance data. If there are processes with status D they will be shown (to analyze cpu waits). -### Syntax +## Syntax ``$ check_NAME [-c CRITICAL] [-w WARING] [-i CRITICAL_IO]`` -#### Parameters +### Parameters ```text -w VALUE cpu usage warning level (default: 75) @@ -42,7 +36,7 @@ If there are processes with status D they will be shown (to analyze cpu waits). ``` -# Examples +## Examples ``check_cpu -w 60 -c 80 -i 40`` check cpu usage. diff --git a/check_snmp_data.md b/docs/20_Checks/check_snmp_data.md similarity index 87% rename from check_snmp_data.md rename to docs/20_Checks/check_snmp_data.md index d12ef6663f33e67db137ecf8495cd1f022573d42..b0725ac3002d1b4860768d30d16d5714a50c790b 100644 --- a/check_snmp_data.md +++ b/docs/20_Checks/check_snmp_data.md @@ -1,26 +1,20 @@ -# IML Checks for Icinga / Nagios +# check SNMP data -[Home](readme.md) - ---- - -## check SNMP data - -### Introduction +## Introduction **check_snmp_data** is a plugin for fetching performance data with a set of given OIDs. It can handle current values (i.e. load or cpu usage) and counter values (i.e. network io). -### Syntax +## Syntax ``$ check_snmp_data -h HOSTNAME [-C COOMMUNITYSTRING] -v -m METHOD`` -#### Parameters +### Parameters Starting the script without parameters shows a help. -``` +```txt SNMP performance data v1.0 @@ -46,16 +40,16 @@ EXAMPLE: ``` -### Examples +## Examples + +### Get values -#### Get values +`./check_snmp_data -h 192.168.100.12 -v -m cpu` -``./check_snmp_data -h 192.168.100.12 -v -m cpu`` - Shows the current cpu usage of host *192.168.100.12*. The output is something like that: -``` +```txt OK: SNMP performance data :: CPU usage cpu-user 0 % cpu-system 0 % @@ -68,19 +62,21 @@ The 3 lines with values starting from line 2 are written with *-v* option only. The performance data (last line) always will be sent. -#### Get counter data +### Get counter data + +`./check_snmp_data -h 192.168.100.12 -v -m netio` -``./check_snmp_data -h 192.168.100.12 -v -m netio`` - If there is a check with counter data using *-v* option you see the counter value and the delta speed. It is calculated by -``` +```txt [current_counter] - [last_counter] delta_speed = ---------------------------------- time_since_last_check_in_sec ``` + The output looks like that: -``` + +```txt OK: SNMP performance data :: Network IO (experimental) in total: 2669086814 delta: 1 per sec out total: 2212665608 delta: 0 per sec @@ -88,19 +84,21 @@ out total: 2212665608 delta: 0 per sec |in=1;;;0; out=0;;;0; ``` - -### Configuration +## Configuration check_snmp_data is a Bash script. If you open / view it you see a DATA section as comment lines on the top. It starts with a short description: -``` + +```txt # SYNTAX: # label --> DATA:[method]:label:[text] # n x data --> DATA:[method]:data:[perf-label]:[oid]:[optional unit] ``` + ... followed by the configuration data of the checks. -``` + +```txt # # DATA:cpu:label:CPU usage # DATA:cpu:data:cpu-user:1.3.6.1.4.1.2021.11.9.0:% @@ -108,7 +106,7 @@ It starts with a short description: # DATA:cpu:data:cpu-idle:1.3.6.1.4.1.2021.11.11.0:% ``` -To fetch configuration data the text in $0 is grepped by ``^#\ DATA:``. +To fetch configuration data the text in $0 is grepped by `^#\ DATA:`. There is a single line with **label** to define a short description of the check. diff --git a/inc_pluginfunctions.md b/docs/20_Checks/inc_pluginfunctions.md similarity index 86% rename from inc_pluginfunctions.md rename to docs/20_Checks/inc_pluginfunctions.md index 8ca811e1075dfdbc32667571a16822744aa8811f..65d951ca676db0fb6a1b3996d92365ae68709d18 100644 --- a/inc_pluginfunctions.md +++ b/docs/20_Checks/inc_pluginfunctions.md @@ -1,20 +1,14 @@ -# IML Checks for Icinga / Nagios +# Shared functions -[Home](readme.md) +## Init ---- - -## Shared functions - -### Init - -All scripts start with sourcing a shared bash file +All scripts start with sourcing a shared bash file ``. `dirname $0`/inc_pluginfunctions`` In that script are several functions starting with prefix **ph.** (=plugin helper) -### Available functions +## Available functions This is a list in alphabetic order @@ -70,7 +64,7 @@ You can override it as often you want during the script. Based on the last setti **ph.setStatusByLimit** VALUE WARNLIMIT CRITLIMIT -set statuscode by verifying integer(!) value with crtical and warning limit +set statuscode by verifying integer(!) value with crtical and warning limit Example: @@ -93,23 +87,25 @@ Add performance data. Their output will be written with ph.exit. So you are free For increasing system counters: get changerate per second since last check. Unit value can be + * s or sec - for seconds * m or min - for minutes Example: - # speed in byte per sec based on last stored value and its age - iSpeedRead=` ph.perfdeltaspeed "netio-${myinterface}-rx" $iRead` +```txt +# speed in byte per sec based on last stored value and its age +iSpeedRead=` ph.perfdeltaspeed "netio-${myinterface}-rx" $iRead` +``` **ph.perfshow** dump performance data (if u are not using ph.exit) -**ph.require** [PROG [PROG2]] +**ph.require** [PROG [...PROG_N]] check if a binary PROG exists in search path (=are installed) - if not then execution stops with showing a warning message and status unknown (using ph.abort). Example: -``ph.require bc lsblk`` - +`ph.require bc lsblk` diff --git a/docs/20_Checks/zz_template_check_.md b/docs/20_Checks/zz_template_check_.md new file mode 100644 index 0000000000000000000000000000000000000000..a51231222750253421e5d7c7ec4d6dc82b0355f1 --- /dev/null +++ b/docs/20_Checks/zz_template_check_.md @@ -0,0 +1,20 @@ +# check NAME + +## Introduction + +**check_NAME** is a plugin for ... + +## Syntax + +`$ check_NAME [-c CRITICAL] [-w WARING] PRODUCT VERSION` + +### Parameters + +... + +## Examples + +... + +`check_NAME blubb` + Show blubber bubbles diff --git a/docs/config.json b/docs/config.json new file mode 100644 index 0000000000000000000000000000000000000000..6b291ff32f0459c84d495a5b57703ae3774a70c5 --- /dev/null +++ b/docs/config.json @@ -0,0 +1,25 @@ +{ + "title": "IML Icinga Checks", + "author": "Axel Hahn", + "tagline": "Icinga checks written in Bash", + "ignore": { + "files": ["20_Checks/zz_template_check_.md"], + "folders": ["99_Not_Ready"] + }, + "html": { + "auto_toc": true, + "auto_landing": false, + "date_modified": false, + "jump_buttons": true, + "edit_on_github_": "iml-it/__PROJECT__/tree/master/docs", + "edit_on_": { + "name": "Gitlab", + "basepath": "https://git-repo.iml.unibe.ch/iml-open-source/icinga-checks/tree/master/docs" + }, + "links": { + "Git Repo": "https://git-repo.iml.unibe.ch/iml-open-source/icinga-checks" + }, + "theme": "daux-blue", + "search": true + } +} \ No newline at end of file diff --git a/docs/readme.md b/docs/readme.md new file mode 100644 index 0000000000000000000000000000000000000000..9ed5d8e4409b6f32e77e43a1208e76fdbb9f1586 --- /dev/null +++ b/docs/readme.md @@ -0,0 +1,17 @@ +# IML Checks for Icinga / Nagios + +## Introduction + +IML - Institute for Medical Education at university in Bern, Switzerland. + +This is a collection of our checks. They are used on Linux systems (Debian, CentOS, Ubuntu) and written in Bash using some shared functions. + +We use Icinga graphite module to show performance data. The templates are located in a sister repository + + +📃 Sources: + +* Checks: <https://git-repo.iml.unibe.ch/iml-open-source/icinga-checks> +* Graphs (Graphite): <https://git-repo.iml.unibe.ch/iml-open-source/icinga-graphite-templates> + +📜 Licence: GNU GPL 3.0 diff --git a/docs/style.css b/docs/style.css new file mode 100644 index 0000000000000000000000000000000000000000..909562cb91d2a8335f4470332ef1e07bdb2ee44c --- /dev/null +++ b/docs/style.css @@ -0,0 +1,176 @@ +/* + + patch css elements of daux.io blue theme + version 2022-05-13 + +*/ + + +/* ---------- vars ---------- */ + +:root{ + + /* background colors */ + --bg:none; + --bg-body: #fff; + --bg-navlinkactive:#f4f4f4; + --bg-navlinkactive: linear-gradient(-90deg,rgba(0,0,0,0), rgba(40,60,80,0.05) 30%); + --bg-pre:#f8f8f8; + --bg-toc: #fff; + + /* foreground colors */ + --color: #234; + --navlinkactive:#f33; + --title: #aaa; + + --link:#12a; + --toclink:rgba(40,60,80,0.8); + + --h1: rgba(40,60,80,0.8); + --h1-bottom: 1px solid rgba(40,60,80,0.1); + --h2: #468; + --h3: #579; + +} + +/* ---------- tags ---------- */ + +a.Brand::before { + background: rgb(255,0,51); + color: #fff; + font-family: arial; + font-weight: bold; + padding: 0.5em 0.3em; + content: 'IML'; + margin-right: 0.4em; +} + +body, *{color: var(--color);} +body{background: var(--bg-body);} + + +a{color: var(--link);} +a:hover{opacity: 0.7;} + +h1>a{ color:var(--title);} +_h1:nth-child(1){position: fixed; background: var(--bg); box-shadow: 0 0 1em #ccc; padding: 0 1em} +h1:nth-child(1)>a{ color:var(--navlinkactive); } + +.s-content h1{color: var(--h1); font-size: 200%; font-weight:bold; margin-top: 2em; border-bottom: var(--h1-bottom);} +.s-content h2{color: var(--h2); font-size: 160%; } +.s-content h3{color: var(--h3); font-size: 140%; } +.s-content h4{margin: 0; font-size: 100%; text-align: center; background-color: rgba(0,0,0,0.05);padding: 0.3em;} + +.s-content pre{ + background: var(--bg-pre); +} + +/* ---------- classes ---------- */ + +.required{color:#a42;} +.optional{color:#888;} + + +/* ----- top left */ +.Brand, +.Columns__left { + background: var(--bg); + border-right: 0px solid #e7e7e9; + color: var(--color); +} +.Brand{font-size: 200%; + background_: linear-gradient(-10deg,#fff 50%, #ddd); + background: var(--bg); +} +.Columns__right__content { + background: var(--bg); +} + +/* ----- Navi left */ + +.Nav a:hover{ + background: none; + color: var(--navlinkactive) !important; +} + +.Nav__item--active { + border-right_: 0.3em solid var(--navlinkactive); +} +.Nav__item--active > a{ + background: var(--bg-navlinkactive); + color: var(--navlinkactive); +} +.Nav .Nav .Nav__item--active a { + color: var(--navlinkactive); +} +.Nav .Nav .Nav__item a { + opacity: 1; +} +.Nav__item--open > a { + background-color: var(--bg); +} + +.Nav a[href*="__Welcome"]{ + background: url("/icons/house.png") no-repeat 10px 4px ; + padding-left: 40px; +} +.Nav a[href*="__How_does_it_work"]{ + background: url("/icons/light-bulb.png") no-repeat 10px 4px ; + padding-left: 40px; +} + + + + +/* ---------- classes ---------- */ + +/* FIX smaller fnt size in tables */ +.s-content table { + font-size: 1em; +} + + +/* TOC */ +@media(min-width:1700px){ + .TableOfContentsContainer{ + position: fixed; + right: 2em; + top: 1em; + } +} + +.TableOfContentsContainer{ + border-top-left-radius: 1em; + background-color: var(--bg-toc); + border-left: 2px solid rgba(0,0,0,0.05); + padding: 0em; +} +.TableOfContentsContainer__content { + + border: none; + font-size: 0.5em; + +} +ul.TableOfContents ul{ + list-style-type: none; + padding-left: 1em; +} +.TableOfContentsContainer a{ color:var(--toclink);} + +.TableOfContentsContainer__content > .TableOfContents > li + li { + border-top: none; +} +.TableOfContentsContainer__content > .TableOfContents > li { + border-bottom: 1px dashed #ddd; +} + +/* pager - prev .. next */ +.s-content{ + margin-bottom: 6em; +} +.Pager{ + border-top: 1px dashed #aaa; margin: 0; padding: 1em; +} +.Pager a{ + color:var(--navlinkactive); +} diff --git a/readme.md b/readme.md index 597a0c7d0e890718e8e74812eacf538f5d9af5e5..6346c9e35959f0f146e4e388509d9d742fafbcae 100644 --- a/readme.md +++ b/readme.md @@ -2,18 +2,20 @@ ## Introduction -IML - we are the Institute for Medical Education at university in Bern, Switzerland. +IML - Institute for Medical Education at university in Bern, Switzerland. This is a collection of our checks. They are used on Linux systems (Debian, CentOS, Ubuntu) and written in Bash using some shared functions. -We use Icinga graphite module to show performance data. The templates are located in a sister repository. +We use Icinga graphite module to show performance data. The templates are located in a sister repository -## License -* Licence: GNU GPL 3.0 -* Source: - * Checks: https://git-repo.iml.unibe.ch/iml-open-source/icinga-checks - * Graphs (Graphite): https://git-repo.iml.unibe.ch/iml-open-source/icinga-graphite-templates +📃 Sources: + +* Checks: <https://git-repo.iml.unibe.ch/iml-open-source/icinga-checks> +* Graphs (Graphite): <https://git-repo.iml.unibe.ch/iml-open-source/icinga-graphite-templates> + +📗 Docs: see [./docs/](./docs) folder \ +📜 Licence: GNU GPL 3.0 ## Scripts diff --git a/zz_template_check_.md b/zz_template_check_.md deleted file mode 100644 index 63d8e5fcb142dfb372bc551a46e98d88b855f0d3..0000000000000000000000000000000000000000 --- a/zz_template_check_.md +++ /dev/null @@ -1,26 +0,0 @@ -# IML Checks for Icinga / Nagios - -[Home](readme.md) - ---- - -## check NAME - -### Introduction - -**check_NAME** is a plugin for ... - -### Syntax - -``$ check_NAME [-c CRITICAL] [-w WARING] PRODUCT VERSION`` - -#### Parameters - -... - -### Examples - -... - -``check_NAME blubb`` - Show blubber bubbles