Ad Widget

Collapse

Auto Reg with Regex for hostname

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • wiliamL
    Junior Member
    • Feb 2022
    • 28

    #1

    Auto Reg with Regex for hostname

    Trying to create a auto reg for linux and hostnames with dev in them. I have read a few posts but noone has posted the actual fix.


    Host metadata contains Linux
    Host name contains (?i)dev <--because dev can be captalized or lowercase. But this does not work.

    im guessing the syntax is not correct, but i have tried [Dd][Ee][Vv]
    conditionid:26 conditiontype:22 cond.value:'[Dd][Ee][Vv]' cond.value2:'' result:FAIL


    thanks in advance
  • LenR
    Senior Member
    • Sep 2009
    • 1005

    #2
    Have you tried Host name Matches
    .*[dD][eE][vV].*
    The order of [dD] doesn't matter, I think you need the leading and trailing .*

    Comment

    • cyber
      Senior Member
      Zabbix Certified SpecialistZabbix Certified Professional
      • Dec 2006
      • 4807

      #3

      that "(?i)dev" regex should be ok.. https://regex101.com/r/KCQKtH/1
      But you need to use "Matches" instead of "contains"... "Contains" is the string to match, not regex. So it is taken literally as "(?i)dev" not as regex.

      https://www.zabbix.com/documentation...ration-actions
      Host name contains
      does not contain
      matches
      does not match
      Specify a host name or a host name to exclude.
      contains - host name contains the string.
      does not contain - host name does not contain the string.
      matches - host name matches regular expression.
      does not match - host name does not match regular expression.

      Comment

      • wiliamL
        Junior Member
        • Feb 2022
        • 28

        #4
        Both worked. I had the syntax incorrect. I was using contains and not match.

        Thank you both of you for replying. Much appreciated.

        Comment

        Working...