and the rest of it...

This commit is contained in:
2024-12-11 13:03:15 -06:00
parent c2b1b821f7
commit f759149c11
26 changed files with 9767 additions and 0 deletions

View File

@@ -0,0 +1,26 @@
function error_out()
#Handle error conditions
#Takes two arguments:
#Error type (fatal,nonfatal)
#Error message
{
if [ $1 == "fatal" ]; then
echo "$0 has experienced a fatal error condition and has aborted operation at $DATE. Please investigate and resolve. Details: $2" | mail -s "Observium discovery fatal error" -r $ERROR_FROM $ERROR_TO
logger $0 has experienced a fatal error condition and has aborted operation at $DATE. Details: $2
exit 1
elif [ $1 == "nonfatal" ]; then
echo "$0 has experienced a non fatal error condition and has continued operation at $DATE. Please investigate and resolve. \n Details: $2" | mail -s "Observium discovery non fatal error" -r $ERROR_FROM $ERROR_TO
logger $0 has experienced a non fatal error condition and has continued operation at $DATE . Details: $2
fi
}
function preflight()
#Perform preflight checks for all scan types
{
logger "Performing preflight checks for discovery of node type: $1"
echo "Performing preflight checks for discovery of node type: $1"
if [ -f /tmp/discovery-$1.lock ]; then
error_out fatal "lock file /tmp/discovery-$1.lock exists. Bailing out."
fi
}