summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorhugetoad <hugetoad@97f52cf1-0a1b-0410-bd0e-c28be96e8082>2005-12-30 09:55:32 +0000
committerhugetoad <hugetoad@97f52cf1-0a1b-0410-bd0e-c28be96e8082>2005-12-30 09:55:32 +0000
commitd5dce47a8b216a4db6ba2d075edd0e2de7556b6a (patch)
treea8f5c1292819773f054df4be577e80707ac3e3bd /src
parent30032180cbe3735bcb119b8a477c42eddf50d2f2 (diff)
- fixed processing of Delta (Alexei)
git-svn-id: svn://svn.zabbix.com/trunk@2457 97f52cf1-0a1b-0410-bd0e-c28be96e8082
Diffstat (limited to 'src')
-rw-r--r--src/libs/zbxdbhigh/db.c2
-rw-r--r--src/zabbix_server/evalfunc.c2
-rw-r--r--src/zabbix_server/functions.c15
-rw-r--r--src/zabbix_server/poller/poller.c4
-rw-r--r--src/zabbix_server/timer/timer.c2
-rw-r--r--src/zabbix_server/zlog.c2
6 files changed, 17 insertions, 10 deletions
diff --git a/src/libs/zbxdbhigh/db.c b/src/libs/zbxdbhigh/db.c
index 60286f45..933903b5 100644
--- a/src/libs/zbxdbhigh/db.c
+++ b/src/libs/zbxdbhigh/db.c
@@ -1417,6 +1417,8 @@ void DBget_item_from_db(DB_ITEM *item,DB_RESULT *result, int row)
item->formula = DBget_field(result,i,29);
item->host_available=atoi(DBget_field(result,i,30));
item->status=atoi(DBget_field(result,i,31));
+ item->trapper_hosts=DBget_field(result,i,32);
+ item->logtimefmt=DBget_field(result,i,33);
}
int DBget_default_escalation_id()
diff --git a/src/zabbix_server/evalfunc.c b/src/zabbix_server/evalfunc.c
index fd439f93..727cb3aa 100644
--- a/src/zabbix_server/evalfunc.c
+++ b/src/zabbix_server/evalfunc.c
@@ -731,7 +731,7 @@ int evaluate_FUNCTION2(char *value,char *host,char *key,char *function,char *par
zabbix_log(LOG_LEVEL_DEBUG, "In get_lastvalue()" );
- snprintf(sql,sizeof(sql)-1,"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.network_errors,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 from items i,hosts h where h.host='%s' and h.hostid=i.hostid and i.key_='%s'", host, key );
+ snprintf(sql,sizeof(sql)-1,"select %s from items i,hosts h where h.host='%s' and h.hostid=i.hostid and i.key_='%s'", ZBX_SQL_ITEM_SELECT, host, key );
result = DBselect(sql);
if(DBnum_rows(result) == 0)
diff --git a/src/zabbix_server/functions.c b/src/zabbix_server/functions.c
index 5fae4c21..b04343cd 100644
--- a/src/zabbix_server/functions.c
+++ b/src/zabbix_server/functions.c
@@ -413,7 +413,9 @@ int process_data(int sockfd,char *server,char *key,char *value,char *lastlogsize
init_result(&agent);
- snprintf(sql,sizeof(sql)-1,"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.value_type,i.trapper_hosts,i.delta,i.units,i.multiplier,i.formula,i.logtimefmt from items i,hosts h where h.status=%d and h.hostid=i.hostid and h.host='%s' and i.key_='%s' and i.status=%d and i.type in (%d,%d)", HOST_STATUS_MONITORED, server, key, ITEM_STATUS_ACTIVE, ITEM_TYPE_TRAPPER, ITEM_TYPE_ZABBIX_ACTIVE);
+/* snprintf(sql,sizeof(sql)-1,"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.value_type,i.trapper_hosts,i.delta,i.units,i.multiplier,i.formula,i.logtimefmt from items i,hosts h where h.status=%d and h.hostid=i.hostid and h.host='%s' and i.key_='%s' and i.status=%d and i.type in (%d,%d)", HOST_STATUS_MONITORED, server, key, ITEM_STATUS_ACTIVE, ITEM_TYPE_TRAPPER, ITEM_TYPE_ZABBIX_ACTIVE);*/
+ snprintf(sql,sizeof(sql)-1,"select %s where h.status=%d and h.hostid=i.hostid and h.host='%s' and i.key_='%s' and i.status=%d and i.type in (%d,%d)", ZBX_SQL_ITEM_SELECT, HOST_STATUS_MONITORED, server, key, ITEM_STATUS_ACTIVE, ITEM_TYPE_TRAPPER, ITEM_TYPE_ZABBIX_ACTIVE);
+
result = DBselect(sql);
if(DBnum_rows(result) == 0)
@@ -438,11 +440,13 @@ int process_data(int sockfd,char *server,char *key,char *value,char *lastlogsize
}
}
- item.itemid=atoi(DBget_field(result,0,0));
+ DBget_item_from_db(&item,result,0);
+
+/* item.itemid=atoi(DBget_field(result,0,0));
strscpy(item.key,DBget_field(result,0,1));
item.host=DBget_field(result,0,2);
item.type=atoi(DBget_field(result,0,7));
- item.trapper_hosts=DBget_field(result,0,16);
+ item.trapper_hosts=DBget_field(result,0,16);*/
if( (item.type==ITEM_TYPE_ZABBIX_ACTIVE) && (check_security(sockfd,item.trapper_hosts,1) == FAIL))
{
@@ -459,7 +463,7 @@ int process_data(int sockfd,char *server,char *key,char *value,char *lastlogsize
DBupdate_item_status_to_notsupported(item.itemid, "Not supported by agent");
}
- item.port=atoi(DBget_field(result,0,3));
+/* item.port=atoi(DBget_field(result,0,3));
item.delay=atoi(DBget_field(result,0,4));
item.description=DBget_field(result,0,5);
item.nextcheck=atoi(DBget_field(result,0,6));
@@ -495,7 +499,7 @@ int process_data(int sockfd,char *server,char *key,char *value,char *lastlogsize
item.units=DBget_field(result,0,18);
item.multiplier=atoi(DBget_field(result,0,19));
item.formula=DBget_field(result,0,20);
- item.logtimefmt=DBget_field(result,0,21);
+ item.logtimefmt=DBget_field(result,0,21);*/
s=value;
if( (strncmp(item.key,"log[",4)==0) ||
@@ -582,6 +586,7 @@ static int add_history(DB_ITEM *item, AGENT_RESULT *value, int now)
/* Delta as speed of change */
else if(item->delta == ITEM_STORE_SPEED_PER_SECOND)
{
+ zabbix_log( LOG_LEVEL_WARNING, "ITEM_STORE_SPEED_PER_SECOND(%s,%f,%f)", item->key, item->prevorgvalue, value->dbl);
/* Save delta */
if( (item->value_type==ITEM_VALUE_TYPE_FLOAT) && (value->type & AR_DOUBLE))
{
diff --git a/src/zabbix_server/poller/poller.c b/src/zabbix_server/poller/poller.c
index 10f3a413..cea42ee8 100644
--- a/src/zabbix_server/poller/poller.c
+++ b/src/zabbix_server/poller/poller.c
@@ -213,11 +213,11 @@ int get_values(void)
if(CONFIG_REFRESH_UNSUPPORTED != 0)
{
- snprintf(sql,sizeof(sql)-1,"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.network_errors,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 from items i,hosts h where i.nextcheck<=%d and i.status in (%d,%d) and i.type not in (%d,%d) and ((h.status=%d and h.available!=%d) or (h.status=%d and h.available=%d and h.disable_until<=%d)) and h.hostid=i.hostid and i.itemid%%%d=%d and i.key_ not in ('%s','%s','%s','%s') order by i.nextcheck", now, ITEM_STATUS_ACTIVE, ITEM_STATUS_NOTSUPPORTED, ITEM_TYPE_TRAPPER, ITEM_TYPE_ZABBIX_ACTIVE, HOST_STATUS_MONITORED, HOST_AVAILABLE_FALSE, HOST_STATUS_MONITORED, HOST_AVAILABLE_FALSE, now, CONFIG_SUCKERD_FORKS-5,server_num-5,SERVER_STATUS_KEY, SERVER_ICMPPING_KEY, SERVER_ICMPPINGSEC_KEY,SERVER_ZABBIXLOG_KEY);
+ snprintf(sql,sizeof(sql)-1,"select %s where i.nextcheck<=%d and i.status in (%d,%d) and i.type not in (%d,%d) and ((h.status=%d and h.available!=%d) or (h.status=%d and h.available=%d and h.disable_until<=%d)) and h.hostid=i.hostid and i.itemid%%%d=%d and i.key_ not in ('%s','%s','%s','%s') order by i.nextcheck", ZBX_SQL_ITEM_SELECT, now, ITEM_STATUS_ACTIVE, ITEM_STATUS_NOTSUPPORTED, ITEM_TYPE_TRAPPER, ITEM_TYPE_ZABBIX_ACTIVE, HOST_STATUS_MONITORED, HOST_AVAILABLE_FALSE, HOST_STATUS_MONITORED, HOST_AVAILABLE_FALSE, now, CONFIG_SUCKERD_FORKS-5,server_num-5,SERVER_STATUS_KEY, SERVER_ICMPPING_KEY, SERVER_ICMPPINGSEC_KEY,SERVER_ZABBIXLOG_KEY);
}
else
{
- snprintf(sql,sizeof(sql)-1,"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.network_errors,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 from items i,hosts h where i.nextcheck<=%d and i.status in (%d) and i.type not in (%d,%d) and ((h.status=%d and h.available!=%d) or (h.status=%d and h.available=%d and h.disable_until<=%d)) and h.hostid=i.hostid and i.itemid%%%d=%d and i.key_ not in ('%s','%s','%s','%s') order by i.nextcheck", now, ITEM_STATUS_ACTIVE, ITEM_TYPE_TRAPPER, ITEM_TYPE_ZABBIX_ACTIVE, HOST_STATUS_MONITORED, HOST_AVAILABLE_FALSE, HOST_STATUS_MONITORED, HOST_AVAILABLE_FALSE, now, CONFIG_SUCKERD_FORKS-5,server_num-5,SERVER_STATUS_KEY, SERVER_ICMPPING_KEY, SERVER_ICMPPINGSEC_KEY,SERVER_ZABBIXLOG_KEY);
+ snprintf(sql,sizeof(sql)-1,"select %s where i.nextcheck<=%d and i.status in (%d) and i.type not in (%d,%d) and ((h.status=%d and h.available!=%d) or (h.status=%d and h.available=%d and h.disable_until<=%d)) and h.hostid=i.hostid and i.itemid%%%d=%d and i.key_ not in ('%s','%s','%s','%s') order by i.nextcheck", ZBX_SQL_ITEM_SELECT, now, ITEM_STATUS_ACTIVE, ITEM_TYPE_TRAPPER, ITEM_TYPE_ZABBIX_ACTIVE, HOST_STATUS_MONITORED, HOST_AVAILABLE_FALSE, HOST_STATUS_MONITORED, HOST_AVAILABLE_FALSE, now, CONFIG_SUCKERD_FORKS-5,server_num-5,SERVER_STATUS_KEY, SERVER_ICMPPING_KEY, SERVER_ICMPPINGSEC_KEY,SERVER_ZABBIXLOG_KEY);
}
result = DBselect(sql);
diff --git a/src/zabbix_server/timer/timer.c b/src/zabbix_server/timer/timer.c
index a71df992..ce961765 100644
--- a/src/zabbix_server/timer/timer.c
+++ b/src/zabbix_server/timer/timer.c
@@ -91,7 +91,7 @@ void main_timer_loop()
#endif
*/
- snprintf(sql,sizeof(sql)-1,"select distinct 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.network_errors,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 from items i,hosts h, functions f where h.hostid=i.hostid and h.status=%d and i.status=%d and f.function in ('nodata','date','dayofweek','time','now') and i.itemid=f.itemid", HOST_STATUS_MONITORED, ITEM_STATUS_ACTIVE);
+ snprintf(sql,sizeof(sql)-1,"select distinct %s, functions f where h.hostid=i.hostid and h.status=%d and i.status=%d and f.function in ('nodata','date','dayofweek','time','now') and i.itemid=f.itemid", ZBX_SQL_ITEM_SELECT, HOST_STATUS_MONITORED, ITEM_STATUS_ACTIVE);
result = DBselect(sql);
diff --git a/src/zabbix_server/zlog.c b/src/zabbix_server/zlog.c
index b0bfb85c..02c39fbf 100644
--- a/src/zabbix_server/zlog.c
+++ b/src/zabbix_server/zlog.c
@@ -63,7 +63,7 @@ void zabbix_syslog(const char *fmt, ...)
zabbix_log(LOG_LEVEL_DEBUG, "In zabbix_log()");
- snprintf(sql,sizeof(sql)-1,"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.network_errors,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 from items i,hosts h where h.hostid=i.hostid and i.key_='%s' and i.value_type=%d", SERVER_ZABBIXLOG_KEY,ITEM_VALUE_TYPE_STR);
+ snprintf(sql,sizeof(sql)-1,"select %s from items i,hosts h where h.hostid=i.hostid and i.key_='%s' and i.value_type=%d", ZBX_SQL_ITEM_SELECT, SERVER_ZABBIXLOG_KEY, ITEM_VALUE_TYPE_STR);
result = DBselect(sql);
if( DBnum_rows(result) == 0)