Package Products :: Package Zuul :: Package routers :: Module zep :: Class EventsRouter
[hide private]
[frames] | no frames]

Class EventsRouter

source code

ZenUtils.Ext.DirectRouter --+
                            |
                           EventsRouter

A JSON/ExtDirect interface to operations on events in ZEP

Instance Methods [hide private]
 
__init__(self, context, request) source code
 
_canViewEvents(self)
To view any events you either have to have administered roles or be a global roled user
source code
 
_timeRange(self, value) source code
 
_filterInvalidUuids(self, events)
When querying archived events we need to make sure that we do not link to devices and components that are no longer valid
source code
 
queryArchive(self, page=None, limit=0, start=0, sort='lastTime', dir='desc', params=None, exclusion_filter=None, keys=None, uid=None, detailFormat=False) source code
dictionary
query(self, limit=0, start=0, sort='lastTime', dir='desc', params=None, exclusion_filter=None, keys=None, page=None, archive=False, uid=None, detailFormat=False)
Query for events.
source code
generator
queryGenerator(self, sort='lastTime', dir='desc', evids=None, excludeIds=None, params=None, archive=False, uid=None, detailFormat=False)
Query for events.
source code
 
_buildSort(self, sort='lastTime', dir='desc') source code
 
_buildFilter(self, uids, params, specificEventUuids=None, includeContextInUid=True)
Construct a dictionary that can be converted into an EventFilter protobuf.
source code
DirectResponse
detail(self, evid)
Get event details.
source code
 
_hasPermissionsForAllEvents(self, permission, evids) source code
 
manage_events(self, evids=None, excludeIds=None, params=None, uid=None, asof=None, limit=None, timeout=None) source code
 
write_event_logs(self, evid=None, message=None) source code
DirectResponse
write_log(self, evid=None, message=None)
Write a message to an event's log.
source code
 
postNote(self, uuid, note) source code
 
_buildRequestFilters(self, uid, params, evids, excludeIds)
Given common request parameters, build the inclusive and exclusive filters for event update requests.
source code
 
nextEventSummaryUpdate(self, next_request)
When performing updates from the event console, updates are performed in batches to allow the user to see the progress of event changes and cancel out of updates while they are in progress.
source code
 
clear_device_heartbeats(self, params, limit=None) source code
DirectResponse
close(self, evids=None, excludeIds=None, params=None, uid=None, asof=None, limit=None, timeout=None)
Close event(s).
source code
DirectResponse
acknowledge(self, evids=None, excludeIds=None, params=None, uid=None, asof=None, limit=None, timeout=None)
Acknowledge event(s).
source code
 
unacknowledge(self, *args, **kwargs)
Deprecated, Use reopen
source code
DirectResponse
reopen(self, evids=None, excludeIds=None, params=None, uid=None, asof=None, limit=None, timeout=None)
Reopen event(s).
source code
 
updateEventSummaries(self, update, event_filter=None, exclusion_filter=None, limit=None, timeout=None) source code
DirectResponse

For other parameters please see class Event.

add_event(self, summary, device, component, severity, evclasskey, evclass=None, monitor=None, **kwargs)
Create a new event.
source code
 
configSchema(self) source code
 
_mergeSchemaAndZepConfig(self, data, configSchema)
Copy the values and defaults from ZEP to our schema
source code
 
getConfig(self) source code
 
setConfigValues(self, values) source code
[dictionary]
column_config(self, uid=None, archive=False)
Get the current event console field column configuration.
source code
DirectResponse
classify(self, evrows, evclass)
Associate event(s) with an event class.
source code
DirectResponse
clear_heartbeats(self)
Clear all heartbeat events
source code
DirectResponse
clear_heartbeat(self, monitor, daemon)
Clears a specific heartbeat event.
source code
 
updateDetails(self, evid, **detailInfo)
On success, returns the status.
source code
Method Details [hide private]

queryArchive(self, page=None, limit=0, start=0, sort='lastTime', dir='desc', params=None, exclusion_filter=None, keys=None, uid=None, detailFormat=False)

source code 
Decorators:
  • @serviceConnectionError
  • @require('ZenCommon')

query(self, limit=0, start=0, sort='lastTime', dir='desc', params=None, exclusion_filter=None, keys=None, page=None, archive=False, uid=None, detailFormat=False)

source code 

Query for events.

Parameters:
  • limit (integer) - (optional) Max index of events to retrieve (default: 0)
  • start (integer) - (optional) Min index of events to retrieve (default: 0)
  • sort (string) - (optional) Key on which to sort the return results (default: 'lastTime')
  • dir (string) - (optional) Sort order; can be either 'ASC' or 'DESC' (default: 'DESC')
  • params (dictionary) - (optional) Key-value pair of filters for this search. (default: None)
  • history (boolean) - (optional) True to search the event history table instead of active events (default: False)
  • uid (string) - (optional) Context for the query (default: None)
Returns: dictionary
Properties:
  • events: ([dictionary]) List of objects representing events
  • totalCount: (integer) Total count of events returned
  • asof: (float) Current time
Decorators:
  • @serviceConnectionError
  • @require('ZenCommon')

queryGenerator(self, sort='lastTime', dir='desc', evids=None, excludeIds=None, params=None, archive=False, uid=None, detailFormat=False)

source code 

Query for events.

Parameters:
  • sort (string) - (optional) Key on which to sort the return results (default: 'lastTime')
  • dir (string) - (optional) Sort order; can be either 'ASC' or 'DESC' (default: 'DESC')
  • params (dictionary) - (optional) Key-value pair of filters for this search. (default: None)
  • archive (boolean) - (optional) True to search the event archive instead of active events (default: False)
  • uid (string) - (optional) Context for the query (default: None)
Returns: generator
Generator returning events.
Decorators:
  • @serviceConnectionError
  • @require('ZenCommon')

_buildFilter(self, uids, params, specificEventUuids=None, includeContextInUid=True)

source code 

Construct a dictionary that can be converted into an EventFilter protobuf.

Parameters:
  • params (dictionary) - (optional) Key-value pair of filters for this search. (default: None)
  • uids (iterable(string)) - (optional) Contexts for the query (default: None)

detail(self, evid)

source code 

Get event details.

Parameters:
  • evid (string) - Event ID to get details
  • history (boolean) - Deprecated
Returns: DirectResponse
Properties:
  • event: ([dictionary]) List containing a dictionary representing event details

write_log(self, evid=None, message=None)

source code 

Write a message to an event's log.

Parameters:
  • evid (string) - Event ID to log to
  • message (string) - Message to log
Returns: DirectResponse
Success message
Decorators:
  • @require(write_event_logs)

postNote(self, uuid, note)

source code 
Decorators:
  • @require(ZEN_MANAGE_EVENTS)

nextEventSummaryUpdate(self, next_request)

source code 

When performing updates from the event console, updates are performed in batches to allow the user to see the progress of event changes and cancel out of updates while they are in progress. This works by specifying a limit to one of the close, acknowledge, or reopen calls in this router. The response will contain an EventSummaryUpdateResponse, and if there are additional updates to be performed, it will contain a next_request field with all of the parameters used to update the next range of events.

Parameters:
  • next_request (dictionary) - The next_request field from the previous updates.
Decorators:
  • @require(ZEN_MANAGE_EVENTS)

clear_device_heartbeats(self, params, limit=None)

source code 
Parameters:
  • params (dictionary) - Key-value pair of filters for this search.
Decorators:
  • @require(ZEN_MANAGE_EVENTS)

close(self, evids=None, excludeIds=None, params=None, uid=None, asof=None, limit=None, timeout=None)

source code 

Close event(s).

Parameters:
  • evids ([string]) - (optional) List of event IDs to close (default: None)
  • excludeIds ([string]) - (optional) List of event IDs to exclude from close (default: None)
  • params (dictionary) - (optional) Key-value pair of filters for this search. (default: None)
  • uid (string) - (optional) Context for the query (default: None)
  • asof (float) - (optional) Only close if there has been no state change since this time (default: None)
  • limit (The maximum number of events to update in this batch.) - (optional) Maximum number of events to update (default: None).
  • timeout (int) - The time (in seconds) before the underlying saved search times out.
Returns: DirectResponse
Success message
Decorators:
  • @require(manage_events)

acknowledge(self, evids=None, excludeIds=None, params=None, uid=None, asof=None, limit=None, timeout=None)

source code 

Acknowledge event(s).

Parameters:
  • evids ([string]) - (optional) List of event IDs to acknowledge (default: None)
  • excludeIds ([string]) - (optional) List of event IDs to exclude from acknowledgment (default: None)
  • params (dictionary) - (optional) Key-value pair of filters for this search. (default: None)
  • uid (string) - (optional) Context for the query (default: None)
  • asof (float) - (optional) Only acknowledge if there has been no state change since this time (default: None)
  • limit (The maximum number of events to update in this batch.) - (optional) Maximum number of events to update (default: None).
  • timeout (int) - The time (in seconds) before the underlying saved search times out.
Returns: DirectResponse
Success message
Decorators:
  • @require(manage_events)

unacknowledge(self, *args, **kwargs)

source code 

Deprecated, Use reopen

Decorators:
  • @require(manage_events)
  • @deprecated

reopen(self, evids=None, excludeIds=None, params=None, uid=None, asof=None, limit=None, timeout=None)

source code 

Reopen event(s).

Parameters:
  • evids ([string]) - (optional) List of event IDs to reopen (default: None)
  • excludeIds ([string]) - (optional) List of event IDs to exclude from reopen (default: None)
  • params (dictionary) - (optional) Key-value pair of filters for this search. (default: None)
  • uid (string) - (optional) Context for the query (default: None)
  • asof (float) - (optional) Only reopen if there has been no state change since this time (default: None)
  • limit (The maximum number of events to update in this batch.) - (optional) Maximum number of events to update (Default: None).
  • timeout (int) - The time (in seconds) before the underlying saved search times out.
Returns: DirectResponse
Success message
Decorators:
  • @require(manage_events)

updateEventSummaries(self, update, event_filter=None, exclusion_filter=None, limit=None, timeout=None)

source code 
Decorators:
  • @require(ZEN_MANAGE_EVENTS)

add_event(self, summary, device, component, severity, evclasskey, evclass=None, monitor=None, **kwargs)

source code 

Create a new event.

Parameters:
  • summary (string) - New event's summary
  • device (string) - Device id to use for new event
  • component (string) - Component uid to use for new event
  • severity (string) - Severity of new event. Can be one of the following: Critical, Error, Warning, Info, Debug, or Clear
  • evclasskey (string) - The Event Class Key to assign to this event
  • evclass (string) - Event class for the new event
Returns: DirectResponse

For other parameters please see class Event.

Decorators:
  • @require(ZEN_MANAGE_EVENTS)

configSchema(self)

source code 
Decorators:
  • @property

getConfig(self)

source code 
Decorators:
  • @require('ZenCommon')

setConfigValues(self, values)

source code 
Parameters:
  • values (Dictionary) - Key Value pairs of config values
Decorators:
  • @require('Manage DMD')

column_config(self, uid=None, archive=False)

source code 

Get the current event console field column configuration.

Parameters:
  • uid (string) - (optional) UID context to use (default: None)
  • archive (boolean) - (optional) True to use the event archive instead of active events (default: False)
Returns: [dictionary]
A list of objects representing field columns

classify(self, evrows, evclass)

source code 

Associate event(s) with an event class.

Parameters:
  • evrows ([dictionary]) - List of event rows to classify
  • evclass (string) - Event class to associate events to
Returns: DirectResponse
Properties:
  • msg: (string) Success/failure message
  • success: (boolean) True if class update successful
Decorators:
  • @require(ZEN_MANAGE_EVENTS)

clear_heartbeats(self)

source code 

Clear all heartbeat events

Returns: DirectResponse
Properties:
  • success: (boolean) True if heartbeats deleted successfully
Decorators:
  • @require(ZEN_MANAGE_EVENTS)

clear_heartbeat(self, monitor, daemon)

source code 

Clears a specific heartbeat event.

Parameters:
  • monitor (basestring) - The heartbeat monitor (i.e. 'localhost').
  • daemon (basestring) - The heartbeat daemon (i.e. 'zenhub').
Returns: DirectResponse
A DirectResponse indicating success or failure.
Decorators:
  • @require(ZEN_MANAGE_EVENTS)

updateDetails(self, evid, **detailInfo)

source code 

On success, returns the status.

Decorators:
  • @require(ZEN_MANAGE_EVENTS)