diff --git a/check_iml_backup_server b/check_iml_backup_server index b5f6134fda5543b4eca235ff2f70a5f0814725de..3e5a14126db60d8969f94378faa87870508a89b6 100755 --- a/check_iml_backup_server +++ b/check_iml_backup_server @@ -10,11 +10,12 @@ # 2020-07-27 v0.x <axel.hahn@iml.unibe.ch> # 2023-12-20 v0.2 <axel.hahn@iml.unibe.ch> # 2023-12-21 v1.0 <axel.hahn@iml.unibe.ch> first version +# 2023-12-21 v1.1 <axel.hahn@iml.unibe.ch> Update help text # ====================================================================== . $(dirname $0)/inc_pluginfunctions -export self_APPVERSION=1.0 +export self_APPVERSION=1.1 sInstalldir=/opt/imlbackup/server sScript=storage_helper.sh @@ -24,6 +25,7 @@ sMode= # FUNCTIONS # ---------------------------------------------------------------------- +# show help function showHelp(){ local _self; _self=$(basename $0) cat <<EOF @@ -35,33 +37,48 @@ You can get the count of connections or the status of server backup. See https://os-docs.iml.unibe.ch/iml-backup-server/ SYNTAX: -$_self [-d DIRECTORY] -m MODE + + $_self [-d DIRECTORY] -m MODE OPTIONS: - -h or --help show this help. - -d or --dir set installation dir of iml deployment to find its check skript - default dir: ${sInstalldir} - script: ${sInstalldir}/${sScript} - -m or --mode mode: set type of result; one of status|backupstatus - backupstatus status of backup sets of all servers - status count of connected servers + + -h, --help + show this help. + + -d, --dir PATH + set installation dir of iml deployment to find its check skript + default dir: ${sInstalldir} + script: ${sInstalldir}/${sScript} + + -m, --mode MODE + mode: set type of result; one of status|backupstatus + backupstatus status of backup sets of all servers + status count of connected servers EXAMPLE: -$_self -m status -$_self -m backupstatus + + $_self -m status + $_self -m backupstatus EOF } +# get all server entries with a given status +# param string status character in 1st column; one of .|?|D|E +# param string text to parse function _getServerOfStatus(){ local _key="$1" local _data="$2" grep "$_key .*| [0-9].* |" <<< "$_data" } +# get count of servers with a given status +# param string status character in 1st column; one of .|?|D|E +# param string text to parse function _getStatusCount(){ _getServerOfStatus "$1" "$2" | wc -l } + # ---------------------------------------------------------------------- # MAIN # ---------------------------------------------------------------------- diff --git a/docs/20_Checks/check_iml_backup_server.md b/docs/20_Checks/check_iml_backup_server.md index d2887338403b6ad83f4e990aca9a7f227a8132ca..6227e4d6a55519676c8498c13bec410cfe2d1744 100644 --- a/docs/20_Checks/check_iml_backup_server.md +++ b/docs/20_Checks/check_iml_backup_server.md @@ -26,7 +26,7 @@ uid=1041(icingaclient) gid=1041(icingaclient) groups=1041(icingaclient),1031(iml ______________________________________________________________________ CHECK_IML_BACKUP_SERVER -v1.0 +v1.1 (c) Institute for Medical Education - University of Bern Licence: GNU GPL 3 @@ -40,20 +40,28 @@ You can get the count of connections or the status of server backup. See https://os-docs.iml.unibe.ch/iml-backup-server/ SYNTAX: -check_iml_backup_server [-d DIRECTORY] -m MODE + + check_iml_backup_server [-d DIRECTORY] -m MODE OPTIONS: - -h or --help show this help. - -d or --dir set installation dir of iml deployment to find its check skript - default dir: /opt/imlbackup/server - script: /opt/imlbackup/server/storage_helper.sh - -m or --mode mode: set type of result; one of status|backupstatus - backupstatus status of backup sets of all servers - status count of connected servers + + -h, --help + show this help. + + -d, --dir PATH + set installation dir of iml deployment to find its check skript + default dir: /opt/imlbackup/server + script: /opt/imlbackup/server/storage_helper.sh + + -m, --mode MODE + mode: set type of result; one of status|backupstatus + backupstatus status of backup sets of all servers + status count of connected servers EXAMPLE: -check_iml_backup_server -m status -check_iml_backup_server -m backupstatus + + check_iml_backup_server -m status + check_iml_backup_server -m backupstatus ``` @@ -61,9 +69,6 @@ check_iml_backup_server -m backupstatus ### Backup server status -``check_http -u https://www.example.com/`` is a check that makes an http GET request. -The queck is OK if the responded status code is no error - if it is 2xx (OK) or a redirect (3xx). - ```txt # ./check_iml_backup_server -m backupstatus OK: Server Backups - 36 servers in backup - 0 errors - 7 disbled - 0 running