diff options
| author | alex <alex@97f52cf1-0a1b-0410-bd0e-c28be96e8082> | 2006-09-18 15:10:14 +0000 |
|---|---|---|
| committer | alex <alex@97f52cf1-0a1b-0410-bd0e-c28be96e8082> | 2006-09-18 15:10:14 +0000 |
| commit | 60ac638462e1f5b72ba9010cd61b734631f2dc32 (patch) | |
| tree | 4f0fd61bc054da3d2809a2011f81dce8c3d31ba2 /src/zabbix_server/pinger/pinger.c | |
| parent | f35a91b884a0030b6128e60292cd0db16aeac4d4 (diff) | |
| download | zabbix-60ac638462e1f5b72ba9010cd61b734631f2dc32.tar.gz zabbix-60ac638462e1f5b72ba9010cd61b734631f2dc32.tar.xz zabbix-60ac638462e1f5b72ba9010cd61b734631f2dc32.zip | |
- more development of distributed monitoring
- added automatic generation of database schemas (Alexei)
- pinger will use unique temporary file name (Alexei)
git-svn-id: svn://svn.zabbix.com/trunk@3315 97f52cf1-0a1b-0410-bd0e-c28be96e8082
Diffstat (limited to 'src/zabbix_server/pinger/pinger.c')
| -rw-r--r-- | src/zabbix_server/pinger/pinger.c | 17 |
1 files changed, 12 insertions, 5 deletions
diff --git a/src/zabbix_server/pinger/pinger.c b/src/zabbix_server/pinger/pinger.c index e134b9bd..02eab615 100644 --- a/src/zabbix_server/pinger/pinger.c +++ b/src/zabbix_server/pinger/pinger.c @@ -221,13 +221,17 @@ static int create_host_file(void) DB_HOST host; DB_RESULT result; DB_ROW row; + char str[MAX_STRING_LEN]; + zabbix_log( LOG_LEVEL_DEBUG, "In create_host_file()"); - if(NULL == (f = fopen("/tmp/zabbix_server.pinger", "w") )) + zbx_snprintf(str,sizeof(str),"/tmp/zabbix_server_%d.pinger",getpid()); + + if(NULL == (f = fopen(str, "w") )) { - zabbix_log( LOG_LEVEL_ERR, "Cannot open file [%s] [%s]", "/tmp/zabbix_server.pinger", strerror(errno)); - zabbix_syslog("Cannot open file [%s] [%s]", "/tmp/zabbix_server.pinger", strerror(errno)); + zabbix_log( LOG_LEVEL_ERR, "Cannot open file [%s] [%s]", str, strerror(errno)); + zabbix_syslog("Cannot open file [%s] [%s]", str, strerror(errno)); return FAIL; } @@ -294,7 +298,7 @@ static int do_ping(void) zabbix_log( LOG_LEVEL_DEBUG, "In do_ping()"); - zbx_snprintf(str,sizeof(str),"cat /tmp/zabbix_server.pinger | %s -e 2>/dev/null",CONFIG_FPING_LOCATION); + zbx_snprintf(str,sizeof(str),"cat /tmp/zabbix_server_%d.pinger | %s -e 2>/dev/null",getpid(),CONFIG_FPING_LOCATION); f=popen(str,"r"); if(f==0) @@ -379,6 +383,8 @@ void main_pinger_loop() { int ret = SUCCEED; + char str[MAX_STRING_LEN]; + if(1 == CONFIG_DISABLE_PINGER) { for(;;) @@ -404,7 +410,8 @@ void main_pinger_loop() ret = do_ping(); } - unlink("/tmp/zabbix_server.pinger"); + zbx_snprintf(str,sizeof(str),"/tmp/zabbix_server_%d.pinger",getpid()); + unlink(str); /* zabbix_set_log_level(LOG_LEVEL_WARNING); */ |
