Ad Widget

Collapse

Zabbix Version 1.1.5 - Can not add host names with a dash

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Palmertree
    Senior Member
    • Sep 2005
    • 746

    #1

    Zabbix Version 1.1.5 - Can not add host names with a dash

    Is anyone else experiencing this issue in version 1.1.5. If you try and add a host name with a dash "-", I get an error saying that it is not allowed but it's showen in the allowed list. I used dashes plenty of times before in the hostname.

    I get this message:

    [ERROR:Cannot update host]

    Hostname should contain '0-9a-zA-Z_.-$' characters only

    Host I am trying to add is Computer-Test
    Last edited by Palmertree; 27-01-2007, 08:31.
  • Palmertree
    Senior Member
    • Sep 2005
    • 746

    #2
    Compared the hosts.inc.php to a Zabbix version 1.1.4 and I found that the line below was different:

    Version 1.1.5:
    function db_save_host($host,$port,$status,$useip,$ip,$templ ateid,$hostid=NULL)
    {
    if (!eregi('^([0-9a-zA-Z\_\.-\$]+)$', $host))

    Version 1.1.4:
    function db_save_host($host,$port,$status,$useip,$ip,$templ ateid,$hostid=NULL)
    {
    if (!eregi('^([0-9a-zA-Z\_\.-]+)$', $host))

    I remodified the code in 1.1.5 and it seems to be working again with dashes. Hopefully I did not break anything else.

    Comment

    • Alexei
      Founder, CEO
      Zabbix Certified Trainer
      Zabbix Certified SpecialistZabbix Certified Professional
      • Sep 2004
      • 5654

      #3
      Sorry for this problem. Correct fix is:

      function db_save_host($host,$port,$status,$useip,$ip,$templ ateid,$hostid=NULL)
      {
      if (!eregi('^([0-9a-zA-Z\_\.\$-]+)$', $host))
      Alexei Vladishev
      Creator of Zabbix, Product manager
      New York | Tokyo | Riga
      My Twitter

      Comment

      • Palmertree
        Senior Member
        • Sep 2005
        • 746

        #4
        Thanks Alex for the quick reply. I will make the adjustments.

        Comment

        • aelix
          Junior Member
          • Jan 2007
          • 5

          #5
          Same problem with expressions too

          I applied this patch, but I still get "expression does not match" errors for all my hosts that have dashes in their hostname! This happens if I update a trigger, for example.

          Comment

          • James Wells
            Senior Member
            • Jun 2005
            • 664

            #6
            Greetings,
            Originally posted by aelix
            I applied this patch, but I still get "expression does not match" errors for all my hosts that have dashes in their hostname! This happens if I update a trigger, for example.
            Please see BUG: Arithmetic Minus Not Supported In Triggers to see how to fix that one.
            Unofficial Zabbix Developer

            Comment

            • aelix
              Junior Member
              • Jan 2007
              • 5

              #7
              Originally posted by James Wells
              Greetings,

              Please see BUG: Arithmetic Minus Not Supported In Triggers to see how to fix that one.
              Although I probably would have hit that bug eventually, I found my problem is in config.inc.php line 683:

              if (eregi('^\{([0-9a-zA-Z\_\.-\$]+)\: ......

              should be

              if (eregi('^\{([0-9a-zA-Z\_\.\$-]+)\: .....

              Comment

              • nevzorofff
                Junior Member
                • Oct 2008
                • 26

                #8
                Why dosn't allowed to use national characters in hostname(not in DNS)?
                Russian trigger i can set, but hostname - can't.

                Comment

                • micw
                  Junior Member
                  • Oct 2008
                  • 1

                  #9
                  Same issue here in version 1.6.1: It's not possible to add hostnames with dashes. This should be filed as bug because the hostname field must accept any character that is allowed for hostnames.

                  Comment

                  Working...