Ad Widget

Collapse

1.3.4 problems with new hosts

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • savl
    Junior Member
    • Mar 2007
    • 9

    #1

    1.3.4 problems with new hosts

    Hello.
    I'm testing zabbix 1.3.4 with postgresql 8.2.3 and php-pgsql-4.4.5.
    Installation was successful except issue with php and bcmath (http://www.zabbix.com/forum/showthread.php?t=5619). But now I have strange problem. When I add new host to monitor (localhost in my case), things work fine for about a minute, and then something breakes. Messages like:
    Code:
    16648:20070328:135347 Query::insert into ids (nodeid,table_name,field_name,nextid) values (0,'events'
    ,'eventid',)
     16648:20070328:135347 Query failed:PGRES_FATAL_ERROR:ERROR:  syntax error at or near ")"
    LINE 1: ...table_name,field_name,nextid) values (0,'events','eventid',)
                                                                          ^
    starts flooding zabbix_server.log
    Restarting of zabbix_server doesn't help - it continues flooding after restart
    Although I'm not familiar with php, I've found some similar code in include/db.inc.php file of GUI.
    Code:
    function        get_dbid($table,$field)
            {
                    global  $ZBX_CURNODEID;
    
                    if(!isset($ZBX_CURNODEID))      init_nodes();
    
    /*              $row=DBfetch(DBselect("select max($field) as id from $table where ".DBid2nodeid($field)." in (".$ZBX_CURNODEID.")"));
                    if($row && !is_null($row["id"]))
                    {
                            return  bcadd($row["id"],1);
                    }
                    else
                    {
                            return bcadd(bcmul($ZBX_CURNODEID,"100000000000000"),1);
                    }*/
    
    
                    $found = false;
                    do
                    {
                            $row = DBfetch(DBselect("select nextid from ids where nodeid=$ZBX_CURNODEID and table_name='$table' and field_name='$field'"));
                            if(!$row || is_null($row["nextid"]))
                            {
                                    $row=DBfetch(DBselect("select max($field) as id from $table where ".DBid2nodeid($field)." in (".$ZBX_CURNODEID.")"));
                                    if(!$row || is_null($row["id"]))
                                    {
                                           [COLOR=Red] DBexecute("insert into ids (nodeid,table_name,field_name,nextid) values ($ZBX_CURNODEID,'$table','$field',".bcadd(bcmul($ZBX_CURNODEID,"100000000000000"),1).")");[/COLOR]
                                    }
                                    else
                                    {
                                            [COLOR=Red]DBexecute("insert into ids (nodeid,table_name,field_name,nextid) values ($ZBX_CURNODEID,'$table','$field',".$row["id"].")");[/COLOR]
                                    }
                                    continue;
                            }
                            else
                            {
                                    $ret1 = $row["nextid"];
    
                                    DBexecute("update ids set nextid=nextid+1 where nodeid=$ZBX_CURNODEID and table_name='$table' and field_name='$field'");
    
                                    $row = DBfetch(DBselect("select nextid from ids where nodeid=$ZBX_CURNODEID and table_name='$table' and field_name='$field'"));
                                    if(!$row || is_null($row["nextid"]))
                                    {
                                            /* Should never be here */
                                            continue;
                                    }
                                    else
                                    {
                                            $ret2 = $row["nextid"];
                                            if(bccomp(bcadd($ret1,1),$ret2) ==0)
                                            {
                                                    $found = true;
                                            }
                                    }
                            }
                    }
                    while(false == $found);
    
                    return $ret2;
            }
    Seems that values are not calculated by higlited expressions
    The most strange thing that it works in the beginning (for about a minute or less), as i can see on graphs - there are short lines there representing some data. You can see example image, attached. Do anybody have any suggestions about this issue?
    Attached Files
  • NOB
    Senior Member
    Zabbix Certified Specialist
    • Mar 2007
    • 469

    #2
    Re: 1.3.4 problems with new hosts

    Hi,

    I did not see this report prior to writing mine ot the same
    subject.
    However, I think that the source of the problem
    is NOT the web-page.
    It's in the server.
    That's why restarting the server didn't help.

    It's in src/libs/zbxdbhigh/db.c Line 1596 ff.:

    Code:
    			{
    				DBexecute("insert into ids (nodeid,table_name,field_name,nextid) values (%d,'%s','%s',%s)",
    					CONFIG_NODEID,
    					table,
    					field,
    					row[0]);
    			}
    So, if row[0] is empty, the wrong query results.

    Hope this helps finding the cause of the problem.

    Regards,

    Norbert.

    Comment

    Working...