Ad Widget

Collapse

Multiple Zabbix agent

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Matthieu
    Member
    • Mar 2011
    • 41

    #1

    Multiple Zabbix agent

    Hello,

    I try to have a 2 zabbix agent on a debian server because i want to monitor him with 2 differents zabbix server.

    How can i make please?

    (I managed on a windows server).

    Thanks,
  • untergeek
    Senior Member
    Zabbix Certified Specialist
    • Jun 2009
    • 512

    #2
    You would need to set up 2 separate zabbix_agentd.conf files.

    In the second one, you'd set the ListenPort=10050 to ListenPort=10052 or ListenPort=10049.

    Option 2 would be to have two IPs on the box and configure the ListenIP to be different in each file, instead of the port.

    Then execute zabbix_agentd with the -c or --config option and point to the second file for the second agent.

    Comment

    • Matthieu
      Member
      • Mar 2011
      • 41

      #3
      Thanks untergeek for you reply. But i've a question:

      If I execute zabbix_agentd -c /etc/zabbix/zabbix_agentd2.conf

      (agent2.conf is my second zabbix config file)

      The configuration of my first zabbix agent will be changed? (windows agent have -m parameter for multiple agent)

      And with this added, should i modify /etc/services ?

      Comment

      • untergeek
        Senior Member
        Zabbix Certified Specialist
        • Jun 2009
        • 512

        #4
        No, the config files are safe from alteration by the zabbix processes.

        You can alter /etc/services, but that's only if you want to know what is running where. It's unnecessary for the ability to run zabbix.

        Comment

        • Matthieu
          Member
          • Mar 2011
          • 41

          #5
          Yeah it's good! Thanks very much untergeek

          Comment

          • Matthieu
            Member
            • Mar 2011
            • 41

            #6
            hummm it's not good...

            I can't connect to my second zabbix agent.

            When i try

            telnet 192.168.0.210 10051

            I have:

            telnet: Unable to connect to remote host: Connection refused

            and in my zabbix server:

            error: Get value from agent failed: *** Cannot connect to [192.168.0.210]:11051 [Connection refused]

            Comment

            • untergeek
              Senior Member
              Zabbix Certified Specialist
              • Jun 2009
              • 512

              #7
              agent1 on host1.example.com:10050 -> zabbix_server1.example.com:10051
              agent2 on host1.example.com:11050 -> zabbix_server2.example.com:10051

              You need to make sure that from host1 you can telnet to port 10051 on both zabbix servers. You also need to make sure that zabbix_server1 and zabbix_server2 can telnet to host1.example.com on both ports 10050 and 11050.

              On top of that, when you create the host for host1.example.com on zabbix_server2, you need to make sure to assign the port to be 11050 in the host definition in the zabbix UI.

              Comment

              • Matthieu
                Member
                • Mar 2011
                • 41

                #8
                Sorry it's an error when i've copy my log. I use 11050 port.




                I've solved my problem. I post the solution for have 2 agent in the same linux server:


                You have the first zabbix-agent that running well


                Copy zabbix agent config file:

                cp /etc/zabbix/zabbix_agentd.conf /etc/zabbix/zabbix_agentd2.conf


                Edit /etc/zabbix/zabbix_agentd2.conf

                --------------------------------------------------------------------------------------------


                ####Ip Zabbix_Server

                Server="ip_zabbix-server"

                #### Hostname value must be different that hostname value in zabbix_agentd.conf
                #### Hostname = Hostname on zabbix server

                Hostname="name"

                ####Listen port must be different that Listenport value in zabbix_agentd.conf

                ListenPort= "port_zabbix-server"


                ####Listen IP

                ListenIP="ip_machine"


                ####Name of PID file

                PidFile=/var/run/zabbix-agent/zabbix_agentd2.pid



                --------------------------------------------------------------------------------------------


                Create a second zabbix_agent processus:

                cp /var/run/zabbix-agent/zabbix_agentd.pid /var/run/zabbix-agent/zabbix_agentd2.pid


                chown zabbix /var/run/zabbix-agent/zabbix_agentd2.pid


                Launch zabbix agent

                zabbix_agentd -c /etc/zabbix/zabbix_agentd2.conf




                It's good!!!

                Comment

                • nelsonab
                  Senior Member
                  Zabbix Certified SpecialistZabbix Certified Professional
                  • Sep 2006
                  • 1233

                  #9
                  Not quite true:

                  Code:
                  ### Option: Server
                  #       List of comma delimited IP addresses (or hostnames) of Zabbix servers.
                  #       No spaces allowed. First entry is used for receiving list of and sending active checks.
                  #       If IPv6 support is enabled then '127.0.0.1', '::127.0.0.1', '::ffff:127.0.0.1' are treated equally.
                  You only need two agents if you are using active mode to both servers. Otherwise it's active only to the first server in the list.
                  RHCE, author of zbxapi
                  Ansible, the missing piece (Zabconf 2017): https://www.youtube.com/watch?v=R5T9NidjjDE
                  Zabbix and SNMP on Linux (Zabconf 2015): https://www.youtube.com/watch?v=98PEHpLFVHM

                  Comment

                  • richlv
                    Senior Member
                    Zabbix Certified Trainer
                    Zabbix Certified SpecialistZabbix Certified Professional
                    • Oct 2005
                    • 3112

                    #10
                    to expand on what nelsonab said, if you are using passive items, all you need is a single agent that allows connections from multiple ips. which means adding them all to the agentd config file "server" directive
                    Zabbix 3.0 Network Monitoring book

                    Comment

                    • phoenixx
                      Junior Member
                      • Aug 2011
                      • 10

                      #11
                      Originally posted by richlv
                      to expand on what nelsonab said, if you are using passive items, all you need is a single agent that allows connections from multiple ips. which means adding them all to the agentd config file "server" directive
                      may I ask, what's the correct syntax for this ?

                      Server=IP1,IP2

                      or ?

                      I want 2 zabbix servers to connect on 1 agent ... to have one host monitored by 2 zabbix srvrs ...

                      is there any other change required in .conf or ?

                      thanks so much in advance ...

                      Comment

                      • richlv
                        Senior Member
                        Zabbix Certified Trainer
                        Zabbix Certified SpecialistZabbix Certified Professional
                        • Oct 2005
                        • 3112

                        #12
                        as the configuration file comment confirms, that is the correct syntax
                        Zabbix 3.0 Network Monitoring book

                        Comment

                        • yousefi
                          Junior Member
                          • May 2019
                          • 1

                          #13
                          hello
                          i try to have a 2 zabbix agent version 3 and version 4 on a centos7 server for monitor him with 2 different zabbix server.
                          how can i make it?
                          please help me

                          Comment

                          Working...