Access Points
    Wi-Fi Routers
    Magicbox
    Software
    Access Points
    Magicbox
    Motherboards
    Radio modules
    Accessories
    Enclosures
    Client sets
    Motherboards
    Radio modules
    Access points
    Connectors
    Power Supply
    Tools
    Enclosures
    Spliters
    Bluetooth
    Accessories
    Optical fibre
    Switches
    ADSL Modem
    Print Servers
  
  Wiedza/MikroTik/Jak to zrobić??/How to Configure Router to Send E-mails When Power Failure has Occured?

How to Configure Router to Send E-mails When Power Failure has Occured?

Description

Suppose you want to receive e-mail (most GSM operators provide service to forward e-mail as SMS) from your router every time power has failed and UPS is running on bateries.

To do so you should set up Scheduler to check the state of UPS and write a script to send e-mail every time UPS switches to on-battery mode. As you do not want e-mail to come every time the router checks the state of the UPS, this script should be run only once. To achieve this, two scripts should be created. One of them should work while the UPS is on utility power, and send e-mail, should it fail. It should also change the Scheduler task so that the other one is executed next time the task runs. The second script should run while the UPS is on battery, and change the Scheduler task back to execute the first script, once the UPS has switched back to utility power.

First of all scripts should be written. The first script will send an e-mail to the mail@company.com mailbox via the 11.22.33.44 server (you should change these values appropriately):

/system script add name=wait-on-battery source={
 /system ups monitor once do {
  :if ($on-battery) do {
   /system scheduler set ups-monitor script=wait-off-battery
   /tool e-mail send subject="on-battery" to="mail@company.com"
   from="router@company.com" server=11.22.33.44
  }
 }
}
/system script add name=wait-off-battery source={
 /system ups monitor once do {
  :if (!$on-battery) do {
   /system scheduler set ups-monitor script=wait-on-battery
  }
 }
}

And now the initial Scheduler task should be created. It will run every 5 seconds:

/system scheduler add name="ups-monitor" interval=5s
 script="wait-on-battery"

Powrót    
Copyright 2002-2005 by Advert all rights reserved.