Ad Widget

Collapse

Setting a trigger on an item with preprocessing and JSON output

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • horseatingweeds
    Junior Member
    • Nov 2020
    • 3

    #1

    Setting a trigger on an item with preprocessing and JSON output


    I'm using JMX to monitor a messaging system, ActiveMQ-Artemis. I'd like to setup a notification that let's me know queue names that start to accumulate more than some number of messages. Using jmx.get() I can pull data in a variety of ways, especially after using JSONPath, under the Preprocessing tab. For example, I can get the message count like this:

    Code:
    [
    {
    "name": "MessageCount",
    "description": "number of messages currently in this queue (includes scheduled, paged, and in-delivery messages)",
    "type": "java.lang.Long",
    "value": "0",
    "object": "org.apache.activemq.artemis:broker=\"0.0.0.0\",co mponent=addresses,address=\"MAO.SOF.User.Import.To pic\",subcomponent=queues,routing-type=\"multicast\",queue=\"MAO.SOF.User.Import.Que ue\""
    },
    {
    "name": "MessageCount",
    "description": "number of messages currently in this queue (includes scheduled, paged, and in-delivery messages)",
    "type": "java.lang.Long",
    "value": "105",
    "object": "org.apache.activemq.artemis:broker=\"0.0.0.0\",co mponent=addresses,address=\"test1.test\",subcompon ent=queues,routing-type=\"multicast\",queue=\"test1.test.B\""
    },
    {
    "name": "MessageCount",
    "description": "number of messages currently in this queue (includes scheduled, paged, and in-delivery messages)",
    "type": "java.lang.Long",
    "value": "0",
    "object": "org.apache.activemq.artemis:broker=\"0.0.0.0\",co mponent=addresses,address=\"SiteCore.SOF.Order.Ful fillment.Submission.Topic\",subcomponent=queues,ro uting-type=\"multicast\",queue=\"SiteCore.SOF.Order.Fulf illment.Submission.ActiveOmni.Queue\""
    }
    ]

    By pulling all the attributes with JMX and then filtering only the MessageCount with $.[?(@.name=='MessageCount')]

    But I don't see how to setup alerts from here. When I try to create an alert, it offers only the Key, not the preprocessed data. Meaning I can add this to the expression editor "{IP:jmx.get[attributes,"org.apache.activemq.artemis:broker=*,c omponent=addresses,address=*,subcomponent=queues,r outing-type=*,queue=*"].last()}" but that is not preprocessed, correct?

    But even if it did, the JSON isn't the low-level data I need for the simple trigger functions.

    So once I setup an item with preprocessing, how shall I setup the trigger?

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

    #2
    option 1: based on your item, create a dependent json LLD that creates several data elements (type-dependent on the same master item) and the corresponding triggers.
    option 2: do all the processing in the main item preprocessing. as a result, item returns a sign of a problem, which the trigger responds to.

    Comment

    Working...