~ubuntu-dev/ubuntu/lucid/zabbix/lucid-201002110857

« back to all changes in this revision

Viewing changes to include/db.h

  • Committer: Bazaar Package Importer
  • Author(s): Michael Ablassmeier
  • Date: 2007-07-02 09:06:51 UTC
  • mfrom: (1.1.4 upstream)
  • Revision ID: james.westby@ubuntu.com-20070702090651-8l6fl3fjw9rh6l2u
Tags: 1:1.4.1-2
Add patch from SVN in order to fix Incorrect processing of character '%'
in user parameters and remote commands.

Show diffs side-by-side

added added

removed removed

Lines of Context:
24
24
/* time_t */
25
25
#include <time.h>
26
26
 
27
 
#include "config.h"
28
27
#include "common.h"
29
 
 
30
 
#ifdef HAVE_MYSQL
31
 
#       include "mysql.h"
32
 
#       include "errmsg.h"
33
 
#       include "mysqld_error.h"
34
 
#       define  DB_HANDLE       MYSQL
35
 
#endif /* HAVE_MYSQL */
36
 
 
37
 
#ifdef HAVE_ORACLE
38
 
#       include "sqlora.h"
39
 
#endif /* HAVE_ORACLE */
40
 
 
41
 
#ifdef HAVE_PGSQL
42
 
#       include <libpq-fe.h>
43
 
#endif /* HAVE_PGSQL */
 
28
#include "zbxdb.h"
44
29
 
45
30
extern  char    *CONFIG_DBHOST;
46
31
extern  char    *CONFIG_DBNAME;
48
33
extern  char    *CONFIG_DBPASSWORD;
49
34
extern  char    *CONFIG_DBSOCKET;
50
35
extern  int     CONFIG_DBPORT;
 
36
extern  int     CONFIG_NODEID;
 
37
extern  int     CONFIG_MASTER_NODEID;
 
38
 
 
39
#define ZBX_DB_CONNECT_NORMAL   0
 
40
#define ZBX_DB_CONNECT_EXIT     1
51
41
 
52
42
#define DB_FULL_DELETE  0
53
43
#define DB_PART_DELETE  1
54
44
 
55
 
#define DB_HOST         struct host_type
56
 
#define DB_PROFILE      struct profile_type
57
 
#define DB_ITEM         struct item_type
58
 
#define DB_TRIGGER      struct trigger_type
59
 
#define DB_ACTION       struct action_type
60
 
#define DB_CONDITION    struct condition_type
61
 
#define DB_ALERT        struct alert_type
62
 
#define DB_FUNCTION     struct function_type
63
 
#define DB_MEDIA        struct media_type
64
 
#define DB_MEDIATYPE    struct mediatype_type
65
 
#define DB_GRAPH        struct graph_type
66
 
#define DB_GRAPH_ITEM   struct graph_item_type
67
 
#define DB_HOUSEKEEPER  struct housekeeper_type
68
 
 
69
 
#ifdef HAVE_MYSQL
70
 
        #define DB_RESULT       MYSQL_RES *
71
 
        #define DBfree_result   mysql_free_result
72
 
        #define DB_ROW          MYSQL_ROW
73
 
#endif
74
 
 
75
 
#ifdef HAVE_PGSQL
76
 
        #define DB_ROW          char **
77
 
        #define DB_RESULT       ZBX_PG_DB_RESULT*
78
 
        #define DBfree_result   PG_DBfree_result
79
 
 
80
 
        typedef struct zbx_pg_db_result_s
81
 
        {
82
 
                PGresult        *pg_result;
83
 
                int             row_num;
84
 
                int             fld_num;
85
 
                int             cursor;
86
 
                DB_ROW          values;
87
 
        } ZBX_PG_DB_RESULT;
88
 
 
89
 
void    PG_DBfree_result(DB_RESULT result);
90
 
 
91
 
#endif
92
 
 
93
 
#ifdef HAVE_ORACLE
94
 
        #define DB_RESULT       sqlo_stmt_handle_t
95
 
        #define DBfree_result   sqlo_close
96
 
        #define DB_ROW          char **
97
 
#endif
 
45
#define DB_ACTION       struct zbx_action_type
 
46
#define DB_ALERT        struct zbx_alert_type
 
47
#define DB_CONDITION    struct zbx_condition_type
 
48
#define DB_DHOST        struct zbx_dhost_type
 
49
#define DB_DRULE        struct zbx_drule_type
 
50
#define DB_DSERVICE     struct zbx_dservice_type
 
51
#define DB_DCHECK       struct zbx_dcheck_type
 
52
#define DB_EVENT        struct zbx_event_type
 
53
#define DB_FUNCTION     struct zbx_function_type
 
54
#define DB_GRAPH        struct zbx_graph_type
 
55
#define DB_GRAPH_ITEM   struct zbx_graph_item_type
 
56
#define DB_HOST         struct zbx_host_type
 
57
#define DB_HOUSEKEEPER  struct zbx_housekeeper_type
 
58
#define DB_ITEM         struct zbx_item_type
 
59
#define DB_MEDIA        struct zbx_media_type
 
60
#define DB_MEDIATYPE    struct zbx_mediatype_type
 
61
#define DB_OPERATION    struct zbx_operation_type
 
62
#define DB_TRIGGER      struct zbx_trigger_type
 
63
#define DB_HTTPTEST     struct zbx_httptest_type
 
64
#define DB_HTTPSTEP     struct zbx_httpstep_type
 
65
#define DB_HTTPSTEPITEM struct zbx_httpstepitem_type
 
66
#define DB_HTTPTESTITEM struct zbx_httptestitem_type
98
67
 
99
68
#define MAX_HOST_HOST_LEN       64
100
69
 
101
 
#define MAX_ITEM_KEY_LEN        64
 
70
#define MAX_ITEM_KEY_LEN        255
102
71
#define MAX_ITEM_IP_LEN         15
103
72
#define MAX_ITEM_SNMP_COMMUNITY_LEN     64
104
73
#define MAX_ITEM_SNMP_OID_LEN   255
118
87
 
119
88
#define HOST_HOST_LEN                   64
120
89
#define HOST_HOST_LEN_MAX               HOST_HOST_LEN+1
 
90
#define HOST_DNS_LEN                    64
 
91
#define HOST_DNS_LEN_MAX                HOST_DNS_LEN+1
121
92
#define HOST_IP_LEN                     15
122
93
#define HOST_IP_LEN_MAX                 HOST_IP_LEN+1
123
94
#define HOST_ERROR_LEN                  128
125
96
#define HOST_ERROR_LEN                  128
126
97
#define HOST_ERROR_LEN_MAX              HOST_ERROR_LEN+1
127
98
 
128
 
#define ITEM_KEY_LEN                    64
 
99
#define ITEM_KEY_LEN                    256
129
100
#define ITEM_KEY_LEN_MAX                ITEM_KEY_LEN+1
130
101
 
131
102
#define GRAPH_NAME_LEN                  128
137
108
#define ACTION_SUBJECT_LEN              255
138
109
#define ACTION_SUBJECT_LEN_MAX          ACTION_SUBJECT_LEN+1
139
110
 
140
 
#define ZBX_SQL_ITEM_SELECT     "i.itemid,i.key_,h.host,h.port,i.delay,i.description,i.nextcheck,i.type,i.snmp_community,i.snmp_oid,h.useip,h.ip,i.history,i.lastvalue,i.prevvalue,i.hostid,h.status,i.value_type,h.errors_from,i.snmp_port,i.delta,i.prevorgvalue,i.lastclock,i.units,i.multiplier,i.snmpv3_securityname,i.snmpv3_securitylevel,i.snmpv3_authpassphrase,i.snmpv3_privpassphrase,i.formula,h.available,i.status,i.trapper_hosts,i.logtimefmt,i.valuemapid from hosts h, items i"
 
111
#define DSERVICE_VALUE_LEN              255
 
112
#define DSERVICE_VALUE_LEN_MAX          DSERVICE_VALUE_LEN+1
 
113
 
 
114
#define HTTPSTEP_STATUS_LEN             255
 
115
#define HTTPSTEP_STATUS_LEN_MAX         HTTPSTEP_STATUS_LEN+1
 
116
 
 
117
#define HTTPSTEP_REQUIRED_LEN           255
 
118
#define HTTPSTEP_REQUIRED_LEN_MAX       HTTPSTEP_REQUIRED_LEN+1
 
119
 
 
120
#define ZBX_SQL_ITEM_SELECT     "i.itemid,i.key_,h.host,h.port,i.delay,i.description,i.nextcheck,i.type,i.snmp_community,i.snmp_oid,h.useip,h.ip,i.history,i.lastvalue,i.prevvalue,i.hostid,h.status,i.value_type,h.errors_from,i.snmp_port,i.delta,i.prevorgvalue,i.lastclock,i.units,i.multiplier,i.snmpv3_securityname,i.snmpv3_securitylevel,i.snmpv3_authpassphrase,i.snmpv3_privpassphrase,i.formula,h.available,i.status,i.trapper_hosts,i.logtimefmt,i.valuemapid,i.delay_flex,h.dns from hosts h, items i"
 
121
 
 
122
#define ZBX_MAX_SQL_LEN                 65535
 
123
 
 
124
DB_DRULE
 
125
{
 
126
        zbx_uint64_t    druleid;
 
127
        char            *iprange;
 
128
        int             delay;
 
129
        int             nextcheck;
 
130
        char            *name;
 
131
        int             status;
 
132
};
 
133
 
 
134
DB_DCHECK
 
135
{
 
136
        zbx_uint64_t    dcheckid;
 
137
        zbx_uint64_t    druleid;
 
138
        int             type;
 
139
        char            *ports;
 
140
        char            *key_;
 
141
        char            *snmp_community;
 
142
        int             status;
 
143
        char            value[DSERVICE_VALUE_LEN_MAX];
 
144
};
 
145
 
 
146
DB_DHOST
 
147
{
 
148
        zbx_uint64_t    dhostid;
 
149
        zbx_uint64_t    druleid;
 
150
        char            ip[HOST_IP_LEN_MAX];
 
151
        int             status;
 
152
        int             lastup;
 
153
        int             lastdown;
 
154
};
 
155
 
 
156
DB_DSERVICE
 
157
{
 
158
        zbx_uint64_t    dserviceid;
 
159
        zbx_uint64_t    dhostid;
 
160
        int             type;
 
161
        int             port;
 
162
        int             status;
 
163
        int             lastup;
 
164
        int             lastdown;
 
165
        char            value[DSERVICE_VALUE_LEN_MAX];
 
166
        char            key_[MAX_ITEM_KEY_LEN];
 
167
};
 
168
 
 
169
DB_EVENT
 
170
{
 
171
        zbx_uint64_t    eventid;
 
172
        int             source;
 
173
        int             object;
 
174
        zbx_uint64_t    objectid;
 
175
        int             clock;
 
176
        int             value;
 
177
        int             acknowledged;
 
178
        int             skip_actions;
 
179
        char            trigger_description[TRIGGER_DESCRIPTION_LEN_MAX];
 
180
        int             trigger_priority;
 
181
        char            *trigger_url;
 
182
        char            *trigger_comments;
 
183
};
141
184
 
142
185
DB_HOST
143
186
{
144
 
        int     hostid;
 
187
        zbx_uint64_t     hostid;
145
188
        char    host[HOST_HOST_LEN_MAX];
 
189
        char    dns[HOST_DNS_LEN_MAX];
146
190
        int     useip;
147
191
        char    ip[HOST_IP_LEN_MAX];
148
192
        int     port;
153
197
        int     available;
154
198
};
155
199
 
156
 
DB_PROFILE
157
 
{
158
 
        char    *devicetype;
159
 
        char    *name;
160
 
        char    *os;
161
 
        char    *serialno;
162
 
        char    *tag;
163
 
        char    *macaddress;
164
 
        char    *hardware;
165
 
        char    *software;
166
 
        char    *contact;
167
 
        char    *location;
168
 
        char    *notes;
169
 
};
170
 
 
171
200
DB_GRAPH
172
201
{
173
 
        int     graphid;
 
202
        zbx_uint64_t    graphid;
174
203
        char    name[GRAPH_NAME_LEN_MAX];
175
204
        int     width;
176
205
        int     height;
181
210
 
182
211
DB_GRAPH_ITEM
183
212
{
184
 
        int     gitemid;
185
 
        int     graphid;
186
 
        int     itemid;
 
213
        zbx_uint64_t    gitemid;
 
214
        zbx_uint64_t    graphid;
 
215
        zbx_uint64_t    itemid;
187
216
        int     drawtype;
188
217
        int     sortorder;
189
218
        char    color[GRAPH_ITEM_COLOR_LEN_MAX];
191
220
 
192
221
DB_ITEM
193
222
{
194
 
        int     itemid;
195
 
        int     hostid;
196
 
        int     type;
197
 
        int     status;
 
223
        zbx_uint64_t    itemid;
 
224
        zbx_uint64_t    hostid;
 
225
        zbx_item_type_t type;
 
226
        zbx_item_status_t       status;
198
227
        char    *description;
199
228
        char    key[ITEM_KEY_LEN_MAX];
200
 
        char    *host;
 
229
        char    *host_name;
 
230
        char    *host_ip;
 
231
        char    *host_dns;
201
232
        int     host_status;
202
233
        int     host_available;
203
234
        int     host_errors_from;
204
235
        int     useip;
205
 
        char    *ip;
206
236
        char    *shortname;
207
237
        char    *snmp_community;
208
238
        char    *snmp_oid;
212
242
        int     delay;
213
243
        int     history;
214
244
        int     trends;
215
 
        double  prevorgvalue;
 
245
        char    *prevorgvalue_str;
 
246
        double  prevorgvalue_dbl;
 
247
        zbx_uint64_t    prevorgvalue_uint64;
216
248
        int     prevorgvalue_null;
217
 
        double  lastvalue;
 
249
        char    *lastvalue_str;
 
250
        double  lastvalue_dbl;
 
251
        zbx_uint64_t    lastvalue_uint64;
218
252
        int     lastclock;
219
 
        char    *lastvalue_str;
220
253
        int     lastvalue_null;
221
 
        double  prevvalue;
222
254
        char    *prevvalue_str;
 
255
        double  prevvalue_dbl;
 
256
        zbx_uint64_t    prevvalue_uint64;
223
257
        int     prevvalue_null;
224
258
        time_t  lastcheck;
225
259
        time_t  nextcheck;
226
 
        int     value_type;
 
260
        zbx_item_value_type_t   value_type;
227
261
        int     delta;
228
262
        int     multiplier;
229
263
        char    *units;
240
274
        char    *eventlog_source;
241
275
 
242
276
        char    *logtimefmt;
243
 
        int     valuemapid;
 
277
        zbx_uint64_t    valuemapid;
 
278
        char    *delay_flex;
244
279
};
245
280
 
246
281
DB_FUNCTION
247
282
{
248
 
        int     functionid;
249
 
        int     itemid;
250
 
        int     triggerid;
 
283
        zbx_uint64_t     functionid;
 
284
        zbx_uint64_t     itemid;
 
285
        zbx_uint64_t     triggerid;
251
286
        double  lastvalue;
252
287
        int     lastvalue_null;
253
288
        char    *function;
257
292
 
258
293
DB_MEDIA
259
294
{
260
 
        int     mediaid;
 
295
        zbx_uint64_t    mediaid;
261
296
/*      char    *type;*/
262
 
        int     mediatypeid;
 
297
        zbx_uint64_t    mediatypeid;
263
298
        char    *sendto;
264
299
        char    *period;
265
300
        int     active;
268
303
 
269
304
DB_MEDIATYPE
270
305
{
271
 
        int     mediatypeid;
272
 
        int     type;
 
306
        zbx_uint64_t            mediatypeid;
 
307
        zbx_alert_type_t        type;
273
308
        char    *description;
274
309
        char    *smtp_server;
275
310
        char    *smtp_helo;
276
311
        char    *smtp_email;
277
312
        char    *exec_path;
278
313
        char    *gsm_modem;
 
314
        char    *username;
 
315
        char    *passwd;
279
316
};
280
317
 
281
318
DB_TRIGGER
282
319
{
283
 
        int     triggerid;
 
320
        zbx_uint64_t    triggerid;
284
321
        char    expression[TRIGGER_EXPRESSION_LEN_MAX];
285
322
        char    description[TRIGGER_DESCRIPTION_LEN_MAX];
286
323
        char    *url;
287
324
        char    *comments;
288
325
        int     status;
289
326
        int     value;
290
 
        int     prevvalue;
 
327
/*      int     prevvalue; */
291
328
        int     priority;
292
329
};
293
330
 
294
331
DB_ACTION
295
332
{
296
 
        int     actionid;
297
 
        int     actiontype;
298
 
        int     userid;
299
 
/*      int     delay;*/
300
 
        int     lastcheck;
301
 
        int     recipient;
302
 
        char    *subject;
303
 
        char    *message;
304
 
        int     maxrepeats;
305
 
        int     repeatdelay;
306
 
        char    *scripts;
 
333
        zbx_uint64_t    actionid;
 
334
        int             actiontype;
 
335
        int             evaltype;
 
336
        int             status;
 
337
        int             eventsource;
 
338
};
 
339
 
 
340
DB_OPERATION
 
341
{
 
342
        zbx_uint64_t    operationid;
 
343
        zbx_uint64_t    actionid;
 
344
        int             operationtype;
 
345
        int             object;
 
346
        zbx_uint64_t    objectid;
 
347
        char            *shortdata;
 
348
        char            *longdata;
307
349
};
308
350
 
309
351
DB_CONDITION
310
352
{
311
 
        int     conditionid;
312
 
        int     actionid;
313
 
        int     conditiontype;
314
 
        int     operator;
 
353
        zbx_uint64_t    conditionid;
 
354
        zbx_uint64_t    actionid;
 
355
        zbx_condition_type_t    conditiontype;
 
356
        zbx_condition_op_t      operator;
315
357
        char    *value;
316
358
};
317
359
 
318
360
DB_ALERT
319
361
{
320
 
        int     alertid;
321
 
        int     actionid;
 
362
        zbx_uint64_t    alertid;
 
363
        zbx_uint64_t    actionid;
322
364
        int     clock;
323
 
        int     mediatypeid;
 
365
/*      char    *type;*/
 
366
        zbx_uint64_t    mediatypeid;
324
367
        char    *sendto;
325
368
        char    *subject;
326
369
        char    *message;
327
 
        int     status;
328
 
        int     retries;
329
 
        int     delay;
 
370
        zbx_alert_status_t      status;
 
371
/*      int     retries;
 
372
        int     delay;*/
330
373
};
331
374
 
332
375
DB_HOUSEKEEPER
333
376
{
334
 
        int     housekeeperid;
 
377
        zbx_uint64_t    housekeeperid;
335
378
        char    *tablename;
336
379
        char    *field;
337
 
        int     value;
338
 
};
339
 
 
340
 
 
341
 
void    DBconnect(void);
 
380
        zbx_uint64_t    value;
 
381
};
 
382
 
 
383
DB_HTTPTEST
 
384
{
 
385
        zbx_uint64_t    httptestid;
 
386
        char            *name;
 
387
        zbx_uint64_t    applicationid;
 
388
        int             nextcheck;
 
389
        int             status;
 
390
        int             delay;
 
391
        char            *macros;
 
392
        char            *agent;
 
393
        double          speed;
 
394
        double          time;
 
395
};
 
396
 
 
397
DB_HTTPSTEP
 
398
{
 
399
        zbx_uint64_t    httpstepid;
 
400
        zbx_uint64_t    httptestid;
 
401
        int             no;
 
402
        char            *name;
 
403
        char            url[MAX_STRING_LEN];
 
404
        int             timeout;
 
405
        char            posts[MAX_STRING_LEN];
 
406
        char            required[HTTPSTEP_REQUIRED_LEN_MAX];
 
407
        char            status_codes[HTTPSTEP_STATUS_LEN_MAX];
 
408
};
 
409
 
 
410
DB_HTTPSTEPITEM
 
411
{
 
412
        zbx_uint64_t    httpstepitemid;
 
413
        zbx_uint64_t    httpstepid;
 
414
        zbx_uint64_t    itemid;
 
415
        zbx_httpitem_type_t     type;
 
416
};
 
417
 
 
418
DB_HTTPTESTITEM
 
419
{
 
420
        zbx_uint64_t    httptestitemid;
 
421
        zbx_uint64_t    httptestid;
 
422
        zbx_uint64_t    itemid;
 
423
        zbx_httpitem_type_t     type;
 
424
};
 
425
 
 
426
 
 
427
int     DBping(void);
 
428
 
 
429
void    DBconnect(int flag);
342
430
 
343
431
void    DBclose(void);
344
432
void    DBvacuum(void);
345
433
 
346
 
int     DBexecute( char *query );
347
 
/*long  DBaffected_rows();*/
 
434
int     DBexecute(const char *fmt, ...);
348
435
 
349
 
DB_RESULT       DBselect(char *query);
 
436
DB_RESULT       DBselect(const char *fmt, ...);
350
437
DB_RESULT       DBselectN(char *query, int n);
351
 
DB_ROW  DBfetch(DB_RESULT result);
352
 
/*char  *DBget_field(DB_RESULT result, int rownum, int fieldnum);*/
353
 
/*int   DBnum_rows(DB_RESULT result);*/
354
 
int     DBinsert_id(int exec_result, const char *table, const char *field);
355
 
int     DBis_null(char *field);
356
 
 
357
 
int     DBget_function_result(double *result,char *functionid);
358
 
void    DBupdate_host_availability(int hostid,int available,int clock,char *error);
359
 
int     DBupdate_item_status_to_notsupported(int itemid, char *error);
360
 
int     DBadd_trend(int itemid, double value, int clock);
361
 
int     DBadd_history(int itemid, double value, int clock);
362
 
int     DBadd_history_log(int itemid, char *value, int clock, int timestamp, char *source, int severity);
363
 
int     DBadd_history_str(int itemid, char *value, int clock);
364
 
int     DBadd_history_text(int itemid, char *value, int clock);
365
 
int     DBadd_history_uint(int itemid, zbx_uint64_t value, int clock);
366
 
int     DBadd_service_alarm(int serviceid,int status,int clock);
367
 
int     DBadd_alert(int actionid, int triggerid, int userid, int mediatypeid, char *sendto, char *subject, char *message, int maxrepeats, int repeatdelay);
 
438
DB_ROW          DBfetch(DB_RESULT result);
 
439
zbx_uint64_t    DBinsert_id(int exec_result, const char *table, const char *field);
 
440
int             DBis_null(char *field);
 
441
void            DBbegin();
 
442
void            DBcommit();
 
443
void            DBrollback();
 
444
 
 
445
zbx_uint64_t    DBget_maxid(char *table, char *field);
 
446
 
 
447
int     DBget_function_result(char **result,char *functionid);
 
448
void    DBupdate_host_availability(zbx_uint64_t hostid,int available,int clock,char *error);
 
449
int     DBupdate_item_status_to_notsupported(zbx_uint64_t itemid, char *error);
 
450
int     DBadd_trend(zbx_uint64_t itemid, double value, int clock);
 
451
int     DBadd_history(zbx_uint64_t itemid, double value, int clock);
 
452
int     DBadd_history_log(zbx_uint64_t itemid, char *value, int clock, int timestamp, char *source, int severity);
 
453
int     DBadd_history_str(zbx_uint64_t itemid, char *value, int clock);
 
454
int     DBadd_history_text(zbx_uint64_t itemid, char *value, int clock);
 
455
int     DBadd_history_uint(zbx_uint64_t itemid, zbx_uint64_t value, int clock);
 
456
int     DBadd_service_alarm(zbx_uint64_t serviceid,int status,int clock);
 
457
int     DBadd_alert(zbx_uint64_t actionid, zbx_uint64_t triggerid, zbx_uint64_t userid, zbx_uint64_t mediatypeid, char *sendto, char *subject, char *message);
368
458
void    DBupdate_triggers_status_after_restart(void);
369
 
int     DBget_prev_trigger_value(int triggerid);
 
459
int     DBget_prev_trigger_value(zbx_uint64_t triggerid);
370
460
/*int   DBupdate_trigger_value(int triggerid,int value,int clock);*/
371
461
int     DBupdate_trigger_value(DB_TRIGGER *trigger, int new_value, int now, char *reason);
372
462
 
378
468
int     DBget_triggers_count(void);
379
469
int     DBget_queue_count(void);
380
470
 
381
 
void    DBescape_string(char *from, char *to, int maxlen);
 
471
void    DBescape_string(const char *from, char *to, int maxlen);
 
472
char*   DBdyn_escape_string(const char *str);
 
473
 
382
474
void    DBget_item_from_db(DB_ITEM *item,DB_ROW row);
383
475
 
384
 
int     DBadd_host(char *server, int port, int status, int useip, char *ip, int disable_until, int available);
 
476
zbx_uint64_t    DBadd_host(char *server, int port, int status, int useip, char *ip, int disable_until, int available);
385
477
int     DBhost_exists(char *server);
386
478
int     DBget_host_by_hostid(int hostid,DB_HOST *host);
387
 
int     DBget_profile_by_hostid(int hostid,DB_PROFILE *profile);
388
 
int     DBsync_host_with_templates(int hostid);
389
 
int     DBsync_host_with_template(int hostid,int templateid,int items,int triggers,int graphs);
390
479
int     DBadd_templates_to_host(int hostid,int host_templateid);
391
480
 
392
481
int     DBadd_template_linkage(int hostid,int templateid,int items,int triggers,int graphs);
393
482
 
394
483
int     DBget_item_by_itemid(int itemid,DB_ITEM *item);
395
 
int     DBadd_item_to_linked_hosts(int itemid, int hostid);
396
 
int     DBadd_item(char *description, char *key, int hostid, int delay, int history, int status, int type, char *snmp_community, char *snmp_oid,int value_type,char *trapper_hosts,int snmp_port,char *units,int multiplier,int delta, char *snmpv3_securityname,int snmpv3_securitylevel,char *snmpv3_authpassphrase,char *snmpv3_privpassphrase,char *formula,int trends,char *logtimefmt);
397
 
 
398
 
int     DBadd_action_to_linked_hosts(int actionid,int hostid);
399
484
 
400
485
int     DBget_trigger_by_triggerid(int triggerid,DB_TRIGGER *trigger);
401
486
int     DBadd_trigger_to_linked_hosts(int triggerid,int hostid);
402
 
void    DBdelete_triggers_by_itemid(int itemid);
403
 
void    DBdelete_sysmaps_hosts_by_hostid(int hostid);
 
487
void    DBdelete_sysmaps_hosts_by_hostid(zbx_uint64_t hostid);
404
488
 
405
 
int     DBadd_graph(char *name, int width, int height, int yaxistype, double yaxismin, double yaxismax);
406
489
int     DBget_graph_item_by_gitemid(int gitemid, DB_GRAPH_ITEM *graph_item);
407
490
int     DBget_graph_by_graphid(int graphid, DB_GRAPH *graph);
408
491
int     DBadd_graph_item_to_linked_hosts(int gitemid,int hostid);
 
492
void    get_latest_event_status(zbx_uint64_t triggerid, int *prev_status, int *latest_status);
 
493
 
 
494
 
 
495
void    DBdelete_template_elements(
 
496
                zbx_uint64_t  hostid,
 
497
                zbx_uint64_t templateid,
 
498
                unsigned char unlink_mode
 
499
        );
 
500
int     DBcopy_template_elements(
 
501
                zbx_uint64_t hostid,
 
502
                zbx_uint64_t templateid,
 
503
                unsigned char copy_mode
 
504
        );
 
505
int     DBsync_host_with_template(
 
506
                zbx_uint64_t hostid,
 
507
                zbx_uint64_t templateid
 
508
        );
 
509
int     DBsync_host_with_templates(
 
510
                zbx_uint64_t hostid
 
511
        );
 
512
int     DBdelete_host(
 
513
                zbx_uint64_t hostid
 
514
        );
 
515
 
409
516
#endif