Ad Widget

Collapse

Can connect my agent on server.

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • simonlf
    Junior Member
    • Dec 2018
    • 4

    #1

    Can connect my agent on server.



    Hello,


    Im trying to connect a Windows Client (agent zabbix NOT IN AWS) to my Server Zabbix which is on Amazon Web Services.


    Zabbix Server version is Zabbix 3.2.11

    Zabbix Agent version Zabbix 4.0.1


    In Amazon Web Services i have a public ip 34.XXX.XXX.XXX and private ip 172.XX.XXX.XXX


    I want connect the agent to my server, on zabbix_agentd.conf i configure:

    server: 34.XXX.XXX.XXX (ip public from server on AWS)

    ListenPort=10050

    Serveractive= 34.XXX.XXX.XXX (ip public from server on AWS)

    Hostname=DESKTOP-XXXXXX (hostname from Windows agent)


    The host, is in my office, where we have an internal connection. I opened the port 10050 in my router but on zabbix still the error:


    Get value from agent failed: cannot connect to [[192.168.7.150]:10050]: [4] Interrupted system call.





    Also opened the ports 10050 and 10051 /tcp and /udp on the network security of my Amazon Web Service Instance.


    Someone can help me, please? Sorry for my english.


    Thanks.
    Last edited by simonlf; 13-12-2018, 12:45.
  • kmpm
    Junior Member
    • Dec 2018
    • 11

    #2
    Where is the "Get value from agent failed: cannot connect to [[192.168.7.150]:10050]: [4] Interrupted system call." originating, server or agent log?
    If it's the server then you have the wrong Item Type on something, "Zabbix agent" instead of "Zabbix agent (Active)" and the server tries to reach one of your internal IPs. From the photo you supplied it looks as if you are using "Zabbix agent" as the item type.
    1. If you want the agent (from inside your private network) to contact the server (on AWS) and not the other way around you can not use "Zabbix agent" item type.
    2. If you want your server (on AWS) to contact you host (on your private network) you will need to set up NAT translation in your local firewall and configure the host in the server to use your local firewall external IP, Or set up a VPN between the networks.
    3. Install a zabbix proxy in your local private network that collects everything and sends it to the server.
    I would recommend option 1 if it's just 1 single agent. Just clone the template and in the clone change all types to active and then change the host so that it uses the new template.

    Comment

    • simonlf
      Junior Member
      • Dec 2018
      • 4

      #3
      Hey kmpm,

      thanks for answer.

      when you say, clone the template and in the clone change all types to active, what do you mean?

      thanks.

      Comment

      • simonlf
        Junior Member
        • Dec 2018
        • 4

        #4
        Originally posted by kmpm
        Where is the "Get value from agent failed: cannot connect to [[192.168.7.150]:10050]: [4] Interrupted system call." originating, server or agent log?
        If it's the server then you have the wrong Item Type on something, "Zabbix agent" instead of "Zabbix agent (Active)" and the server tries to reach one of your internal IPs. From the photo you supplied it looks as if you are using "Zabbix agent" as the item type.
        1. If you want the agent (from inside your private network) to contact the server (on AWS) and not the other way around you can not use "Zabbix agent" item type.
        2. If you want your server (on AWS) to contact you host (on your private network) you will need to set up NAT translation in your local firewall and configure the host in the server to use your local firewall external IP, Or set up a VPN between the networks.
        3. Install a zabbix proxy in your local private network that collects everything and sends it to the server.
        I would recommend option 1 if it's just 1 single agent. Just clone the template and in the clone change all types to active and then change the host so that it uses the new template.
        Hey kmpm,

        thanks for answer.

        when you say, clone the template and in the clone change all types to active, what do you mean?

        thanks.

        Comment

        • kmpm
          Junior Member
          • Dec 2018
          • 11

          #5
          Hi,
          Sorry for being confusing.

          On your host configuration you have probably linked a template called "Template OS Windows".
          This template have a bunch of "Items" + "Discovery rules". All these use a type definition called "Zabbix agent".
          Click image for larger version  Name:	zabbix-agent-1.png Views:	1 Size:	6.0 KB ID:	370900
          Type is more or less describes how the values are collected and in the case of "Zabbix agent" the agent is passive, listening for requests from the Zabbix server, and the server needs access to the agent somehow.
          This might be directly on the same network or as in your case you would have to open ports in your firewall + NAT-forward to let the zabbix server reach the computer with the agent.
          Server ====> AWS Firewall ====> Local Firewall ====> Agent
          The server needs the public ip of your local firewall and that local firewall needs to do a NAT-forward to your local IP of the agent to let the server initiate the connection with the client.


          What you probably want is a template where all these "Items" are changed to "Zabbix agent (Active)".
          With a "Active" type the flow of information is reversed and the agent takes an active role initiating the connection. First it connects to the server (using the ServerActive information in the config file) and gets information about all it needs to collect.
          Then it sends that information on regular intervals to the server. In this case the server does not need a direct connection to the agent but the agent needs to be able to connect to the server.
          Agent ====> Local Firewall ====> AWS Firewall ====> Server
          The server does not need to know the IP of the agent, there is no need to open anything up in the local firewall or anything.
          Just allow the traffic to flow from inside to outside (which most firewalls/routers do by default) and open up a port in the AWS firewall (usually port 10051) so that the server can be reached.

          Back to templates...
          The default template has "Type" set to "Zabbix agent" on all "Items" which is probably not what you want and by default there is no template for active but it can easily be made by cloning (copying) and modifying an existing one.

          Clone an existing...
          1. Go to Configure -> Templates
          2. Find and open "Template OS Windows" or whatever you want to clone.
          3. Click the "Full clone" button in the bottom of the template configuration.
          4. Give the clone a new name, default is the same as the original which can't be saved. Example "Template OS Windows (Active)"
          5. Click "Add"
          Now you should have an exact copy of the old template but with a new name. Now you have to go through all items and change them from "Zabbix agent" to "Zabbix agent (Active)".
          1. Go to Configure -> Templates
          2. Find and open the cloned template, ex. "Template OS Windows (Active)"
          3. Click on "Items" of the template.
          4. You now have to change ALL items either by clicking one by one or do a mass update. Change type to "Zabbix agent (Active)"
          5. Do the same for every thing you find in Discovery rules.
          If the template you have chosen have other linked templates you might have to create "Active" versions of those to and exchange the linked templates from the default passive version to your new and shiny active one.

          Last part should be to go to your host configuration and exchange the template used for the host from the default passive to your newly created "Active" version.
          If you only have "Active" items then the agent does not need to listen for anything and you could remove the "Server=xx.xx.xx.xx" line completely from the agent config.

          I hope this helps...
          //kmpm

          Comment

          Working...