I just upgraded Zabbix from 1.1 beta 9 to 1.1 on Gentoo. Now zabbix_agentd dies almost immediately after it starts.
The log file wasn't even opened and no error was written to standard output or standard error. I tried setting DebugLevel=4, but the log file still was not opened.
Next, I ran zabbix_agentd with strace to strace system calls. It starts as expected (here in process 11049), and soon reads the configuration file:
My configuration file does not contain a hostname, so zabbix_agentd runs the hostname command via a popen call, which forks child process 11050:
The hostname command eventually executes a uname system call, which returns the nodename strudel, among other things. The hostname command writes "strudel" to standard output, the pipe, and exits. The parent process, zabbix_agentd reads "strudel" from the pipe, waits for the child process to exit, and then terminates with error status 1.
I'm not sure why zabbix_agentd exits without writing a log message.
Workaround: After I added this line into my zabbix_agentd.conf to set the hostname, zabbix_agentd ran normally.
The log file wasn't even opened and no error was written to standard output or standard error. I tried setting DebugLevel=4, but the log file still was not opened.
Next, I ran zabbix_agentd with strace to strace system calls. It starts as expected (here in process 11049), and soon reads the configuration file:
Code:
11049 execve("/usr/sbin/zabbix_agentd", ["/usr/sbin/zabbix_agentd"], [/* 31 vars */]) = 0
...
11049 open("/etc/zabbix/zabbix_agentd.conf", O_RDONLY) = 3
11049 fstat64(3, {st_mode=S_IFREG|0640, st_size=2030, ...}) = 0
11049 mmap2(NULL, 131072, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x40160000
11049 read(3, "# This is config file for zabbix"..., 131072) = 2030
11049 read(3, "", 131072) = 0
Code:
11049 pipe([4, 5]) = 0
11049 fork() = 11050
11049 close(5) = 0
11049 fstat64(4, {st_mode=S_IFIFO|0600, st_size=0, ...}) = 0
11049 mmap2(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x40015000
11049 read(4, <unfinished ...>
11050 close(4) = 0
11050 dup2(5, 1) = 1
11050 close(5) = 0
11050 execve("/bin/sh", ["sh", "-c", "hostname"], [/* 31 vars */]) = 0
Code:
...
11050 uname({sys="Linux", node="strudel", ...}) = 0
11050 fstat64(1, {st_mode=S_IFIFO|0600, st_size=0, ...}) = 0
11050 mmap2(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x40015000
11050 write(1, "strudel\n", 8) = 8
11049 <... read resumed> "strudel\n", 4096) = 8
11049 read(4, <unfinished ...>
11050 munmap(0x40015000, 4096) = 0
11050 exit_group(0) = ?
11049 <... read resumed> "", 4096) = 0
11049 --- SIGCHLD (Child exited) @ 0 (0) ---
11049 close(4) = 0
11049 waitpid(11050, [{WIFEXITED(s) && WEXITSTATUS(s) == 0}], 0) = 11050
11049 munmap(0x40015000, 4096) = 0
11049 exit_group(1)
Workaround: After I added this line into my zabbix_agentd.conf to set the hostname, zabbix_agentd ran normally.
Code:
Hostname=strudel
Comment