Ad Widget

Collapse

Difficulties with Zabbix aggregate grpsum

Collapse
This topic has been answered.
X
X
 
  • Time
  • Show
Clear All
new posts
  • bobotron
    Junior Member
    • Mar 2020
    • 5

    #1

    Difficulties with Zabbix aggregate grpsum

    Zabbix Appliance 4.4.5 here...

    I have a host group called Terminal Servers. For each host in the group, I am grabbing Zabbix Agent item perf_counter["\Terminal Services\Active Sessions"] as TSActiveSessions

    I'd like to see a sum of these numbers in a dashboard, so I created a Zabbix aggregate item on one of the hosts using the key grpsum["Terminal Servers","perf_counter[\Terminal Services\Active Sessions\]",last]

    The Items entry page accepts it, but in the Item list, it shows as "Not Supported" and gives me the message No items for key "perf_counter[\Terminal Services\Active Sessions\]" in group(s) "Terminal Servers".

    I'm sure I'm doing something wrong. Can anyone help, or suggest a better way to sum these counts? Thanks in advance!!
  • Answer selected by Hamardaban at 24-01-2024, 13:30.
    Hamardaban
    Senior Member
    Zabbix Certified SpecialistZabbix Certified Professional
    • May 2019
    • 2713

    Code:
    item key ===> perf_counter["\Terminal Services\Active Sessions"]
    gfunc ===> grpsum["Terminal Servers","perf_counter[\"\Terminal Services\Active Sessions\"]",last]
    Last edited by Hamardaban; 24-01-2024, 13:29.

    Comment

    • bobotron
      Junior Member
      • Mar 2020
      • 5

      #2
      I'm sorry -- not trying to be daft... No what character at the end of what?

      Comment

      • dimir
        Zabbix developer
        • Apr 2011
        • 1080

        #3
        Try removing double quotes from the item parameter:
        Code:
        perf_counter["\Terminal Services\Active Sessions"] -> perf_counter[\Terminal Services\Active Sessions]

        Comment

        • bobotron
          Junior Member
          • Mar 2020
          • 5

          #4
          If I remove the double quotes and click Update, I receive a "Cannot update item" error: Invalid key "grpsum[Terminal Servers,perf_counter[\Terminal Services\Active Sessions\],last]" for item "TSActiveSessions-GroupSum" on "REDACTED-HOSTNAME": incorrect syntax near ",last]".

          Comment

          • dimir
            Zabbix developer
            • Apr 2011
            • 1080

            #5
            Remove the last backslash from grpsum item:
            Code:
            grpsum[Terminal Servers,perf_counter[\Terminal Services\Active Sessions],last]

            Comment

            • bobotron
              Junior Member
              • Mar 2020
              • 5

              #6
              Same result. Thanks, though!

              Comment

              • Hamardaban
                Senior Member
                Zabbix Certified SpecialistZabbix Certified Professional
                • May 2019
                • 2713

                #7
                Code:
                item key ===> perf_counter["\Terminal Services\Active Sessions"]
                gfunc ===> grpsum["Terminal Servers","perf_counter[\"\Terminal Services\Active Sessions\"]",last]
                Last edited by Hamardaban; 24-01-2024, 13:29.

                Comment

                • bobotron
                  Junior Member
                  • Mar 2020
                  • 5

                  #8
                  Perfect, Hamandaban! I think I had tried escaping the quotes before, but I must have been impatient waiting for data to refresh. Thanks all!!

                  Comment

                  • sbocquet
                    Junior Member
                    • Mar 2020
                    • 12

                    #9
                    Hi,

                    I'm also trying to use grpsum aggregate function but cannot succed at the moment.
                    So far, I've tried this syntax in a calculated item :

                    Code:
                    grpsum["Server/Linux servers","system.sw.updates[\"{$SYSTEM.UPDATE.SOURCELIST.STANDARD}\",\"{$SYSTEM.UPDATE.SOURCEPARTS.STANDARD}\"]",last]
                    Can I use macro definitions with grpsum, as those macro have default values in the template that create the key "system.sw.updates" ?
                    Is my syntax correct (I have escaped the " character) ?

                    The error is :

                    Code:
                    Invalid parameter "/1/params": incorrect expression starting from "grpsum["Server/Linux servers","system.sw.updates[\"{$SYSTEM.UPDATE.SOURCELIST.STANDARD}\",\"{$SYSTE M.UPDATE.SOURCEPARTS.STANDARD}\"]",last]".​
                    Last edited by sbocquet; 22-01-2024, 18:58.

                    Comment

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

                      #10
                      Originally posted by sbocquet
                      Hi,

                      I'm also trying to use grpsum aggregate function but cannot succed at the moment.
                      So far, I've tried this syntax in a calculated item :

                      Code:
                      grpsum["Server/Linux servers","system.sw.updates[\"{$SYSTEM.UPDATE.SOURCELIST.STANDARD}\",\"{$SYSTEM.UPDATE.SOURCEPARTS.STANDARD}\"]",last]
                      Can I use macro definitions with grpsum, as those macro have default values in the template that create the key "system.sw.updates" ?
                      Is my syntax correct (I have escaped the " character) ?

                      The error is :

                      Code:
                      Invalid parameter "/1/params": incorrect expression starting from "grpsum["Server/Linux servers","system.sw.updates[\"{$SYSTEM.UPDATE.SOURCELIST.STANDARD}\",\"{$SYSTE M.UPDATE.SOURCEPARTS.STANDARD}\"]",last]".​
                      what version of Zabbix? Since 5.4, there is no grp functions, they are replaced with _foreach functions..

                      Comment

                      • sbocquet
                        Junior Member
                        • Mar 2020
                        • 12

                        #11
                        Hi,

                        Thx for the help. My version is v6.0.xx, so I changed my expression with :

                        Code:
                        sum(last_foreach(/*/system.sw.updates[{$SYSTEM.UPDATE.SOURCELIST.STANDARD},{$SYSTEM.UPDATE.SOURCEPARTS.STANDARD}]?[group="Server/Linux servers"]))
                        I can create the item onmy selected host, but when I look at the Latest Data, I have this error on the item :

                        Code:
                        Cannot evaluate expression: no input data for function at "sum(last_foreach(/*/system.sw.updates[{$SYSTEM.UPDATE.SOURCELIST.STANDARD},{$SYSTEM.UPDATE.SOURCEPARTS.STANDARD}]?[group="Server/Linux servers"]))"
                        Any idea ?
                        Attached Files

                        Comment

                        • sbocquet
                          Junior Member
                          • Mar 2020
                          • 12

                          #12
                          After some more tests, it seems that there is a problem with the macro parameters on the items I want to sum.

                          If I add a new key on some test hosts that does not have parameters, like this :

                          Code:
                          UserParameter=system.sw.test, apt-get -s dist-upgrade -o Dir::Etc::SourceList='/etc/apt/sources.list' -o Dir::Etc::SourceParts='/etc/apt/sources.list.d' | sed -n 's/^\([0-9]\+\) upgraded.*/\1/p'
                          And now, I create a new "sum"

                          Code:
                          sum(last_foreach(/*/system.sw.test?[group="Server/Tests"]))
                          It works !

                          Click image for larger version

Name:	image.png
Views:	340
Size:	8.8 KB
ID:	477662

                          So... Can macro parameters be used when using the aggregate function ?​

                          Thanks

                          Comment

                          Working...