Maybe I'm asking too much, but here is what I am trying to do:
I want to monitor a, or actually multiple, Silicon Dust HDHomerun Prime network tuners. I simply installed their agent (hdhomerun_config) through apt-get, as it's in the repository for Ubuntu (this is an appliance install). I simply created a symbolic link to the program in the default external scripts directory, and it works, I can create simple external script items against the agent directly on the zabbix server.
So now I want to create a discovery rule using a user defined macro to define the individual tuners within each device. The goal is to create something as a useful starting point for anybody that may want to use zabbix to monitor these devices, and different models have different numbers of tuners.
Near as I can figure there is really only one way on these devices to get the number of tuners and that is through a /sys/debug command which also returns some other info that is not of interest and returns the tuner numbers but in a longer string than what I actually want, which is simply a number. Here is a bit more detail...
In the discovery rule I want to send the command
"hdhomerun_config["{HOST.IP}","get /sys/debug"]
Which will return
mem: nbm=776919/6822 npf=40878 dmf=1519968
loop: pkt=0
t0: pt=11 cal=-537
t1: pt=11 cal=-534
t2: pt=11 cal=-539
eth: link=1000f
I only really want the "t?:" lines which I can limit through a simple regular expression, but then I want to assign just the number in the 2nd position of the string into a reusable user defined macro similar to how the filesystem and network discovery rules work so I can just create universal prototypes.
So the question is how does one chop up a string to assign it to a user defined macro?
Do I have to predefine the macro someplace other than in the discovery rule filter first in order to use it?
...or am I not understanding the concept at all and need to complicate things by writing a script that returns exactly what I need?
It's not difficult to do, I would just rather not make the process slower on the polling side by introducing a script that calls a program when I could just call the program directly. Also if I can define it all through a template this process becomes as simple as install this, link it here, and use this template.
I want to monitor a, or actually multiple, Silicon Dust HDHomerun Prime network tuners. I simply installed their agent (hdhomerun_config) through apt-get, as it's in the repository for Ubuntu (this is an appliance install). I simply created a symbolic link to the program in the default external scripts directory, and it works, I can create simple external script items against the agent directly on the zabbix server.
So now I want to create a discovery rule using a user defined macro to define the individual tuners within each device. The goal is to create something as a useful starting point for anybody that may want to use zabbix to monitor these devices, and different models have different numbers of tuners.
Near as I can figure there is really only one way on these devices to get the number of tuners and that is through a /sys/debug command which also returns some other info that is not of interest and returns the tuner numbers but in a longer string than what I actually want, which is simply a number. Here is a bit more detail...
In the discovery rule I want to send the command
"hdhomerun_config["{HOST.IP}","get /sys/debug"]
Which will return
mem: nbm=776919/6822 npf=40878 dmf=1519968
loop: pkt=0
t0: pt=11 cal=-537
t1: pt=11 cal=-534
t2: pt=11 cal=-539
eth: link=1000f
I only really want the "t?:" lines which I can limit through a simple regular expression, but then I want to assign just the number in the 2nd position of the string into a reusable user defined macro similar to how the filesystem and network discovery rules work so I can just create universal prototypes.
So the question is how does one chop up a string to assign it to a user defined macro?
Do I have to predefine the macro someplace other than in the discovery rule filter first in order to use it?
...or am I not understanding the concept at all and need to complicate things by writing a script that returns exactly what I need?
It's not difficult to do, I would just rather not make the process slower on the polling side by introducing a script that calls a program when I could just call the program directly. Also if I can define it all through a template this process becomes as simple as install this, link it here, and use this template.
Comment