Add check: check_systemd

This commit is contained in:
Alban VIDAL 2019-09-30 07:19:30 +02:00
parent c60065e498
commit 4a6e82a164
2 changed files with 44 additions and 0 deletions

View File

@ -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

View File

@ -0,0 +1,43 @@
# BSD 3-Clause License
#
# Copyright (c) 2019, Alban Vidal <alban.vidal@zordhak.fr>
# 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"