This repository was archived by the owner on Apr 9, 2026. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 11
Expand file tree
/
Copy pathcheck_misc.sh
More file actions
executable file
·105 lines (89 loc) · 2.9 KB
/
check_misc.sh
File metadata and controls
executable file
·105 lines (89 loc) · 2.9 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
#!/bin/bash
#
# Important : This scripts checks stuff that should be OK 99.99999% of the time
#
if [ -d /usr/lib/nagios/plugins ]; then
NAGIOS_PLUGINS=/usr/lib/nagios/plugins
else
NAGIOS_PLUGINS=/usr/lib64/nagios/plugins
fi
set -e
set -o pipefail
#TEST_GRUB=true
#TEST_RELEASE=true
TEST_IMAP=true
#TEST_NTP=true
#TEST_INOTIFY=true
#TEST_CRON=true
TEST_SENSORS=true
TEST_IPMI_SENSORS=true
while test $# -gt 0
do
case "$1" in
--no-imap) TEST_IMAP=false
;;
--no-sensors) TEST_SENSORS=false
;;
--no-ipmi-sensors) TEST_IPMI_SENSORS=false
;;
esac
shift
done
if [ -f /etc/debian_version ] ; then
if ! [ -f /boot/grub/grub.cfg ] ; then
if ! [ "$(jq -r '.host.model' /etc/sysnove.json)" == "container" ]; then
echo "CRITICAL - /boot/grub/grub.cfg does not exist, please run update-grub2 and grub-install"
exit 2
fi
fi
fi
if lsb_release -d | grep -Eq '(Ubuntu|Debian)'; then
lsb_release_distrib="$(lsb_release -cs)"
motd_distrib="$(grep -o 'OS :.*' /etc/motd | grep -o '(.*)' | grep -o '[A-Za-z]*')"
if [ -n "$motd_distrib" ] && [ "$lsb_release_distrib" != "$motd_distrib" ]; then
echo "CRITICAL - Host is running on $lsb_release_distrib but /etc/motd contains $motd_distrib, you should run post_upgrade.sh"
exit 2
fi
fi
if [ ! -d /etc/.git ] ; then
echo "CRITICAL - No /etc/.git, etckeeper is not working"
exit 2
fi
if $TEST_IMAP; then
if ! $NAGIOS_PLUGINS/check_tcp -H imap.snmail.fr -p 587 -t 1 > /dev/null; then
echo "CRITICAL - Could not connect to imap.snmail.fr:587"
exit 2
fi
fi
(
$NAGIOS_PLUGINS/check_ntp_time -H 0.debian.pool.ntp.org | cut -d '|' -f 1
/usr/local/nagios/plugins/check_shorewall_custom_conf.sh | cut -d '|' -f 1
/usr/bin/sudo /usr/local/nagios/plugins/check_failover_interfaces.sh | cut -d '|' -f 1
/usr/bin/sudo /usr/local/nagios/plugins/check_inotify_user_instances.sh | cut -d '|' -f 1
/usr/bin/sudo /usr/local/nagios/plugins/check_cron_log.sh
/usr/local/nagios/plugins/check_ansible_groups.sh
if [ -f /etc/cron.d/ipinfo ]; then
/usr/bin/sudo /usr/local/nagios/plugins/check_ipinfo_bl.sh
fi
if [ -d /etc/nginx ]; then
/usr/local/nagios/plugins/check_nginx_config.sh
fi
if [ -d /etc/php ]; then
/usr/local/nagios/plugins/check_fpm_custom_pools.sh
fi
if [ -f /proc/mdstat ]; then
/usr/local/nagios/plugins/check_md_nbdisks.sh
fi
if pgrep varnishd >/dev/null; then
/usr/local/nagios/plugins/check_varnish_vcl.sh
fi
if ! systemd-detect-virt -q; then
if $TEST_SENSORS; then
$NAGIOS_PLUGINS/check_sensors
fi
if $TEST_IPMI_SENSORS && [ -f $NAGIOS_PLUGINS/check_ipmi_sensor ] && [ -f /usr/sbin/ipmi-sensors ]; then
/usr/local/nagios/plugins/check_ipmi_sensors.sh
fi
fi
echo "OK - Everything is Awesome"
) | tac # Shinken uses the first line as the main output, so we need to inverse the output