smax-postgres v0.9
PostgreSQL / TimescaleDB logger for SMA-X
|
Macros | |
#define | _POSIX_C_SOURCE 200809 |
For clock_gettime() | |
#define | CONNECT_ATTEMPTS 20 |
Total number of reconnection attempts when initializing. | |
#define | CONNECT_RETRY_INTERVAL 3 |
(sec) Time between reconnection attempts when initializing. | |
#define | REDIS_SCAN_COUNT 100 |
Work-load count to use for Redis SCAN-type commands. | |
#define | SYSERR_RTN 0x40 |
Exit code indicating not to restart in case of error. | |
#define | UPDATE_TIMEOUT 10000 |
(ms) Timeout value for gathering queued SMA-X variables | |
Functions | |
void | destroyVariable (Variable *u) |
int | initCollector () |
smaxLogger connector module that mines SMA-X for inserting select variables into a time-series database at regular intervals.
void destroyVariable | ( | Variable * | u | ) |
Destroys a variable, freeing up the memory it occupies.
u | Pointer to the variable. |
References Variable::field, Variable::id, XField::name, and XField::value.
int initCollector | ( | ) |
Initializes the SMA-X collector. It connects to SMA-X and starts a grabber thread in the background, which will be pushing data to the time-series database at regular intervals.
References CONNECT_ATTEMPTS, CONNECT_RETRY_INTERVAL, dprintf, ERROR_RETURN, FALSE, getSMAXServerAddress(), smaxConnect(), smaxSetPipelined(), smaxSetResilient(), smaxSetResilientExit(), SUCCESS_RETURN, TRUE, and X_NO_SERVICE.