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

Merge branch 'simple-task/7546-icinga-check-für-ablaufende-gitlab-tokens' into 'master'

Simple task/7546 icinga check für ablaufende gitlab tokens

See merge request !295
parents d2580140 bd470143
No related branches found
No related tags found
1 merge request!295Simple task/7546 icinga check für ablaufende gitlab tokens
...@@ -62,10 +62,10 @@ PARAMETERS: ...@@ -62,10 +62,10 @@ PARAMETERS:
-c, --critical VALUE -c, --critical VALUE
critical level in days (default: $iLimitCritical) critical level in days (default: $iLimitCritical)
-w. --warning VALUE -w, --warning VALUE
warning level in days (default: $iLimitWarning) warning level in days (default: $iLimitWarning)
-f --filter FILTER -f, --filter FILTER
filter for filenames (default: ${filter_files} filter for filenames (default: ${filter_files}
EXAMPLE: EXAMPLE:
......
...@@ -21,6 +21,7 @@ ...@@ -21,6 +21,7 @@
# 2023-06-16 v0.7 <axel.hahn@unibe.ch> update help text # 2023-06-16 v0.7 <axel.hahn@unibe.ch> update help text
# 2023-08-30 v0.8 <axel.hahn@unibe.ch> reverse return code in ph.hasParamoption to unix like return codes: 0=true; <>0 = false # 2023-08-30 v0.8 <axel.hahn@unibe.ch> reverse return code in ph.hasParamoption to unix like return codes: 0=true; <>0 = false
# 2023-09-18 v0.9 <axel.hahn@unibe.ch> prevent broken pipe message in journallog # 2023-09-18 v0.9 <axel.hahn@unibe.ch> prevent broken pipe message in journallog
# 2025-02-11 v1.0 <axel.hahn@unibe.ch> add default banner for IML checks
# ====================================================================== # ======================================================================
...@@ -111,13 +112,7 @@ EOF ...@@ -111,13 +112,7 @@ EOF
function _usage(){ function _usage(){
local _self=$( basename $0 ) local _self=$( basename $0 )
cat <<EOH cat <<EOH
______________________________________________________________________ $( ph.showImlHelpHeader )
${self_APPNAME} :: v${self_APPVERSION}
(c) Institute for Medical Education - University of Bern
Licence: GNU GPL 3
______________________________________________________________________
USAGE: USAGE:
$_self [OPTIONS] -m METHOD $_self [OPTIONS] -m METHOD
......
...@@ -5,23 +5,24 @@ ...@@ -5,23 +5,24 @@
# #
# ---------------------------------------------------------------------- # ----------------------------------------------------------------------
# works for sure on # works for sure on
# - centos7,8 # - centos7+
# - debian6..10 # - debian6+
# - ubuntu10,12 # - ubuntu10+
# ---------------------------------------------------------------------- # ----------------------------------------------------------------------
# 2016-08-12 added ouput of packages # 2016-08-12 added ouput of packages
# 2020-03-05 v1.2 <axel.hahn@iml.unibe.ch> switch to ph.* helper functions # 2020-03-05 v1.2 <axel.hahn@iml.unibe.ch> switch to ph.* helper functions
# 2022-10-14 v1.3 <axel.hahn@unibe.ch> fix debian output if /var/run/reboot-required.pkgs does not exist # 2022-10-14 v1.3 <axel.hahn@unibe.ch> fix debian output if /var/run/reboot-required.pkgs does not exist
# Shellfixes; add help # Shellfixes; add help
# 2023-03-29 v1.4 <martin.gasser@unibe.ch> add almalinux as distro # 2023-03-29 v1.4 <martin.gasser@unibe.ch> add almalinux as distro
# 2024-03-7 v1.4 <martin.gasser@unibe.ch> add rocky as distro # 2024-03-07 v1.4 <martin.gasser@unibe.ch> add rocky as distro
# 2025-02-11 v1.5 <axel.hahn@unibe.ch> add default banner for IML checks; add support for manjaro
# ====================================================================== # ======================================================================
. $(dirname $0)/inc_pluginfunctions . $(dirname $0)/inc_pluginfunctions
self_APPNAME=$( basename $0 | tr [:lower:] [:upper:] ) self_APPNAME=$( basename $0 | tr [:lower:] [:upper:] )
self_APPVERSION=1.3 self_APPVERSION=1.5
distro=$( ph.getOS ) distro=$( ph.getOS )
...@@ -31,21 +32,20 @@ distro=$( ph.getOS ) ...@@ -31,21 +32,20 @@ distro=$( ph.getOS )
function showHelp(){ function showHelp(){
cat <<EOF cat <<EOF
______________________________________________________________________ $( ph.showImlHelpHeader )
$self_APPNAME
v$self_APPVERSION
(c) Institute for Medical Education - University of Bern
Licence: GNU GPL 3
______________________________________________________________________
Check if a reboot is required. Check if a reboot is required.
It works for Centos and Debian/ Ubuntu. It works for Centos and Debian/ Ubuntu and Manjaro
If the reboot is required: If the reboot is required:
* On Centos it shows the kernel number that will be installed, * On Centos it shows the kernel number that will be installed,
* On Debian/ Ubuntu it shows the packages that require the reboot, * On Debian/ Ubuntu it shows the packages that require the reboot,
* On Manjaro it shows if a newer kernel or which libs require the reboot.
The check for libs uses lsof.
If your distro is based on Arch, Centos or Debian then it easily can be added
in the script if it does not work. Report the distro name to the author.
SYNTAX: SYNTAX:
$(basename $0) $(basename $0)
...@@ -99,8 +99,40 @@ case $distro in ...@@ -99,8 +99,40 @@ case $distro in
fi fi
;; ;;
#
"manjaro")
kernel_current="$( uname -r | sed 's/-[a-z]*$//i' )"
kernel_installed="$( pacman -Q linux | cut -f 2 -d " " )"
sReason=""
if [ "$kernel_current" != "$kernel_installed" ]; then
sReason+="Kernel $kernel_installed was installed ... "
fi
libs=""
if which lsof > /dev/null; then
libs=$(lsof -n +c 0 2> /dev/null | grep 'DEL.*lib' | awk '1 { print $1 ": " $NF }' | sort -u)
if [[ -n $libs ]]; then
sReason+="Libs reqire a reboot ... "
fi
fi
if [ -n "$sReason" ]; then
ph.setStatus "warning"
ph.status "[$distro] $sReason"
cat <<< $libs
else
ph.status "[$distro] No reboot required."
if ! which lsof > /dev/null; then
echo "Remark: Install lsof to search for libs that require a reboot."
fi
fi
;;
*) *)
ph.abort "UNKNOWN: distro [$distro] was detected but is not supported (yet)." ph.setStatus "unknown"
ph.status "distro [$distro] was detected but is not supported (yet)."
echo "If your distro is based on Arch, Centos or Debian then it easily can be added in the script. Report the distro name to the author."
;; ;;
esac esac
......
## Check filesystem errors
Script: `check_file_age`
**check_file_age** checks if files are not out of date.
You can find non finisheing processes that do not write an output file or logfile anymore.
This check sends performance data.
## Requirements
* sudo permission on /bin/journalctl to scan for the information
```txt
icingaclient ALL=(ALL) NOPASSWD: /bin/journalctl
```
## Standalone installation
From this repository ypu need next to this script:
* `inc_pluginfunctions` shared function for all IML checks written in bash
## Syntax
```txt
______________________________________________________________________
CHECK_FILE_AGE
v1.0
(c) Institute for Medical Education - University of Bern
Licence: GNU GPL 3
https://os-docs.iml.unibe.ch/icinga-checks/Checks/check_file_age.html
______________________________________________________________________
Check if files are not out of date.
You can customize the values for
* directory
* limits for warning and critical
* filename filter pattern
This plugin sends performancedata.
SYNTAX:
check_file_age [-h] [--dir PATH] [--filter FILTER] [--critical VALUE] [--warning VALUE]
OPTIONS:
-h, --help
this help
PARAMETERS:
-d, --dir PATH
set installation dir of iml deployment to find its check skript
default dir: /var/iml-backup
-c, --critical VALUE
critical level in days (default: 14)
-w. --warning VALUE
warning level in days (default: 7)
-f --filter FILTER
filter for filenames (default: *.*
EXAMPLE:
check_file_age
Check backup data with initial values
check_file_age -d /data/mybackups
Check iso files a given directory
check_file_age -d /data/mybackups -w 14 -c 28
Check iso files a given directory and customized limits
```
### Parameters
(none)
...@@ -20,16 +20,45 @@ From this repository ypu need next to this script: ...@@ -20,16 +20,45 @@ From this repository ypu need next to this script:
`$ check_reboot_required [-h]` `$ check_reboot_required [-h]`
### Parameters ```txt
______________________________________________________________________
CHECK_REBOOT_REQUIRED
v1.5
(c) Institute for Medical Education - University of Bern
Licence: GNU GPL 3
https://os-docs.iml.unibe.ch/icinga-checks/Checks/check_reboot_required.html
______________________________________________________________________
Check if a reboot is required.
It works for Centos and Debian/ Ubuntu and Manjaro
If the reboot is required:
* On Centos it shows the kernel number that will be installed,
* On Debian/ Ubuntu it shows the packages that require the reboot,
* On Manjaro it shows if a newer kernel or which libs require the reboot.
The check for libs uses lsof.
If your distro is based on Arch, Centos or Debian then it easily can be added
in the script if it does not work. Report the distro name to the author.
SYNTAX:
check_reboot_required
```text
OPTIONS: OPTIONS:
-h or --help show this help. -h or --help show this help.
PARAMETERS: PARAMETERS:
None None.
EXAMPLE:
check_reboot_required
``` ```
## Examples ## Examples
...@@ -54,5 +83,6 @@ WARNING: [centos] need to reboot for kernel package kernel is not installed (c ...@@ -54,5 +83,6 @@ WARNING: [centos] need to reboot for kernel package kernel is not installed (c
```txt ```txt
./check_reboot_required ./check_reboot_required
UNKNOWN: distro [manjaro] was detected but is not supported (yet). UNKNOWN: distro [otherlinux] was detected but is not supported (yet).
If your distro is based on Arch, Centos or Debian then it easily can be added in the script. Report the distro name to the author.
``` ```
...@@ -100,7 +100,13 @@ function ph.exit(){ ...@@ -100,7 +100,13 @@ function ph.exit(){
# ---------------------------------------------------------------------- # ----------------------------------------------------------------------
# detect LINUX DISTRO as lowercase # detect LINUX DISTRO as lowercase
# returns one of centos|debian|ubuntu|... # returns string; one of ...
# almalinux
# centos
# debian
# manjaro
# rocky
# ubuntu
function ph.getOS(){ function ph.getOS(){
local distro= local distro=
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment