Ad Widget

Collapse

Getting Output Count with Zabbix Dependent Item

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • 234233214
    Junior Member
    • Nov 2022
    • 15

    #1

    Getting Output Count with Zabbix Dependent Item

    Hello,

    Sorry if this is basic but I have spent considerable time getting this to work. I have a master item master_item that outputs something like this:
    JobID,User,State,NodeList,NNodes,Elapsed,Waittime,
    1,user1,RUNNING,server1,1,3-17:43:02,00:00:14,
    2,user2,RUNNING,server2,1,2-21:45:11,00:00:00,
    3,user3,COMPLETED,server3,1,2-14:46:49,00:00:02,
    4,user4,COMPLETED,server4,1,00:19:50,00:00:00,​
    I want to create dependent items that would get the count of COMPLETED or RUNNING. Just looking at the case of 'COMPLETED', I have been able to create a basic Regular Expression that seems to find 'COMPLETED' but I can't figure out how to get the count of the 'COMPLETED' occurrences. This is what I have so far in the pre-processing:
    Click image for larger version

Name:	image.png
Views:	512
Size:	25.1 KB
ID:	458971
    It appears that I'd have to add another pre-processing step to get the count but I can't figure out which one and how to do it.
    Please suggest a solution to this,
    Thanks,
  • Hamardaban
    Senior Member
    Zabbix Certified SpecialistZabbix Certified Professional
    • May 2019
    • 2713

    #2
    Use JavaScript preprocessing in dependent items and count in it .

    Comment

    • 234233214
      Junior Member
      • Nov 2022
      • 15

      #3
      Hamardaban that worked, thanks for pointing me to the right direction

      Comment

      • Semiadmin
        Senior Member
        • Oct 2014
        • 1625

        #4
        1. In master item: CSV to JSON with header raw
        2. In dependent item JSONPath: $.[?(@.State == 'COMPLETED')].State.length()

        Comment

        • 234233214
          Junior Member
          • Nov 2022
          • 15

          #5
          Originally posted by Semiadmin
          1. In master item: CSV to JSON with header raw
          2. In dependent item JSONPath: $.[?(@.State == 'COMPLETED')].State.length()
          Semiadmin this worked beautifully. I wasn't aware of JSONPath query language. Thanks a bunch for this.

          Comment

          Working...