Fix me not knowing Nagios return codes
https://assets.nagios.com/downloads/nagioscore/docs/nagioscore/3/en/pluginapi.html The more you know
This commit is contained in:
parent
36e1bace98
commit
972fdaf614
@ -14,11 +14,11 @@ service="$1"
|
||||
# If the service is null, be critical
|
||||
if [ -z "$service" ]; then
|
||||
echo "UNIT CRITICAL - Service is undefined"
|
||||
exit 1
|
||||
exit 2
|
||||
# If systemctl is not present, be critical
|
||||
elif ! command -v systemctl > /dev/null 2>&1; then
|
||||
echo "UNIT CRITICAL - systemctl missing from PATH"
|
||||
exit 1
|
||||
exit 2
|
||||
# If the service is failed, be critical
|
||||
elif systemctl is-failed --quiet "$service" > /dev/null 2>&1; then
|
||||
echo "UNIT CRITICAL - $service is failed"
|
||||
@ -33,7 +33,7 @@ else
|
||||
;;
|
||||
1|2)
|
||||
echo "UNIT CRITICAL - $service is dead"
|
||||
exit 3
|
||||
exit 2
|
||||
;;
|
||||
3)
|
||||
# In this case, the unit is not running. Whether this is an issue depends on the type of service
|
||||
@ -42,12 +42,12 @@ else
|
||||
exit 0
|
||||
else
|
||||
echo "UNIT CRITICAL - $service is not running"
|
||||
exit 4
|
||||
exit 2
|
||||
fi
|
||||
;;
|
||||
4)
|
||||
echo "UNIT CRITICAL - $service is not present on this machine"
|
||||
exit 50
|
||||
exit 2
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
|
Loading…
Reference in New Issue
Block a user