Send an email when the gateway falls



  • The work of 2 providers is configured, I would like to receive an e-mail in case of problems with one of them. For example, if the gateway is offline for more than 5 minutes, send an email. Now we are trying to configure this through a script that reads gateways.log through cron, a problem with sending out for lack of sendmail.
    PfSense is installed on several servers and we would not like to have files that will not be included in the backup.



  • @azelie:

    ….
    PfSense is installed on several servers and we would not like to have files that will not be included in the backup.

    Then no, pfSense has no such facility on-board.
    Special demands need special code (lines)  ;)

    But, I do receive a mail when my pfSense becomes unreachable - and even with just ONE ( 1 !) WAN interface.
    I check from the outside  ;) https://www.test-domaine.fr/munin/brit-hotel-fumel.net/pfsense.brit-hotel-fumel.net/index.html
    Munin dials in every 5 minutes for chart updates, and when it times out, he will call Houston (that's me).



  • I use UptimeRobot for this.  It's free.

    https://uptimerobot.com/


  • Rebel Alliance Global Moderator

    What if both your gateways are down?  How do you get the email ;)

    As mentioned easier and more reliable to test from outside or some sort of out of band system.  I use domotz and multiple outside monitors.. If my connection goes down I hear about it on my phone via app push, via sms via email, etc.

    No reason to re-invent the wheel for this sort of monitoring.



  • From the outside, you will not be able to watch due to the fact that not all external interfaces have a permanent IP, and some are behind NAT.



  • For public IP addresses, use dynamic DNS with a static hostname then… the router will update the hostname with the correct IP address if/when it changes.

    Not sure of a way to handle it if your carrier is using NAT. Maybe see if they have IPv6 available also, and use that instead as your down-detector?



  • Are you not using gateway groups? It's a standard pfSense notification whenever a gateway in a gateway group goes up or down:

    TMOBILE_DHCP is down, omitting from routing group FIOS_to_TMOBILE
    8.8.8.8|192.168.0.254|TMOBILE_DHCP|982.895ms|1995.669ms|0.0%|down