Ad Widget

Collapse

Проблема с запуском Zabbix-agent

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • lazynchik
    Junior Member
    • Oct 2015
    • 16

    #1

    Проблема с запуском Zabbix-agent

    Помогите новичку!

    У меня сервак с Debian 8. После установки сервера и агента Zabbix, сервер в WEB-интерфейсе пишет ошибку: Get value from agent failed: cannot connect to [[127.0.0.1]:10050]: [111] Connection refused.

    Сам агент не запускается:
    user@localhost:~$ sudo service zabbix-agent start
    user@localhost:~$ Job for zabbix-agent.service failed. See 'systemctl status zabbix-agent.service' and 'journalctl -xn' for details.

    Смотрим статус:
    user@localhost:~$ systemctl status zabbix-agent.service
    ● zabbix-agent.service - LSB: Start zabbix-agent daemon
    Loaded: loaded (/etc/init.d/zabbix-agent)
    Active: failed (Result: exit-code) since Tue 2015-10-06 16:03:56 CEST; 1min 23s ago
    Process: 7623 ExecStart=/etc/init.d/zabbix-agent start (code=exited, status=1/FAILURE)

    Смотрим журнал:
    Oct 06 16:07:30 localhost sudo[7641]: pam_unix(sudo:session): session opened for user root by admin(uid=0)
    Oct 06 16:07:30 localhost sudo[7641]: pam_unix(sudo:session): session closed for user root
    Oct 06 16:07:30 localhost sudo[7640]: pam_unix(sudo:session): session closed for user root
    Oct 06 16:07:32 localhost snmpd[365]: error on subcontainer 'ia_addr' insert (-1)
    Oct 06 16:07:45 localhost sudo[7643]: admin : TTY=pts/0 ; PWD=/home/admin ; USER=root ; COMMAND=/usr/sbin/servic

    Лога агента нету в /var/log/zabbix/, только лог сервера zabbix_server.log
    Last edited by lazynchik; 06-10-2015, 20:09.
  • lpkone
    Member
    • May 2015
    • 56

    #2
    Покажи вывод:
    cat /var/log/zabbix/zabbix.agentd.log

    Comment

    • lazynchik
      Junior Member
      • Oct 2015
      • 16

      #3
      Originally posted by lpkone
      Покажи вывод:
      cat /var/log/zabbix/zabbix.agentd.log
      У меня там нет лога агента zabbix.agentd.log, только сервера zabbix_server.log .
      Last edited by lazynchik; 07-10-2015, 09:54.

      Comment

      • sadman
        Senior Member
        • Dec 2010
        • 1611

        #4
        Ничто вам не мешает запустить zabbix_agentd не через управление сервисами, а напрямую и глянуть, на что он обругается.

        Comment

        • Zentarim
          Senior Member
          • Mar 2012
          • 526

          #5
          Originally posted by lazynchik
          Помогите новичку!

          У меня сервак с debian 8. После установки сервера и агента zabbix, сервер в web-интерфейсе пишет ошибку: Get value from agent failed: Cannot connect to [[127.0.0.1]:10050]: [111] connection refused.

          Сам агент не запускается:
          user@localhost:~$ sudo service zabbix-agent start
          user@localhost:~$ job for zabbix-agent.service failed. See 'systemctl status zabbix-agent.service' and 'journalctl -xn' for details.

          Смотрим статус:
          user@localhost:~$ systemctl status zabbix-agent.service
          ● zabbix-agent.service - lsb: Start zabbix-agent daemon
          loaded: Loaded (/etc/init.d/zabbix-agent)
          active: Failed (result: Exit-code) since tue 2015-10-06 16:03:56 cest; 1min 23s ago
          process: 7623 execstart=/etc/init.d/zabbix-agent start (code=exited, status=1/failure)

          Смотрим журнал:
          oct 06 16:07:30 localhost sudo[7641]: Pam_unix(sudo:session): Session opened for user root by admin(uid=0)
          oct 06 16:07:30 localhost sudo[7641]: Pam_unix(sudo:session): Session closed for user root
          oct 06 16:07:30 localhost sudo[7640]: Pam_unix(sudo:session): Session closed for user root
          oct 06 16:07:32 localhost snmpd[365]: Error on subcontainer 'ia_addr' insert (-1)
          oct 06 16:07:45 localhost sudo[7643]: Admin : Tty=pts/0 ; pwd=/home/admin ; user=root ; command=/usr/sbin/servic

          Лога агента нету в /var/log/zabbix/, только лог сервера zabbix_server.log
          Конфиг агента покажите

          Comment

          • lazynchik
            Junior Member
            • Oct 2015
            • 16

            #6
            1

            Originally posted by Zentarim
            Конфиг агента покажите
            # This is a config file for the Zabbix agent daemon (Unix)
            # To get more information about Zabbix, visit http://www.zabbix.com

            ############ GENERAL PARAMETERS #################

            ### Option: PidFile
            # Name of PID file.
            #
            # Mandatory: no
            # Default:
            # PidFile=/tmp/zabbix_agentd.pid
            # PidFile=/var/run/zabbix/zabbix_agentd.pid

            PidFile=/tmp/zabbix_agentd.pid
            PidFile=/var/run/zabbix/zabbix_agentd.pid

            ### Option: LogFile
            # Name of log file.
            # If not set, syslog is used.
            #
            # Mandatory: no
            # Default:
            # LogFile=/tmp/zabbix_agentd.log
            # LogFile=/var/log/zabbix/zabbix_agentd.log

            LogFile=/tmp/zabbix_agentd.log
            LogFile=/var/log/zabbix/zabbix_agentd.log

            ### Option: LogFileSize
            # Maximum size of log file in MB.
            # 0 - disable automatic log rotation.
            #
            # Mandatory: no
            # Range: 0-1024
            # Default:
            # LogFileSize=1

            LogFileSize=1

            ### Option: DebugLevel
            # Specifies debug level
            # 0 - no debug
            # 1 - critical information
            # 2 - error information
            # 3 - warnings
            # 4 - for debugging (produces lots of information)
            #
            # Mandatory: no
            # Range: 0-4
            # Default:
            # DebugLevel=3

            ### Option: SourceIP
            # Source IP address for outgoing connections.
            #
            # Mandatory: no
            # Default:
            # SourceIP=

            ### Option: EnableRemoteCommands
            # Whether remote commands from Zabbix server are allowed.
            # 0 - not allowed
            # 1 - allowed
            #
            # Mandatory: no
            # Default:
            # EnableRemoteCommands=1

            EnableRemoteCommands=1

            ### Option: LogRemoteCommands
            # Enable logging of executed shell commands as warnings.
            # 0 - disabled
            # 1 - enabled
            #
            # Mandatory: no
            # Default:
            # LogRemoteCommands=1

            ##### Passive checks related

            ### Option: Server
            # List of comma delimited IP addresses (or hostnames) of Zabbix servers.
            # Incoming connections will be accepted only from the hosts listed here.
            # If IPv6 support is enabled then '127.0.0.1', '::127.0.0.1', '::ffff:127.0.0.1' are treated equally.
            #
            # Mandatory: no
            # Default:
            # Server=127.0.0.1

            Server=127.0.0.1

            ### Option: ListenPort
            # Agent will listen on this port for connections from the server.
            #
            # Mandatory: no
            # Range: 1024-32767
            # Default:
            # ListenPort=10050

            ListenPort=10050

            ### Option: ListenIP
            # List of comma delimited IP addresses that the agent should listen on.
            # First IP address is sent to Zabbix server if connecting to it to retrieve list of active checks.
            #
            # Mandatory: no
            # Default:
            # ListenIP=0.0.0.0
            # ListenIP=127.0.0.1

            ListenIP=0.0.0.0
            ListenIP=127.0.0.1

            ### Option: StartAgents
            # Number of pre-forked instances of zabbix_agentd that process passive checks.
            # If set to 0, disables passive checks and the agent will not listen on any TCP port.
            #
            # Mandatory: no
            # Range: 0-100
            # Default:
            # StartAgents=3

            StartAgent=3

            ##### Active checks related

            ### Option: ServerActive
            # List of comma delimited IPort (or hostnameort) pairs of Zabbix servers for active checks.
            # If port is not specified, default port is used.
            # IPv6 addresses must be enclosed in square brackets if port for that host is specified.
            # If port is not specified, square brackets for IPv6 addresses are optional.
            # If this parameter is not specified, active checks are disabled.
            # Example: ServerActive=127.0.0.1:20051,zabbix.domain,[::1]:30051,::1,[12fc::1]
            #
            # Mandatory: no
            # Default:
            # ServerActive=127.0.0.1:10051

            #ServerActive=127.0.0.1:10051

            ### Option: Hostname
            # Unique, case sensitive hostname.
            # Required for active checks and must match hostname as configured on the server.
            # Value is acquired from HostnameItem if undefined.
            #
            # Mandatory: no
            # Default:
            # Hostname=system.uname

            Hostname=Zabbix server

            ### Option: HostnameItem
            # Item used for generating Hostname if it is undefined. Ignored if Hostname is defined.
            # Does not support UserParameters or aliases.
            #
            # Mandatory: no
            # Default:
            # HostnameItem=system.hostname

            ### Option: HostMetadata
            # Optional parameter that defines host metadata.
            # Host metadata is used at host auto-registration process.
            # An agent will issue an error and not start if the value is over limit of 255 characters.
            # If not defined, value will be acquired from HostMetadataItem.
            #
            # Mandatory: no
            # Range: 0-255 characters
            # Default:
            # HostMetadata=

            ### Option: HostMetadataItem
            # Optional parameter that defines an item used for getting host metadata.
            # Host metadata is used at host auto-registration process.
            # During an auto-registration request an agent will log a warning message if
            # the value returned by specified item is over limit of 255 characters.
            # This option is only used when HostMetadata is not defined.
            #
            # Mandatory: no
            # Default:
            # HostMetadataItem=

            ### Option: ServerPort
            # Port of server
            #
            # Mandatory: no
            # Default:
            # ServerPort=10051

            ServerPort=10051

            ### Option: RefreshActiveChecks
            # How often list of active checks is refreshed, in seconds.
            #
            # Mandatory: no
            # Range: 60-3600
            # Default:
            # RefreshActiveChecks=120

            ### Option: BufferSend
            # Do not keep data longer than N seconds in buffer.
            #
            # Mandatory: no
            # Range: 1-3600
            # Default:
            # BufferSend=5

            ### Option: BufferSize
            # Maximum number of values in a memory buffer. The agent will send
            # all collected data to Zabbix Server or Proxy if the buffer is full.
            #
            # Mandatory: no
            # Range: 2-65535
            # Default:
            # BufferSize=100

            ### Option: MaxLinesPerSecond
            # Maximum number of new lines the agent will send per second to Zabbix Server
            # or Proxy processing 'log' and 'logrt' active checks.
            # The provided value will be overridden by the parameter 'maxlines',
            # provided in 'log' or 'logrt' item keys.
            #
            # Mandatory: no
            # Range: 1-1000
            # Default:
            # MaxLinesPerSecond=100

            ############ ADVANCED PARAMETERS #################

            ### Option: Alias
            # Sets an alias for an item key. It can be used to substitute long and complex item key with a smaller and simpler one.
            # Multiple Alias parameters may be present. Multiple parameters with the same Alias key are not allowed.
            # Different Alias keys may reference the same item key.
            # For example, to retrieve the ID of user 'zabbix':
            # Alias=zabbix.userid:vfs.file.regexp[/etc/passwd,^zabbix:.[0-9]+),,,,\1]
            # Now shorthand key zabbix.userid may be used to retrieve data.
            # Aliases can be used in HostMetadataItem but not in HostnameItem parameters.
            #
            # Mandatory: no
            # Range:
            # Default:

            ### Option: Timeout
            # Spend no more than Timeout seconds on processing
            #
            # Mandatory: no
            # Range: 1-30
            # Default:
            # Timeout=3

            ### Option: AllowRoot
            # Allow the agent to run as 'root'. If disabled and the agent is started by 'root', the agent
            # will try to switch to user 'zabbix' instead. Has no effect if started under a regular user.
            # 0 - do not allow
            # 1 - allow
            #
            # Mandatory: no
            # Default:
            # AllowRoot=1

            ### Option: Include
            # You may include individual files or all files in a directory in the configuration file.
            # Installing Zabbix will create include directory in /etc/zabbix, unless modified during the compile time.
            #
            # Mandatory: no
            # Default:
            # Include=

            # Include=/usr/local/etc/zabbix/zabbix_agentd.userparams.conf
            # Include=/usr/local/etc/zabbix/zabbix_agentd/

            Include=/usr/local/etc/zabbix/zabbix_agentd.conf.d/

            ####### USER-DEFINED MONITORED PARAMETERS #######

            ### Option: UnsafeUserParameters
            # Allow all characters to be passed in arguments to user-defined parameters.
            # 0 - do not allow
            # 1 - allow
            #
            # Mandatory: no
            # Range: 0-1
            # Default:
            # UnsafeUserParameters=0

            ### Option: UserParameter
            # User-defined parameter to monitor. There can be several user-defined parameters.
            # Format: UserParameter=<key>,<shell command>
            # See 'zabbix_agentd' directory for examples.
            #
            # Mandatory: no
            # Default:
            # UserParameter=

            ####### LOADABLE MODULES #######

            ### Option: LoadModulePath
            # Full path to location of agent modules.
            # Default depends on compilation options.
            #
            # Mandatory: no
            # Default:
            # LoadModulePath=${libdir}/modules

            ### Option: LoadModule
            # Module to load at agent startup. Modules are used to extend functionality of the agent.
            # Format: LoadModule=<module.so>
            # The modules must be located in directory specified by LoadModulePath.
            # It is allowed to include multiple LoadModule parameters.
            #
            # Mandatory: no
            # Default:
            # LoadModule=

            Comment

            • Zentarim
              Senior Member
              • Mar 2012
              • 526

              #7
              Вы задвоили многие строчки конфига. Что вы хотите от агента, написав такое:
              Code:
              ListenIP=0.0.0.0
              ListenIP=127.0.0.1
              
              LogFile=/tmp/zabbix_agentd.log
              LogFile=/var/log/zabbix/zabbix_agentd.log

              Comment

              • lazynchik
                Junior Member
                • Oct 2015
                • 16

                #8
                Originally posted by Zentarim
                Вы задвоили многие строчки конфига. Что вы хотите от агента, написав такое:
                Code:
                ListenIP=0.0.0.0
                ListenIP=127.0.0.1
                
                LogFile=/tmp/zabbix_agentd.log
                LogFile=/var/log/zabbix/zabbix_agentd.log
                Строчки подправил, агента запустил. Но в самом сервере выдает ошику.
                Get value from agent failed: cannot connect to [[127.0.0.1]:10050]: [111] Connection refused

                Comment

                • Zentarim
                  Senior Member
                  • Mar 2012
                  • 526

                  #9
                  Originally posted by lazynchik
                  Строчки подправил, агента запустил. Но в самом сервере выдает ошику.
                  Get value from agent failed: cannot connect to [[127.0.0.1]:10050]: [111] Connection refused
                  Вы только 2 этих строчки поправили?

                  Code:
                  PidFile=/tmp/zabbix_agentd.pid
                  PidFile=/var/run/zabbix/zabbix_agentd.pid

                  Comment

                  • lazynchik
                    Junior Member
                    • Oct 2015
                    • 16

                    #10
                    Originally posted by Zentarim
                    Вы только 2 этих строчки поправили?

                    Code:
                    PidFile=/tmp/zabbix_agentd.pid
                    PidFile=/var/run/zabbix/zabbix_agentd.pid
                    Поправил
                    # PidFile=/tmp/zabbix_agentd.pid

                    PidFile=/var/run/zabbix/zabbix_agentd.pid

                    И

                    # LogFile=/tmp/zabbix_agentd.log

                    LogFile=/var/log/zabbix/zabbix_agentd.log

                    И

                    # Server=127.0.0.1

                    Server=127.0.0.1

                    И

                    # ListenPort=10050

                    ListenPort=10050

                    И

                    # ListenIP=0.0.0.0

                    ListenIP=127.0.0.1

                    И

                    # ServerActive=127.0.0.1:10051

                    #ServerActive=127.0.0.1:10051

                    И

                    # ServerPort=10051

                    ServerPort=10051

                    Comment

                    • Zentarim
                      Senior Member
                      • Mar 2012
                      • 526

                      #11
                      Хорошо. Появился ли лог агента в папке /var/log/zabbix?
                      Если да - то что в нем?
                      Если нет - есть ли права у пользователя, от которого работает zabbix agent на папку /var/log/zabbix?
                      Code:
                      ls -la /var/log | grep zabbix

                      Comment

                      • lazynchik
                        Junior Member
                        • Oct 2015
                        • 16

                        #12
                        Originally posted by Zentarim
                        Хорошо. Появился ли лог агента в папке /var/log/zabbix?
                        Если да - то что в нем?
                        Если нет - есть ли права у пользователя, от которого работает zabbix agent на папку /var/log/zabbix?
                        Code:
                        ls -la /var/log | grep zabbix
                        Лога нету.

                        Права такие.
                        drwxr-xr-x 2 admin zabbix 4096 Oct 8 14:58 zabbix
                        drwxr-xr-x 2 zabbix zabbix 4096 Oct 4 06:25 zabbix-agent
                        -rwxrwxr-x 1 root zabbix 0 Oct 2 16:00 zabbix_server.log

                        Comment

                        • Zentarim
                          Senior Member
                          • Mar 2012
                          • 526

                          #13
                          Originally posted by lazynchik
                          Лога нету.

                          Права такие.
                          drwxr-xr-x 2 admin zabbix 4096 Oct 8 14:58 zabbix
                          drwxr-xr-x 2 zabbix zabbix 4096 Oct 4 06:25 zabbix-agent
                          -rwxrwxr-x 1 root zabbix 0 Oct 2 16:00 zabbix_server.log
                          А от чьего имени вы запускаете zabbix agent? Я вижу, что в папку zabbix может писать только admin, однако обычно агент запускается либо от пользователя zabbix либо от zabbixs. Попробуйте
                          Code:
                          sudo chown -R zabbix:zabbix /var/log/zabbix
                          Потом запустите агент снова и проверьте - появился ли лог

                          Comment

                          • lazynchik
                            Junior Member
                            • Oct 2015
                            • 16

                            #14
                            Originally posted by Zentarim
                            А от чьего имени вы запускаете zabbix agent? Я вижу, что в папку zabbix может писать только admin, однако обычно агент запускается либо от пользователя zabbix либо от zabbixs. Попробуйте
                            Code:
                            sudo chown -R zabbix:zabbix /var/log/zabbix
                            Потом запустите агент снова и проверьте - появился ли лог
                            Права дал:
                            user@localhost:~$ ls -la /var/log | grep zabbix
                            drwxr-xr-x 2 zabbix zabbix 4096 Oct 8 14:58 zabbix
                            drwxr-xr-x 2 zabbix zabbix 4096 Oct 4 06:25 zabbix-agent
                            -rwxrwxr-x 1 root zabbix 0 Oct 2 16:00 zabbix_server.log

                            Лог не появился:
                            user@localhost:~$ /var/log/zabbix$ ls
                            zabbix_server.log

                            Comment

                            • Zentarim
                              Senior Member
                              • Mar 2012
                              • 526

                              #15
                              Originally posted by lazynchik
                              Права дал:
                              user@localhost:~$ ls -la /var/log | grep zabbix
                              drwxr-xr-x 2 zabbix zabbix 4096 Oct 8 14:58 zabbix
                              drwxr-xr-x 2 zabbix zabbix 4096 Oct 4 06:25 zabbix-agent
                              -rwxrwxr-x 1 root zabbix 0 Oct 2 16:00 zabbix_server.log

                              Лог не появился:
                              user@localhost:~$ /var/log/zabbix$ ls
                              zabbix_server.log
                              Запустите агента вручную:
                              Code:
                              zabbix_agentd -c <полный путь к zabbix_agentd.conf>

                              Comment

                              Working...