Need help for script to send email when psu1-state is down

Hi all

Trying to have a bunch of my CRS354 switches, do the following in RouterV7

I would like to have a script running that send an email, when the switch detect the PSU1-state is down, and preferable also when the psu1-state goes to OK again

the ideas is that all of my switches, will have a UPS attached to PSU2, and land power attached to PSU1, and therefore I will receive a mail if the landline goes down, and then I will have the time to act before the switch goes completely down.

Instead of email, I could also get the notification with telegram if that is easier to script?

can some one point me in the right direction

Sincerely
Carsten Larsen

Have a look at Notify about health state. It supports both, e-mail and Telegram (and Matrix on top).

Thanks , Will check

Figured it out, had a mate help me

Now I have a script and a scheduler than runs every 5 minutes, who check if PSU-STATE has changed, and sends me a telegram when the PSU-STATE changes from down and up

Thanks a lot everyone

Sincerely
Carsten Larsen