ikzelf / zbxdb

Zabbix database monitoring, the easy and extendable way
GNU General Public License v3.0
94 stars 45 forks source link

Question: how to work with a 4 rows return? #89

Closed JustNZ closed 3 years ago

JustNZ commented 3 years ago

Hello,

I've an query which returns a four row key / value pair. How do I have to configure that in zbxdb and in my zabbix template to work?

Query ouput example:

------------------------
|   key       |     value    |
|------------------------
|    max     |      500      |
|    peak    |      413      |
|  current  |      42        |
|  active    |      12        |
-------------------------
ikzelf commented 3 years ago

Hi, if this is just a static set (max, peak,current and active) just create the items with the same name (case sensitive) and they will get populated after the next config cache refresh. I guess this is something app/site specific so smarted would be to put the sql[s] in a site specific sql and use the site_checks parameter to point to your specific file. Also it might proof smart to create a site/app specific template for this, making it easier for you to distinguish and remember where you used it.

If the result set is not static (there could be more or less items depending on who knows what) it would be smarter to create a discovery query for them. For an example look at inst.lld in the oracle/primary.19.cfg and the inst.lld discovery rule in the zbxdb template.

JustNZ commented 3 years ago

Hey, just tested it and didn't thought that it would be that easy.

Thanks!