smax-postgres v0.9
PostgreSQL / TimescaleDB logger for SMA-X
|
Macros | |
#define | _GNU_SOURCE |
C source code standard. | |
#define | LOOKUP_INITIAL_CAPACITY 65536 |
Initial hashtable capacity. | |
#define | MIN_AGE ( 1 * DAY ) |
(s) Provide slow updates for unchanging variable at least this long | |
#define | MIN_SIZE 8 |
(bytes) Always log variable up to this size, no matter | |
Functions | |
logger_properties * | getLogProperties (const char *id) |
int | getMaxLogSize () |
int | getSampleCount (const Variable *u) |
const char * | getSMAXServerAddress () |
int | getSnapshotInterval () |
const char * | getSQLAuth () |
const char * | getSQLDatabaseName () |
const char * | getSQLServerAddress () |
const char * | getSQLUserName () |
int | getUpdateInterval () |
boolean | isLogging (const char *id, double updateTime) |
boolean | isUseHyperTables () |
int | parseConfig (const char *filename) |
int | setSMAXServerAddress (const char *addr) |
int | setSQLAuth (const char *passwd) |
int | setSQLDatabaseName (const char *name) |
int | setSQLServerAddress (const char *addr) |
int | setSQLUserName (const char *name) |
void | setUseHyperTables (boolean value) |
Configuration support for smaxLogger.
logger_properties * getLogProperties | ( | const char * | id | ) |
Returns the currently configured logging properties for an SMA-X variable.
id | The aggregate name/ID of the SMA-X variable |
int getMaxLogSize | ( | ) |
Returns the maximum byte size for automatically logged variables, in their binary storage format. For variables that are sampled at some interval
int getSampleCount | ( | const Variable * | u | ) |
Returns the number of samples that should be logged into the SQL database for a given SMA-X variable, which may be different from the element count of the variable by a configured downsampling factor.
u | Pointer to the variable's data structure |
References Variable::field, Variable::sampling, and xGetFieldCount().
const char * getSMAXServerAddress | ( | ) |
Returns the SMA-X server host name or IP address.
References SMAX_DEFAULT_HOSTNAME.
int getSnapshotInterval | ( | ) |
Returns the currently configured snapshot interval. Snapshots will be taken in the regular update cycle, whenever the time since the last snapshot equals or exceeds the set interval. For example, if the update interval is '2m', and the snapshot interval is '11m', then snapshots will be generated at every 6th update cycle, that is at every 12 minutes.
const char * getSQLAuth | ( | ) |
Returns the SQL database password to use when connecting to the database.
const char * getSQLDatabaseName | ( | ) |
Returns the SQL database to use when connecting to the database.
References DEFAULT_SQL_DB.
const char * getSQLServerAddress | ( | ) |
Returns the SQL server host name or IP address.
References DEFAULT_SQL_SERVER.
const char * getSQLUserName | ( | ) |
Returns the SQL user name to use when connecting to the database.
References DEFAULT_SQL_USER.
int getUpdateInterval | ( | ) |
Returns the currently configured update interval.
boolean isLogging | ( | const char * | id, |
double | updateTime | ||
) |
Checks if a given variable is to be logged into the SQL database
id | The aggregate name/ID of the SMA-X variable |
updateTime | (s) UNIX timestamp when the variable was last updated in the SMA-X database. |
References logger_properties::exclude, FALSE, logger_properties::force, getLogProperties(), LOOKUP_INITIAL_CAPACITY, and TRUE.
boolean isUseHyperTables | ( | ) |
Checks whether to use TimescaleDB hypertables. TimescaleDB is available for PostgreSQL only, so the setting will not affect other database backends.
int parseConfig | ( | const char * | filename | ) |
Pases settings from a specified configuration file
filename | the file name / path of the configuration to load. |
References dprintf, FALSE, MIN_AGE, MIN_SIZE, MINUTE, setSMAXServerAddress(), setSQLAuth(), setSQLDatabaseName(), setSQLServerAddress(), setSQLUserName(), TRUE, and X_SEP.
int setSMAXServerAddress | ( | const char * | addr | ) |
Sets the SMA-X server address or IP.
addr | The host name or IP address of the SMA-X server |
int setSQLAuth | ( | const char * | passwd | ) |
Sets the SQL database password to use when connecting to the database.
passwd | The SQL database password to use |
int setSQLDatabaseName | ( | const char * | name | ) |
Sets the SQL database name to select when connecting to the SQL server.
name | The SQL database name |
int setSQLServerAddress | ( | const char * | addr | ) |
Sets the SQL server address or IP.
addr | The host name or IP address of the SQL server |
int setSQLUserName | ( | const char * | name | ) |
Sets the SQL user name to use when connecting to the database.
name | The SQL database user name |
void setUseHyperTables | ( | boolean | value | ) |
Sets whether to use TimescaleDB hypertables extension. TimescaleDB is available for PostgreSQL only, so the setting will not affect other database backends.
value | TRUE (non-zero) to enable TimescaleDB hypertables. |