Ad Widget

Collapse

Macros on Discovery rule's Key

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • maco1717
    Junior Member
    • Apr 2019
    • 21

    #1

    Macros on Discovery rule's Key

    Hi,

    I want to create a Discovery rule key, Zabbix trapper type, where the key has the hostname as a "parameter" then I would want the item prototypes for that discovery rule that will also be type zabbix trapper get hostname and data (another piece of info), till will then generate a set of item Zabbix trapper type with two parameters.

    Does it make sense?

    So I am trying to send from the remote host (using the sender or not, doesn't matter but either way the key type will be trapper) some information, I would like not to have to create the items under each required hosts in Zabbix front end manually for each server/host but rather have a template (or similar) that using a discovery rule generates the items automatically on all required hosts.

    The issue I see with implementing something like this using Zabbix trapper is that the discovery key needs to be unique to each host entry in Zabbix right? if not how does the sender know what key to populate the data on? so I was looking for a way to use some default macro in the discovery rule key for the hostname of the host


    Template:
    Discovery rule:
    Key: DiscoveryRuleKey[{HOST.NAME}]

    BUT when I go to the host where this should create the discovery with a key containing the hostname the Macro is not "parsed" ... so doesn't work...

    I have thought about a few ways around
    have the discovery rules be a zabbix agent, use userparameter and get the data for the remote host using passive checks where the remote server (zabbix agent) sends the necessary information to create the items type trapper with hostname and another parameter using item prototypes

    another option I have been using lately is to have a script on zabbix server backend get info from zabbix server API a list of host, then using the API create on those hosts the discovery rules with the required information (hostname) as zabbix trapper, then at that point the discovery rule key will be able to parse watever the remote host send to zabbix as there are individual keys for each discovery rule key.

    first question. is it not possible to have a discovery rule key use the {host.name} macro or any other macro that takes the name of the host where that discovery rule is "running from"?
    second any suggestion on how to implement what I am trying to implement?

    Thanks.
    \M


  • _Andrey
    Junior Member
    • Jul 2013
    • 27

    #2
    I have the same trouble. Any chance to get ability to use any macros in network discovery rule's items?

    I'll expand the task:
    Let's say, that i have a pool of.. some analog devices, and one 'control' device which is have digital interface and able to control/query these dependent analog devices via specific interface. Technically, of course, i can create 1 host (control device) and add (discover) all dependent analog devices as items, but in this case i get very uncomfortable scheme on how is data storing, processing and presenting because
    1. multiple items will be created for every analog device and these devices should have distinct access rights, alerting rules and recipients.
    2. this method is logically wrong, because all these analog devices are standalone and independent units (i.e. hosts, although they managing via single control device)

    So theoretically i need to provide some 'marker' to "control device"s zabbix agent's user parameter (an internal name of dependent device, for example) - that's how i could distinguish these dependent devices.
    Last edited by _Andrey; 06-10-2021, 23:36.

    Comment

    Working...