lt2p alert

Hi there!

i’d like to have a script that alert me when lt2p is down, and disable my NAT masquerade rule. Plus is to alert me by email

i had try with this:

name="test" owner="admin" policy=ftp,reboot,read,write,policy,test,password,sniff,sensitive,romon last-started=aug/28/1970 04:46:16 run-count=4 source=
       :if ( [/interface l2tp-server get number=0 running] = true ) do={
       ip firewall nat set 0 disabled=yes
       ip firewall nat set 1 disabled=yes
       /tool e-mail send \
           to="somemail@example.com" from=somemail@example.com \
           subject=([/system identity get name] . "alert l2tp") \
        server=myserveripaddress
       
       }
       }

when try to run, nothing happens and any error happens

any idea?

You can also use ppp profile to achieve the same. Make sure to bind the secret to the profile.

/tool e-mail
set address=myserveripaddress from=somemail@example.com
/ppp profile
add name=l2tp-alert on-down="/ip firewall nat disable 0,1\r\
    \n/tool e-mail send \\\r\
    \n  to=\"somemail@example.com\" \\\r\
    \n  subject=([/system identity get name] . \" - l2tp down\")" on-up="/ip firewall nat enable 0,1"