diff options
| author | hugetoad <hugetoad@97f52cf1-0a1b-0410-bd0e-c28be96e8082> | 2005-11-17 08:32:21 +0000 |
|---|---|---|
| committer | hugetoad <hugetoad@97f52cf1-0a1b-0410-bd0e-c28be96e8082> | 2005-11-17 08:32:21 +0000 |
| commit | fbd1e76e0b40874b0ace0a0ac6bd9a4a888b1fa4 (patch) | |
| tree | 907565094512269614f3d6f00ce6295e8c5cafa3 /src/zabbix_server/pinger/pinger.c | |
| parent | cbd2c53907b42b4cdabaf3b12f8c831c420fa6d7 (diff) | |
| download | zabbix-fbd1e76e0b40874b0ace0a0ac6bd9a4a888b1fa4.tar.gz zabbix-fbd1e76e0b40874b0ace0a0ac6bd9a4a888b1fa4.tar.xz zabbix-fbd1e76e0b40874b0ace0a0ac6bd9a4a888b1fa4.zip | |
Minor cleanup.
git-svn-id: svn://svn.zabbix.com/trunk@2329 97f52cf1-0a1b-0410-bd0e-c28be96e8082
Diffstat (limited to 'src/zabbix_server/pinger/pinger.c')
| -rw-r--r-- | src/zabbix_server/pinger/pinger.c | 26 |
1 files changed, 20 insertions, 6 deletions
diff --git a/src/zabbix_server/pinger/pinger.c b/src/zabbix_server/pinger/pinger.c index c95b5586..839f876a 100644 --- a/src/zabbix_server/pinger/pinger.c +++ b/src/zabbix_server/pinger/pinger.c @@ -120,7 +120,7 @@ static int is_ip(char *ip) * Comments: can be done in process_data() * * * ******************************************************************************/ -static int process_value(char *key, char *host, char *value) +static int process_value(char *key, char *host, AGENT_RESULT *value) { char sql[MAX_STRING_LEN]; @@ -296,6 +296,7 @@ static int do_ping(void) double mseconds; char *c; int alive; + AGENT_RESULT value; zabbix_log( LOG_LEVEL_DEBUG, "In do_ping()"); @@ -331,16 +332,29 @@ static int do_ping(void) { *c=0; zabbix_log( LOG_LEVEL_DEBUG, "IP [%s] alive [%d]", ip, alive); + if(0 == alive) { - process_value(SERVER_ICMPPING_KEY,ip,"0"); - process_value(SERVER_ICMPPINGSEC_KEY,ip,"0"); + init_result(&value); + value.type |= AR_DOUBLE; + + value.dbl = (double)0; + process_value(SERVER_ICMPPING_KEY,ip,&value); + value.dbl = (double)0; + process_value(SERVER_ICMPPINGSEC_KEY,ip,&value); + + free_result(&value); } else { - snprintf(tmp,sizeof(tmp)-1,"%f",mseconds/1000); - process_value(SERVER_ICMPPING_KEY,ip,"1"); - process_value(SERVER_ICMPPINGSEC_KEY,ip,tmp); + init_result(&value); + value.type |= AR_DOUBLE; + + value.dbl = (double)1; + process_value(SERVER_ICMPPING_KEY,ip,&value); + value.dbl = (double)(mseconds/1000); + process_value(SERVER_ICMPPINGSEC_KEY,ip,&value); + free_result(&value); } } } |
