Monkey Albino

Linux altar53.supremepanel53.com 4.18.0-553.8.1.lve.el8.x86_64 #1 SMP Thu Jul 4 16:24:39 UTC 2024 x86_64
/ lib64/ nagios/ plugins/

//lib64/nagios/plugins/check_cpsrvd.sh

#!/bin/bash

CMD=$(sudo /usr/bin/pgrep -c cpsrvd)

crit_face=$(echo -ne "\x0\x01\xF6\x21" | iconv -f UTF-32BE -t UTF-8)
ok_face=$(echo -ne "\x0\x01\xF6\x01" | iconv -f UTF-32BE -t UTF-8)
warn_face=$(echo -ne "\x0\x01\xF6\x20" | iconv -f UTF-32BE -t UTF-8)
unknown_face=$(echo -ne "\x0\x01\xF6\x15" | iconv -f UTF-32BE -t UTF-8)

if (("$CMD" >= 10 && "$CMD" <= 15))
        then
	echo -e "$warn_face WARNING: cPanel processes count is [$CMD]\n"
        exit 1
elif (("$CMD" > 15))
        then
	echo -e "$crit_face CRITICAL: cPanel processes count is [$CMD]"
        exit 2
elif (("$CMD" < 1))
        then
	echo
	echo -e "$crit_face CRITICAL: cPanel processes count is [$CMD] - cPanel not running"
        exit 2
elif (("$CMD" > 0 && "$CMD" < 10))
        then
	echo -e "$ok_face OK: cPanel processes count is [$CMD]"
        exit 0
else
    	echo -e "$warn_face UNKNOWN: cannot get cPanel processes count"
        exit 3
fi