Ad Widget

Collapse

Error in query (Configuration-Graphs)

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • west
    Junior Member
    • Sep 2007
    • 1

    #1

    Error in query (Configuration-Graphs)

    Hi all,

    I got an error when I choose Configuration -> Graphs -> Group [all] -> Host [all]. I am using Zabbix 1.4.2 on Ubuntu 7. If I choose a specific host, no errors prompted. Any idea?

    Error in query [select distinct g.* from graphs g left join graphs_items gi on g.graphid=gi.graphid left join items i on gi.itemid=i.itemid while (g.graphid div 100000000000000) in (0) and ( i.hostid not in (-1) OR i.hostid is NULL ) order by g.name, g.graphid] [You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'while (g.graphid div 100000000000000) in (0) and ( i.hostid not in (-1) OR i.' at line 1]
  • jacob.hamacher
    Junior Member
    • Sep 2007
    • 5

    #2
    Error in query (Configuration-Graphs)

    I experience the same bug over here as well.

    I use FreeBSD 6.2 and Zabbix 1.4.2 with mysql 5.0.45. Both are installed from ports.

    /jacob

    Comment

    • eli.stair
      Junior Member
      • May 2006
      • 20

      #3
      Duplication of problem also on 1.4.2 w/ mysql 5.0.22

      NOTE: this looks like it might be related to another bug in this code:

      http://www.zabbix.com/forum/showthre...ht=error+query

      Running on RHEL5 x86_64, configured as :

      ./configure --prefix=/usr/local/zabbix --with-ldap --enable-server --enable-agent --with-mysql --with-net-snmp --with-libcurl

      Running mysql 5.0.22 on a separate machine, all rights/perms correct and all other functions seemingly OK (fresh 1.4.2 install, no hosts added yet).

      Looks like an incorrectly formed query, that's an easy statement to make since the error gives that much up IANADBA, so... the query is more complex than I can make sense of without lunch, reading, and digging through the tables and source. However, stripping out the section of the query that causes it to choke results in data returning anyhow:

      select distinct g.* from graphs g left join graphs_items gi on g.graphid=gi.graphid left join items i on gi.itemid=i.itemid order by g.name, g.graphid;

      It appears that this query is formed in graphs.php, line 348, run if hostid>0:

      if($_REQUEST["hostid"] > 0)
      {
      $result = DBselect("select distinct g.* from graphs g left join graphs_items gi on g.graphid=gi.graphid ".
      " left join items i on gi.itemid=i.itemid ".
      " where i.hostid=".$_REQUEST["hostid"].
      " and i.hostid not in (".$denyed_hosts.") ".
      ' and '.DBin_node('g.graphid').
      " and i.hostid is not NULL ".
      " order by g.name, g.graphid");
      }
      else
      {
      $result = DBselect("select distinct g.* from graphs g left join graphs_items gi on g.graphid=gi.graphid ".
      " left join items i on gi.itemid=i.itemid ".
      ' while '.DBin_node('g.graphid').
      " and ( i.hostid not in (".$denyed_hosts.") OR i.hostid is NULL )".
      " order by g.name, g.graphid");
      }



      Hopefully this will be enough to go on for someone else to fix the problem, else I'll have to get back around to digging into it when I get time.



      Cheers,

      /eli

      Comment

      • nelsonab
        Senior Member
        Zabbix Certified SpecialistZabbix Certified Professional
        • Sep 2006
        • 1233

        #4
        I just had this problem on a fresh install myself.

        I changed the 'while' on line 348 in graphs.php to 'where' and it works for me.

        I'm running 1.4.2
        RHCE, author of zbxapi
        Ansible, the missing piece (Zabconf 2017): https://www.youtube.com/watch?v=R5T9NidjjDE
        Zabbix and SNMP on Linux (Zabconf 2015): https://www.youtube.com/watch?v=98PEHpLFVHM

        Comment

        Working...