Legrand / Raritan / Server Technology Xerus™ JSON-RPC API

Loading...
Searching...
No Matches
Server Reachability Monitoring

The server reachability monitor is configured via the servermon.ServerMonitor interface at the well-known URI `/servermon`. Monitored servers are managed with the addServer, modifyServer and deleteServer methods and retrieved with listServers and getServers.

# Python example: Monitor a new server
import raritan.rpc.servermon
server = raritan.rpc.servermon.ServerMonitor.ServerSettings(
host = "8.8.8.8",
enabled = True,
pingInterval = 60, # seconds
retryInterval = 5, # seconds
activationCount = 15,
failureCount = 5,
resumeDelay = 180, # seconds
resumeCount = 5
)
server_monitor = raritan.rpc.servermon.ServerMonitor("/servermon", agent)
server_monitor.addServer(server)

# Reacting to Server Status Changes

Server status changes raise events that can be used to trigger event rules. See eventengine for details. The second component in the event ID is the server's host name in the exact notation of the server settings. For example, an event rule for the server in the example above would select event IDs like `[ "Server", "8.8.8.8", "Unreachable" ]`. It is possible to use the wildcard `*` as host name to select events for all monitored servers.

The following events are emitted for monitored servers.

- `Server.<host>.Monitored`: State event. Asserted when a new server is monitored, deasserted when deleting or disabling the server entry.
- `Server.<host>.Error`: Trigger event. Sent once when there is an error monitoring a server, e.g. when the host name coult not be resolved.
- `Server.<host>.Unreachable`: State event. Asserted when a formerly reachable server becomes unreachable. Repeatedly asserted if the server is still unreachable after resuming. Deasserted when a server becomes reachable.
- `Server.<host>.Unrecoverable`: Trigger event. Sent once when a server is still unreachable after resuming resumeCount times. No further events will be raised until the server becomes reachable.