mirror of
https://github.com/m8tin/cis.git
synced 2025-12-06 15:58:26 +01:00
Added basic Monitoring
This commit is contained in:
14
script/monitor/checks/GENERIC_NGINX_CHECK.sh
Executable file
14
script/monitor/checks/GENERIC_NGINX_CHECK.sh
Executable file
@@ -0,0 +1,14 @@
|
||||
#!/bin/bash
|
||||
|
||||
_SERVER="${1:?"FQDN of server missing"}"
|
||||
_PORT="${2:-"22"}"
|
||||
_USER="monitoring"
|
||||
|
||||
#grep:
|
||||
# -F Use fixed text, no regexp which has to be interpreted
|
||||
|
||||
#cut:
|
||||
# -d Delimiter, marker where to cut (here ;)
|
||||
# -f Index of column to show (One based, so there is no -f0)
|
||||
_RESULT="$(ssh -p "${_PORT}" "${_USER}"@"${_SERVER}" 'systemctl status nginx.service' | grep -F Active: | grep -F running | cut -d';' -f2)"
|
||||
! [ -z "${_RESULT}" ] && echo "OK#UPTIME:${_RESULT}" || echo "FAIL"
|
||||
Reference in New Issue
Block a user