24 lines
		
	
	
		
			970 B
		
	
	
	
		
			Bash
		
	
	
		
			Executable File
		
	
	
			
		
		
	
	
			24 lines
		
	
	
		
			970 B
		
	
	
	
		
			Bash
		
	
	
		
			Executable File
		
	
	
#!/bin/bash
 | 
						|
dateformat="%d.%m.%Y %H:%M:%S"
 | 
						|
enabledebug=${1}
 | 
						|
debugfile="${2}"
 | 
						|
mservicename="${3}"
 | 
						|
mserviceaction="${4}"
 | 
						|
mservicestatus="${5}"
 | 
						|
mservicedesc="${6}"
 | 
						|
mservicehost="${7}"
 | 
						|
 | 
						|
monitnotifyerpretriggeroutput() {
 | 
						|
    if [ ${enabledebug} == true ]; then
 | 
						|
        /bin/echo "$(date +"${dateformat}") - [PRETRIGGER_NOTIFICATION] - ${1}" >> "${debugfile}"
 | 
						|
    fi
 | 
						|
}
 | 
						|
 | 
						|
if [[ "${mservicestatus}" == *"succe"*  ]] || [[ "${mservicestatus}" == "Exists" ]] ; then
 | 
						|
	monitnotifyerpretriggeroutput "OK/RECOVERY message detected" &
 | 
						|
    /home/myuser/mynotiicationscript.sh --status OK --device mydevice --title "[${mserviceaction}] ${mservicestatus} on ${mservicename}" --application monitoring "${mservicedesc}" &
 | 
						|
else
 | 
						|
	monitnotifyerpretriggeroutput "WARNING/CRITICAL/UNKNOWN message detected" &
 | 
						|
    /home/myuser/mynotiicationscript.sh --status CTIR --device mydevice --title "[${mserviceaction}] ${mservicestatus} on ${mservicename}" --application monitoring "${mservicedesc}" &
 | 
						|
fi
 |