ansible-roles/smartgears/resource_checker_se_plugin/templates/check_missing_resources.sh.j2

27 lines
679 B
Plaintext
Raw Normal View History

#!/bin/bash
COMMON_SH_LIB={{ nagios_isti_plugdir }}/check_library.sh
RESOURCES_STATUS_FILE={{ smartgears_user_home }}/missing_resources/identifiers
if [ -f $COMMON_SH_LIB ] ; then
. $COMMON_SH_LIB
else
echo "UNKNOWN - Library file $COMMON_SH_LIB does not exist"
exit $NAGIOS_UNKNOWN
fi
if [ ! -f $RESOURCES_STATUS_FILE ] ; then
echo "UNKNOWN - File $RESOURCES_STATUS_FILE does not exist"
exit $NAGIOS_UNKNOWN
fi
RESOURCES_DATA=$( cat $RESOURCES_STATUS_FILE )
if [ "$RESOURCES_DATA" == "none" ] ; then
echo "OK - No resources are missing"
exit $NAGIOS_OK
else
echo "CRITICAL - Missing resources: $RESOURCES_DATA"
exit $NAGIOS_CRITICAL
fi