diff options
author | hugetoad <hugetoad@97f52cf1-0a1b-0410-bd0e-c28be96e8082> | 2005-12-10 14:18:33 +0000 |
---|---|---|
committer | hugetoad <hugetoad@97f52cf1-0a1b-0410-bd0e-c28be96e8082> | 2005-12-10 14:18:33 +0000 |
commit | 270697e5530038a74ecceff7b3d500eb09f32978 (patch) | |
tree | fd9cf7c94c82d35d254bd84affb49eff8c2d32dc /src/zabbix_server/poller | |
parent | 33c537482ce46bb741ab698de5079a5f2a98c055 (diff) | |
download | zabbix-270697e5530038a74ecceff7b3d500eb09f32978.tar.gz zabbix-270697e5530038a74ecceff7b3d500eb09f32978.tar.xz zabbix-270697e5530038a74ecceff7b3d500eb09f32978.zip |
- fixed nodata() processing when used with host 'status' (Alexei)
git-svn-id: svn://svn.zabbix.com/trunk@2403 97f52cf1-0a1b-0410-bd0e-c28be96e8082
Diffstat (limited to 'src/zabbix_server/poller')
-rw-r--r-- | src/zabbix_server/poller/poller.c | 30 |
1 files changed, 16 insertions, 14 deletions
diff --git a/src/zabbix_server/poller/poller.c b/src/zabbix_server/poller/poller.c index 36336bc7..9ade80b2 100644 --- a/src/zabbix_server/poller/poller.c +++ b/src/zabbix_server/poller/poller.c @@ -155,7 +155,7 @@ static void update_key_status(int hostid,int host_status) zabbix_log(LOG_LEVEL_DEBUG, "In update_key_status()"); - 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 from items i,hosts h where h.hostid=i.hostid and h.hostid=%d and i.key_='%s'", hostid,SERVER_STATUS_KEY); + 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 h.hostid=%d and i.key_='%s'", hostid,SERVER_STATUS_KEY); result = DBselect(sql); if( DBnum_rows(result) == 0) @@ -165,16 +165,17 @@ static void update_key_status(int hostid,int host_status) else { DBget_item_from_db(&item,result,0); - -/* snprintf(value_str,sizeof(value_str)-1,"%d",host_status);*/ - init_result(&agent); - SET_UI64_RESULT(&agent, host_status); - process_new_value(&item,&agent); -/* process_new_value(&item,value_str);*/ - free_result(&agent); +/* Do not process new value for status, if previous status is the same */ + if(cmp_double(item.lastvalue, (double)host_status) == 1) + { + init_result(&agent); + SET_UI64_RESULT(&agent, host_status); + process_new_value(&item,&agent); + free_result(&agent); - update_triggers(item.itemid); + update_triggers(item.itemid); + } } DBfree_result(result); @@ -241,11 +242,11 @@ int get_values(void) /* if(HOST_STATUS_UNREACHABLE == item.host_status)*/ if(HOST_AVAILABLE_TRUE != item.host_available) { - item.host_available=HOST_AVAILABLE_TRUE; zabbix_log( LOG_LEVEL_WARNING, "Enabling host [%s]", item.host ); zabbix_syslog("Enabling host [%s]", item.host ); DBupdate_host_availability(item.hostid,HOST_AVAILABLE_TRUE,now,agent.msg); - update_key_status(item.hostid,HOST_STATUS_MONITORED); + update_key_status(item.hostid, HOST_STATUS_MONITORED); /* 0 */ + item.host_available=HOST_AVAILABLE_TRUE; /* Why this break??? Trigger needs to be updated anyway! break;*/ @@ -267,11 +268,11 @@ int get_values(void) /* if(HOST_STATUS_UNREACHABLE == item.host_status)*/ if(HOST_AVAILABLE_TRUE != item.host_available) { - item.host_available=HOST_AVAILABLE_TRUE; zabbix_log( LOG_LEVEL_WARNING, "Enabling host [%s]", item.host ); zabbix_syslog("Enabling host [%s]", item.host ); DBupdate_host_availability(item.hostid,HOST_AVAILABLE_TRUE,now,agent.msg); - update_key_status(item.hostid,HOST_STATUS_MONITORED); + update_key_status(item.hostid, HOST_STATUS_MONITORED); /* 0 */ + item.host_available=HOST_AVAILABLE_TRUE; stop=1; } @@ -285,7 +286,8 @@ int get_values(void) zabbix_log( LOG_LEVEL_WARNING, "Host [%s] will be checked after [%d] seconds", item.host, DELAY_ON_NETWORK_FAILURE ); zabbix_syslog("Host [%s] will be checked after [%d] seconds", item.host, DELAY_ON_NETWORK_FAILURE ); DBupdate_host_availability(item.hostid,HOST_AVAILABLE_FALSE,now,agent.msg); - update_key_status(item.hostid,HOST_AVAILABLE_FALSE); + update_key_status(item.hostid,HOST_AVAILABLE_FALSE); /* 2 */ + item.host_available=HOST_AVAILABLE_FALSE; snprintf(sql,sizeof(sql)-1,"update hosts set network_errors=3 where hostid=%d", item.hostid); DBexecute(sql); |