1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Unusual request... email stuff.

Discussion in 'Tomato Firmware' started by Devileyezz, Jan 27, 2007.

  1. Devileyezz

    Devileyezz LI Guru Member


    I have no idea how it can be done since there's no sendmail on busybox.
    But this is what I want to do, when WAN is down, I'd like to be notified with past 20 lines of the log as attachment or pasted, etc.

    Email, IM, etc?
    I'm stumped.
    Anyone else can think of something?
  2. luckman212

    luckman212 LI Guru Member

    forgive the stupid question-- but if WAN is down, how do you propose that the router send out an email? :huh:
  3. unicorn02

    unicorn02 LI Guru Member

    hmm. maybe he wants the mail to be send on the intranet zone.
    The feature sounds useful, but maybe a bit too specific to be included in tomato :eyebrow:
  4. Devileyezz

    Devileyezz LI Guru Member

    Yes, I have an intra box to handle email. root@thatbox would be real good.
    And since you mentioned it, the box can come online an email me at my devil@linksys.com email.
  5. ntest7

    ntest7 Network Guru Member

    Send syslog output from the linksys to your internal server Administration->Logging. (This will likely require configuration of syslog.conf on your internal server also).

    Then run a monitor program (monit is a simple to use choice) on the internal server that sends a notice, possibly including log entries, when there is a problem with the external connection. Or just write a little shell script that does this one task.

    If you must do this on the router, you'll need a tool like nc or expect or mini_sendmail that can do the SMTP conversation for you.
  6. Devileyezz

    Devileyezz LI Guru Member

    I'm really a network newbie.
  7. orangekay

    orangekay LI Guru Member

    Setup a local RPC savvy web app that can be triggered from the highly crippled wget build bundled with the firmware and let it do the emailing.
  8. Devileyezz

    Devileyezz LI Guru Member

    In theory everything sounds fun and simple.
  9. orangekay

    orangekay LI Guru Member

    Well I'd be happy to write it for you, but that will cost you $75/hour, and if this honestly all sounds completely foreign to you then odds are good you wouldn't be able to make it work without a hands-on consultation on top of that. Finding a local web developer would probably be your best bet if this is something you legitimately need badly enough to spend money on. If not, I don't think I'd cross any fingers waiting for such functionality to be built in as lack of WAN connectivity pretty well precludes any sort of IM/email capabilities for most people, and frankly I think it should be fairly obvious when the WAN goes down anyway. You don't really need Doppler Radar to tell you it's raining if you already have a window.
  10. tievolu

    tievolu Network Guru Member

    If you have an always-on Linux box somewhere on your network, you could write a little shell script to ping a reliable web site (e.g. www.google.com), and if the ping fails, grab the latest log entries from the router web pages using wget and mail them to an email address using sendmail or whatever.

    Something like this should work, once you've added your details (router password, router IP and email address):

    if !(ping -c 1 www.google.com > /dev/null 2>/dev/null)
      if !(ping -c 1 www.google.com >/dev/null 2>/dev/null)
        wget -q --http-user=root --http-passwd=yourpassword --output-document=log.txt
        cat ./log.txt | mail -s "**** WAN down ****" you@yourmail.com
    The script pings google, and if it fails, pings it again to check whether the failure was a one off. If both ping attempts fail, the script gets the last 50 lines of the log from your router's web GUI and sends it via email.

    Add a cron job to run this script every few minutes, and Robert's your father's brother.

Share This Page