Ad Widget

Collapse

Aggregate configuration

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • grantd
    Junior Member
    • Jun 2015
    • 6

    #1

    Aggregate configuration

    Hey Everyone,
    I am fairly new to Zabbix and having an issue trying to figure out how to set up the aggregate functions for a group.



    I have the following:

    Host group: "VM Hosts"
    Item key: vmware.hv.cpu.usage.percent[{$URL},{$UUID}]
    Item type: Calculated
    Formula: last("vmware.hv.cpu.usage[{$URL},{$UUID}]",0)/(last("vmware.hv.hw.cpu.freq[{$URL},{$UUID}]",0)*last("vmware.hv.hw.cpu.num[{$URL},{$UUID}]",0))




    What I want to do is get the average of these item keys across all members of the group, so I tried the following:

    grpavg["VM Hosts",vmware.hv.cpu.usage.percent,last,0]
    grpavg["VM Hosts","vmware.hv.cpu.usage.percent",last,0]
    grpavg["VM Hosts","vmware.hv.cpu.usage.percent[,]",last,0]

    These all go unsupported, so I know I am doing something wrong. How would I formulate my grpavg line when my item key contains a reference to MACROS that are defined on each host? I want to do this for several of the metrics in the host (CPU %, memory %, # of VMs, network in, network out, etc) as either SUMs or AVGs, but they all use the same two MACROS ({$URL},{$UUID}) that are defined at the host level.


    Thanks in advance. Willing to try any suggestions and report back.
  • grantd
    Junior Member
    • Jun 2015
    • 6

    #2
    Old thread, I know, but I finally figured out why it didnt work

    Because the host I was adding the aggregate function to had a macro of {$URL}, it was substituting the macro value instead of the macro name.

    So as a work around I created 2 new macros:
    {$HOST_UUID} = {$UUID}
    {$HOST_URL} = {$URL}

    And use these macros in my key:
    grpavg["HOST GROUP","vmware.hv.cpu.usage.percent[{$HOST_URL},{$HOST_UUID}]",last]

    And in case anyone is interested, the vmware.hv.cpu.usage.percent is calculated by the following "percent=usage/(frequency*cores)":
    last("vmware.hv.cpu.usage[{$URL},{$UUID}]",0)/(last("vmware.hv.hw.cpu.freq[{$URL},{$UUID}]",0)*last("vmware.hv.hw.cpu.num[{$URL},{$UUID}]",0))

    Comment


    • yasith
      yasith commented
      Editing a comment
      Hi grantd ,

      I also try to find the vmware cpu usage as a percentage and i tired it with so many ways.
      can you please tell me where should i create the macros?

      Regards,
      Yasith

    • grantd
      grantd commented
      Editing a comment
      You create those macros on the host entry where you created the grpavg. Just upgraded from Zabbix 4.0 to 6.0 and it stopped working, don't have a new solution yet
  • grantd
    Junior Member
    • Jun 2015
    • 6

    #3
    For prosperity, I am adding what I found so they next time I Google this issue and find my own post, I will remember what I have already figured out.

    I found that when using the test function of the item, I had to use the group ID number instead of the group name, but for it to work as an actual item, it had to be the group name and not the group number.

    This meant for me to do this: sum(last_foreach(/*/vmware.hv.vm.num[{$URL},{$UUID}]?[group="ESX"]))
    To test before creating/updating the item, it had to look like this: sum(last_foreach(/*/vmware.hv.vm.num[{$URL},{$UUID}]?[group="121"]))
    Where the host group ID for "ESX" was "121"
    And then change it back to "ESX" when adding/updating the item for it to work on the interval.



    Also want to point out that in Zabbix 4.0, you couldn't directly use aggregate functions across items that had macros in the item key, and the workaround was to add a macro on the host entry that would contain the aggregate items and the value of that macro was the name of the macro used in the item keys.

    Example, if you wanted to do a grpsum of these items on many hosts: vmware.hv.vm.num[{$URL},{$UUID}]
    Your key would look like this: grpsum["ESX","vmware.hv.vm.num[{$HOST_URL},{$HOST_UUID}]",last]
    Where the host had macros like:
    {$HOST_URL} = {$URL}
    {$HOST_UUID} = {$UUID}

    So I just had to go through and update all my aggregate functions and replace {$HOST_URL} with {$URL} and {$HOST_UUID} with {$UUID} as they no longer will do macro replacements/evaluations.

    Comment

    Working...