Central data models of NAV’s event/alert subsystems

EventQueue

From NAV Wiki: The event queue. Additional data in eventqvar. Different subsystem (specified in source) post events on the event queue. Normally event engine is the target and will take the event off the event queue and process it. getDeviceData are in some cases the target.

Parameters
  • id (AutoField) – Id

  • source (ForeignKey to Subsystem) – Source

  • target (ForeignKey to Subsystem) – Target

  • device (ForeignKey to Device) – Device

  • netbox (ForeignKey to Netbox) – Netbox

  • subid (VarcharField) – Subid

  • time (DateTimeField) – Time

  • event_type (ForeignKey to EventType) – Event type

  • state (CharField) – State

  • value (IntegerField) – Value

  • severity (IntegerField) – Severity

Model field: device, accesses the Device model.

Model field: device

Model field: event type, accesses the EventType model.

Model field: event type

Autogenerated: Finds next instance based on time.

Autogenerated: Finds previous instance based on time.

Autogenerated: Shows the label of the state

Model field: id

Model field: netbox, accesses the Netbox model.

Model field: netbox

Save the current instance. Override this in a subclass if you want to control the saving process.

The ‘force_insert’ and ‘force_update’ parameters can be used to insist that the “save” must be an SQL insert or update (or equivalent for non-SQL backends), respectively. Normally, they should not be set.

Model field: severity

Model field: source, accesses the Subsystem model.

Model field: source

Model field: state

Model field: subid

Model field: target, accesses the Subsystem model.

Model field: target

Model field: time

Model field: value

Model field: event queue, accesses the M2M EventQueueVar model.

EventQueueVar

From NAV Wiki: Defines additional (key,value) tuples that follow events.

Parameters
  • id (AutoField) – Id

  • event_queue (ForeignKey to EventQueue) – Event queue

  • variable (VarcharField) – Variable

  • value (TextField) – Value

Model field: event queue, accesses the EventQueue model.

Model field: event queue

Model field: ID

Model field: value

Model field: variable

AlertQueue

From NAV Wiki: The alert queue. Additional data in alertqvar and alertmsg. Event engine posts alerts on the alert queue (and in addition on the alerthist table). Alert engine will process the data on the alert queue and send alerts to users based on their alert profiles. When all signed up users have received the alert, alert engine will delete the alert from alertq (but not from alert history).

Parameters
  • id (AutoField) – Id

  • source (ForeignKey to Subsystem) – Source

  • device (ForeignKey to Device) – Device

  • netbox (ForeignKey to Netbox) – Netbox

  • subid (VarcharField) – Subid

  • time (DateTimeField) – Time

  • event_type (ForeignKey to EventType) – Event type

  • alert_type (ForeignKey to AlertType) – Alert type

  • state (CharField) – State

  • value (IntegerField) – Value

  • severity (IntegerField) – Severity

  • history (ForeignKey to AlertHistory) – History

Model field: alert, accesses the M2M AccountAlertQueue model.

Model field: alert type, accesses the AlertType model.

Model field: alert type

Model field: device, accesses the Device model.

Model field: device

Model field: event type, accesses the EventType model.

Model field: event type

Autogenerated: Finds next instance based on time.

Autogenerated: Finds previous instance based on time.

Autogenerated: Shows the label of the state

Model field: history, accesses the AlertHistory model.

Model field: history

Model field: id

Model field: alert queue, accesses the M2M AlertQueueMessage model.

Model field: netbox, accesses the Netbox model.

Model field: netbox

Save the current instance. Override this in a subclass if you want to control the saving process.

The ‘force_insert’ and ‘force_update’ parameters can be used to insist that the “save” must be an SQL insert or update (or equivalent for non-SQL backends), respectively. Normally, they should not be set.

Model field: severity

Model field: source, accesses the Subsystem model.

Model field: source

Model field: state

Model field: subid

Model field: time

Model field: value

Model field: alert queue, accesses the M2M AlertQueueVariable model.

AlertQueueVariable

From NAV Wiki: Defines additional (key,value) tuples that follow alert. Note: the eventqvar tuples are passed along to the alertqvar table so that the variables may be used in alert profiles.

Parameters
  • id (AutoField) – Id

  • alert_queue (ForeignKey to AlertQueue) – Alert queue

  • variable (VarcharField) – Variable

  • value (TextField) – Value

Model field: alert queue, accesses the AlertQueue model.

Model field: alert queue

Model field: id

Model field: value

Model field: variable

AlertHistory

From NAV Wiki: The alert history. Simular to the alert queue with one important distinction; alert history stores stateful events as one row, with the start and end time of the event.

Parameters
  • id (AutoField) – Id

  • source (ForeignKey to Subsystem) – Source

  • device (ForeignKey to Device) – Device

  • netbox (ForeignKey to Netbox) – Netbox

  • subid (VarcharField) – Subid

  • start_time (DateTimeField) – Start time

  • end_time (DateTimeInfinityField) – End time

  • event_type (ForeignKey to EventType) – Event type

  • alert_type (ForeignKey to AlertType) – Alert type

  • value (IntegerField) – Value

  • severity (IntegerField) – Severity

Acknowledges this alert using a given account and comment.

Any pre-existing acknowledgement will be overwritten.

Model field: alert, accesses the Acknowledgement model.

Model field: alert type, accesses the AlertType model.

Model field: alert type

Model field: history, accesses the M2M AlertQueue model.

Model field: device, accesses the Device model.

Model field: device

Model field: end time

Model field: event type, accesses the EventType model.

Model field: event type

Returns the difference between start_time and end_time, the current downtime if the alert is still open, and None if the alert is stateless.

Autogenerated: Finds next instance based on start_time.

Autogenerated: Finds previous instance based on start_time.

Model field: id

Returns an Acknowledgement instance if this alert has been acknowledged, otherwise None.

Returns true if stateful and open.

Returns true if the alert is stateful.

Model field: alert history, accesses the M2M AlertHistoryMessage model.

Model field: netbox, accesses the Netbox model.

Model field: netbox

Save the current instance. Override this in a subclass if you want to control the saving process.

The ‘force_insert’ and ‘force_update’ parameters can be used to insist that the “save” must be an SQL insert or update (or equivalent for non-SQL backends), respectively. Normally, they should not be set.

Model field: severity

Model field: source, accesses the Subsystem model.

Model field: source

Model field: start time

Model field: subid

Model field: value

Model field: alert history, accesses the M2M AlertHistoryVariable model.

Descriptor for simplified dict-like access to the AlertHistory stateful variable map.

NOTE: Updating the dictionary will not save it, the attribute must be assigned a dict value for a db update to take place.

AlertHistoryVariable

From NAV Wiki: Defines additional (key,value) tuples that follow the alerthist record.

Parameters
  • id (AutoField) – Id

  • alert_history (ForeignKey to AlertHistory) – Alert history

  • state (CharField) – State

  • variable (VarcharField) – Variable

  • value (TextField) – Value

Model field: alert history, accesses the AlertHistory model.

Model field: alert history

Autogenerated: Shows the label of the state

Model field: id

Model field: state

Model field: value

Model field: variable

AlertHistoryMessage

From NAV Wiki: To have a history of the formatted messages too, they are stored in alerthistmsg.

Parameters
  • id (AutoField) – Id

  • alert_history (ForeignKey to AlertHistory) – Alert history

  • state (CharField) – State

  • type (VarcharField) – Type

  • language (VarcharField) – Language

  • message (TextField) – Message

Model field: alert history, accesses the AlertHistory model.

Model field: alert history

Autogenerated: Shows the label of the state

Model field: id

Model field: language

Model field: message

Model field: state

Model field: type

EventMixIn

MixIn for methods common to multiple event/alert/alerthistory models

Returns an identifying key for this event.

The key is a tuple of identity attribute values and can be used as a dictionary key to keep track of events that reference the same problem.

Returns the subject of a given event/alert.

Sometimes, the subject is just a Netbox objects. Other times, it may be some physical or logical subcomponents of a Netbox.

EventType

From NAV Wiki: Defines event types.

Parameters
  • id (CharField) – Id

  • description (VarcharField) – Description

  • stateful (CharField) – Stateful

Model field: event type, accesses the M2M AlertHistory model.

Model field: event type, accesses the M2M AlertQueue model.

Model field: event type, accesses the M2M AlertType model.

Model field: description

Model field: event type, accesses the M2M EventQueue model.

Autogenerated: Shows the label of the stateful

Model field: id

Model field: stateful

AlertType

From NAV Wiki: Defines the alert types. An event type may have many alert types.

Parameters
  • id (AutoField) – Id

  • event_type (ForeignKey to EventType) – Event type

  • name (VarcharField) – Name

  • description (VarcharField) – Description

Model field: alert type, accesses the M2M AlertHistory model.

Model field: alert type, accesses the M2M AlertQueue model.

Model field: description

Model field: event type, accesses the EventType model.

Model field: event type

Model field: id

Model field: name