The pysros.ehs
module provides functionality obtain data from the
specific event that triggered the execution of a Python application from
the event handling system (EHS).
Note
This module is available when executing on SR OS only. On a remote machine, the event handling system (EHS) and its functionality are not supported.
- pysros.ehs.get_event()¶
The EHS event that triggered the execution of the Python application.
- Returns
The Event object or None.
- Return type
pysros.ehs.Event
orNone
- class pysros.ehs.Event¶
The EHS
pysros.ehs.Event
Class for the event that triggered the execution of the Python application.- name¶
The name of the event.
- Type
str
- appid¶
The name of the application that generated the event.
- Type
str
- eventid¶
The event ID number of the application.
- Type
int
- severity¶
The severity level of the event.
- Type
str
- sequence¶
The sequence number of the event in the syslog collector.
- Type
int
- Raises
ValueError – for negative values.
- subject¶
The subject or affected object of the event.
- Type
str
- router_name¶
The name of the SR OS router-instance (For example,
Base
) in which this event was triggered.- Type
str
- gentime¶
The time, in ISO 8601 format, that the event was generated.
- type
str
- timestamp¶
The timestamp, in seconds, that the event was generated.
- Type
float
- text¶
The event specific body, formatted as a string. By default, this is generated from the
eventparameters
.- Type
str
- eventparameters¶
The additional parameters specific to the event that caused the Python application to execute.
- format_msg()¶
Return a string representation of the SR OS formatted log message.
- Returns
SR OS formatted log message.
- Return type
str
- class EventParams¶
The additional parameters of the specific
pysros.ehs.Event
. This class is read-only. Specific additional parameters may be accessed using standard Python subscript syntax.- keys()¶
Obtain the additional parameters names.
- Returns
Additional parameters names for the Event.
- Return type
tuple(str)
- params[key]
Return the value of the parameter key. If the parameter does not exist, a
KeyError
is raised.