D
D
Dan Ivanov2015-02-28 13:45:50
System administration
Dan Ivanov, 2015-02-28 13:45:50

Zabbix, autodiscovery and custom macros, how to make friends?

Hello.
There was a task to somehow connect autodiscovery and user macros in zabbix, and I don’t understand how to do it in the most convenient way.
What do we have.
There is a discovery rule that pulls a script that issues a list of log file names in the specified directory along the passed path. Based on this output, a number of items are generated, which in turn are userparameters.
This userparameter is a script that takes a number of parameters as input (hostname/logname/collect_type, time shift, etc), and produces various values ​​at the output (the number of defined response codes, the total number of events in the log, the number of events with req_time> 100ms, etc.).
The task arose, to exclude certain log files from processing one of the userparameters.
From the wishes, I would like the list of these exceptions to be set in the settings of each host as a macro.
As it turned out, they cannot be used in autodiscovery prototypes.
We tried to create items on the host system.run[/bin/echo {$LOG_EXCLUDES}], and pull it on the host using zabbix_get. It doesn't work, probably because the agent doesn't know anything about such a variable.
Of the solutions that are currently being seen, separate these userparameters into a separate discovery rule, and set restrictions in its filter on each host, which, in my opinion, is not very transparent.
I would like to somehow transfer the list of files from the macro to the userparametr script. But I can't figure out how to do it.
Your ideas?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
D
Dan Ivanov, 2015-04-23
@ptchol

By the way, everything was decided by creating a separate item (normal, not prototype), which creates a file with a list of excludes, and this list is dragged into the aggregation script.
Uncomfortable, inflexible. While it works.

S
Sergey Petrikov, 2015-02-28
@RicoX

LLD perfectly supports its scripts, the only thing is that they should give data in json format, there is nothing complicated in writing, you can use any filters and logic in the script. Your task is far from me personally, but I have several self-written LLD scripts for zabbix and examples of their use. Look at this thread on the forum https://www.zabbix.com/forum/showthread.php?t=28870 there are examples of scripts both from me and from other forum members, I think you will figure it out.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question