Ad Widget

Collapse

How can I automatically add new Amazon EC2 instance to right groups/templates?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • malcolmb
    Junior Member
    • Aug 2010
    • 2

    #1

    How can I automatically add new Amazon EC2 instance to right groups/templates?

    Hi,

    I'm using Amazon EC2 instances for my servers, and scaling up/down the number of servers as load changes.

    When a new server comes up, I want to automatically register it in Zabbix and then configure the right sort of template based on what type of server it is (e.g. web, memcache, ha proxy, database etc).

    I've figured out the first bit using Actions and auto-discovery, but I can't figure out how to create an action that reads a value from the agent (e.g. system.role) and configures templates appropriately.

    Any ideas?

    Malcolm
  • eas
    Junior Member
    • Aug 2010
    • 4

    #2
    I have the same basic question.

    I'm using chef to configure systems. I have created user parameters that chef populates that provide strings to define the environment (ie "stage", "production"), role (db, memcache, etc), and I have an auto registration action that adds new hosts to a group and/or template, but I can't figure out how I can actually use the user parameter to determine which group or template to apply to the host.

    I was planning on doing it with a trigger, but it only seems that I can add or remove from a group or template based on a discovery or auto-registration event, not a trigger.

    Are we missing something obvious?

    Comment

    • walterheck
      Senior Member
      • Jul 2009
      • 153

      #3
      I haven't actually tried it, but from exploring around a bit it seems that when you create a new discovery rule, you create a new check for zabbix agent and fill out the key there. Does that help?

      Read this for a bit more information: http://www.zabbix.com/documentation/..._life_scenario
      Free and Open Source Zabbix Templates Repository | Hosted Zabbix @ Tribily (http://tribily.com)

      Comment

      • malcolmb
        Junior Member
        • Aug 2010
        • 2

        #4
        Sadly that doesn't help in the EC2 case, since running a discovery rule that searched Amazon's IP address range would be .... unfriendly.

        Essentially it needs a merge of the functionality that you can trigger when a discovery rule matches, with what you can do with autodiscovery.

        So flow is:

        - Agent contact server
        - Agent IP not known, triggers autodiscovery rule
        - New host created
        - New host triggers discovery processing
        - Discovery rule reads setting from host and associates templates etc

        Both halves of this work, but as far as I can see there's no way to get an autodiscovered host to trigger the discovery rules.

        Malcolm

        Comment

        • eas
          Junior Member
          • Aug 2010
          • 4

          #5
          That's my conclusion too, malcomb.

          I actually think it would be great if the ability to add and remove templates, etc could be driven by ordinary triggers too. I'd love to be able to set macros on hosts and templates based on values discovered from a userparam too.

          As it is, I guess I can put generic monitoring into place, but environment and role specific stuff ia going toned to b edone by hand, or the API.

          Comment

          • mattsmith
            Member
            Zabbix Certified Specialist
            • Aug 2010
            • 33

            #6
            Hi eas,malcolmb

            Hope all is well, Just wondering how you guys got on with automatically adding the EC2 instances into zabbix? We will shortly be looking to do the same thing and we too will be using Chef.

            Did you go down the API route or did you use a different method? Could you share any problems that you encountered or hopefully your success stories?

            Any information that you are able to provide I'm sure will prove top be very valuable.

            Thanks
            Matt

            Comment

            • MaximVeksler
              Junior Member
              • Jun 2011
              • 9

              #7
              Hi,

              Just now seen this thread. We did the auto addition using API calls, based on the security groups in which the instance got launched with.

              So far looks like it's working OK.

              Comment

              • nicolasg
                Member
                • Apr 2011
                • 50

                #8
                Hi MaximVeksler,

                Can you post an example with more details ?

                Comment

                • tzn
                  Junior Member
                  • Apr 2011
                  • 19

                  #9
                  I also just use API to add hosts to zabbix.
                  No wI only lack removing instances, but I'm working on that. I will problaby use cron triggered script checking instance presence with EC2 tools

                  Comment

                  Working...