Ad Widget

Collapse

templates for items

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • michaelNGV
    Junior Member
    • Jul 2022
    • 27

    #1

    templates for items

    Templates are applied to hosts, and basically parameterise them; i.e., apply common functionality to the hosts. Is there any way parameterise items?

    The circumstance which prompts the question is that we have a server which runs a number of jobs at various (scheduled) times. We would like Zabbix to check that the jobs are running as they should, so I created a host (for the purposes of this discussion it could be called Our Server Jobs) and I want to add one (trapper) item to the host for each job. When our server finishes running a job, it sends a code (0 = finished OK, 1 = finished but with problems etc.) to Zabbix. The design requires four triggers for each item, and one item for each job. There are currently 12 jobs and that could increase to 20 or so as our server is developed. So I don't really want to replicate the logic of those four triggers over each item. But so far as I can tell, templates, which would solve the problem, can be applied only to hosts. What I really want is an item-level template, that is applied to items. Is there any way of achieving such functionality?

    Obviously I could just create a host in Zabbix for each job, but it doesn't feel like the right solution; we have one server, and it runs multiple jobs. I've resorted to cloning, but it's ugly.
    Last edited by michaelNGV; 05-08-2022, 06:18.
  • vladimir_lv
    Senior Member
    • May 2022
    • 240

    #2
    Forgive my asking, but if I understood you correctly you have one server that has to do 12 or more jobs. After the job is completed the server sends some code to Zabbix. So, why do you need a template for this case? Can this job use zabbix_sender for sending status to the trapper?

    Comment

    • michaelNGV
      Junior Member
      • Jul 2022
      • 27

      #3
      It does use zabbix_sender; well, not the stock Python/Bash implementation(s) that's commonly available, but my own rewrite in Kotlin.

      I want an item-level template because each item has three triggers and those three triggers will be the same for each item, except for the item name.

      This is based on my understanding that hosts have items, and items have triggers but maybe this is a misunderstanding; it might be that hosts have both items and triggers, and triggers can reference more than one item, so it doesn't make any sense in the trigger definition to refer to {ITEM.NAME} for example.
      Last edited by michaelNGV; 05-08-2022, 08:41.

      Comment

      • vladimir_lv
        Senior Member
        • May 2022
        • 240

        #4
        Maybe is easier to create one Zabbix trapper item with a key, for example, 'getresponse', type of information 'text' and then create trappers with extensions such as last(/your_server/getresponse)="Job1,0" and Events like "{ITEM.VALUE} failed".

        Comment

        • cyber
          Senior Member
          Zabbix Certified SpecialistZabbix Certified Professional
          • Dec 2006
          • 4807

          #5
          So you would like to have 12 items and 4 triggers that work with all of those 12 items, like looping over them?
          Unfortunately it does not work that way.. You can ease the creation with discovery a little bit.. like, keep job list on server and retrieve it time to time and create items/triggers based on newly found stuff.. but otherwise its still 12 items and then 4 trigger for each of them...

          Comment

          • michaelNGV
            Junior Member
            • Jul 2022
            • 27

            #6
            Thanks all for the suggestions.

            Comment

            Working...