Compare commits
No commits in common. "d41ba60101fd4b41d7aef9f20be7f96cea0be41d" and "a1cd78b7e5a9df339567ddf0d7402990c876731e" have entirely different histories.
d41ba60101
...
a1cd78b7e5
@ -3,14 +3,13 @@
|
|||||||
#
|
#
|
||||||
#/
|
#/
|
||||||
#/ Usage:
|
#/ Usage:
|
||||||
#/ check-disk.sh --warning=<level> --critical=<level> --help
|
#/ check-disk.sh --warning=<level> --critical=<level>
|
||||||
#/
|
#/
|
||||||
#/ Checks the disk usage
|
#/ Checks the disk usage
|
||||||
#/
|
#/
|
||||||
#/ Options:
|
#/ Options:
|
||||||
#/ -w, --warning=<level> The level of when to trigger a warning (level=loadavg/nproc)
|
#/ -w, --warning=<level> The level of when to trigger a warning (level=loadavg/nproc)
|
||||||
#/ -c, --critical=<level> The level of when to trigger a critical warning (level=loadavg/nproc)
|
#/ -c, --critical=<level> The level of when to trigger a critical warning (level=loadavg/nproc)
|
||||||
#/ -h, --help Display this help message
|
|
||||||
#/
|
#/
|
||||||
#/ Exit Codes:
|
#/ Exit Codes:
|
||||||
#/ 0 Everything OK
|
#/ 0 Everything OK
|
||||||
@ -26,8 +25,8 @@ Usage() {
|
|||||||
|
|
||||||
GetOptions() {
|
GetOptions() {
|
||||||
# https://stackoverflow.com/a/29754866
|
# https://stackoverflow.com/a/29754866
|
||||||
OPTIONS=w:c:h
|
OPTIONS=w:c:
|
||||||
LONGOPTS=warning:,critical:,help
|
LONGOPTS=warning:,critical:
|
||||||
|
|
||||||
# -use ! and PIPESTATUS to get exit code with errexit set
|
# -use ! and PIPESTATUS to get exit code with errexit set
|
||||||
# -temporarily store output to be able to check for errors
|
# -temporarily store output to be able to check for errors
|
||||||
@ -55,9 +54,6 @@ GetOptions() {
|
|||||||
crit="$2"
|
crit="$2"
|
||||||
shift 2
|
shift 2
|
||||||
;;
|
;;
|
||||||
-h|--help)
|
|
||||||
Usage
|
|
||||||
exit 0;
|
|
||||||
--)
|
--)
|
||||||
shift
|
shift
|
||||||
break
|
break
|
||||||
|
@ -3,23 +3,13 @@
|
|||||||
#
|
#
|
||||||
#/
|
#/
|
||||||
#/ Usage:
|
#/ Usage:
|
||||||
#/ check-dummy.sh [--ok|--warning|--critical] --help
|
#/ check-dummy.sh
|
||||||
#/
|
#/
|
||||||
#/ Does not check anything.
|
#/ Does not check anything. Always gives OK!
|
||||||
#/
|
|
||||||
#/ Options:
|
|
||||||
#/ -o, --ok Trigger a OK status (default)
|
|
||||||
#/ -w, --warning Trigger a warning
|
|
||||||
#/ -c, --critical Trigger a critical warning
|
|
||||||
#/ -u, --unknown Trigger a unknown status
|
|
||||||
#/ -h, --help Display this help message
|
|
||||||
#/
|
#/
|
||||||
#/
|
#/
|
||||||
#/ Exit Codes:
|
#/ Exit Codes:
|
||||||
#/ 0 Everything OK
|
#/ 0 Everything OK
|
||||||
#/ 1 Warning level exceeded
|
|
||||||
#/ 2 Critical level exceeded
|
|
||||||
#/ 3 Unknown status
|
|
||||||
#/
|
#/
|
||||||
|
|
||||||
Usage() {
|
Usage() {
|
||||||
@ -28,8 +18,8 @@ Usage() {
|
|||||||
|
|
||||||
GetOptions() {
|
GetOptions() {
|
||||||
# https://stackoverflow.com/a/29754866
|
# https://stackoverflow.com/a/29754866
|
||||||
OPTIONS='owcuh'
|
OPTIONS=''
|
||||||
LONGOPTS='ok,warning,critical,unknown,help'
|
LONGOPTS=''
|
||||||
|
|
||||||
# -use ! and PIPESTATUS to get exit code with errexit set
|
# -use ! and PIPESTATUS to get exit code with errexit set
|
||||||
# -temporarily store output to be able to check for errors
|
# -temporarily store output to be able to check for errors
|
||||||
@ -40,6 +30,7 @@ GetOptions() {
|
|||||||
# e.g. return value is 1
|
# e.g. return value is 1
|
||||||
# then getopt has complained about wrong arguments to stdout
|
# then getopt has complained about wrong arguments to stdout
|
||||||
Usage
|
Usage
|
||||||
|
exit 2
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# read getopt's output this way to handle the quoting right:
|
# read getopt's output this way to handle the quoting right:
|
||||||
@ -48,45 +39,23 @@ GetOptions() {
|
|||||||
# now enjoy the options in order and nicely split until we see --
|
# now enjoy the options in order and nicely split until we see --
|
||||||
while true; do
|
while true; do
|
||||||
case "$1" in
|
case "$1" in
|
||||||
-o|--ok)
|
|
||||||
rval=0
|
|
||||||
rmsg="OK"
|
|
||||||
shift
|
|
||||||
;;
|
|
||||||
-w|--warning)
|
|
||||||
rval=1
|
|
||||||
rmsg="WARNING"
|
|
||||||
shift
|
|
||||||
;;
|
|
||||||
-c|--critical)
|
|
||||||
rval=2
|
|
||||||
rmsg="CRITICAL"
|
|
||||||
shift
|
|
||||||
;;
|
|
||||||
-u|--unknown)
|
|
||||||
rval=3
|
|
||||||
rmsg="UNKNOWN"
|
|
||||||
shift
|
|
||||||
;;
|
|
||||||
-h|--help)
|
|
||||||
Usage
|
|
||||||
exit 0;
|
|
||||||
--)
|
--)
|
||||||
shift
|
shift
|
||||||
break
|
break
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
echo "DUMMY UNKNOWN - ${1} is not a valid parameter"
|
echo "URL UNKNOWN - ${1} is not a valid parameter"
|
||||||
exit 3
|
exit 3
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
done
|
done
|
||||||
}
|
|
||||||
script_name=$(basename "${0}")
|
|
||||||
script_dir=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )
|
|
||||||
rval=0
|
|
||||||
rmsg="OK"
|
|
||||||
GetOptions "$@"
|
|
||||||
|
|
||||||
echo "DUMMY $rmsg"
|
if [ -z ${1+x} ]; then
|
||||||
exit $rval
|
echo "URL UNKNOWN - url not given"
|
||||||
|
exit 3
|
||||||
|
else
|
||||||
|
url=${1}
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
echo "DUMMY OK"
|
||||||
|
exit 0
|
@ -3,7 +3,7 @@
|
|||||||
#
|
#
|
||||||
#/
|
#/
|
||||||
#/ Usage:
|
#/ Usage:
|
||||||
#/ check-load.sh --warning=<level> --critical=<level> --average=<level> --help
|
#/ check-load.sh --warning=<level> --critical=<level> --average=<level>
|
||||||
#/
|
#/
|
||||||
#/ Checks the system load
|
#/ Checks the system load
|
||||||
#/
|
#/
|
||||||
@ -11,7 +11,6 @@
|
|||||||
#/ -w, --warning=<level> The level of when to trigger a warning (level=loadavg/nproc)
|
#/ -w, --warning=<level> The level of when to trigger a warning (level=loadavg/nproc)
|
||||||
#/ -c, --critical=<level> The level of when to trigger a critical warning (level=loadavg/nproc)
|
#/ -c, --critical=<level> The level of when to trigger a critical warning (level=loadavg/nproc)
|
||||||
#/ -a, --average=<average> Which avarage to use for the load level (possible values are 1, 5 and 15)
|
#/ -a, --average=<average> Which avarage to use for the load level (possible values are 1, 5 and 15)
|
||||||
#/ -h, --help Display this help message
|
|
||||||
#/
|
#/
|
||||||
#/ Exit Codes:
|
#/ Exit Codes:
|
||||||
#/ 0 Everything OK
|
#/ 0 Everything OK
|
||||||
@ -27,8 +26,8 @@ Usage() {
|
|||||||
|
|
||||||
GetOptions() {
|
GetOptions() {
|
||||||
# https://stackoverflow.com/a/29754866
|
# https://stackoverflow.com/a/29754866
|
||||||
OPTIONS=w:c:a:h
|
OPTIONS=w:c:a:
|
||||||
LONGOPTS=warning:,critical:,avarage:,help
|
LONGOPTS=warning:,critical:,avarage:
|
||||||
|
|
||||||
# -use ! and PIPESTATUS to get exit code with errexit set
|
# -use ! and PIPESTATUS to get exit code with errexit set
|
||||||
# -temporarily store output to be able to check for errors
|
# -temporarily store output to be able to check for errors
|
||||||
@ -64,9 +63,6 @@ GetOptions() {
|
|||||||
check="$2"
|
check="$2"
|
||||||
shift 2
|
shift 2
|
||||||
;;
|
;;
|
||||||
-h|--help)
|
|
||||||
Usage
|
|
||||||
exit 0;
|
|
||||||
--)
|
--)
|
||||||
shift
|
shift
|
||||||
break
|
break
|
||||||
|
10
check-md.sh
10
check-md.sh
@ -3,14 +3,13 @@
|
|||||||
#
|
#
|
||||||
#/
|
#/
|
||||||
#/ Usage:
|
#/ Usage:
|
||||||
#/ check-md.sh --warning=<events> --critical=<events> --help <md-device>
|
#/ check-md.sh --warning=<events> --critical=<events> <md-device>
|
||||||
#/
|
#/
|
||||||
#/ Checks the raid-device status
|
#/ Checks the raid-device status
|
||||||
#/
|
#/
|
||||||
#/ Options:
|
#/ Options:
|
||||||
#/ -w, --warning=<events> The events of when to trigger a warning (comma-separated)
|
#/ -w, --warning=<events> The events of when to trigger a warning (comma-separated)
|
||||||
#/ -c, --critical=<events> The events of when to trigger a critical warning (comma-separated)
|
#/ -c, --critical=<events> The events of when to trigger a critical warning (comma-separated)
|
||||||
#/ -h, --help Display this help message
|
|
||||||
#/
|
#/
|
||||||
#/ Possible events
|
#/ Possible events
|
||||||
#/ - clean
|
#/ - clean
|
||||||
@ -32,8 +31,8 @@ Usage() {
|
|||||||
|
|
||||||
GetOptions() {
|
GetOptions() {
|
||||||
# https://stackoverflow.com/a/29754866
|
# https://stackoverflow.com/a/29754866
|
||||||
OPTIONS=w:c:h
|
OPTIONS=w:c:
|
||||||
LONGOPTS=warning:,critical:,help
|
LONGOPTS=warning:,critical:
|
||||||
|
|
||||||
# -use ! and PIPESTATUS to get exit code with errexit set
|
# -use ! and PIPESTATUS to get exit code with errexit set
|
||||||
# -temporarily store output to be able to check for errors
|
# -temporarily store output to be able to check for errors
|
||||||
@ -66,9 +65,6 @@ GetOptions() {
|
|||||||
IFS=$OLDIFS
|
IFS=$OLDIFS
|
||||||
shift 2
|
shift 2
|
||||||
;;
|
;;
|
||||||
-h|--help)
|
|
||||||
Usage
|
|
||||||
exit 0;
|
|
||||||
--)
|
--)
|
||||||
shift
|
shift
|
||||||
break
|
break
|
||||||
|
10
check-mem.sh
10
check-mem.sh
@ -3,14 +3,13 @@
|
|||||||
#
|
#
|
||||||
#/
|
#/
|
||||||
#/ Usage:
|
#/ Usage:
|
||||||
#/ check-memory.sh --warning=<level> --critical=<level> --help
|
#/ check-memory.sh --warning=<level> --critical=<level>
|
||||||
#/
|
#/
|
||||||
#/ Checks the memory usage
|
#/ Checks the memory usage
|
||||||
#/
|
#/
|
||||||
#/ Options:
|
#/ Options:
|
||||||
#/ -w, --warning=<level> The level of when to trigger a warning (level=loadavg/nproc)
|
#/ -w, --warning=<level> The level of when to trigger a warning (level=loadavg/nproc)
|
||||||
#/ -c, --critical=<level> The level of when to trigger a critical warning (level=loadavg/nproc)
|
#/ -c, --critical=<level> The level of when to trigger a critical warning (level=loadavg/nproc)
|
||||||
#/ -h, --help Display this help message
|
|
||||||
#/
|
#/
|
||||||
#/ Exit Codes:
|
#/ Exit Codes:
|
||||||
#/ 0 Everything OK
|
#/ 0 Everything OK
|
||||||
@ -26,8 +25,8 @@ Usage() {
|
|||||||
|
|
||||||
GetOptions() {
|
GetOptions() {
|
||||||
# https://stackoverflow.com/a/29754866
|
# https://stackoverflow.com/a/29754866
|
||||||
OPTIONS=w:c:h
|
OPTIONS=w:c:
|
||||||
LONGOPTS=warning:,critical:,help
|
LONGOPTS=warning:,critical:
|
||||||
|
|
||||||
# -use ! and PIPESTATUS to get exit code with errexit set
|
# -use ! and PIPESTATUS to get exit code with errexit set
|
||||||
# -temporarily store output to be able to check for errors
|
# -temporarily store output to be able to check for errors
|
||||||
@ -55,9 +54,6 @@ GetOptions() {
|
|||||||
crit="$2"
|
crit="$2"
|
||||||
shift 2
|
shift 2
|
||||||
;;
|
;;
|
||||||
-h|--help)
|
|
||||||
Usage
|
|
||||||
exit 0;
|
|
||||||
--)
|
--)
|
||||||
shift
|
shift
|
||||||
break
|
break
|
||||||
|
@ -3,11 +3,10 @@
|
|||||||
#
|
#
|
||||||
#/
|
#/
|
||||||
#/ Usage:
|
#/ Usage:
|
||||||
#/ check-systemctl-service.sh --help <unit-file>
|
#/ check-systemctl-service.sh <unit-file>
|
||||||
#/
|
#/
|
||||||
#/ Options:
|
#/ Options:
|
||||||
#/ -u, --user Check for running within current user
|
#/ -u, --user Check for running within current user
|
||||||
#/ -h, --help Display this help message
|
|
||||||
#/
|
#/
|
||||||
#/ Checks if a systemd unit is active
|
#/ Checks if a systemd unit is active
|
||||||
#/
|
#/
|
||||||
@ -24,8 +23,8 @@ Usage() {
|
|||||||
|
|
||||||
GetOptions() {
|
GetOptions() {
|
||||||
# https://stackoverflow.com/a/29754866
|
# https://stackoverflow.com/a/29754866
|
||||||
OPTIONS=uh
|
OPTIONS=u
|
||||||
LONGOPTS=user,help
|
LONGOPTS=user
|
||||||
|
|
||||||
# -use ! and PIPESTATUS to get exit code with errexit set
|
# -use ! and PIPESTATUS to get exit code with errexit set
|
||||||
# -temporarily store output to be able to check for errors
|
# -temporarily store output to be able to check for errors
|
||||||
@ -49,9 +48,6 @@ GetOptions() {
|
|||||||
user='--user'
|
user='--user'
|
||||||
shift 1
|
shift 1
|
||||||
;;
|
;;
|
||||||
-h|--help)
|
|
||||||
Usage
|
|
||||||
exit 0;
|
|
||||||
--)
|
--)
|
||||||
shift
|
shift
|
||||||
break
|
break
|
||||||
@ -73,8 +69,6 @@ GetOptions() {
|
|||||||
user=''
|
user=''
|
||||||
service=''
|
service=''
|
||||||
LC_NUMERIC="C"
|
LC_NUMERIC="C"
|
||||||
script_name=$(basename "${0}")
|
|
||||||
script_dir=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )
|
|
||||||
GetOptions "$@"
|
GetOptions "$@"
|
||||||
|
|
||||||
if [[ $(systemctl ${user} list-unit-files "${service}*" | wc -l) -gt 3 ]]; then
|
if [[ $(systemctl ${user} list-unit-files "${service}*" | wc -l) -gt 3 ]]; then
|
||||||
|
10
check-url.sh
10
check-url.sh
@ -3,7 +3,7 @@
|
|||||||
#
|
#
|
||||||
#/
|
#/
|
||||||
#/ Usage:
|
#/ Usage:
|
||||||
#/ check-url.sh --proxy=<proxy-url> --warning=<level> --critical=<level> --help <URL>
|
#/ check-url.sh --proxy=<proxy-url> --warning=<level> --critical=<level> <URL>
|
||||||
#/
|
#/
|
||||||
#/ Checks if URL is available
|
#/ Checks if URL is available
|
||||||
#/
|
#/
|
||||||
@ -11,7 +11,6 @@
|
|||||||
#/ -p, --proxy=<proxy-url> The proxy server to use
|
#/ -p, --proxy=<proxy-url> The proxy server to use
|
||||||
#/ -w, --warning=<sec> The amount of response time to trigger a warning (in sec)
|
#/ -w, --warning=<sec> The amount of response time to trigger a warning (in sec)
|
||||||
#/ -c, --critical=<sec> The amount of response time to trigger a critcal warning (in sec)
|
#/ -c, --critical=<sec> The amount of response time to trigger a critcal warning (in sec)
|
||||||
#/ -h, --help Display this help message
|
|
||||||
#/
|
#/
|
||||||
#/ Exit Codes:
|
#/ Exit Codes:
|
||||||
#/ 0 Everything OK
|
#/ 0 Everything OK
|
||||||
@ -27,8 +26,8 @@ Usage() {
|
|||||||
|
|
||||||
GetOptions() {
|
GetOptions() {
|
||||||
# https://stackoverflow.com/a/29754866
|
# https://stackoverflow.com/a/29754866
|
||||||
OPTIONS=p:w:c:h
|
OPTIONS=p:w:c:
|
||||||
LONGOPTS=proxy:,warning:,critical:,help
|
LONGOPTS=proxy:,warning:,critical:
|
||||||
|
|
||||||
# -use ! and PIPESTATUS to get exit code with errexit set
|
# -use ! and PIPESTATUS to get exit code with errexit set
|
||||||
# -temporarily store output to be able to check for errors
|
# -temporarily store output to be able to check for errors
|
||||||
@ -60,9 +59,6 @@ GetOptions() {
|
|||||||
crit="$2"
|
crit="$2"
|
||||||
shift 2
|
shift 2
|
||||||
;;
|
;;
|
||||||
-h|--help)
|
|
||||||
Usage
|
|
||||||
exit 0;
|
|
||||||
--)
|
--)
|
||||||
shift
|
shift
|
||||||
break
|
break
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
#
|
#
|
||||||
#/
|
#/
|
||||||
#/ Usage:
|
#/ Usage:
|
||||||
#/ check-webcron.sh --proxy=<proxy-url> [--daemon] --warning=<level> --critical=<level> --help <URL>
|
#/ check-webcron.sh --proxy=<proxy-url> [--daemon] --warning=<level> --critical=<level> <URL>
|
||||||
#/
|
#/
|
||||||
#/ Checks webcron jobs
|
#/ Checks webcron jobs
|
||||||
#/
|
#/
|
||||||
@ -12,7 +12,6 @@
|
|||||||
#/ -d, --daemon When no daemon is running trigger a critical warning
|
#/ -d, --daemon When no daemon is running trigger a critical warning
|
||||||
#/ -w, --warning=<ratio> The ratio of failed jobs to trigger a warning (1 = all jobs; 0.5 = half of all jobs)
|
#/ -w, --warning=<ratio> The ratio of failed jobs to trigger a warning (1 = all jobs; 0.5 = half of all jobs)
|
||||||
#/ -c, --critical=<ratio> The ratio of failed jobs to trigger a critcal warning (1 = all jobs; 0.5 = half of all jobs)
|
#/ -c, --critical=<ratio> The ratio of failed jobs to trigger a critcal warning (1 = all jobs; 0.5 = half of all jobs)
|
||||||
#/ -h, --help Display this help message
|
|
||||||
#/
|
#/
|
||||||
#/ Exit Codes:
|
#/ Exit Codes:
|
||||||
#/ 0 Everything OK
|
#/ 0 Everything OK
|
||||||
@ -28,8 +27,8 @@ Usage() {
|
|||||||
|
|
||||||
GetOptions() {
|
GetOptions() {
|
||||||
# https://stackoverflow.com/a/29754866
|
# https://stackoverflow.com/a/29754866
|
||||||
OPTIONS=p:dw:c:h
|
OPTIONS=p:dw:c:
|
||||||
LONGOPTS=proxy:,daemon,warning:,critical:,help
|
LONGOPTS=proxy:,daemon,warning:,critical:
|
||||||
|
|
||||||
# -use ! and PIPESTATUS to get exit code with errexit set
|
# -use ! and PIPESTATUS to get exit code with errexit set
|
||||||
# -temporarily store output to be able to check for errors
|
# -temporarily store output to be able to check for errors
|
||||||
@ -64,9 +63,6 @@ GetOptions() {
|
|||||||
crit="$2"
|
crit="$2"
|
||||||
shift 2
|
shift 2
|
||||||
;;
|
;;
|
||||||
-h|--help)
|
|
||||||
Usage
|
|
||||||
exit 0;
|
|
||||||
--)
|
--)
|
||||||
shift
|
shift
|
||||||
break
|
break
|
||||||
|
Loading…
Reference in New Issue
Block a user