Ad Widget

Collapse

Get Item name in trigger

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • wars
    Junior Member
    • Aug 2023
    • 4

    #1

    Get Item name in trigger

    I created some items to check if a port is running on my host

    Simple check with key net.tcp.service[http,,xxxxxx]

    Now I want to use one trigger for all my items. I used something like this
    Code:
    last(/192.168.0.1/net.tcp.service[http,,xxxxxx])=0 or last(/192.168.0.1/net.tcp.service[http,,xxxxxx])=0
    This works, but how can I edit the name of the trigger so I know which item has a problem? I already tried things like {ITEM.NAME} but doesn't display anything.​
  • Hamardaban
    Senior Member
    Zabbix Certified SpecialistZabbix Certified Professional
    • May 2019
    • 2713

    #2
    Study:

    and then

    Comment

    • wars
      Junior Member
      • Aug 2023
      • 4

      #3
      Thanks for the info, but I already looked into these docs.
      When I name the trigger port_http {ITEM.NAME2}, it displays this text in my alerts, so it doesn't replace the {ITEM.NAME2}​ with the correct item. And offcourse I want this to be dynamic so I always get the correct item with the alert.

      Comment

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

        #4
        In the documentation where macros are described, pay attention to the "Supported in" column...

        and at trigger topic:
        Name Trigger name.
        Supported macros are: {HOST.HOST}, {HOST.NAME}, {HOST.PORT}, {HOST.CONN}, {HOST.DNS}, {HOST.IP}, {ITEM.VALUE}, {ITEM.LASTVALUE}, {ITEM.LOG.*} and {$MACRO} user macros.
        $1, $2...$9 macros can be used to refer to the first, second...ninth constant of the expression.
        Note: $1-$9 macros will resolve correctly if referring to constants in relatively simple, straightforward expressions. For example, the name "Processor load above $1 on {HOST.NAME}" will automatically change to "Processor load above 5 on New host" if the expression is last(/New host/system.cpu.load[percpu,avg1])>5

        Your task is solved correctly with the use of LLD and the creation of data elements and triggers for each port.

        Or you can create one calculated data element in which the total "state" of the system is calculated and create one trigger from it.

        Comment

        Working...