Ad Widget

Collapse

Help with Kubernetes Host Group Assignment in Zabbix

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • matmz
    Junior Member
    • Mar 2021
    • 10

    #1

    Help with Kubernetes Host Group Assignment in Zabbix

    I am currently monitoring a Kubernetes cluster using Zabbix, leveraging the integration provided https://git.zabbix.com/projects/ZBX/...at=release/7.0. Following the instructions, I created an Hostgroup for the hosts, and then proceeded with the following steps:

    1. Created a generic host for the nodes and assigned the "Kubernetes nodes by HTTP" template to it.
    2. Set the macros according to the template instructions.
    3. Created a cluster state host and assigned the "Kubernetes cluster state by HTTP" template to it.

    The system works correctly overall, but I'm encountering an issue: the hosts created by the discovery system are not being added to the host group where their parent hosts belong.

    This is causing some difficulties in keeping the host groups organized and assigning permissions effectively.

    Has anyone encountered a similar issue or can suggest a solution? Your help would be greatly appreciated!

    Thanks in advance!
  • cyber
    Senior Member
    Zabbix Certified SpecialistZabbix Certified Professional
    • Dec 2006
    • 4806

    #2
    And where are those discovered hosts placed?

    Comment

    • matmz
      Junior Member
      • Mar 2021
      • 10

      #3
      The hosts are currently registered under the "Applications" host group as well as other host groups defined within the template. I made some adjustments to the templates by explicitly adding the parent host group (hardcoding it) to resolve the issue. However, I'm looking for a more elegant and maintainable solution. Any suggestions?

      Comment

      • matmz
        Junior Member
        • Mar 2021
        • 10

        #4
        ---
        (deleted message, wrong topic, sorry)
        ---

        Comment

        • cyber
          Senior Member
          Zabbix Certified SpecialistZabbix Certified Professional
          • Dec 2006
          • 4806

          #5
          I am not familiar with this template, but there are things like group prototypes also available. But as long as I understand, those should also come from discovery. so data should be somewhere on discoverable object... This definitely requires some mods to template, I guess...

          Comment

          • matmz
            Junior Member
            • Mar 2021
            • 10

            #6
            Exactly, the Kubernetes template relies on discovery, host prototypes, and group prototypes.
            The main issue is that there is no reference to the host group used in the parent item. By 'parent item,' I’m referring to the two host: 'controller' and 'state' that need to be defined for using the Kubernetes template as described in the documentation. I managed to solve this by editing the templates and hardcoding the values, but as you can imagine, this approach is only feasible if you're monitoring a single cluster. In the case of multiple clusters, I would have to duplicate the templates, which isn’t ideal.

            Comment

            • Brambo
              Senior Member
              • Jul 2023
              • 245

              #7
              Did you change the host-prototype host group value to the desired group?
              I don't expect a macro to work there because it uses internal linking UUID for the host group. (and making a duplicate template can be challenging )
              See image:
              Click image for larger version  Name:	image.png Views:	0 Size:	43.3 KB ID:	489552
              Last edited by Brambo; 14-08-2024, 09:38.

              Comment

              • matmz
                Junior Member
                • Mar 2021
                • 10

                #8
                I changed Host groups in this way:
                • I removed Templates/Applications
                • I added my "parent" hostgroup
                Not a clean solution, it's hardcoded...

                Comment

                • Brambo
                  Senior Member
                  • Jul 2023
                  • 245

                  #9
                  It's not ideal but believe, when it comes to make a duplicate template it will be more work then this.
                  What you could do is make the discovery rule with filter and for each where filter matches it's own host prototype item with the group you want. Still hardcoded but host-group isn't a variable.
                  Other way is build something yourself and talk to the zabbix API to create host-group you want and then also add hosts through the same API route

                  Comment

                  • matmz
                    Junior Member
                    • Mar 2021
                    • 10

                    #10
                    Thank you for the suggestion! I really appreciate it.

                    Comment

                    Working...