Please help me to send email for a recovered interface.
Here is my requirement- I am validating 50 interfaces from a desktop application. Every minute i will be doing data scrapping and the output will be stored in “ExtractDataTable” datatable variable.
Suppose if any interface does not come up after 5min of its actual up time. Bot will be sending email alert like below. The output of failed interfaces will be storing in “failed_interfaces_DT” datatable variable.
now here comes the problem-
at 6th minute - if any interface doesn’t come up. Bot will be sending email attached below.
at 7th minute- interface will come up and it got recovered.
I need to send an email saying 'Interface got recovred" during 7th minute.
REQUEST YOU TO PLEASE HELP ME HOW I CAN IMPLEMENT THIS LOGIC ASAP
If the bot is not stopping and looping through or is running continuously transaction wise then use a global variable and set it to true when failed…and in next iteration once inteface is up check the variable value if true send the recovered email …if not true jut continue the normal process
If proces runs once per min and not continuous then leverage assets…the logic remains same
To send an email when an interface recovers, you can compare the failed interfaces from the previous minute (failedInterfaces_Last) with the current minute’s failed interfaces (failed_interfaces_DT). If an interface from the previous list no longer appears in the current list, it means the interface has recovered. You can then send an email detailing the recovered interfaces. After sending the email, update failedInterfaces_Last to store the current failed_interfaces_DT for future comparisons. Use activities like For Each Row, If conditions, and Send Mail to implement this logic. Ensure that you’re comparing the interface names and sending alerts only when recovery is detected.
Start a loop (every minute):
a. Scrape data and store in ExtractDataTable
b. Check for failed interfaces:
For each row in ExtractDataTable:
If (Interface has not been active for 5 minutes):
If not already in failed_interfaces_DT:
Add to failed_interfaces_DT
Send email: “Interface failed”
c. Detect recovered interfaces:
For each row in failed_interfaces_DT:
If (Interface is now active in ExtractDataTable):
Add to recovered_interfaces_DT
d. Send recovery email:
If recovered_interfaces_DT is not empty:
Format email with recovered interfaces list
Send email: “Recovered Interfaces: ”
e. Update failed_interfaces_DT:
Remove recovered interfaces from failed_interfaces_DT