Script to send an email if Traffic-group failovers on F5
I am using this script to detect the status of a traffic-group and send out an email if it changes its status from Active to Standby, some how i am not getting any email when i flip over the traffic group between active standby boxes. Though i have tested email through CLI and mail works. need experts advice if i am missing any thing?
#!/bin/bash # Variables EMAIL_SUBJECT="HLR-STG-LB01 WHARF Traffic-Group Failover Alert" # Function to send email # Function to log messages # Function to get the current status of the traffic group # Initial state # Main loop if [[ "${previous_status}" != "${current_status}" ]]; then sleep ${CHECK_INTERVAL} |
Added this script to crontab.
ensured that script is running
#ps aux | grep failover_notify.sh
root 23928 0.0 0.0 115208 1500 pts/1 T 12:04 0:00 /bin/bash ./failover_notify.sh
root 31495 0.0 0.0 114736 948 pts/1 S+ 12:52 0:00 grep failover_notify.sh