summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authoralex <alex@97f52cf1-0a1b-0410-bd0e-c28be96e8082>2006-09-20 06:58:59 +0000
committeralex <alex@97f52cf1-0a1b-0410-bd0e-c28be96e8082>2006-09-20 06:58:59 +0000
commitb3ca9173d1a1135522cb9c6eb002a5e1d0849eda (patch)
tree8b875b9905b4985bd9cbfb877a121c623e65e30b
parent60ac638462e1f5b72ba9010cd61b734631f2dc32 (diff)
downloadzabbix-b3ca9173d1a1135522cb9c6eb002a5e1d0849eda.tar.gz
zabbix-b3ca9173d1a1135522cb9c6eb002a5e1d0849eda.tar.xz
zabbix-b3ca9173d1a1135522cb9c6eb002a5e1d0849eda.zip
- table ALARMS renamed to EVENTS (Alexei)
- more development of distributed monitoring git-svn-id: svn://svn.zabbix.com/trunk@3317 97f52cf1-0a1b-0410-bd0e-c28be96e8082
-rw-r--r--ChangeLog1
-rw-r--r--create/data/data.sql3
-rwxr-xr-xcreate/data/recreate.sh46
-rw-r--r--create/schema/mysql.fmt2
-rw-r--r--create/schema/schema.sql16
-rw-r--r--include/common.h4
-rw-r--r--include/db.h46
-rw-r--r--include/dbsync.h8
-rwxr-xr-xinclude/zbxtypes.h2
-rw-r--r--src/libs/zbxdbhigh/db.c70
-rw-r--r--src/zabbix_server/actions.c14
-rw-r--r--src/zabbix_server/housekeeper/housekeeper.c24
-rw-r--r--src/zabbix_server/nodewatcher/.deps/nodewatcher.Po30
-rw-r--r--src/zabbix_server/nodewatcher/nodesender.c31
-rw-r--r--src/zabbix_server/nodewatcher/nodewatcher.c24
-rw-r--r--src/zabbix_server/trapper/nodesync.c12
16 files changed, 172 insertions, 161 deletions
diff --git a/ChangeLog b/ChangeLog
index 21528270..dbf22ff1 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,6 @@
Changes for 1.3:
+ - table ALARMS renamed to EVENTS (Alexei)
- added automatic generation of database schemas (Alexei)
- pinger will use unique temporary file name (Alexei)
- developed SLA calculation periods (Eugene)
diff --git a/create/data/data.sql b/create/data/data.sql
index 242b3c2d..50a7e1ef 100644
--- a/create/data/data.sql
+++ b/create/data/data.sql
@@ -60,7 +60,8 @@ INSERT INTO rights VALUES (3,2,'Default permission','R',0);
-- Dumping data for table `hosts`
--
-INSERT INTO hosts VALUES (10001,'Unix_t',0,'',10000,3,0,'',0,0,0);
+--INSERT INTO hosts VALUES (10001,'Unix_t',0,'',10000,3,0,'',0,0,0);
+INSERT INTO hosts VALUES (10001,'Unix_t',1,'127.0.0.1',10050,0,0,'',0,0,0);
INSERT INTO hosts VALUES (10002,'Windows_t',0,'',10000,3,0,'',0,0,0);
INSERT INTO hosts VALUES (10004,'Standalone_t',0,'',10000,3,0,'',0,0,0);
INSERT INTO hosts VALUES (10003,'MySQL_t',0,'',10000,3,0,'',0,0,0);
diff --git a/create/data/recreate.sh b/create/data/recreate.sh
index 25a8f940..e3b60a77 100755
--- a/create/data/recreate.sh
+++ b/create/data/recreate.sh
@@ -16,29 +16,29 @@ done
cat nodes.sql|mysql -uroot
for i in 1 2 3 4 5 6 7; do
- echo "update config set configid=100*configid+$i"|mysql -uroot node$i
- echo "update media_type set mediatypeid=100*mediatypeid+$i"|mysql -uroot node$i
- echo "update users set userid=100*userid+$i"|mysql -uroot node$i
- echo "update usrgrp set usrgrpid=100*usrgrpid+$i"|mysql -uroot node$i
- echo "update rights set rightid=100*rightid+$i"|mysql -uroot node$i
- echo "update rights set userid=100*userid+$i"|mysql -uroot node$i
- echo "update hosts set hostid=100*hostid+$i"|mysql -uroot node$i
- echo "update groups set groupid=100*groupid+$i"|mysql -uroot node$i
- echo "update hosts_groups set hostgroupid=100*hostgroupid+$i"|mysql -uroot node$i
- echo "update hosts_groups set hostid=100*hostid+$i"|mysql -uroot node$i
- echo "update hosts_groups set groupid=100*groupid+$i"|mysql -uroot node$i
- echo "update items set itemid=100*itemid+$i"|mysql -uroot node$i
- echo "update items set hostid=100*hostid+$i"|mysql -uroot node$i
- echo "update functions set functionid=100*functionid+$i"|mysql -uroot node$i
- echo "update functions set itemid=100*itemid+$i"|mysql -uroot node$i
- echo "update functions set triggerid=100*triggerid+$i"|mysql -uroot node$i
- echo "update triggers set triggerid=100*triggerid+$i"|mysql -uroot node$i
- echo "update actions set actionid=100*actionid+$i"|mysql -uroot node$i
- echo "update actions set userid=100*userid+$i"|mysql -uroot node$i
- echo "update media set mediaid=100*mediaid+$i"|mysql -uroot node$i
- echo "update media set userid=100*userid+$i"|mysql -uroot node$i
- echo "update media set mediatypeid=100*mediatypeid+$i"|mysql -uroot node$i
- echo "update images set imageid=100*imageid+$i"|mysql -uroot node$i
+ echo "update config set configid=configid+0000100000000000000*$i"|mysql -uroot node$i
+ echo "update media_type set mediatypeid=mediatypeid+0000100000000000000*$i"|mysql -uroot node$i
+ echo "update users set userid=userid+0000100000000000000*$i"|mysql -uroot node$i
+ echo "update usrgrp set usrgrpid=usrgrpid+0000100000000000000*$i"|mysql -uroot node$i
+ echo "update rights set rightid=rightid+0000100000000000000*$i"|mysql -uroot node$i
+ echo "update rights set userid=userid+0000100000000000000*$i"|mysql -uroot node$i
+ echo "update hosts set hostid=hostid+0000100000000000000*$i"|mysql -uroot node$i
+ echo "update groups set groupid=groupid+0000100000000000000*$i"|mysql -uroot node$i
+ echo "update hosts_groups set hostgroupid=hostgroupid+0000100000000000000*$i"|mysql -uroot node$i
+ echo "update hosts_groups set hostid=hostid+0000100000000000000*$i"|mysql -uroot node$i
+ echo "update hosts_groups set groupid=groupid+0000100000000000000*$i"|mysql -uroot node$i
+ echo "update items set itemid=itemid+0000100000000000000*$i"|mysql -uroot node$i
+ echo "update items set hostid=hostid+0000100000000000000*$i"|mysql -uroot node$i
+ echo "update functions set functionid=functionid+0000100000000000000*$i"|mysql -uroot node$i
+ echo "update functions set itemid=itemid+0000100000000000000*$i"|mysql -uroot node$i
+ echo "update functions set triggerid=triggerid+0000100000000000000*$i"|mysql -uroot node$i
+ echo "update triggers set triggerid=triggerid+0000100000000000000*$i"|mysql -uroot node$i
+ echo "update actions set actionid=actionid+0000100000000000000*$i"|mysql -uroot node$i
+ echo "update actions set userid=userid+0000100000000000000*$i"|mysql -uroot node$i
+ echo "update media set mediaid=mediaid+0000100000000000000*$i"|mysql -uroot node$i
+ echo "update media set userid=userid+0000100000000000000*$i"|mysql -uroot node$i
+ echo "update media set mediatypeid=mediatypeid+0000100000000000000*$i"|mysql -uroot node$i
+ echo "update images set imageid=imageid+0000100000000000000*$i"|mysql -uroot node$i
done
echo Making MySQL server
diff --git a/create/schema/mysql.fmt b/create/schema/mysql.fmt
index e99e70d0..ffb29893 100644
--- a/create/schema/mysql.fmt
+++ b/create/schema/mysql.fmt
@@ -1,4 +1,4 @@
-{bigint}=>bigint
+{bigint}=>bigint unsigned
{integer}=>integer
{double}=>double
{varchar}=>varchar
diff --git a/create/schema/schema.sql b/create/schema/schema.sql
index 0b1861ee..76c51aea 100644
--- a/create/schema/schema.sql
+++ b/create/schema/schema.sql
@@ -171,7 +171,7 @@ CREATE INDEX sysmaps_1 ON sysmaps (name);
CREATE TABLE config (
configid {bigint} DEFAULT '0' NOT NULL,
alert_history {integer} DEFAULT '0' NOT NULL,
- alarm_history {integer} DEFAULT '0' NOT NULL,
+ event_history {integer} DEFAULT '0' NOT NULL,
refresh_unsupported {integer} DEFAULT '0' NOT NULL,
work_period {varchar}(100) DEFAULT '1-5,00:00-24:00' NOT NULL,
PRIMARY KEY (configid)
@@ -248,17 +248,17 @@ CREATE TABLE conditions (
CREATE INDEX conditions_1 ON conditions (actionid);
-CREATE TABLE alarms (
- alarmid {bigint} DEFAULT '0' NOT NULL,
+CREATE TABLE events (
+ eventid {bigint} DEFAULT '0' NOT NULL,
triggerid {bigint} DEFAULT '0' NOT NULL,
clock {integer} DEFAULT '0' NOT NULL,
value {integer} DEFAULT '0' NOT NULL,
acknowledged {integer} DEFAULT '0' NOT NULL,
- PRIMARY KEY (alarmid)
+ PRIMARY KEY (eventid)
) {create_table_opt};
-CREATE INDEX alarms_1 ON alarms (triggerid,clock);
-CREATE INDEX alarms_2 ON alarms (clock);
+CREATE INDEX events_1 ON events (triggerid,clock);
+CREATE INDEX events_2 ON events (clock);
CREATE TABLE functions (
functionid {bigint} DEFAULT '0' NOT NULL,
@@ -634,14 +634,14 @@ CREATE TABLE housekeeper (
CREATE TABLE acknowledges (
acknowledgeid {bigint} DEFAULT '0' NOT NULL,
userid {bigint} DEFAULT '0' NOT NULL,
- alarmid {bigint} DEFAULT '0' NOT NULL,
+ eventid {bigint} DEFAULT '0' NOT NULL,
clock {integer} DEFAULT '0' NOT NULL,
message {varchar}(255) DEFAULT '' NOT NULL,
PRIMARY KEY (acknowledgeid)
) {create_table_opt};
CREATE INDEX acknowledges_1 ON acknowledges (userid);
-CREATE INDEX acknowledges_2 ON acknowledges (alarmid);
+CREATE INDEX acknowledges_2 ON acknowledges (eventid);
CREATE INDEX acknowledges_3 ON acknowledges (clock);
CREATE TABLE applications (
diff --git a/include/common.h b/include/common.h
index 03e1058e..e4a1e98e 100644
--- a/include/common.h
+++ b/include/common.h
@@ -282,8 +282,10 @@ AGENT_RESULT {
ZBX_LIST list;
};
-#define ZBX_COND_NODEID " %s=%d "
+id>=100000000000000*nodeid and id<=(100000000000000*nodeid1+99999999999999)
+#define ZBX_COND_NODEID " %s>=100000000000000*%d and %s<=(100000000000000*%d+99999999999999) "
#define LOCAL_NODE(fieldid) "mod(" fieldid ",100)",CONFIG_NODEID
+#define ANY_NODE(fieldid,nodeid) "mod(" fieldid ",100)",CONFIG_NODEID
/* agent result types */
#define AR_UINT64 1
diff --git a/include/db.h b/include/db.h
index 0b4f47a2..82e2ca7c 100644
--- a/include/db.h
+++ b/include/db.h
@@ -142,7 +142,7 @@ void PG_DBfree_result(DB_RESULT result);
DB_HOST
{
- int hostid;
+ zbx_uint64_t hostid;
char host[HOST_HOST_LEN_MAX];
int useip;
char ip[HOST_IP_LEN_MAX];
@@ -156,7 +156,7 @@ DB_HOST
DB_GRAPH
{
- int graphid;
+ zbx_uint64_t graphid;
char name[GRAPH_NAME_LEN_MAX];
int width;
int height;
@@ -167,9 +167,9 @@ DB_GRAPH
DB_GRAPH_ITEM
{
- int gitemid;
- int graphid;
- int itemid;
+ zbx_uint64_t gitemid;
+ zbx_uint64_t graphid;
+ zbx_uint64_t itemid;
int drawtype;
int sortorder;
char color[GRAPH_ITEM_COLOR_LEN_MAX];
@@ -177,8 +177,8 @@ DB_GRAPH_ITEM
DB_ITEM
{
- int itemid;
- int hostid;
+ zbx_uint64_t itemid;
+ zbx_uint64_t hostid;
int type;
int status;
char *description;
@@ -232,9 +232,9 @@ DB_ITEM
DB_FUNCTION
{
- int functionid;
- int itemid;
- int triggerid;
+ zbx_uint64_t functionid;
+ zbx_uint64_t itemid;
+ zbx_uint64_t triggerid;
double lastvalue;
int lastvalue_null;
char *function;
@@ -244,9 +244,9 @@ DB_FUNCTION
DB_MEDIA
{
- int mediaid;
+ zbx_uint64_t mediaid;
/* char *type;*/
- int mediatypeid;
+ zbx_uint64_t mediatypeid;
char *sendto;
char *period;
int active;
@@ -255,7 +255,7 @@ DB_MEDIA
DB_MEDIATYPE
{
- int mediatypeid;
+ zbx_uint64_t mediatypeid;
int type;
char *description;
char *smtp_server;
@@ -267,7 +267,7 @@ DB_MEDIATYPE
DB_TRIGGER
{
- int triggerid;
+ zbx_uint64_t triggerid;
char expression[TRIGGER_EXPRESSION_LEN_MAX];
char description[TRIGGER_DESCRIPTION_LEN_MAX];
char url[TRIGGER_URL_LEN_MAX];
@@ -280,9 +280,9 @@ DB_TRIGGER
DB_ACTION
{
- int actionid;
+ zbx_uint64_t actionid;
int actiontype;
- int userid;
+ zbx_uint64_t userid;
/* int delay;*/
int lastcheck;
int recipient;
@@ -295,8 +295,8 @@ DB_ACTION
DB_CONDITION
{
- int conditionid;
- int actionid;
+ zbx_uint64_t conditionid;
+ zbx_uint64_t actionid;
int conditiontype;
int operator;
char *value;
@@ -304,11 +304,11 @@ DB_CONDITION
DB_ALERT
{
- int alertid;
- int actionid;
+ zbx_uint64_t alertid;
+ zbx_uint64_t actionid;
int clock;
/* char *type;*/
- int mediatypeid;
+ zbx_uint64_t mediatypeid;
char *sendto;
char *subject;
char *message;
@@ -319,10 +319,10 @@ DB_ALERT
DB_HOUSEKEEPER
{
- int housekeeperid;
+ zbx_uint64_t housekeeperid;
char *tablename;
char *field;
- int value;
+ zbx_uint64_t value;
};
diff --git a/include/dbsync.h b/include/dbsync.h
index d138e283..fe186946 100644
--- a/include/dbsync.h
+++ b/include/dbsync.h
@@ -151,7 +151,7 @@ static ZBX_TABLE tables[]={
{
{"configid", ZBX_TYPE_INT, ZBX_SYNC},
{"alert_history", ZBX_TYPE_INT, ZBX_SYNC},
- {"alarm_history", ZBX_TYPE_INT, ZBX_SYNC},
+ {"event_history", ZBX_TYPE_INT, ZBX_SYNC},
{"refresh_unsupported", ZBX_TYPE_INT, ZBX_SYNC},
{"work_period", ZBX_TYPE_CHAR, ZBX_SYNC},
{0}
@@ -219,9 +219,9 @@ static ZBX_TABLE tables[]={
{0}
}
},
- {"alarms", "alarmid", ZBX_NOSYNC,
+ {"events", "eventid", ZBX_NOSYNC,
{
- {"alarmid", ZBX_TYPE_INT, ZBX_SYNC},
+ {"eventid", ZBX_TYPE_INT, ZBX_SYNC},
{"triggerid", ZBX_TYPE_INT, ZBX_SYNC},
{"clock", ZBX_TYPE_INT, ZBX_SYNC},
{"value", ZBX_TYPE_INT, ZBX_SYNC},
@@ -582,7 +582,7 @@ static ZBX_TABLE tables[]={
{
{"acknowledgeid", ZBX_TYPE_INT, ZBX_SYNC},
{"userid", ZBX_TYPE_INT, ZBX_SYNC},
- {"alarmid", ZBX_TYPE_INT, ZBX_SYNC},
+ {"eventid", ZBX_TYPE_INT, ZBX_SYNC},
{"clock", ZBX_TYPE_INT, ZBX_SYNC},
{"message", ZBX_TYPE_CHAR, ZBX_SYNC},
{0}
diff --git a/include/zbxtypes.h b/include/zbxtypes.h
index 4bc35c1e..1abe1ae6 100755
--- a/include/zbxtypes.h
+++ b/include/zbxtypes.h
@@ -54,4 +54,6 @@
# define S_ISREG(x) (((x) & S_IFMT) == S_IFREG)
#endif
+#define ZBX_STR2UINT64(uint,string) scanf(string ,ZBX_FS_UI64 ,&uint);
+
#endif
diff --git a/src/libs/zbxdbhigh/db.c b/src/libs/zbxdbhigh/db.c
index a4e3ba7a..c270689f 100644
--- a/src/libs/zbxdbhigh/db.c
+++ b/src/libs/zbxdbhigh/db.c
@@ -45,7 +45,7 @@
sqlo_db_handle_t oracle;
#endif
-extern void apply_actions(DB_TRIGGER *trigger,int alarmid,int trigger_value);
+extern void apply_actions(DB_TRIGGER *trigger,int eventid,int trigger_value);
extern void update_services(int triggerid, int status);
extern int CONFIG_NODEID;
@@ -694,7 +694,7 @@ int DBget_prev_trigger_value(int triggerid)
zabbix_log(LOG_LEVEL_DEBUG,"In DBget_prev_trigger_value[%d]", triggerid);
- result = DBselect("select max(clock) from alarms where triggerid=%d",triggerid);
+ result = DBselect("select max(clock) from events where triggerid=%d",triggerid);
row=DBfetch(result);
@@ -707,7 +707,7 @@ int DBget_prev_trigger_value(int triggerid)
clock=atoi(row[0]);
DBfree_result(result);
- result=DBselect("select max(clock) from alarms where triggerid=%d and clock<%d",triggerid,clock);
+ result=DBselect("select max(clock) from events where triggerid=%d and clock<%d",triggerid,clock);
row=DBfetch(result);
if(!row || DBis_null(row[0])==SUCCEED)
@@ -722,7 +722,7 @@ status changes to TRUE for te first time */
clock=atoi(row[0]);
DBfree_result(result);
- result = DBselect("select value from alarms where triggerid=%d and clock=%d",triggerid,clock);
+ result = DBselect("select value from events where triggerid=%d and clock=%d",triggerid,clock);
row=DBfetch(result);
if(!row || DBis_null(row[0])==SUCCEED)
@@ -737,9 +737,9 @@ status changes to TRUE for te first time */
return value;
}
-/* SUCCEED if latest alarm with triggerid has this status */
+/* SUCCEED if latest event with triggerid has this status */
/* Rewrite required to simplify logic ?*/
-static int latest_alarm(int triggerid, int status)
+static int latest_event(int triggerid, int status)
{
char sql[MAX_STRING_LEN];
DB_RESULT result;
@@ -747,9 +747,9 @@ static int latest_alarm(int triggerid, int status)
int ret = FAIL;
- zabbix_log(LOG_LEVEL_DEBUG,"In latest_alarm()");
+ zabbix_log(LOG_LEVEL_DEBUG,"In latest_event()");
- zbx_snprintf(sql,sizeof(sql),"select value from alarms where triggerid=%d order by clock desc",triggerid);
+ zbx_snprintf(sql,sizeof(sql),"select value from events where triggerid=%d order by clock desc",triggerid);
zabbix_log(LOG_LEVEL_DEBUG,"SQL [%s]",sql);
result = DBselectN(sql,1);
row = DBfetch(result);
@@ -812,32 +812,32 @@ int latest_service_alarm(int serviceid, int status)
return ret;
}
-/* Returns alarmid or 0 */
-int add_alarm(int triggerid,int status,int clock,int *alarmid)
+/* Returns eventid or 0 */
+int add_event(int triggerid,int status,int clock,int *eventid)
{
- *alarmid=0;
+ *eventid=0;
- zabbix_log(LOG_LEVEL_DEBUG,"In add_alarm(%d,%d,%d)",triggerid, status, *alarmid);
+ zabbix_log(LOG_LEVEL_DEBUG,"In add_event(%d,%d,%d)",triggerid, status, *eventid);
- /* Latest alarm has the same status? */
- if(latest_alarm(triggerid,status) == SUCCEED)
+ /* Latest event has the same status? */
+ if(latest_event(triggerid,status) == SUCCEED)
{
zabbix_log(LOG_LEVEL_DEBUG,"Alarm for triggerid [%d] status [%d] already exists",triggerid,status);
return FAIL;
}
- *alarmid = DBinsert_id(
- DBexecute("insert into alarms(triggerid,clock,value) values(%d,%d,%d)", triggerid, clock, status),
- "alarms", "alarmid");
+ *eventid = DBinsert_id(
+ DBexecute("insert into events(triggerid,clock,value) values(%d,%d,%d)", triggerid, clock, status),
+ "events", "eventid");
/* Cancel currently active alerts */
if(status == TRIGGER_VALUE_FALSE || status == TRIGGER_VALUE_TRUE)
{
- DBexecute("update alerts set retries=3,error='Trigger changed its status. WIll not send repeats.' where triggerid=%d and repeats>0 and status=%d", triggerid, ALERT_STATUS_NOT_SENT);
+ DBexecute("update events set retries=3,error='Trigger changed its status. WIll not send repeats.' where triggerid=%d and repeats>0 and status=%d", triggerid, ALERT_STATUS_NOT_SENT);
}
- zabbix_log(LOG_LEVEL_DEBUG,"End of add_alarm()");
+ zabbix_log(LOG_LEVEL_DEBUG,"End of add_event()");
return SUCCEED;
}
@@ -860,7 +860,7 @@ int DBadd_service_alarm(int serviceid,int status,int clock)
int DBupdate_trigger_value(DB_TRIGGER *trigger, int new_value, int now, char *reason)
{
- int alarmid;
+ int eventid;
int ret = SUCCEED;
if(reason==NULL)
@@ -875,7 +875,7 @@ int DBupdate_trigger_value(DB_TRIGGER *trigger, int new_value, int now, char *re
if(trigger->value != new_value)
{
trigger->prevvalue=DBget_prev_trigger_value(trigger->triggerid);
- if(add_alarm(trigger->triggerid,new_value,now,&alarmid) == SUCCEED)
+ if(add_event(trigger->triggerid,new_value,now,&eventid) == SUCCEED)
{
if(reason==NULL)
{
@@ -897,7 +897,7 @@ int DBupdate_trigger_value(DB_TRIGGER *trigger, int new_value, int now, char *re
((trigger->prevvalue == TRIGGER_VALUE_TRUE) && (trigger->value == TRIGGER_VALUE_UNKNOWN) && (new_value == TRIGGER_VALUE_FALSE)))
{
zabbix_log(LOG_LEVEL_DEBUG,"In update_trigger_value. Before apply_actions. Triggerid [%d] prev [%d] curr [%d] new [%d]", trigger->triggerid, trigger->prevvalue, trigger->value, new_value);
- apply_actions(trigger,alarmid,new_value);
+ apply_actions(trigger,eventid,new_value);
if(new_value == TRIGGER_VALUE_TRUE)
{
update_services(trigger->triggerid, trigger->priority);
@@ -993,7 +993,7 @@ void DBdelete_trigger(int triggerid)
{
DBexecute("delete from trigger_depends where triggerid_down=%d or triggerid_up=%d", triggerid, triggerid);
DBexecute("delete from functions where triggerid=%d", triggerid);
- DBexecute("delete from alarms where triggerid=%d", triggerid);
+ DBexecute("delete from events where triggerid=%d", triggerid);
/* zbx_snprintf(sql,sizeof(sql),"delete from actions where triggerid=%d and scope=%d", triggerid, ACTION_SCOPE_TRIGGER);
DBexecute(sql);*/
@@ -1638,7 +1638,7 @@ void DBvacuum(void)
#ifdef HAVE_PGSQL
char *table_for_housekeeping[]={"services", "services_links", "graphs_items", "graphs", "sysmaps_links",
"sysmaps_elements", "sysmaps", "config", "groups", "hosts_groups", "alerts",
- "actions", "alarms", "functions", "history", "history_str", "hosts", "trends",
+ "actions", "events", "functions", "history", "history_str", "hosts", "trends",
"items", "media", "media_type", "triggers", "trigger_depends", "users",
"sessions", "rights", "service_alarms", "profiles", "screens", "screens_items",
NULL};
@@ -1723,7 +1723,8 @@ void DBget_item_from_db(DB_ITEM *item,DB_ROW row)
{
char *s;
- item->itemid=atoi(row[0]);
+ ZBX_STR2UINT64(item->itemid, row[0]);
+// item->itemid=atoi(row[0]);
strscpy(item->key,row[1]);
item->host=row[2];
item->port=atoi(row[3]);
@@ -1758,7 +1759,8 @@ void DBget_item_from_db(DB_ITEM *item,DB_ROW row)
item->prevvalue_str=s;
item->prevvalue=atof(s);
}
- item->hostid=atoi(row[15]);
+// item->hostid=atoi(row[15]);
+ ZBX_STR2UINT64(item->hostid, row[15]);
item->host_status=atoi(row[16]);
item->value_type=atoi(row[17]);
@@ -1811,26 +1813,32 @@ zbx_uint64_t DBget_nextid(char *table, char *field)
DB_RESULT result;
DB_ROW row;
zbx_uint64_t res;
+ zbx_uint64_t min;
+ zbx_uint64_t max;
zabbix_log(LOG_LEVEL_DEBUG,"In DBget_nextid(%s,%s)", table, field);
- result = DBselect("select max(%s) from %s where mod(%s,100)=%d", field, table, field, CONFIG_NODEID);
+ min = (zbx_uint64_t)100000000000000*(zbx_uint64_t)CONFIG_NODEID;
+ max = (zbx_uint64_t)100000000000000*(zbx_uint64_t)(CONFIG_NODEID+1)-1;
+
+ result = DBselect("select max(%s) from %s where %s>=" ZBX_FS_UI64 " and %s<=" ZBX_FS_UI64, field, table, field, min, field, max);
+// zabbix_log(LOG_LEVEL_WARNING, "select max(%s) from %s where %s>=" ZBX_FS_UI64 " and %s<=" ZBX_FS_UI64, field, table, field, min, field, max);
row=DBfetch(result);
if(row && (DBis_null(row[0])!=SUCCEED))
{
- zabbix_log(LOG_LEVEL_DEBUG,"3 [%s]", row[0]);
sscanf(row[0],ZBX_FS_UI64,&res);
- res=res+100;
+ res++;
}
else
{
- zabbix_log(LOG_LEVEL_DEBUG,"4");
- res=(zbx_uint64_t)(100+CONFIG_NODEID);
+// zabbix_log(LOG_LEVEL_WARNING,"4");
+ res=(zbx_uint64_t)100000000000000*(zbx_uint64_t)CONFIG_NODEID+1;
}
DBfree_result(result);
+// zabbix_log(LOG_LEVEL_WARNING, ZBX_FS_UI64, res);
return res;
}
diff --git a/src/zabbix_server/actions.c b/src/zabbix_server/actions.c
index b40e06f8..18d26b58 100644
--- a/src/zabbix_server/actions.c
+++ b/src/zabbix_server/actions.c
@@ -337,7 +337,7 @@ static int get_next_command(char** command_list, char** alias, int* is_group, ch
zabbix_log( LOG_LEVEL_DEBUG, "Run remote commands END");
}
-static int check_action_condition(DB_TRIGGER *trigger,int alarmid,int new_trigger_value, DB_CONDITION *condition)
+static int check_action_condition(DB_TRIGGER *trigger,int eventid,int new_trigger_value, DB_CONDITION *condition)
{
DB_RESULT result;
DB_ROW row;
@@ -533,7 +533,7 @@ static int check_action_condition(DB_TRIGGER *trigger,int alarmid,int new_trigge
return ret;
}
-static int check_action_conditions(DB_TRIGGER *trigger,int alarmid,int new_trigger_value, int actionid)
+static int check_action_conditions(DB_TRIGGER *trigger,int eventid,int new_trigger_value, int actionid)
{
DB_RESULT result;
DB_ROW row;
@@ -558,7 +558,7 @@ static int check_action_conditions(DB_TRIGGER *trigger,int alarmid,int new_trigg
/* OR conditions */
if(old_type == condition.conditiontype)
{
- if(check_action_condition(trigger, alarmid, new_trigger_value, &condition) == SUCCEED)
+ if(check_action_condition(trigger, eventid, new_trigger_value, &condition) == SUCCEED)
ret = SUCCEED;
}
/* AND conditions */
@@ -566,7 +566,7 @@ static int check_action_conditions(DB_TRIGGER *trigger,int alarmid,int new_trigg
{
/* Break if PREVIOUS AND condition is FALSE */
if(ret == FAIL) break;
- if(check_action_condition(trigger, alarmid, new_trigger_value, &condition) == FAIL)
+ if(check_action_condition(trigger, eventid, new_trigger_value, &condition) == FAIL)
ret = FAIL;
}
@@ -586,7 +586,7 @@ static int check_action_conditions(DB_TRIGGER *trigger,int alarmid,int new_trigg
return ret;
}
-void apply_actions(DB_TRIGGER *trigger,int alarmid,int trigger_value)
+void apply_actions(DB_TRIGGER *trigger,int eventid,int trigger_value)
{
DB_RESULT result;
DB_ROW row;
@@ -595,7 +595,7 @@ void apply_actions(DB_TRIGGER *trigger,int alarmid,int trigger_value)
/* int now;*/
- zabbix_log( LOG_LEVEL_DEBUG, "In apply_actions(triggerid:%d,alarmid:%d,trigger_value:%d)",trigger->triggerid, alarmid, trigger_value);
+ zabbix_log( LOG_LEVEL_DEBUG, "In apply_actions(triggerid:%d,eventid:%d,trigger_value:%d)",trigger->triggerid, eventid, trigger_value);
if(TRIGGER_VALUE_TRUE == trigger_value)
{
@@ -629,7 +629,7 @@ void apply_actions(DB_TRIGGER *trigger,int alarmid,int trigger_value)
{
action.actionid=atoi(row[0]);
- if(check_action_conditions(trigger, alarmid, trigger_value, action.actionid) == SUCCEED)
+ if(check_action_conditions(trigger, eventid, trigger_value, action.actionid) == SUCCEED)
{
zabbix_log( LOG_LEVEL_DEBUG, "Conditions match our trigger. Do apply actions.");
action.userid=atoi(row[1]);
diff --git a/src/zabbix_server/housekeeper/housekeeper.c b/src/zabbix_server/housekeeper/housekeeper.c
index 5e516cd1..f1df28be 100644
--- a/src/zabbix_server/housekeeper/housekeeper.c
+++ b/src/zabbix_server/housekeeper/housekeeper.c
@@ -158,19 +158,19 @@ static int housekeeping_alerts(int now)
return res;
}
-static int housekeeping_alarms(int now)
+static int housekeeping_events(int now)
{
- int alarm_history;
+ int event_history;
DB_RESULT result;
DB_RESULT result2;
DB_ROW row1;
DB_ROW row2;
- int alarmid;
+ int eventid;
int res = SUCCEED;
- zabbix_log( LOG_LEVEL_DEBUG, "In housekeeping_alarms(%d)", now);
+ zabbix_log( LOG_LEVEL_DEBUG, "In housekeeping_events(%d)", now);
- result = DBselect("select alarm_history from config");
+ result = DBselect("select event_history from config");
row1=DBfetch(result);
@@ -181,16 +181,16 @@ static int housekeeping_alarms(int now)
}
else
{
- alarm_history=atoi(row1[0]);
+ event_history=atoi(row1[0]);
- result2 = DBselect("select alarmid from alarms where clock<%d", now-24*3600*alarm_history);
+ result2 = DBselect("select eventid from events where clock<%d", now-24*3600*event_history);
while((row2=DBfetch(result2)))
{
- alarmid=atoi(row2[0]);
+ eventid=atoi(row2[0]);
- DBexecute("delete from acknowledges where alarmid=%d",alarmid);
+ DBexecute("delete from acknowledges where eventid=%d",eventid);
- DBexecute("delete from alarms where alarmid=%d",alarmid);
+ DBexecute("delete from events where eventid=%d",eventid);
}
DBfree_result(result2);
@@ -318,9 +318,9 @@ int main_housekeeper_loop()
housekeeping_process_log(now);
- zbx_setproctitle("housekeeper [removing old alarms]");
+ zbx_setproctitle("housekeeper [removing old events]");
- housekeeping_alarms(now);
+ housekeeping_events(now);
zbx_setproctitle("housekeeper [removing old alerts]");
diff --git a/src/zabbix_server/nodewatcher/.deps/nodewatcher.Po b/src/zabbix_server/nodewatcher/.deps/nodewatcher.Po
index a2e2b8df..2e746cf1 100644
--- a/src/zabbix_server/nodewatcher/.deps/nodewatcher.Po
+++ b/src/zabbix_server/nodewatcher/.deps/nodewatcher.Po
@@ -8,15 +8,14 @@ nodewatcher.o nodewatcher.o: nodewatcher.c ../../../include/config.h \
/usr/include/gconv.h \
/usr/lib/gcc-lib/x86_64-linux-gnu/3.3.6/include/stdarg.h \
/usr/include/bits/stdio_lim.h /usr/include/bits/sys_errlist.h \
- /usr/include/bits/stdio.h /usr/include/stdlib.h \
- /usr/include/sys/types.h /usr/include/time.h /usr/include/endian.h \
- /usr/include/bits/endian.h /usr/include/sys/select.h \
- /usr/include/bits/select.h /usr/include/bits/sigset.h \
- /usr/include/bits/time.h /usr/include/sys/sysmacros.h \
- /usr/include/bits/pthreadtypes.h /usr/include/alloca.h \
- /usr/include/unistd.h /usr/include/bits/posix_opt.h \
- /usr/include/bits/confname.h /usr/include/getopt.h \
- /usr/include/sys/stat.h /usr/include/bits/stat.h \
+ /usr/include/stdlib.h /usr/include/sys/types.h /usr/include/time.h \
+ /usr/include/endian.h /usr/include/bits/endian.h \
+ /usr/include/sys/select.h /usr/include/bits/select.h \
+ /usr/include/bits/sigset.h /usr/include/bits/time.h \
+ /usr/include/sys/sysmacros.h /usr/include/bits/pthreadtypes.h \
+ /usr/include/alloca.h /usr/include/unistd.h \
+ /usr/include/bits/posix_opt.h /usr/include/bits/confname.h \
+ /usr/include/getopt.h /usr/include/sys/stat.h /usr/include/bits/stat.h \
/usr/include/sys/socket.h /usr/include/sys/uio.h \
/usr/include/bits/uio.h /usr/include/bits/socket.h \
/usr/lib/gcc-lib/x86_64-linux-gnu/3.3.6/include/limits.h \
@@ -34,7 +33,6 @@ nodewatcher.o nodewatcher.o: nodewatcher.c ../../../include/config.h \
/usr/include/bits/sigthread.h /usr/include/sys/resource.h \
/usr/include/bits/resource.h /usr/include/bits/waitflags.h \
/usr/include/bits/waitstatus.h /usr/include/string.h \
- /usr/include/bits/string.h /usr/include/bits/string2.h \
/usr/include/netdb.h /usr/include/rpc/netdb.h /usr/include/bits/netdb.h \
/usr/include/pwd.h /usr/include/errno.h /usr/include/bits/errno.h \
/usr/include/linux/errno.h /usr/include/asm/errno.h \
@@ -64,8 +62,8 @@ nodewatcher.o nodewatcher.o: nodewatcher.c ../../../include/config.h \
/usr/include/sys/sem.h /usr/include/bits/sem.h /usr/include/sys/shm.h \
/usr/include/bits/shm.h /usr/include/math.h \
/usr/include/bits/huge_val.h /usr/include/bits/mathdef.h \
- /usr/include/bits/mathcalls.h /usr/include/bits/mathinline.h \
- /usr/include/regex.h /usr/include/arpa/inet.h /usr/include/sys/mount.h \
+ /usr/include/bits/mathcalls.h /usr/include/regex.h \
+ /usr/include/arpa/inet.h /usr/include/sys/mount.h \
/usr/include/sys/ioctl.h /usr/include/bits/ioctls.h \
/usr/include/asm/ioctls.h /usr/include/asm-x86_64/ioctls.h \
/usr/include/asm/ioctl.h /usr/include/asm-x86_64/ioctl.h \
@@ -112,8 +110,6 @@ nodewatcher.o nodewatcher.o: nodewatcher.c ../../../include/config.h \
/usr/include/bits/sys_errlist.h:
-/usr/include/bits/stdio.h:
-
/usr/include/stdlib.h:
/usr/include/sys/types.h:
@@ -216,10 +212,6 @@ nodewatcher.o nodewatcher.o: nodewatcher.c ../../../include/config.h \
/usr/include/string.h:
-/usr/include/bits/string.h:
-
-/usr/include/bits/string2.h:
-
/usr/include/netdb.h:
/usr/include/rpc/netdb.h:
@@ -354,8 +346,6 @@ nodewatcher.o nodewatcher.o: nodewatcher.c ../../../include/config.h \
/usr/include/bits/mathcalls.h:
-/usr/include/bits/mathinline.h:
-
/usr/include/regex.h:
/usr/include/arpa/inet.h:
diff --git a/src/zabbix_server/nodewatcher/nodesender.c b/src/zabbix_server/nodewatcher/nodesender.c
index a01eef64..10ef78ef 100644
--- a/src/zabbix_server/nodewatcher/nodesender.c
+++ b/src/zabbix_server/nodewatcher/nodesender.c
@@ -214,7 +214,7 @@ static int send_to_node(int dest_nodeid, int nodeid, char *xml)
* Comments: *
* *
******************************************************************************/
-static int send_config_data(int nodeid, int dest_nodeid, int maxlogid, int node_type)
+static int send_config_data(int nodeid, int dest_nodeid, zbx_uint64_t maxlogid, int node_type)
{
DB_RESULT result;
DB_RESULT result2;
@@ -237,11 +237,11 @@ static int send_config_data(int nodeid, int dest_nodeid, int maxlogid, int node_
/* Begin work */
if(node_type == ZBX_NODE_MASTER)
{
- result=DBselect("select tablename,recordid,operation from node_configlog where nodeid=%d and sync_master=0 and conflogid<=%d order by tablename,operation", nodeid, maxlogid);
+ result=DBselect("select tablename,recordid,operation from node_configlog where nodeid=" ZBX_FS_UI64 " and sync_master=0 and conflogid<=" ZBX_FS_UI64 " order by tablename,operation", nodeid, maxlogid);
}
else
{
- result=DBselect("select tablename,recordid,operation from node_configlog where nodeid=%d and sync_slave=0 and conflogid<=%d order by tablename,operation", nodeid, maxlogid);
+ result=DBselect("select tablename,recordid,operation from node_configlog where nodeid=" ZBX_FS_UI64 " and sync_slave=0 and conflogid<=" ZBX_FS_UI64 " order by tablename,operation", nodeid, maxlogid);
}
// snprintf(tmp,sizeof(tmp),"<Data type='config'>\n<Node id='%d'>\n</Node>\n<Version>1.4</Version>\n<Records>\n", nodeid);
@@ -334,11 +334,11 @@ static int send_config_data(int nodeid, int dest_nodeid, int maxlogid, int node_
{
if(node_type == ZBX_NODE_MASTER)
{
- DBexecute("update node_configlog set sync_master=1 where nodeid=%d and sync_master=0 and conflogid<=%d", nodeid, maxlogid);
+ DBexecute("update node_configlog set sync_master=1 where nodeid=%d and sync_master=0 and conflogid<=" ZBX_FS_UI64, nodeid, maxlogid);
}
else
{
- DBexecute("update node_configlog set sync_slave=1 where nodeid=%d and sync_slave=0 and conflogid<=%d", nodeid, maxlogid);
+ DBexecute("update node_configlog set sync_slave=1 where nodeid=%d and sync_slave=0 and conflogid<=" ZBX_FS_UI64, nodeid, maxlogid);
}
}
@@ -453,12 +453,12 @@ static int send_to_master_and_slave(int nodeid)
DB_ROW row;
int master_nodeid, slave_nodeid;
int master_result, slave_result;
- int maxlogid;
+ zbx_uint64_t maxlogid;
// zabbix_log( LOG_LEVEL_WARNING, "In send_to_master_and_slave(local:%d,node:%d)",local_nodeid, nodeid);
/* Begin work */
- result = DBselect("select min(conflogid),max(conflogid) from node_configlog where nodeid=%d", nodeid);
+ result = DBselect("select max(conflogid) from node_configlog where nodeid=%d", nodeid);
row = DBfetch(result);
@@ -468,16 +468,7 @@ static int send_to_master_and_slave(int nodeid)
DBfree_result(result);
return SUCCEED;
}
- if(atoi(row[1])-atoi(row[0])>200)
- {
-// Limit number of config changes to send in one go
-// maxlogid = atoi(row[0])+200;
- maxlogid = atoi(row[1]);
- }
- else
- {
- maxlogid = atoi(row[1]);
- }
+ sscanf(row[0], ZBX_FS_UI64, &maxlogid);
DBfree_result(result);
@@ -503,7 +494,7 @@ static int send_to_master_and_slave(int nodeid)
{
if((master_result == SUCCEED) && (slave_result == SUCCEED))
{
- DBexecute("delete from node_configlog where nodeid=%d and sync_slave=1 and sync_master=1 and conflogid<=%d", nodeid, maxlogid);
+ DBexecute("delete from node_configlog where nodeid=%d and sync_slave=1 and sync_master=1 and conflogid<=" ZBX_FS_UI64, nodeid, maxlogid);
// zabbix_log(LOG_LEVEL_WARNING,"delete from node_configlog where nodeid=%d and sync_slave=1 and sync_master=1 and conflogid<=%d", nodeid, maxlogid);
}
}
@@ -512,7 +503,7 @@ static int send_to_master_and_slave(int nodeid)
{
if(master_result == SUCCEED)
{
- DBexecute("delete from node_configlog where nodeid=%d and sync_master=1 and conflogid<=%d", nodeid, maxlogid);
+ DBexecute("delete from node_configlog where nodeid=%d and sync_master=1 and conflogid<=" ZBX_FS_UI64, nodeid, maxlogid);
// zabbix_log(LOG_LEVEL_WARNING,"delete from node_configlog where nodeid=%d and sync_master=1 and conflogid<=%d", nodeid, maxlogid);
}
}
@@ -521,7 +512,7 @@ static int send_to_master_and_slave(int nodeid)
{
if(slave_result == SUCCEED)
{
- DBexecute("delete from node_configlog where nodeid=%d and sync_slave=1 and conflogid<=%d", nodeid, maxlogid);
+ DBexecute("delete from node_configlog where nodeid=%d and sync_slave=1 and conflogid<=" ZBX_FS_UI64, nodeid, maxlogid);
// zabbix_log(LOG_LEVEL_WARNING,"delete from node_configlog where nodeid=%d and sync_slave=1 and conflogid<=%d", nodeid, maxlogid);
}
}
diff --git a/src/zabbix_server/nodewatcher/nodewatcher.c b/src/zabbix_server/nodewatcher/nodewatcher.c
index 3ec605eb..66a147de 100644
--- a/src/zabbix_server/nodewatcher/nodewatcher.c
+++ b/src/zabbix_server/nodewatcher/nodewatcher.c
@@ -82,6 +82,9 @@ static int calculate_checksums()
DB_RESULT result2;
DB_ROW row;
DB_ROW row2;
+ int nodeid;
+
+ int now;
// zabbix_log( LOG_LEVEL_WARNING, "In calculate_checksums");
DBexecute("delete from node_cksum where cksumtype=%d", NODE_CKSUM_TYPE_NEW);
@@ -92,6 +95,9 @@ static int calculate_checksums()
result =DBselect(sql);
while((row=DBfetch(result)))
{
+ now = time(NULL);
+ nodeid = atoi(row[0]);
+
zbx_snprintf(sql,sizeof(sql),"select 'table ','field ',itemid, '012345678901234' from items where 1=0\n");
for(i=0;tables[i].table!=0;i++)
@@ -119,22 +125,31 @@ static int calculate_checksums()
if(fields[0]!=0) fields[strlen(fields)-1] = 0;
// select table,recid,md5(fields) from table union all ...
- zbx_snprintf(tmp,sizeof(tmp),"union all select '%s','%s',%s,md5(concat(%s)) from %s where mod(%s,100)=%s\n",
- tables[i].table, tables[i].recid, tables[i].recid, fields, tables[i].table, tables[i].recid, row[0]);
+ zbx_snprintf(tmp,sizeof(tmp),"union all select '%s','%s',%s,md5(concat(%s)) from %s where %s>=" ZBX_FS_UI64 " and %s<=" ZBX_FS_UI64 "\n",
+ tables[i].table, tables[i].recid, tables[i].recid, fields, tables[i].table,
+ tables[i].recid, (zbx_uint64_t)100000000000000*(zbx_uint64_t)nodeid,
+ tables[i].recid, (zbx_uint64_t)100000000000000*(zbx_uint64_t)nodeid+99999999999999);
+// zabbix_log( LOG_LEVEL_WARNING, "TMP [%s]", tmp);
strncat(sql,tmp,sizeof(sql));
}
// zabbix_log( LOG_LEVEL_WARNING, "SQL [%s]", sql);
result2 =DBselect(sql);
+
+ zabbix_log( LOG_LEVEL_WARNING, "Selected records in %d seconds", time(NULL)-now);
+ now = time(NULL);
+ i=0;
while((row2=DBfetch(result2)))
{
// zabbix_log( LOG_LEVEL_WARNING, "Cksum [%s]", row2[3]);
DBexecute("insert into node_cksum (cksumid,nodeid,tablename,fieldname,recordid,cksumtype,cksum)"\
- "values (" ZBX_FS_UI64 ",%s,'%s','%s',%s,%d,'%s')",
+ "values (" ZBX_FS_UI64 ",%d,'%s','%s',%s,%d,'%s')",
DBget_nextid("node_cksum","cksumid"),
- row[0],row2[0],row2[1],row2[2],NODE_CKSUM_TYPE_NEW,row2[3]);
+ nodeid,row2[0],row2[1],row2[2],NODE_CKSUM_TYPE_NEW,row2[3]);
+ i++;
}
DBfree_result(result2);
+ zabbix_log( LOG_LEVEL_WARNING, "Added %d records in %d seconds", i, time(NULL)-now);
}
DBfree_result(result);
@@ -264,6 +279,7 @@ int main_nodewatcher_loop()
{
zbx_setproctitle("connecting to the database");
+// zabbix_log( LOG_LEVEL_WARNING, "Starting sync with nodes");
DBconnect();
calculate_checksums();
diff --git a/src/zabbix_server/trapper/nodesync.c b/src/zabbix_server/trapper/nodesync.c
index 8462701a..a85d1eef 100644
--- a/src/zabbix_server/trapper/nodesync.c
+++ b/src/zabbix_server/trapper/nodesync.c
@@ -89,7 +89,7 @@ static int process_record(int nodeid, char *record)
{
char tablename[MAX_STRING_LEN];
char fieldname[MAX_STRING_LEN];
- int recid;
+ zbx_uint64_t recid;
int op;
int valuetype;
char value[MAX_STRING_LEN];
@@ -108,7 +108,7 @@ static int process_record(int nodeid, char *record)
get_field(record,tablename,0);
get_field(record,tmp,1);
- recid=atoi(tmp);
+ sscanf(tmp,ZBX_FS_UI64,&recid);
get_field(record,tmp,2);
op=atoi(tmp);
@@ -128,7 +128,7 @@ static int process_record(int nodeid, char *record)
}
if(op==NODE_CONFIGLOG_OP_DELETE)
{
- zbx_snprintf(tmp,sizeof(tmp),"delete from %s where %s=%d and nodeid=%d", tablename, key, recid, nodeid);
+ zbx_snprintf(tmp,sizeof(tmp),"delete from %s where %s=" ZBX_FS_UI64 " and nodeid=%d", tablename, key, recid, nodeid);
zabbix_log( LOG_LEVEL_WARNING, "SQL [%s]", sql);
return SUCCEED;
}
@@ -193,15 +193,15 @@ static int process_record(int nodeid, char *record)
{
// zbx_snprintf(tmp,sizeof(tmp),"%s='%s',", fieldname, value);
// strncat(fields,tmp,sizeof(fields));
- zbx_snprintf(sql,sizeof(sql),"update %s set %s where %s=%d", tablename, fields_update, key, recid);
+ zbx_snprintf(sql,sizeof(sql),"update %s set %s where %s=" ZBX_FS_UI64, tablename, fields_update, key, recid);
}
else if(op==NODE_CONFIGLOG_OP_ADD)
{
- result = DBselect("select 0 from %s where %s=%d", tablename, key, recid);
+ result = DBselect("select 0 from %s where %s=" ZBX_FS_UI64, tablename, key, recid);
row = DBfetch(result);
if(row)
{
- zbx_snprintf(sql,sizeof(sql),"update %s set %s where %s=%d", tablename, fields_update, key, recid);
+ zbx_snprintf(sql,sizeof(sql),"update %s set %s where %s=" ZBX_FS_UI64, tablename, fields_update, key, recid);
}
else
{