Uploaded image for project: 'ZABBIX BUGS AND ISSUES'
  1. ZABBIX BUGS AND ISSUES
  2. ZBX-16810

zabbix agent terminates with SIGHUP when started in foreground via screen

XMLWordPrintable

    • Icon: Incident report Incident report
    • Resolution: Won't fix
    • Icon: Minor Minor
    • None
    • 4.4.0
    • Agent (G)
    • None

      For reasons beyond my control i have to run zabbix agent via screen but it keeps immediately exiting with a SIGHUP and i'm not sure why. 

      Version

      zabbix_agentd (daemon) (Zabbix) 4.4.0
      Revision cfac660b25 7 October 2019, compilation time: Oct 7 2019 07:58:57

       

      Here is command used to start

      screen -DmS testing -L /usr/sbin/zabbix_agentd -f -c /etc/zabbix/zabbix_agentd.conf

       

      Here is log output

      cat /var/log/zabbix-agent/zabbix_agentd.log
      
      4437:20191022:223448.514 Starting Zabbix Agent [scott-VirtualBox]. Zabbix 4.4.0 (revision cfac660b25).
      4437:20191022:223448.514 Got signal [signal:1(SIGHUP),sender_pid:0,sender_uid:0,reason:128]. Exiting ...
      4437:20191022:223448.514 zbx_on_exit() called
      4437:20191022:223448.514 In zbx_unload_modules()
      4437:20191022:223448.514 End of zbx_unload_modules()
      4437:20191022:223448.514 Zabbix Agent stopped. Zabbix 4.4.0 (revision cfac660b25). 
      

      As you can see, as soon as it starts it gets SIGHUP and exits. I am confused where the SIGHUP is coming from though ?

      If using bash, python or golang i try a similar screen command then i don't get any SIGHUP. Example with below code.. it never receives any SIGHUP so why is zabbix agent ?

       

      package main
      	
      	import (
      	"fmt"
      	"os"
      	"os/signal"
      	"syscall"
      	)
      	
      	func main() {
      	signal_chan := make(chan os.Signal, 1)
      	signal.Notify(signal_chan,
      	syscall.SIGHUP,
      	syscall.SIGINT,
      	syscall.SIGTERM,
      	syscall.SIGQUIT)
      	
      	exit_chan := make(chan int)
      	go func() {
      	for {
      	s := <-signal_chan
      	switch s {
      	case syscall.SIGHUP:
      	fmt.Println("SIGHUP")
      	
      	case syscall.SIGINT:
      	fmt.Println("SIGINT")
      	
      	case syscall.SIGTERM:
      	fmt.Println("SIGTERM ")
      	exit_chan <- 0
      	
      	case syscall.SIGQUIT:
      	fmt.Println("SIGQUIT ")
      	exit_chan <- 0
      	
      	default:
      	fmt.Println("Unknown signal.")
      	exit_chan <- 1
      	}
      	}
      	}()
      	
      	code := <-exit_chan
      	os.Exit(code)
      	}
      go build signal_test.go
      screen -DmS testing -L ./signal_test

      Attaching to the session screen -r or cat screenlog.0 has nothing about it getting sent a SIGHUP.

      Any ideas why the zabbix agent can not be run in foreground via screen without being immediately killed ?

            zabbix.support Zabbix Support Team
            scott.mcgillivray@gmail.com Scott McGillivray
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

              Created:
              Updated:
              Resolved: