Ad Widget

Collapse

Trigger Description - Can I use item values?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • tcweb
    Member
    • Jun 2024
    • 51

    #1

    Trigger Description - Can I use item values?

    I have a template I created that I link to the base Linux/windows templates. I've added some items and dependent items, etc.
    I'd like to be able to use item values in a trigger description. The documentation says that macros are valid in trigger descriptions.

    I'm trying this: (I cloned the default trigger for high PCU, and modified the description.

    Windows: High CPU utilization (over 90% for 5m) {?last(//top.cpu.pname)} : {?last(//top.cpu.pct)}%

    I end up with *UNKNOWN* after the macros expand:

    Windows: High CPU utilization (over 90% for 5m) *UNKNOWN* : *UNKNOWN*%


    Here are all of the relevent items from the host perspective, so they are all available and populated:
    Click image for larger version

Name:	image.png
Views:	18
Size:	187.0 KB
ID:	516075

    I've tried several variations, but I'm starting to wonder if the fact that these templates are linked is the issue? In order for this to work, do I need all of the item values to be in the SAME template?

    Thanks,

    -Tom
    Attached Files
  • rozols
    Junior Member
    • Aug 2026
    • 9

    #2
    Hi,

    I checked this tried myself in a lab, created 1 master item and 3 dependent items for collecting data from master, afterwards made a clone of High CPU utilization trigger and updated the name -
    Test: High CPU utilization - {?last(//top.cpu.pname)} PID {?last(//top.cpu.pid)} : {?last(//top.cpu.pct)}%
    Click image for larger version

Name:	image.png
Views:	13
Size:	20.1 KB
ID:	516098

    Click image for larger version

Name:	image.png
Views:	16
Size:	42.1 KB
ID:	516095


    Adjusted the expression to trigger the alert and in end got -
    Click image for larger version

Name:	image.png
Views:	13
Size:	45.4 KB
ID:	516097
    Test: High CPU utilization - java PID 7155 : 0.4%

    Only way to reproduce the *UNKNOWN* alert was if in the dependent item i set history to Do not store -
    Click image for larger version

Name:	image.png
Views:	13
Size:	20.0 KB
ID:	516096


    Maybe more details would help the check the issue further:
    - What Zabbix version are you running? The {?last(//key)} syntax in trigger names/descriptions requires 5.4+.
    - Does the item ever show a "not supported" state?
    - Can you paste the exact item key as shown in Latest Data, next to the exact macro text you're using? {?last(//key)} needs an exact, case-sensitive match including any bracket parameters.
    - Check Housekeeping setting — is "Override item history period" enabled?

    Comment

    • tcweb
      Member
      • Jun 2024
      • 51

      #3
      Only way to reproduce the *UNKNOWN* alert was if in the dependent item i set history to Do not store <-- for the master item, I do not store history, but I do for the dependent items.

      I am using zabbix 7.4.

      I did see "not supported" once, but I assume it was because high CPU on the host may have caused the item to timeout. (I had increased timeout from default to 5s)

      I will paste the exact item key and macro test shortly. Thank you.

      Comment

      • tcweb
        Member
        • Jun 2024
        • 51

        #4
        Here is the trigger description I am using:

        Windows: High CPU utilization (over 90% for 5m) {?last(/Company Windows Servers/top.cpu.pname)} : {?last(/Company Windows Servers/top.cpu.pct)}%
        Note: I also tried the syntax I posted above: {?last(//top.cpu.pname)}

        Here are the item keys. top.cpu.process is the input from my user parameter. top.cpu.pct, top.cpu.pid, and top.cpu.pname are dependent items.

        Click image for larger version  Name:	image.png Views:	0 Size:	105.3 KB ID:	516115
        Last edited by tcweb; Today, 18:42.

        Comment

        • tcweb
          Member
          • Jun 2024
          • 51

          #5
          rozols, can you confirm that you did this all within one template? or did you create your master/dependent items in a separate template like I did?
          I recall that there may be issues referencing items from different templates. But I was hoping that LINKING templates addressed that issue. Perhaps not. Would it be too much trouble to ask you to try this? Pull your items to a separate template, link that template to your default Linux template, and see if it still works, or if it breaks?

          I just copied the items into the main Windows template, and ramped up CPU on a test server. Trigger fired, and I got UNKNOWN again. I did see that my items timed out, again probably due to CPU being 100 on the server:

          Click image for larger version

Name:	image.png
Views:	0
Size:	28.0 KB
ID:	516117
          Last edited by tcweb; Today, 20:05.

          Comment

          • tcweb
            Member
            • Jun 2024
            • 51

            #6
            OK, I got it to work - modified the trigger to fire at 60%, so I wouldn't have to bury the CPU at 100%:
            Click image for larger version

Name:	image.png
Views:	0
Size:	27.1 KB
ID:	516119
            Now back to putting my items in a linked template to see if it still works.

            Comment

            • tcweb
              Member
              • Jun 2024
              • 51

              #7
              ...And it still works with a linked template. Phew.
              So I just need to get my trigger to fire a bit faster, in case we have a runaway process that pushes host CPU too high that the user parameter times out.

              -Tom

              Comment

              Working...