1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
|
#pragma once
#include "../../config.h"
#include "thresholds.h"
#include <stddef.h>
#include <pg_config_manual.h>
#define DEFAULT_DB "template1"
enum {
DEFAULT_WARN = 2,
DEFAULT_CRIT = 8,
};
typedef struct {
char *pghost; /* host name of the backend server */
char *pgport; /* port of the backend server */
char *pgoptions; /* special options to start up the backend server */
char *pgtty; /* debugging tty for the backend server */
char dbName[NAMEDATALEN];
char *pguser;
char *pgpasswd;
char *pgparams;
char *pgquery;
char *pgqueryname;
double twarn;
double tcrit;
thresholds *qthresholds;
char *query_warning;
char *query_critical;
} check_pgsql_config;
/* begin, by setting the parameters for a backend connection if the
* parameters are null, then the system will try to use reasonable
* defaults by looking up environment variables or, failing that,
* using hardwired constants
* this targets .pgoptions and .pgtty
*/
check_pgsql_config check_pgsql_config_init() {
check_pgsql_config tmp = {
.pghost = NULL,
.pgport = NULL,
.pgoptions = NULL,
.pgtty = NULL,
.dbName = DEFAULT_DB,
.pguser = NULL,
.pgpasswd = NULL,
.pgparams = NULL,
.pgquery = NULL,
.pgqueryname = NULL,
.twarn = (double)DEFAULT_WARN,
.tcrit = (double)DEFAULT_CRIT,
.qthresholds = NULL,
.query_warning = NULL,
.query_critical = NULL,
};
return tmp;
}
|