AN61 Application Note describes how to configure PING Watchdog function in the NETIO devices. Part 1 shows simple example with periodical pinging to 1 IP address only and restarting device connected to Output 1. Part 2 shows extended option with ping to 2 various IP addreses and restart of device Output 1 when both IPs do not reply (= local connectivity failure).

Do you have any questions?

AN61 supported devices

Note: Firmware version 3.2.0 or higher is required

 

NETIO Condition & Rules

NETIO devices use a system of "Condition" & "Rules" which have to be configured separately. To configure even simple IP WatchDog you have to configure 2 tabs:

  • IP Watchdog (with which IP address will be monitored)
  • Rules (what to do if defined state happens)

This configuration system is somehow similar to NETIO Lua scripting, but you don't have to be a programmer.
Detailed description and examples on the NETIO Wiki - Local device scripting.


IP WatchDog (Condition)

The IP WatchDog is used to monitor connectivity to specified IP address (or text defined URL). NETIO devices sending periodically PING request to specified IP and then waiting for PING reply.

It's popular to verify internet connectivity (pinging LAN gateway / router). Second typical usage of IP WatchDog is to check functionality / failure any LAN connected device. No PING answer = device not working and let's restart it by power output. 
AN61 has 2 parts: :

  • Part 1: One IP address - Restart output when IP device not reply to PING requests (device failure).
  • Part 2: Two IP addresses - Restart output when both IPs do not reply at the same time (IP connectivity / router failure).

 

 

 

 

The Rule

The Rule functionality generally define <strong>NETIO device's reaction</strong> to specific situation / event (condition).

Based on the conditions the NETIO device can process these actions:

  • ACTION on defined OUTPUT
    • 0 = TURN OFF
    • 1 = TURN ON
    • 2 = SHORT OFF
    • 3 = SHORT ON
    • 4 = TOGGLE - Changes the status from ON to OFF and vice versa
       
  • Send alarm to NETIO Cloud service (icloud service can inform account user by email for example)

 

Part1: WatchDog (ping) to 1 IP address

NETIO device is sending ping every 60s and waits 5s for the respond. If the ping fails, Watchdog returns  false and Rule will react with restaring (ACTION: 2 = SHORT OFF) on the Output 1. After restart, it waits 120 seconds and starts pinging again. If the device powered from Output 1 does not respond, WatchDog remains in ERROR state until next first successful ping.

 

a) Watchdog tab configuration

1. Navigate to the device's web administration -> Watchdogs section
If this section is not available, ensure you have the latest Firmware version installed

2. Create new WatchDogs definition with name: NR01_WDT (you can skip this and following step if already available by default)

3. Insert following configuration code and change target to monitored IP address or URL: (also be sure to have the device on that IP connected)

{
  "target": "192.168.101.180",
  "pingInterval": 60,
  "timeout": 5,
  "maxTimeouts": 0,
  "timeToReboot": 120,
  "maxRestarts": -1
}

4. Enable WatchDog and Save Changes

Variables description:

Variable Value Description
target IP / URL Monitored address
pingInterval int [s] Time interval between pings
timeout int [s] Time waiting for answer
maxTimeouts int Number of failed pings required to evaluate to FAIL=TRUE
timeToReboot int [s] Time the Watchdog waits after announcing an error condition before starting a new cycle
maxRestarts int Maximum number of restarts when an error condition is declared. After this limit is reached, the Watchdog remains in an FAIL=TRUE state until the next successful ping.

If set to 0, WatchDog will restart after each FAIL=TRUE is declared (This can cause indefinite restarts when the ping remains usuccessful).
If set to -1, WatchDog will NOT restart itself again. E.g. it remains in FAIL=TRUE state after it is declared.

Web administration window:

 

b) Rule tab configuration

1. Create new Rules definition with name: NR01_RULE (you can skip this and following step if already available by default)

2. Insert following configuration code:

{
  "conditions": {
    "WDT/NR01_WDT/FAIL": true
  },
  "actions": {
    "OUTPUTS/1/ACTION": 2
  }
}

3. Enable Rule and Save Changes

Variables description:

Variable Value Description
conditions Eg: `"PAB/PAB1_1/IN": true` Conditions definition. Relationship between conditions is defined by operator (AND/OR)
operator AND/OR Optional. Specifies relationship between conditions. AND = all conditions must apply at the same time. OR = at least one condition must apply. If missing, defaults to OR
filters Eg: "SCHEDULE/MY_SCHEDULE/ACTIVE": true Filter definition. For multiple filter conditions, the relationship between them is always AND
actions Eg: "CLOUD/OUTPUT/1/ALARM": "${COND_RESULT}" Actions definition. All actions defined here will be triggered when conditions (and filters) are met
 

Web administration window:

 

c) Event activation

1. Check the device log. It should NOT contain any logs regarding Rules or WatchDog

2. Disconnect device at target IP (remove ethernet cable, disable wifi or disconnect from power)

3. Wait. Output 1 should trigger in the next 65 seconds. In the device log you will see entries similar to image below.

4. In case the device have NOT produced expected results, see the device log for hints

 

Note: Part 1 examples are named WatchDog configuration NR01_WDT and Rule configuration NR01_RULE. These names are related to NRxx NETIO Rules - examples in NETIO Wiki.

 

Part 2: IP WatchDog for 2 IPs

NETIO Device can also pinging in paralel to 2 different IP addresses / URLs (2 different Conditions) and trigger one Rule (Action) only when both IPs do not reply for defined time. Typical usecase of this is restarting of local Internet connectivity router.

In Part 2 NETIO device pinging in 2 parallel WatchDog tabs (NR06_WDT_1 / NR06_WDT_2) to 2 different IPs and one Rule (NR06_RULE) restarting Output 1 device if none of the IP addresses reply. The ping for both IPs is sent every 30s and waits 5s for device to respond. There are 5 consecutive timeouts tolerated before the ping is considered as failed. When the ping fails, Watchdog returns false and remains in ERROR state.

In case both of the defined WatchDogs are in ERROR state, the Rule is triggered which then restarts Output 1.


Part 2 is similar to monitoring 1 IP address, there are just 2 differences:

  • 2 separate WatchDogs tabs are user in paralel (instead of one)
  • Rule definition have to restart output only when both Watchdogs fail (do not receive ping answer).

 

a) WatchDog 1 configuration

WatchDog name: NR06_WDT_1

Code definition:

{
  "target": "192.168.1.51",
  "pingInterval": 30,
  "timeout": 5,
  "maxTimeouts": 5,
  "maxRestarts": 0
}


WatchDog 1 configuration in NETIO device web for AN61-Part2:

 

b) WatchDog 2 configuration

WatchDog name: NR06_WDT_2

Code definition:

{
  "target": "192.168.1.52",
  "pingInterval": 60,
  "timeout": 5,
  "maxTimeouts": 5,
  "maxRestarts": 0
}

 

WatchDog 2 configuration in NETIO device web for AN61-Part2:

 

c) Rule configuration

Rule name: NR06_RULE

Code definition:

{
  "conditions": {
    "operator": "AND"
    "WDT/NR06_WDT_1/FAIL": true
    "WDT/NR06_WDT_2/FAIL": true
  },
  "actions": {
    "OUTPUTS/1/ACTION": 2
  }
}

 

Rule configuration in NETIO device web for AN61-Part2:

 

d) Event activation

To trigger Rule action, you now need to disconnect both of the IP devices.

 

Note: Part 2 examples are named WatchDog configuration NR06_WDT_1 & NR06_WDT_2 (Checking 2 IP adresses) and Rule configuration NR06_RULE. These names are related to NRxx NETIO Rules - examples in NETIO Wiki.

 

FAQ

1) Can I react based on other conditions than PING requests?

Yes, but not in WatchDog part. In the PAB you can set-up complex conditions based on power measured attributes (Load, Current etc.), state of Digital Inputs (DI) or other Outputs current state.
For examples of different settings, please see our NETIO Wiki - "Local device scripting".

 

2) Can I send email(s) based on PING failure or reseting the device?

Yes, it is possible to do with help of NETIO Cloud service. Sending email alerts is available only for device output with activated NETIO Cloud Premium extension.

 

3) Can I have IP WatchDog (PING) and Scheduler function enabled at the same time on the same Output?

Yes, these functionalities can be enabled at the same time and they work independently.

 

4) What is the difference between IP Watchdog in AN61 and AN09?

  • AN09 describe WatchDog functionality based on Lua. Lua is supported by NETIO PowerPDU 4C only (and NETIO 4 obsolete devices).
  • AN61 can be applied for all other NETIO devices (Winter 2022). You don't need to know Lua programming language.


6) Can I manage AN61 based WatchDog from NETIO Mobile 2 app (NETIO Cloud)?

From the Mobile App you can switch On/Off the output., but not managed or enable/disable Rules & Conditions.
Watchdog, PABs & Rules can be managed from the NETIO device Web administration UI only.
 

Ask for a price or technical parameters

For device testing use name/password demo/demo