Ad Widget

Collapse

Creating sql queries from an autodiscovery rule. Is it possible?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • andrea.g.els
    Junior Member
    • Jan 2018
    • 18

    #1

    Creating sql queries from an autodiscovery rule. Is it possible?

    Hello ,
    it's a couple of days that I'm trying to wrap my head around this problem but I'm not sure how to solve it and (first of all) if it's possible doing it automatically.

    I've got a mysql table which contains inventory information , like :
    Code:
    +---------------------------------------+---------------------------------------+
    | article_id                            |  available_pcs                        |
    +---------------------------------------+---------------------------------------+
    | 1001                                  |  20                                   |
    | 1002                                  |  21                                   |
    | 1003                                  |  35                                   |
    +---------------------------------------+---------------------------------------+
    I need to create one item per article_id per id , using an automatic discovery rule so , if a new article_id is added , a new item will be created , and also a new alert if it drop below the thresold


    First question :
    it must do a simple select of the article_id , so I get the item_id , or it can generate directly the value , so it saves one query per id ?


    Assuming that I cant interfere the value from a macro (right?) , probably I must opt for getting only the article_id, using something like :

    Code:
    select distinct article_id from tbl_inventory ;

    Then I must generate one item per #ARTICLE_ID , which will spawn a query similar to
    Code:
    select available_pcs from tbl_inventory where article_id="#ARTICLE_ID" ;

    Second question :
    How I configure this item template , without changing the zabbix client config file every time a new article is inserted ?


    It's possible to achieve this kind of result ? it's possible or I'm misunderstandig the docs , missing some piece ?


    any hint is appreciated
Working...