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.
To be able to finish this recipe successfully we need our Zabbix server with a few Linux hosts installed and properly configured.
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."aggregated"
and we add two or more Linux hosts in this group."system.cpu.load[percpu,avg1]"
in a new template that we can link to all our hosts available in our "aggregated"
group.aggregated-linux
and link this template to our fake host linuxgroup
that we made in step 1.grpavg["aggregated","system.cpu.load[percpu,avg1]","last"," 0"]
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"
.
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
.
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.