RouterOS PPP线路连接状态监测告警

用于监测PPP账号在线状态,适用于RouterOS PPPoe、VPN等连接状态监测,配合RosZ的钉钉告警功能,实现PPP账号上下线状态实时推送。

已录入RosZ云指令集,可自行批量部署。

{
#RosZ.cn PPP账号上下线告警
#用于监测PPP账号在线状态,适用于PPPoe、VPN等连接状态监测
#配合RosZ的钉钉告警功能,实现PPP账号上下线状态实时推送
#2023-4-12 Ver2 By Sealin
#ppp监控账号
:local pUser "pppoe123456"
#------------------------------
:if ([:len [/ppp active find name=$pUser]]>0) do={
	:if ([:len [/ip fir add find list=RosZ_Warning_PPP_Down address=$pUser]]>0) do={
		/ip fir add remove [find list=RosZ_Warning_PPP_Down address=$pUser]
		:log warning ("PPP账号上线,账号:".$pUser)
	}
	:do {/ip fir add add list=RosZ_Warning_PPP_Up address=$pUser} on-error={}
} else={
	:if ([:len [/ip fir add find list=RosZ_Warning_PPP_Up address=$pUser]]>0) do={
		/ip fir add remove [find list=RosZ_Warning_PPP_Up address=$pUser]
		:log warning ("PPP账号下线,账号:".$pUser)
	}
	:do {/ip fir add add list=RosZ_Warning_PPP_Down address=$pUser} on-error={}
}
}