Skip to content

Instantly share code, notes, and snippets.

@discarn8
Last active March 21, 2022 04:28
Show Gist options
  • Save discarn8/64c288a760d6c92cc57a21e7f57dc361 to your computer and use it in GitHub Desktop.
Save discarn8/64c288a760d6c92cc57a21e7f57dc361 to your computer and use it in GitHub Desktop.
Nagios Check NFS
/usr/lib/nagios/plugins/check_nfs.sh
----------------------------------------------------------------
#!/bin/sh
RC=0
NAGIOS_CRIT=2
NAGIOS_OK=0
NAGIOS_WARN=1
FS="/NFS"
# Main
MOUNT="nfs"
MOUNTED=`mount | grep -v systemd | grep -wc "$FS"` # execute the command to check the mount ang ignore systemd...
if [ $MOUNTED -eq 0 ]; then
MSG="CRITICAL - $FS not mounted"
RC=$NAGIOS_CRIT
elif [ $MOUNTED -eq 1 ]; then
MSG="OK - $FS mounted"
RC=$NAGIOS_OK
else
MSG="WARNING - $FS is mounted several times! ($MOUNTED)"
RC=$NAGIOS_WARN
fi
echo $MSG
exit $RC
----------------------------------------------------------------
cat /etc/nagios/nrpe.cfg | egrep -v '#|^$'
----------------------------------------------------------------
command[check_users]=/usr/lib/nagios/plugins/check_users -w 3 -c 4
command[check_load]=/usr/lib/nagios/plugins/check_load -r -w 1.95,1.90,1.80 -c 2.10,2.00,1.90
command[check_hda1]=/usr/lib/nagios/plugins/check_disk -w 20% -c 10% -p /
command[check_zombie_procs]=/usr/lib/nagios/plugins/check_procs -w 5 -c 10 -s Z
command[check_total_procs]=/usr/lib/nagios/plugins/check_procs -w 250 -c 300
command[check_apt]=/usr/lib/nagios/plugins/check_apt
command[check_ntp]=/usr/lib/nagios/plugins/check_ntp_time -H 1.1.1.1 -w 2 -c 5
command[checknfs]=sudo -u root /usr/lib/nagios/plugins/check_nfs.sh
command[check_hw]=sudo -u root /usr/lib/nagios/plugins/check_hw
command[check_os]=sudo -u root /usr/lib/nagios/plugins/check_os
command[check_rasp_temp]=sudo -u root /usr/lib/nagios/plugins/check_rasp_temp -w 145 -c 165
command[check_throttled]=sudo -u root /usr/lib/nagios/plugins/check_throttled
command[check_v]=sudo -u root /usr/lib/nagios/plugins/check_voltage
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment