Ad Widget

Collapse

Add host in hostgroup by hostname

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • sbartesaghi
    Junior Member
    • Feb 2026
    • 2

    #1

    Add host in hostgroup by hostname

    Hi All,

    I'm a new on zabbix and I install Zabbix 7.4, I create all my discovery rules with SNMPv3 checks; I create the rules like this:
    Discovery1: 192.168.1.0/24, 192.168.2.0/24 etc
    Where Site 1 is 192.168.1.0/24 and site 2 is 192.168.2.0/24
    Then I import the host with general discovery action

    is there a possibility to add the host in a specific hostgroup by regex on his hostname and link specific template?
    Example: -
    Host: SITE1SW100A --> Add to hostgroup Site-1 and Link Template: Switch, Ping
    Host: AP1_50 --> Add to hostgroup Site-1 and Link Template: AP, Ping
    Host: AP2_50 --> Add to hostgroup Site-2 and Link Template: AP, Ping
    Host: SITE2SW100A --> Add to hostgroup Site-2 and Link Template: Switch, Ping

    I try to do it with autoregistration rule but it works only with zabbix Agent, instead I want process the hostname that I set on zabbix Hosts
  • cyber
    Senior Member
    Zabbix Certified SpecialistZabbix Certified Professional
    • Dec 2006
    • 4848

    #2
    You cannot just run something on top of already created hosts (excpet if it is a external script and you do all mods over API)

    This should be done already during discovery. You need a discovery check, that returns your required info and then you can build discovery actions based on that... like here https://www.zabbix.com/documentation...discovery/rule
    First they have a check that retutrns data, is it linux or windows, then add 2 actions, one for linux one for windows. Same applies to your case... a check that would return a type ( swithc/AP) and then actions attach correct template(s), additional to placing them to correct host group... (conditions with and/or in discovery rules).

    Comment

    • sbartesaghi
      Junior Member
      • Feb 2026
      • 2

      #3
      Hi,

      Thank you for yuor reply
      I already config my zabbix with discovery action based on received value

      Thanks a lot!!

      Comment

      Working...