Send list of active connections to email

Dears,
I tried find some solution here but without success.
Is any chance to collect current active connections (/ip firewall connections) and send this list to the email?
I am able to send the information about active vpn connections etc etc… but not active connections :slight_smile:
If some thread is existing here about this thing sorry for that :slight_smile:

Best Regards,
Vojsooo

Hello.

You can use this

First configure your mail settings

/tool e-mail
set address=smtp.gmail.com from=<from@gmail.com> password=passw0rd port=587 start-tls=yes user=from@gmail.com

Then schedule the script with the frequency you need.

/ip firewall connection print file=conex
/tool e-mail send to="mail@gmail.com" from="conex TO MAIL" file=conex.txt

Och, it is so simple… Thank you!
It is working perfect.

Let’s say we want to send the email just in case if the connection list contains a specific IP address?


Vojsooo

Dears,
Any ideas? :frowning:


Vojsooo

Sorry for my delay, i was to busy

You can use something like that

/ip firewall connection print file=conex  where src-address~"1.2.3.4" 
/tool e-mail send to="mail@gmail.com" from="conex TO MAIL" file=conex.txt

In this case it will send you all what is in connection tracking with 1.2.3.4 src-address IP

Regards.