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:

Relationship fields:

Parameters:

Reverse relationships:

Parameters:

variables (Reverse ForeignKey from EventQueueVar) – All variables of this event queue (related name of event_queue)

Type: ForeignKey to Device

Device (related name: events)

Internal field, use device instead.

Type: ForeignKey to EventType

Event type (related name: events)

Internal field, use event_type instead.

Finds next instance based on time. See get_next_by_FOO() for more information.

Finds previous instance based on time. See get_previous_by_FOO() for more information.

Shows the label of the state. See get_FOO_display() for more information.

Type: AutoField

Primary key: Id

Type: ForeignKey to Netbox

Netbox (related name: events)

Internal field, use netbox instead.

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.

Type: IntegerField

Severity

Type: ForeignKey to Subsystem

Source (related name: source_of_events)

Internal field, use source instead.

Type: CharField

State

Choices:

  • x

  • s

  • e

Type: VarcharField

Subid

Type: ForeignKey to Subsystem

Target (related name: target_of_events)

Internal field, use target instead.

Type: DateTimeField

Time

Type: IntegerField

Value

Type: Reverse ForeignKey from EventQueueVar

All variables of this event queue (related name of event_queue)

EventQueueVar

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

Parameters:
  • id (AutoField) – Primary key: ID

  • variable (VarcharField) – Variable

  • value (TextField) – Value

Relationship fields:

Parameters:

event_queue (ForeignKey to EventQueue) – Event queue (related name: variables)

Type: ForeignKey to EventQueue

Event queue (related name: variables)

Internal field, use event_queue instead.

Type: AutoField

Primary key: ID

Type: TextField

Value

Type: VarcharField

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:

Relationship fields:

Parameters:

Reverse relationships:

Parameters:
  • messages (Reverse ForeignKey from AlertQueueMessage) – All messages of this alert queue (related name of alert_queue)

  • variables (Reverse ForeignKey from AlertQueueVariable) – All variables of this alert queue (related name of alert_queue)

  • queued_alerts (Reverse ForeignKey from AccountAlertQueue) – All queued alerts of this alert queue (related name of alert)

Type: ForeignKey to AlertType

Alert type (related name: alerts)

Internal field, use alert_type instead.

Type: ForeignKey to Device

Device (related name: alerts)

Internal field, use device instead.

Type: ForeignKey to EventType

Event type (related name: alerts)

Internal field, use event_type instead.

Finds next instance based on time. See get_next_by_FOO() for more information.

Finds previous instance based on time. See get_previous_by_FOO() for more information.

Shows the label of the state. See get_FOO_display() for more information.

Type: ForeignKey to AlertHistory

History (related name: alerts)

Internal field, use history instead.

Type: AutoField

Primary key: Id

Type: Reverse ForeignKey from AlertQueueMessage

All messages of this alert queue (related name of alert_queue)

Type: ForeignKey to Netbox

Netbox (related name: alerts)

Internal field, use netbox instead.

Type: Reverse ForeignKey from AccountAlertQueue

All queued alerts of this alert queue (related name of alert)

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.

Type: IntegerField

Severity

Type: ForeignKey to Subsystem

Source (related name: alerts)

Internal field, use source instead.

Type: CharField

State

Choices:

  • x

  • s

  • e

Type: VarcharField

Subid

Type: DateTimeField

Time

Type: IntegerField

Value

Type: Reverse ForeignKey from AlertQueueVariable

All variables of this alert queue (related name of alert_queue)

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) – Primary key: Id

  • variable (VarcharField) – Variable

  • value (TextField) – Value

Relationship fields:

Parameters:

alert_queue (ForeignKey to AlertQueue) – Alert queue (related name: variables)

Type: ForeignKey to AlertQueue

Alert queue (related name: variables)

Internal field, use alert_queue instead.

Type: AutoField

Primary key: Id

Type: TextField

Value

Type: VarcharField

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:

Relationship fields:

Parameters:

Reverse relationships:

Parameters:

Acknowledges this alert using a given account and comment.

Any pre-existing acknowledgement will be overwritten.

Type: Reverse OneToOneField from Acknowledgement

The acknowledgement of this alert history (related name of alert)

Type: ForeignKey to AlertType

Alert type (related name: alert_history_set)

Internal field, use alert_type instead.

Type: Reverse ForeignKey from AlertQueue

All alerts of this alert history (related name of history)

Type: ForeignKey to Device

Device (related name: alert_history_set)

Internal field, use device instead.

Type: DateTimeInfinityField

End time

Type: ForeignKey to EventType

Event type (related name: alert_history_set)

Internal field, use event_type instead.

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.

Finds next instance based on start_time. See get_next_by_FOO() for more information.

Finds previous instance based on start_time. See get_previous_by_FOO() for more information.

Type: AutoField

Primary key: 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.

Type: Reverse ForeignKey from AlertHistoryMessage

All messages of this alert history (related name of alert_history)

Type: ForeignKey to Netbox

Netbox (related name: alert_history_set)

Internal field, use netbox instead.

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.

Type: IntegerField

Severity

Type: ForeignKey to Subsystem

Source (related name: alert_history_set)

Internal field, use source instead.

Type: DateTimeField

Start time

Type: VarcharField

Subid

Type: IntegerField

Value

Type: Reverse ForeignKey from AlertHistoryVariable

All variables of this alert history (related name of alert_history)

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:

Relationship fields:

Parameters:

alert_history (ForeignKey to AlertHistory) – Alert history (related name: variables)

Type: ForeignKey to AlertHistory

Alert history (related name: variables)

Internal field, use alert_history instead.

Shows the label of the state. See get_FOO_display() for more information.

Type: AutoField

Primary key: Id

Type: CharField

State

Choices:

  • x

  • s

  • e

Type: TextField

Value

Type: VarcharField

Variable

AlertHistoryMessage

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

Parameters:
  • id (AutoField) – Primary key: Id

  • state (CharField) – State

  • type (VarcharField) – Type

  • language (VarcharField) – Language

  • message (TextField) – Message

Relationship fields:

Parameters:

alert_history (ForeignKey to AlertHistory) – Alert history (related name: messages)

Type: ForeignKey to AlertHistory

Alert history (related name: messages)

Internal field, use alert_history instead.

Shows the label of the state. See get_FOO_display() for more information.

Type: AutoField

Primary key: Id

Type: VarcharField

Language

Type: TextField

Message

Type: CharField

State

Choices:

  • x

  • s

  • e

Type: VarcharField

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) – Primary key: Id

  • description (VarcharField) – Description

  • stateful (CharField) – Stateful

Reverse relationships:

Parameters:

Type: Reverse ForeignKey from AlertHistory

All alert history set of this event type (related name of event_type)

Type: Reverse ForeignKey from AlertType

All alert types of this event type (related name of event_type)

Type: Reverse ForeignKey from AlertQueue

All alerts of this event type (related name of event_type)

Type: VarcharField

Description

Type: Reverse ForeignKey from EventQueue

All events of this event type (related name of event_type)

Shows the label of the stateful. See get_FOO_display() for more information.

Type: CharField

Primary key: Id

Type: CharField

Stateful

Choices:

  • y

  • n

AlertType

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

Parameters:
  • id (AutoField) – Primary key: Id

  • name (VarcharField) – Name

  • description (VarcharField) – Description

Relationship fields:

Parameters:

event_type (ForeignKey to EventType) – Event type (related name: alert_types)

Reverse relationships:

Parameters:

Type: Reverse ForeignKey from AlertHistory

All alert history set of this alert type (related name of alert_type)

Type: Reverse ForeignKey from AlertQueue

All alerts of this alert type (related name of alert_type)

Type: VarcharField

Description

Type: ForeignKey to EventType

Event type (related name: alert_types)

Internal field, use event_type instead.

Type: AutoField

Primary key: Id

Type: VarcharField

Name