diff options
| author | hugetoad <hugetoad@97f52cf1-0a1b-0410-bd0e-c28be96e8082> | 2003-10-17 09:34:54 +0000 |
|---|---|---|
| committer | hugetoad <hugetoad@97f52cf1-0a1b-0410-bd0e-c28be96e8082> | 2003-10-17 09:34:54 +0000 |
| commit | e3eca8ce0ecfaf8fbb40c2de6099bf1dfe811ca9 (patch) | |
| tree | 904b9441b9bb0688ddf6e1d89e5603222125529a /src | |
| parent | 622a603eec30f6bf1d65218dc0e9ca861e16e12c (diff) | |
| download | zabbix-e3eca8ce0ecfaf8fbb40c2de6099bf1dfe811ca9.tar.gz zabbix-e3eca8ce0ecfaf8fbb40c2de6099bf1dfe811ca9.tar.xz zabbix-e3eca8ce0ecfaf8fbb40c2de6099bf1dfe811ca9.zip | |
- support of delta flag in item definition (Alexei)
git-svn-id: svn://svn.zabbix.com/trunk@994 97f52cf1-0a1b-0410-bd0e-c28be96e8082
Diffstat (limited to 'src')
| -rw-r--r-- | src/zabbix_sucker/zabbix_sucker.c | 29 |
1 files changed, 24 insertions, 5 deletions
diff --git a/src/zabbix_sucker/zabbix_sucker.c b/src/zabbix_sucker/zabbix_sucker.c index c803a5e5..7c598f82 100644 --- a/src/zabbix_sucker/zabbix_sucker.c +++ b/src/zabbix_sucker/zabbix_sucker.c @@ -803,11 +803,8 @@ int get_values(void) int network_errors; now = time(NULL); -#ifdef TESTTEST - sprintf(sql,"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,i.snmp_port from items i,hosts h where i.nextcheck<=%d and i.status=0 and (h.status=0 or (h.status=2 and h.disable_until<=%d)) and h.hostid=i.hostid and h.hostid%%%d=%d and i.key_<>'%s' order by i.nextcheck", now, now, CONFIG_SUCKERD_FORKS-4,sucker_num-4,SERVER_STATUS_KEY); -#else - sprintf(sql,"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 from items i,hosts h where i.nextcheck<=%d and i.status=%d and i.type not in (%d) and (h.status=%d or (h.status=%d and h.disable_until<=%d)) and h.hostid=i.hostid and i.itemid%%%d=%d and i.key_<>'%s' and i.key_<>'%s' order by i.nextcheck", now, ITEM_STATUS_ACTIVE, ITEM_TYPE_TRAPPER, HOST_STATUS_MONITORED, HOST_STATUS_UNREACHABLE, now, CONFIG_SUCKERD_FORKS-4,sucker_num-4,SERVER_STATUS_KEY, SERVER_ICMPPING_KEY); -#endif + + sprintf(sql,"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 from items i,hosts h where i.nextcheck<=%d and i.status=%d and i.type not in (%d) and (h.status=%d or (h.status=%d and h.disable_until<=%d)) and h.hostid=i.hostid and i.itemid%%%d=%d and i.key_<>'%s' and i.key_<>'%s' order by i.nextcheck", now, ITEM_STATUS_ACTIVE, ITEM_TYPE_TRAPPER, HOST_STATUS_MONITORED, HOST_STATUS_UNREACHABLE, now, CONFIG_SUCKERD_FORKS-4,sucker_num-4,SERVER_STATUS_KEY, SERVER_ICMPPING_KEY); result = DBselect(sql); for(i=0;i<DBnum_rows(result);i++) @@ -853,6 +850,28 @@ int get_values(void) network_errors=atoi(DBget_field(result,i,18)); item.snmp_port=atoi(DBget_field(result,i,19)); + item.delta=atoi(DBget_field(result,i,20)); + + s=DBget_field(result,i,21); + if(s==NULL) + { + item.prevorgvalue_null=1; + } + else + { + item.prevorgvalue_null=0; + item.prevorgvalue=atof(s); + } + s=DBget_field(result,i,22); + if(s==NULL) + { + item.lastclock=0; + } + else + { + item.lastclock=atoi(s); + } + res = get_value(&value,value_str,&item); zabbix_log( LOG_LEVEL_DEBUG, "GOT VALUE [%s]", value_str ); |
