Ad Widget

Collapse

Dynamic key in trigger expression

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Minuteman
    Junior Member
    • Feb 2014
    • 2

    #1

    Dynamic key in trigger expression

    Hello,

    I'm quite new to Zabbix and have a question about Triggers...

    First of all a bit of background...my goal is to monitor some TV channels with a custom script. If a channel is ok it sends a "Running" value back and if it's down it sends a "Down" value back. Pretty simple and it works well.

    Now my problem is that I have 300 channels which work in that fashion and I would like to add one single trigger to manage them all because they all have the same format (a "trigger prototype").

    Here is an example of some channels in the Template, there are 300 more:


    On one channel (3 Sat) I created a trigger which works very fine:
    {Template Multicast Streams:check_multicast["--g","239.101.10.208","--i","vlan289","--p","1234","--t","2"].regexp(Down)}=1

    Now my question is...can the whole "check_multicast["--g","239.101.10.208","--i","vlan289","--p","1234","--t","2"]" key be replaced with some Macro that gets it for every channel?

    As far as I can see on https://www.zabbix.com/documentation...ed_by_location it's not possible, a trigger expression seems to want a real key

    Thanks!

    I'm running version 2.2.1
  • aib
    Senior Member
    • Jan 2014
    • 1615

    #2
    Do you mind to use any external tools?

    1) Create one trigger
    2) Export trigger to .xml file
    3) Using some scripts/excel spreadsheet/pet monkey/etc. create as many triggers in new .XML file as you need
    4) Import your new .XML file with 300++ triggers back to Zabbix.

    How about that?
    Sincerely yours,
    Aleksey

    Comment

    • steveboyson
      Senior Member
      • Jul 2013
      • 582

      #3
      That really shouts for a "low level discovery" rule.
      Have a text file on your zabbix (or somewhere else) and use that.

      <sender>,<param>

      You would parse that file and send back a JSON reply which zabbix interprets as data.
      With that you can create items and triggers by instantiating your previously created prototypes.

      See the zabbix manual for LLD.

      Comment

      • Minuteman
        Junior Member
        • Feb 2014
        • 2

        #4
        Thanks,

        aib: that was indeed my "dirty" solution
        steveboyson: I'll have a look at the discovery rules, I was not aware of their existence...I'll let you know.

        Comment

        Working...