Skip to content
sqall01 edited this page Jun 1, 2022 · 43 revisions

Database Layout

(For version 0.900-0)

Table of Contents

Database Layout - AlertR Server

Database Layout - AlertR Manger Client Database

Database Layout - AlertR Server

In the following the database layout of the AlertR server is described.

Internals

Used for internal settings/options/values that should not be changed from the outside.

table: internals

  • type (primary key)
  • value

Options

Used for options of the AlertR system.

table options

  • type (primary key)
  • value

Nodes

Used for each client that connects to the server.

table nodes

  • id (primary key)
  • hostname (hostname of the client)
  • username (username used by the client; is also the unique identifier of the client)
  • nodeType (sensor, alert, manager)
  • instance (i.e., alertClientDbus or sensorClientFIFO)
  • connected (0 = no, 1 = yes)
  • version
  • rev
  • persistent (0 = no, 1 = yes)

Sensors

Used for each sensor watched by a client.

table sensors

  • id (primary key)
  • nodeId (id to the entry in the nodes table)
  • clientSensorId (id used by the client for this sensor)
  • description
  • state (0 = normal, 1 = triggered)
  • alertDelay
  • dataType (gives the type of data the sensor holds and consequentially where to find it: 0 = none, 1 = int, 2 = float)
  • error_state
  • error_msg

SensorsAlertLevels

Used for the registered alert levels (you can think of an alert level as a group) for sensors.

table sensorsAlertLevels

  • sensorId (id to the entry in the sensors table, primary key)
  • alertLevel (primary key)

SensorsDataInt

Used to store the integer data of the corresponding sensor.

table sensorsDataInt

  • sensorId (id to the entry in the sensors table, primary key)
  • value
  • unit

SensorsDataFloat

Used to store the floating point data of the corresponding sensor.

table sensorsDataFloat

  • sensorId (id to the entry in the sensors table, primary key)
  • value
  • unit

SensorsDataGPS

Used to store the GPS data of the corresponding sensor.

table sensorsDataGPS

  • sensorId (id to the entry in the sensors table, primary key)
  • lat
  • lon
  • utctime

Alerts

Used for each alert that is managed by a client. It has to be notified by the server when a sensor alert has triggered.

table alerts

  • id (primary key)
  • nodeId (id to the entry in the nodes table)
  • clientAlertId (id used by the client for this alert)
  • description

AlertsAlertLevels

Used for the registered alert levels (you can think of an alert level as a group) for registered alerts.

table alertsAlertLevels

  • alertId (id to the entry in the alerts table, primary key)
  • alertLevel (primary key)

Managers

Used for all registered manager clients.

table managers

  • id (primary key)
  • nodeId (id to the entry in the nodes table)
  • description

Database Layout - AlertR Manger Client Database

In the following the database layout of the AlertR Manger Client Database is described.

Internals

Used for internal settings/options/values that should not be changed from the outside.

table: internals

  • id (primary key)
  • type
  • value

Options

Used for options of the AlertR system.

table options

  • id (primary key)
  • type
  • value

Profiles

Used for profiles of the AlertR system.

table profiles

  • id (primary key)
  • name

Nodes

Used for each client that connects to the server.

table nodes

  • id (primary key)
  • hostname (hostname of the client)
  • nodeType (sensor, alert, manager)
  • instance (i.e., alertClientDbus or sensorClientFIFO)
  • connected (0 = no, 1 = yes)
  • version
  • rev
  • newestVersion (the newest version that is available in the configured repository)
  • newestRev (the newest revision that is available in the configured repository)
  • username (username used by the client; is also the unique identifier of the client)
  • persistent (0 = no, 1 = yes)

Sensors

Used for each sensor watched by a client.

table sensors

  • id (primary key)
  • nodeId (id to the entry in the nodes table)
  • clientSensorId (id used by the client for this sensor)
  • description
  • state (0 = normal, 1 = triggered)
  • alertDelay
  • dataType (gives the type of data the sensor holds and consequentially where to find it: 0 = none, 1 = int, 2 = float)
  • error_state
  • error_msg

SensorsAlertLevels

Used for the registered alert levels (you can think of an alert level as a group) for sensors.

table sensorsAlertLevels

  • sensorId (id to the entry in the sensors table, primary key)
  • alertLevel (primary key)

SensorsDataInt

Used to store the integer data of the corresponding sensor.

table sensorsDataInt

  • sensorId (id to the entry in the sensors table, unique, primary key)
  • value
  • unit

SensorsDataFloat

Used to store the floating point data of the corresponding sensor.

table sensorsDataFloat

  • sensorId (id to the entry in the sensors table, unique, primary key)
  • value
  • unit

SensorsDataGPS

Used to store the GPS data of the corresponding sensor.

table sensorsDataGPS

  • sensorId (id to the entry in the sensors table, unique, primary key)
  • lat
  • lon
  • utctime

SensorAlerts

Used for a triggered sensor alert (will be stored for the time given in the configuration file).

table sensorAlerts

  • id (primary key)
  • sensorId (id to the entry in the sensors table)
  • state (0 = normal, 1 = triggered)
  • description
  • timeReceived (unix timestamp)
  • changeState (0 = False, 1 = True)
  • hasLatestData (0 = False, 1 = True)
  • dataJson (json string that represents the optional data that was sent by the sensor during an alert)
  • dataType (gives the type of data the sensor alert holds and consequentially where to find it: 0 = none, 1 = int, 2 = float)

SensorAlertsAlertLevels

Used for the alert levels that are triggered by the sensor alert.

table sensorAlertsAlertLevels

  • sensorAlertId (id to the entry in the sensorAlerts table, primary key)
  • alertLevel (primary key)

SensorAlertsDataInt

Used to store the integer data of the corresponding sensor.

table sensorAlertsDataInt

  • sensorAlertId (id to the entry in the sensorAlerts table, unique, primary key)
  • value
  • unit

SensorAlertsDataFloat

Used to store the floating point data of the corresponding sensor.

table sensorAlertsDataFloat

  • sensorAlertId (id to the entry in the sensorAlerts table, unique, primary key)
  • value
  • unit

SensorAlertsDataGPS

Used to store the GPS data of the corresponding sensor.

table sensorAlertsDataGPS

  • sensorAlertId (id to the entry in the sensorAlerts table, unique, primary key)
  • lat
  • lon
  • lat

Alerts

Used for each alert that is managed by a client.

table alerts

  • id (primary key)
  • nodeId (id to the entry in the nodes table)
  • clientAlertId (id used by the client for this alert)
  • description

AlertsAlertLevels

Used for the registered alert levels (you can think of an alert level as a group) for registered alerts.

table alertsAlertLevels

  • alertId (id to the entry in the alerts table, primary key)
  • alertLevel (primary key)

Managers

Used for all registered manager clients.

table managers

  • id (primary key)
  • nodeId (id to the entry in the nodes table)
  • description

AlertLevels

Used for all registered manager clients.

table alertLevels

  • alertLevel (primary key)
  • name
  • instrumentation_active (0 = no, 1 = yes)
  • instrumentation_cmd
  • instrumentation_timeout

AlertLevelsProfiles

Used for the registered profiles for an alert level.

table alertLevelsProfiles

  • alertLevel (alertLevel to the entry in the alertLevels table, primary key)
  • profileId (id to the entry in the profiles table, primary key)
Clone this wiki locally