Nagios scripts/utils for monitoring DirectAdmin

rroethof

New member
Joined
Dec 20, 2019
Messages
1
Hi all,

I am writing multiple nagios scripts to monitor our DA systems and wanted to share these.
It might come in handy for others, and possibly others might have similar scripts they would wish to share, open source :D :D

nrpe_local.cfg
Code:
# Run the eventhandler to update DirectAdmin Custombuild
command[check_update_directadmin]=/usr/lib/nagios/plugins/check_directadmin

# Check if CSF is running
command[check_csf]=/usr/lib/nagios/plugins/check_csf
/usr/lib/nagios/plugins/check_directadmin
Code:
#!/bin/bash

countWarnings=`/usr/local/directadmin/custombuild/build versions | grep "update is available" | wc -l`
if [[ $countWarnings == 0 ]]; then
    echo "OK - $countWarnings updates available for DirectAdmin."
    exit 0
else
    echo "CRITICAL - $countWarnings updates available for DirectAdmin."
    exit 2
fi
/usr/lib/nagios/plugins/check_csf
Code:
#!/bin/bash

if [ -d /etc/csf ]; then
    if [[ "$(sudo csf --status | grep DROP -c)" -gt 0 ]]; then
        if [[ "$(sudo ps aux | grep 'lfd' | grep -v grep | wc -l)" -eq 0 ]]; then
            echo "CSF WARNING – CSF is running but LFD is stopped"
            exit 1
        fi
        echo "CSF OK – Running"
        exit 0
    else
        echo "CSF CRITICAL – NOT Running"
        exit 2
    fi
else
    echo "CSF CRITICAL – NOT installed"
    exit 2
fi
 
Top