Ad Widget

Collapse

ZabbixAgent2 - Permit any Hostname for active check

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • marcolino7
    Junior Member
    • Mar 2017
    • 11

    #1

    ZabbixAgent2 - Permit any Hostname for active check

    Hi,
    I'am running Zabbix 5.4 and ZabbixAgent2. I use it to monitor many MQTT devices into my network, for doing this, I have agent installed on one server (Debian 11) and I will check all my MQTT devices througt the MQTT brocker using mqtt.get["tcp://192.168.1.75:1883","tele/shelly1-Mansarda/STATE"]
    So in Zabbix Server Config, I have 1 host for the server that run Agent, and one Host for each MQTT devices.
    This works, but I need to edit zabbix_agent2.conf each time I add and remove a Host from configuration, this because mqtt.get is an active check and works only if Hostname parameter is set into zabbix_agent2.conf. This way is very hard to mantain, so I would like to make ZabbixAgent2 to accept any host for active check.
    Is this possible?

    Many Thanks
  • splitek
    Senior Member
    • Dec 2018
    • 101

    #2
    From Zabbix 5.4 parameter "Hostname" in agent config can be a list.

    Hostname no Set by HostnameItem List of comma-delimited unique, case-sensitive hostnames.
    Required for active checks and must match hostnames as configured on the server. Value is acquired from HostnameItem if undefined.
    Allowed characters: alphanumeric, '.', ' ', '_' and '-'.
    Maximum length: 128 characters per hostname, 2048 characters for the entire line.
    Maybe you need to write script that can modify this specyfic line in zabbix_agent2.conf. Put all hosts in one group, let script to get host names from this group (by zabbix api), parse host names to one line accepted by zabbix config, next script replace line in config file. Add script to crontab or build action in zabbix that will run this script when host is added or deleted.
    I don't see any other way to automate this.

    Comment

    • marcolino7
      Junior Member
      • Mar 2017
      • 11

      #3
      Hi,
      I'm just working on this script from some days.
      Many thanks for help.

      Marco

      Comment

      Working...