Ad Widget

Collapse

Zabbix Agent not running on Centos 7

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • ratnakar1969
    Junior Member
    • Feb 2019
    • 9

    #1

    Zabbix Agent not running on Centos 7

    I tried installing Zabbix Agent on Centos 7, the following is the script I have used

    sudo -S rpm -ivh https://repo.zabbix.com/zabbix/4.0/r...el7.noarch.rpm
    sudo -S yum install -y zabbix-agent
    sudo -S sed -i 's/# EnableRemoteCommands=0/EnableRemoteCommands=1/g' /etc/zabbix/zabbix_agentd.conf
    sudo -S sed -i 's/# LogRemoteCommands=0/LogRemoteCommands=1/g' /etc/zabbix/zabbix_agentd.conf
    sudo -S sed -i 's/Server=127.0.0.1/Server=10.192.170.83/g' /etc/zabbix/zabbix_agentd.conf
    sudo -S sed -i 's/# ListenPort=10050/ListenPort=10050/g' /etc/zabbix/zabbix_agentd.conf
    sudo -S sed -i 's/ServerActive=127.0.0.1/ServerActive=10.192.170.83/g' /etc/zabbix/zabbix_agentd.conf
    sudo -S sed -i 's/Hostname=Zabbix server/Hostname=n014.c0001.exacluster.local/g' /etc/zabbix/zabbix_agentd.conf
    sudo -S systemctl restart zabbix-agent
    sudo -S systemctl enable zabbix-agent

    When I run the script this is the output I am getting

    Retrieving https://repo.zabbix.com/zabbix/4.0/r...el7.noarch.rpm
    Preparing... ################################# [100%]
    package zabbix-release-4.0-1.el7.noarch is already installed
    Loaded plugins: fastestmirror, langpacks
    Loading mirror speeds from cached hostfile
    * base: sjc.edge.kernel.org
    * extras: sjc.edge.kernel.org
    * updates: mirrors.xtom.com
    Package zabbix-agent-4.0.18-1.el7.x86_64 already installed and latest version
    Nothing to do
    * zabbix-agent.service - Zabbix Agent
    Loaded: loaded (/usr/lib/systemd/system/zabbix-agent.service; enabled; vendor preset: disabled)
    Active: active (running) since Fri 2020-03-13 13:31:11 UTC; 117ms ago
    Main PID: 166097
    CGroup: /system.slice/zabbix-agent.service

    Mar 13 13:31:11 n0014.c0001.exacluster.local systemd[1]: Starting Zabbix Agent...
    Mar 13 13:31:11 n0014.c0001.exacluster.local systemd[1]: Can't open PID file /run/zabbix/zabbix_agentd.pid (yet?) after start: No such file or directory
    Mar 13 13:31:11 n0014.c0001.exacluster.local systemd[1]: zabbix-agent.service: Supervising process 166097 which is not our child. We'll most likely... exits.
    Mar 13 13:31:11 n0014.c0001.exacluster.local systemd[1]: Started Zabbix Agent.
    Hint: Some lines were ellipsized, use -l to show in full.


    I tried with all versions of Zabbix Agent, but nothing seems working. Any one could please help


    sudo systemctl status zabbix-agent
    ~
  • dimir
    Zabbix developer
    • Apr 2011
    • 1080

    #2
    SELinux enabled?

    Comment

    • ratnakar1969
      Junior Member
      • Feb 2019
      • 9

      #3
      No it's disabled

      Comment

      • mfortes
        Senior Member
        • Oct 2019
        • 416

        #4
        Open your agent conf file and look for "PidFile".
        Maybe u dont have this directory, then create this will fix your problem...
        (Only the path, not the file...)


        Michael R. Fortes

        Linkedin: Mike Fortes
        Medium: mromeiro-f

        Comment

        • ratnakar1969
          Junior Member
          • Feb 2019
          • 9

          #5
          I do have the file, and when I run the script, get this message

          Can't open PID file /run/zabbix/zabbix_agentd.pid (yet?) after start: No such file or directory

          I tried by changing permissions but no luck

          Comment

          • Atsushi
            Senior Member
            • Aug 2013
            • 2028

            #6
            Does a directory called /run/zabbix exist? If so, what are the permissions on that directory?

            My environment:
            Code:
            $ ls -ld /run/zabbix/
            drwxr-xr-x 2 zabbix zabbix 140  3月 13 11:17 /run/zabbix/
            $

            Comment

            • ratnakar1969
              Junior Member
              • Feb 2019
              • 9

              #7
              It's the same here
              Code:
              UAT2 [root@n0013 ~]# ls -ld /run/zabbix/
              drwxr-xr-x 2 zabbix zabbix 60 Mar 14 06:59 /run/zabbix/

              Comment

              • Atsushi
                Senior Member
                • Aug 2013
                • 2028

                #8
                If there is no problem with the directory permissions, restart Zabbix agent with the systemctl command again.

                Comment

                • ratnakar1969
                  Junior Member
                  • Feb 2019
                  • 9

                  #9
                  I think I got the issue, the zabbix_agentd.pid is getting appended with the cluster name here, and so it's not able to read

                  Code:
                  UAT2 [root@n0013 logs]# cat /tmp/zabbix_agentd.pid
                  275502UAT2 [root@n0013 logs]#
                  Now have no idea how to resolve this. Any idea where the PID is generated?

                  Comment

                  • Atsushi
                    Senior Member
                    • Aug 2013
                    • 2028

                    #10
                    Why are PID files under the /tmp directory? If so, please tell us what and how you changed it. And now clarify what is the problem.

                    Comment

                    • ratnakar1969
                      Junior Member
                      • Feb 2019
                      • 9

                      #11
                      I had initially set the path as /var/run/zabbix_agentd.pid for PID file, but was getting the same issue, PID was getting appended with cluster name.

                      Reason why I changed to /tmp folder

                      Comment

                      • ratnakar1969
                        Junior Member
                        • Feb 2019
                        • 9

                        #12
                        Code:
                        Mar 13 13:31:11 n0014.c0001.exacluster.local systemd[1]: Starting Zabbix Agent...
                        Mar 13 13:31:11 n0014.c0001.exacluster.local systemd[1]: Can't open PID file /run/zabbix/zabbix_agentd.pid (yet?) after start: No such file or directory
                        Mar 13 13:31:11 n0014.c0001.exacluster.local systemd[1]: zabbix-agent.service: Supervising process 166097 which is not our child. We'll most likely... exits.
                        Mar 13 13:31:11 n0014.c0001.exacluster.local systemd[1]: Started Zabbix Agent.
                        Basically when I start the Zabbix Agent,it's trying to read the PID file, however the value there is comming as <PID>UAT2, and reason why it's failing to start.

                        So any idea where this PID file is generated?

                        Comment

                        • Atsushi
                          Senior Member
                          • Aug 2013
                          • 2028

                          #13
                          I think that 275502 is the process ID just because it is not a line break. Isn't UAT2 a prompt for your environment?
                          However, I still don't understand what the cluster name you are writing is.
                          Also, show the current log, not the old log.

                          Comment

                          Working...