Aggregate checks

Running individual checks has been great so far, but they are just checks on one system. What if you would like to know the total CPU load of a group of servers? For example, when you are running a cluster of servers? For this we can make use of the aggregated checks in Zabbix.

Getting ready

To be able to finish this recipe successfully we need our Zabbix server with a few Linux hosts installed and properly configured.

How to do it …

  1. First, we create a new host called linuxgroup, for the agent IP address we can just put 0.0.0.0 and add it in a fictive hostgroup or for example, Discovered hosts.
  2. Next, we create a new group (Configuration | Host groups) "aggregated" and we add two or more Linux hosts in this group.
  3. Now we create an active item "system.cpu.load[percpu,avg1]" in a new template that we can link to all our hosts available in our "aggregated" group.
  4. The next step is to create a new template for example aggregated-linux and link this template to our fake host linuxgroup that we made in step 1.
  5. In this template, create an item with the Key:
    grpavg["aggregated","system.cpu.load[percpu,avg1]","last"," 0"]
    How to do it …

When you go now to Monitoring | Latest data, you will see on our fake host the average CPU load from all our hosts in the group "aggregated".

How to do it …

How it works

Aggregated items summarize the readings of an item of all hosts in a group together. The structure used to create an aggregated item is as follows:

groupfunc["Host group","Item key",itemfunc,timeperiod]

The groupfunc is just a placeholder and needs to be replaced with grpavg, grpmax, grpmin, or grpsum. The Host group is the group of servers that we want to use for our calculation. The item key is the item that is available on all servers in the group. The item function can be avg, count, last, max, min, or sum.

There's more...

Aggregated checks don't rely on any Zabbix agent or server check. Instead the Zabbix server will look at existing data in the database and reuse it to calculate a new item.

When you create an aggregated check in a template and link this template to all servers in for example, the group webservers; then Zabbix will recalculate this check on every server in this group. The result is that Zabbix server will calculate and store the same data for every server. One solution is to add the item local on a host or a better solution could be to create a fake host like we did in the example with the name related to the purpose of our cluster.

Tip

Only active items on enabled hosts are included in the calculations.

The amount of values (prefixed with #) is not supported.

The time period parameter is ignored by the server if the third parameter (item function) is last.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.116.19.17