diff --git a/conf/etc/nagios/nrpe.d/check_nrpe.cfg b/conf/etc/nagios/nrpe.d/check_nrpe.cfg index 70f0345..c8e6a3c 100644 --- a/conf/etc/nagios/nrpe.d/check_nrpe.cfg +++ b/conf/etc/nagios/nrpe.d/check_nrpe.cfg @@ -16,6 +16,7 @@ command[check_available_conntrack] = /usr/local/bin/check_available_conntrack command[check_cpu] = /usr/local/bin/check_cpu +command[check_systemd] = /usr/local/bin/check_systemd # with sudo diff --git a/conf/usr/local/bin/check_systemd b/conf/usr/local/bin/check_systemd new file mode 100755 index 0000000..4a5864e --- /dev/null +++ b/conf/usr/local/bin/check_systemd @@ -0,0 +1,43 @@ +# BSD 3-Clause License +# +# Copyright (c) 2019, Alban Vidal +# All rights reserved. +# +# Please see license file on root of this directory +################################################################################ + +# !! GIT FILE !! +# https://framagit.org/zorval/scripts/check-nrpe + +################################################################################ + +# ConnTrack files +FILE_CONNTRACK_MAX="/proc/sys/net/netfilter/nf_conntrack_max" +FILE_CONNTRACK_COUNT="/proc/sys/net/netfilter/nf_conntrack_count" + +if [[ ! -f "$FILE_CONNTRACK_MAX" || ! -f "$FILE_CONNTRACK_COUNT" ]] ; then + echo "Error, one of this files does not exists :" + echo " - $FILE_CONNTRACK_MAX" + echo " - $FILE_CONNTRACK_COUNT" + exit2 +fi + +################################################################################ + +# Little script which check systemd status + +RETURN_CODE=0 + +# Check systemd status +STATUS=$(systemctl --failed --no-pager --no-legend) + +# Test if return is OK +if [ -z "$STATUS" ]; then + echo "OK" +else + echo "Systemd error" + echo "$STATUS" + RETURN_CODE=2 +fi + +exit "$RETURN_CODE"