organzing for portfolio
This commit is contained in:
26
NetworkManagement/librenmsPollScripts/discoveryWrapCommon.sh
Normal file
26
NetworkManagement/librenmsPollScripts/discoveryWrapCommon.sh
Normal 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
|
||||
}
|
Reference in New Issue
Block a user