From dc9052967080e0e6606e5b1f173548c5255db014 Mon Sep 17 00:00:00 2001 From: "Hahn Axel (hahn)" <axel.hahn@unibe.ch> Date: Thu, 20 Feb 2025 09:15:17 +0100 Subject: [PATCH] hello: add help and markdown doc --- docs/20_Checks/_index.md | 2 +- docs/20_Checks/hello.md | 63 ++++++++++++++++++++++++++++++++++++++++ hello | 43 ++++++++++++++++++++++++++- 3 files changed, 106 insertions(+), 2 deletions(-) create mode 100644 docs/20_Checks/hello.md diff --git a/docs/20_Checks/_index.md b/docs/20_Checks/_index.md index e1ba906..386c022 100644 --- a/docs/20_Checks/_index.md +++ b/docs/20_Checks/_index.md @@ -53,4 +53,4 @@ * [check_systemdunit](check_systemdunit.md) * [check_timesync](check_timesync.md) * [check_uptime](check_uptime.md) -* hello +* [hello](hello.md) diff --git a/docs/20_Checks/hello.md b/docs/20_Checks/hello.md new file mode 100644 index 0000000..5a57771 --- /dev/null +++ b/docs/20_Checks/hello.md @@ -0,0 +1,63 @@ +## Hello + +Script: `hello` + +It prints a hello message to signal that a non reachable host is alive. +Use it for passive checks in private networks that can't be reached from an Icinga sattelite. + +## Requirements + +Nothing special. + +## Standalone installation + +From this repository ypu need next to this script: + +* `inc_pluginfunctions` shared function for all IML checks written in bash + +## Syntax + +Start the script with `-h` or `--help` to get the help. + +```txt +______________________________________________________________________ + +HELLO +v1.1 + +(c) Institute for Medical Education - University of Bern +Licence: GNU GPL 3 + +https://os-docs.iml.unibe.ch/icinga-checks/Checks/hello.html +______________________________________________________________________ + +Print a hello message to signal that a non reachable host is alive. +Use it for passive checks in private networks that can't be reached from an +Icinga sattelite. + +SYNTAX: + + hello [-h] + +OPTIONS: + + -h or --help show this help. + +PARAMETERS: + + None. + +``` + +## Examples + +No parameter is needed. + +`./hello` + +returns + +```txt +OK: Here I am! +Thu Feb 20 09:11:55 CET 2025 + ``` diff --git a/hello b/hello index bb265da..df48986 100755 --- a/hello +++ b/hello @@ -9,10 +9,51 @@ # # ---------------------------------------------------------------------- # 2021-06-04 v1.0 <axel.hahn@iml.unibe.ch> hello :-) +# 2025-02-20 v1.1 <axel.hahn@unibe.ch> add help # ====================================================================== -. `dirname $0`/inc_pluginfunctions +. "$( dirname "$0" )/inc_pluginfunctions" +self_APPVERSION=1.1 + + +# show help text +function showHelp(){ + local _self; _self=$(basename $0) +cat <<EOF +$( ph.showImlHelpHeader ) + +Print a hello message to signal that a non reachable host is alive. +Use it for passive checks in private networks that can't be reached from an +Icinga sattelite. + +SYNTAX: + + $_self [-h] + +OPTIONS: + + -h or --help show this help. + +PARAMETERS: + + None. + +EOF +} + + +if [ "$1" = "-h" ] || [ "$1" = "--help" ]; then + showHelp + exit 0; +fi + +if [ -n "$*" ]; then + echo "ERROR: no parameter expected." + exit 1 +fi + ph.status "Here I am!" +date ph.exit # ---------------------------------------------------------------------- -- GitLab