#!/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