Raritan EMX JSON-RPC API
Device Settings

SNMP Agent

The SNMP agent is configured using the devsettings.Snmp interface that can be found at the well-known URI /snmp. The configuration is retrieved with getSettings and written with setSettings.

Note
The SNMPv3 agent uses a user-based security model. User passphrases and privilege levels are configured with the user management interface.
# Python example: Set SNMPv2 write community and sysName
import raritan.rpc.devsettings
snmp_proxy = raritan.rpc.devsettings.Snmp("/snmp", agent)
cfg = snmp_proxy.getConfiguration()
cfg.v2enable = True
cfg.writeComm = "private"
cfg.sysName = "Rack 17A"
snmp_proxy.setConfiguration(cfg)

SNMP Notifications

Configuration SNMP traps and informs is not straight-forward because there is no dedicated interface for it. It is done by modifying pre-defined rules and actions of the event rules engine. See Event Rules and Actions for more details.

Notifications are enabled or disabled by setting the isEnabled flag in the rule with id SystemSnmpTrapRule. Notification types and destinations are configured with the arguments vector of the SystemSnmpTrapAction action. Action arguments are key-value pairs, with the following keys being supported:

# Python example: Enable SNMPv2 informs for all events
import raritan.rpc.event
event_engine = raritan.rpc.event.Engine("/event_engine", agent)
# Enable rule with ID 'SystemSnmpTrapRule'
event_engine.enableRule("SystemSnmpTrapRule")
# Configure notification type and destination in 'SystemSnmpTrapAction'
for action in event_engine.listActions():
if action.id == 'SystemSnmpTrapAction':
action.arguments = [
raritan.rpc.event.KeyValue("SnmpNotfType", "v2Inform"),
raritan.rpc.event.KeyValue("SnmpTrapDest1", "192.168.0.42:162:private"),
raritan.rpc.event.KeyValue("SnmpNotfTimeout", "3"),
raritan.rpc.event.KeyValue("SnmpNotfRetries", "5")
]
event_engine.modifyAction(action)

Date and Time

System time is configured with the datetime.DateTime interface at /datetime. The following settings can be configured:

# Python example: Set time zone and NTP servers
import raritan.rpc.datetime
datetime_proxy = raritan.rpc.datetime.DateTime("/datetime", agent)
cfg = datetime_proxy.getCfg()
# find time zone by name
for zone in datetime_proxy.getZoneInfos(False):
if zone.name.find("Taipei") >= 0:
cfg.zoneCfg.id = zone.id
cfg.zoneCfg.enableAutoDST = zone.hasDSTInfo
cfg.protocol = raritan.rpc.datetime.DateTime.Protocol.NTP
cfg.ntpCfg.forceStatic = True
cfg.ntpCfg.server1 = "0.pool.ntp.org"
datetime_proxy.setCfg(cfg)

SMTP Server

The SMTP server for mail notifications is configured using the devsettings.Smtp interface at /smtp.

# Python example: Configure SMTP server
import raritan.rpc.devsettings
cfg = raritan.rpc.devsettings.Smtp.Configuration(
host = "mail.company.example",
port = 25,
useTls = False,
allowOffTimeRangeCerts = False,
caCertChain = "",
sender = "pdu-notification@company.example",
useAuth = False,
username = "",
password = "",
retryCount = 5,
retryInterval = 3
)
smtp_proxy = raritan.rpc.devsettings.Smtp("/smtp", agent)
smtp_proxy.setConfiguration(cfg)