ROFL-pipeline  v0.6.0dev
Data Structures | Macros | Typedefs | Enumerations | Functions
monitoring.h File Reference

This file contains the abstractions to monitor particular elements of the platform, like sensors or other hardware state. More...

#include <rofl.h>
#include <stdbool.h>
#include <inttypes.h>
#include <time.h>
#include "platform/lock.h"

Go to the source code of this file.

Data Structures

struct  sensor_data
 Sensor data information. More...
 
struct  monitored_entity
 Abstraction of a monitored entity data. More...
 
struct  monitoring_state
 Container of the monitoring state. More...
 

Macros

#define MONITORED_ENTITY_MAX_SENSOR_DATA   8
 Maximum number of sensors per monitored entity. More...
 

Typedefs

typedef struct sensor_data sensor_data_t
 Sensor data information. More...
 
typedef struct monitored_entity monitored_entity_t
 Abstraction of a monitored entity data. More...
 
typedef struct monitoring_state monitoring_state_t
 Container of the monitoring state. More...
 
typedef monitoring_state_t monitoring_snapshot_state_t
 

Enumerations

enum  sensor_data_type {
  SENSOR_DATA_T_OHTER =1, SENSOR_DATA_T_UNKNOWN =2, SENSOR_DATA_T_VOLTS_AC =3, SENSOR_DATA_T_VOLTS_DC =4,
  SENSOR_DATA_T_AMPERES =5, SENSOR_DATA_T_WATTS =6, SENSOR_DATA_T_HERTZ =7, SENSOR_DATA_T_CELSIUS =8,
  SENSOR_DATA_T_PERCENTRH =9, SENSOR_DATA_T_RPM =10, SENSOR_DATA_T_CMM =11, SENSOR_DATA_T_TRUTH_VALUE =12
}
 Sensor data type. More...
 
enum  sensor_data_scale {
  SENSOR_DATA_S_YOCTO =1, SENSOR_DATA_S_ZEPTO =2, SENSOR_DATA_S_ATTO =3, SENSOR_DATA_S_FEMTO =4,
  SENSOR_DATA_S_PICO =5, SENSOR_DATA_S_NANO =6, SENSOR_DATA_S_MICRO =7, SENSOR_DATA_S_MILLI =8,
  SENSOR_DATA_S_UNITS =9, SENSOR_DATA_S_KILO =10, SENSOR_DATA_S_MEGA =11, SENSOR_DATA_S_GIGA =12,
  SENSOR_DATA_S_TERA =13, SENSOR_DATA_S_EXA =14, SENSOR_DATA_S_PETA =15, SENSOR_DATA_S_ZETTA =16,
  SENSOR_DATA_S_YOTTA =17
}
 Sensor data scale. More...
 
enum  sensor_data_oper_status { SENSOR_DATA_OS_OK =1, SENSOR_DATA_OS_UNAVAILABLE =2, SENSOR_DATA_OS_NONOPERATIONAL =3 }
 Sensor data operational status. More...
 
enum  monitored_entity_type {
  ME_TYPE_OTHER =1, ME_TYPE_UNKNOWN =2, ME_TYPE_CHASSIS =3, ME_TYPE_BACKPLANE =4,
  ME_TYPE_CONTAINER =5, ME_TYPE_POWER_SUPPLY =6, ME_TYPE_FAN =7, ME_TYPE_SENSOR =8,
  ME_TYPE_MODULE =9, ME_TYPE_PORT =10, ME_TYPE_STACK =11
}
 Monitoring entity type enum, defined according to RFC2737. More...
 

Functions

ROFL_BEGIN_DECLS rofl_result_t __monitoring_init (monitoring_state_t *monitoring)
 Initializes the monitoring state. More...
 
void monitoring_dump (monitoring_state_t *monitoring)
 Dumps the monitoring state, only meaningful for debugging purposes. More...
 
static void monitoring_dump_snapshot (monitoring_snapshot_state_t *snapshot)
 Dumps the monitoring state of a snapshot. More...
 
void __monitoring_destroy (monitoring_state_t *monitoring)
 
static bool monitoring_has_changed (monitoring_state_t *state, uint64_t *last_seen_rev)
 Returns true if the monitoring state has changed. More...
 
monitoring_snapshot_state_tmonitoring_get_snapshot (monitoring_state_t *monitoring)
 Get a snapshot of the current monitoring state. More...
 
static
monitoring_snapshot_state_t
monitoring_clone_snapshot (monitoring_snapshot_state_t *orig)
 Clone a monitoring snapshot. More...
 
static void monitoring_destroy_snapshot (monitoring_snapshot_state_t *snapshot)
 Destroy a snapshot previously generated via monitoring_get_snapshot() routine. More...
 
monitored_entity_tmonitoring_add_monitored_entity (monitoring_state_t *monitoring, enum monitored_entity_type type, monitored_entity_t *prev, monitored_entity_t *parent)
 Creates a monitored entity object and links it to the linked-list, in the position of prev OR parent. More...
 
rofl_result_t __monitoring_remove_monitored_entity (monitoring_state_t *monitoring, monitored_entity_t *entity, bool lock_acquired)
 
static rofl_result_t monitoring_remove_monitored_entity (monitoring_state_t *monitoring, monitored_entity_t *entity)
 Destroys an detaches monitored entity object. More...
 

Detailed Description

This file contains the abstractions to monitor particular elements of the platform, like sensors or other hardware state.

Author
Marc Sune<marc.sune (at) bisdn.de>

Definition in file monitoring.h.

Function Documentation

ROFL_BEGIN_DECLS rofl_result_t __monitoring_init ( monitoring_state_t monitoring)

Initializes the monitoring state.

Definition at line 207 of file monitoring.c.