Upcoming Maintenance Alert:

The UBNT Community will be upgraded at 5pm MDT on April 25th. During this time the community forums will be set to read-only status.

Learn more

×
Reply
Highlighted
New Member
Posts: 1
Registered: ‎12-27-2014
Kudos: 1

How to create a ping watchdog to powercycle outlets on Internet outage, manual powercycle from cloud

There really isn't any new information in this post, I just compiled various bits and pieces from different threads and put it all in one spot. At the bottom I'll link to the threads I referenced, sorry if I forgot one.

 

The mFi controller cannot be used to perform a ping watchdog on an outlet. Additionally, if the controller is in the could you cannot use it powercycle a device that interrupts the Internet, even if the internet is still live.

 

However, you can use the pwdog method on the mPower device itself to perform those functions.

 

 

Features and tips on setup process, refer to linked threads for details:

  • power cycles outlet4 and outlet2 when pinging Google DNS fails for one minute (6 consecutive failures, 10 seconds apart)
  • turns outlets back on after one minute even if turned off manually/accidentally from the controller/app. (i.e. always on)
  • repeats power cycle once every 15-16 minutes while internet is offline.
  • works whether or not outlet is in a locked state
  • address the 'pwdog command is too long issue' by running the command in a switch
  • logs the date when power cyles occur
  1. ssh into the mPower device
  2. edit /tmp/system.cfg, change pwdog section to the following
    pwdog.command=/etc/persistent/bin/pwdogcmd.sh
    pwdog.delay=900
    pwdog.host=8.8.8.8
    pwdog.period=10
    pwdog.retry=6
    pwdog.status=enabled
  3. edit/create /etc/persistent/bin/pwdogcmd.sh
    date >>/tmp/pwlog
    echo 0 >/proc/power/lock4
    echo 0 >/proc/power/lock2
    echo 0 >/proc/power/output4
    echo 0 >/proc/power/output2
    sleep 10
    echo 1 >/proc/power/output4
    echo 1 >/proc/power/output2
    echo 1 >/proc/power/lock4
    echo 1 >/proc/power/lock2
    killall pwdog
  4. run the following commands
  5. chmod +x /etc/persistent/bin/pwdogcmd.sh
    save
    reboot

 

https://community.ubnt.com/t5/mFi/pwdog-command-line-length-limitation/m-p/1159529

https://community.ubnt.com/t5/mFi/Manual-Power-Cycle-reboot-of-mPower-Port-which-will-loose/td-p/101...

https://community.ubnt.com/t5/mFi/power-cycle-server-with-mpower-rule/td-p/675069

Reply