Package: zabbix-server-mysql
Version: 1:2.2.7+dfsg-2
Severity: critical
Justification: causes serious data loss

Dear Maintainer,

next to my change zabbix server to node 1, I get some problems by edit or add 
new 
entries in triggers, hosts or items. On save I get following error 
(example on edit/add item, Error in php frontend): 


<SNIP>
[INSERT INTO items 
(type,snmp_community,snmp_oid,hostid,name,description,key_,delay,history,trends,status,value_type,trapper_hosts,units,multiplier,delta,snmpv3_contextname,snmpv3_securityname,snmpv3_securitylevel,snmpv3_authprotocol,snmpv3_authpassphrase,snmpv3_privprotocol,snmpv3_privpassphrase,formula,logtimefmt,valuemapid,delay_flex,params,ipmi_sensor,data_type,authtype,username,password,publickey,privatekey,flags,filter,port,inventory_link,lifetime,interfaceid,templateid,itemid)
 VALUES ('3','','','100100000010293','ICMP 
ping','','icmpping','60','7','365','0','3','','','0','0','','','0','0','','0','','1','','100100000000001','','','','0','0','','','','','0','','','0','30','100100000000153','100100000023655','100100000058464')]
 [Duplicate entry '100100000058464' for key 'PRIMARY']

SQL statement execution has failed "INSERT INTO items 
(type,snmp_community,snmp_oid,hostid,name,description,key_,delay,history,trends,status,value_type,trapper_hosts,units,multiplier,delta,snmpv3_contextname,snmpv3_securityname,snmpv3_securitylevel,snmpv3_authprotocol,snmpv3_authpassphrase,snmpv3_privprotocol,snmpv3_privpassphrase,formula,logtimefmt,valuemapid,delay_flex,params,ipmi_sensor,data_type,authtype,username,password,publickey,privatekey,flags,filter,port,inventory_link,lifetime,interfaceid,templateid,itemid)
 VALUES ('3','','','100100000010293','ICMP 
ping','','icmpping','60','7','365','0','3','','','0','0','','','0','0','','0','','1','','100100000000001','','','','0','0','','','','','0','','','0','30','100100000000153','100100000023655','100100000058464')".
</SNIP>

The new or changed date are not save - this means, it will be discard.

So, I read some other forum message, that the problems its depend to the table 
ids. 
Interest on this System is, that some entries also depend on node 0 - but I 
have 
actually only the node 1.:

Code: select * from ids;
<SNIP>
+--------+----------------------+--------------------------+-----------------+
| nodeid | table_name           | field_name               | nextid          |
+--------+----------------------+--------------------------+-----------------+
|      0 | functions            | functionid               | 100100000021356 |
|      0 | graphs               | graphid                  | 100100000005068 |
|      0 | graphs_items         | gitemid                  | 100100000012510 |
|      0 | items                | itemid                   | 100100000058464 |
|      0 | items_applications   | itemappid                | 100100000041744 |
|      0 | item_discovery       | itemdiscoveryid          | 100100000029388 |
|      0 | triggers             | triggerid                | 100100000020646 |
|      1 | actions              | actionid                 | 100100000000008 |
|      1 | applications         | applicationid            | 100100000001677 |
|      1 | application_template | application_templateid   | 100100000001126 |
|      1 | auditlog             | auditid                  | 100100000006780 |
|      1 | auditlog_details     | auditdetailid            | 100100000000259 |
|      1 | conditions           | conditionid              | 100100000000014 |
|      1 | expressions          | expressionid             | 100100000000011 |
|      1 | functions            | functionid               | 100100000021356 |
|      1 | graphs               | graphid                  | 100100000005077 |
|      1 | graphs_items         | gitemid                  | 100100000012519 |
|      1 | groups               | groupid                  | 100100000000031 |
|      1 | group_prototype      | group_prototypeid        | 100100000000021 |
|      1 | hostmacro            | hostmacroid              | 100100000000175 |
|      1 | hosts                | hostid                   | 100100000010292 |
|      1 | hosts_groups         | hostgroupid              | 100100000000396 |
|      1 | hosts_templates      | hosttemplateid           | 100100000000427 |
|      1 | housekeeper          | housekeeperid            | 100100000001743 |
|      1 | images               | imageid                  | 100100000000117 |
|      1 | interface            | interfaceid              | 100100000000152 |
|      1 | items                | itemid                   | 100100000058463 |
|      1 | items_applications   | itemappid                | 100100000041755 |
|      1 | item_discovery       | itemdiscoveryid          | 100100000029387 |
|      1 | maintenances         | maintenanceid            | 100100000000002 |
|      1 | maintenances_groups  | maintenance_groupid      | 100100000000001 |
|      1 | maintenances_hosts   | maintenance_hostid       | 100100000000013 |
|      1 | maintenances_windows | maintenance_timeperiodid | 100100000000002 |
|      1 | media                | mediaid                  | 100100000000014 |
|      1 | media_type           | mediatypeid              | 100100000000002 |
|      1 | operations           | operationid              | 100100000000008 |
|      1 | opmessage_grp        | opmessage_grpid          | 100100000000005 |
|      1 | opmessage_usr        | opmessage_usrid          | 100100000000001 |
|      1 | profiles             | profileid                | 100100000000257 |
|      1 | rights               | rightid                  | 100100000000001 |
|      1 | screens              | screenid                 | 100100000000039 |
|      1 | screens_items        | screenitemid             | 100100000000182 |
|      1 | sysmaps              | sysmapid                 | 100100000000007 |
|      1 | sysmaps_elements     | selementid               | 100100000000245 |
|      1 | sysmaps_links        | linkid                   | 100100000000023 |
|      1 | timeperiods          | timeperiodid             | 100100000000002 |
|      1 | triggers             | triggerid                | 100100000020646 |
|      1 | trigger_depends      | triggerdepid             | 100100000000141 |
|      1 | users                | userid                   | 100100000000019 |
|      1 | users_groups         | id                       | 100100000000022 |
|      1 | user_history         | userhistoryid            | 100100000000001 |
|      1 | usrgrp               | usrgrpid                 | 100100000000014 |
+--------+----------------------+--------------------------+-----------------+
</SNIP>

So I delete all Node 0 entries and set correct all entries depend on node 1 to 
max of 
the depend table. My PHP Script for this:

<SNIP>
#!/usr/bin/php 
<?php 
        $link = mysql_connect('localhost','zabbix','PASSWORD'); 
        mysql_select_db('zabbix', $link); 

        $sql    = 'SELECT table_name, field_name, nextid FROM ids'; 

        $result = mysql_query($sql, $link); 

        while ($row = mysql_fetch_assoc($result)) 
        { 
                $sql2 = "SELECT max(".$row['field_name'].") AS MAX FROM 
".$row['table_name'].";"; 
                $result2 = mysql_query($sql2, $link); 
                $row2 = mysql_fetch_assoc($result2); 
                if ( $row['nextid'] != $row2['MAX'] &&  $row2['MAX'] != '' &&  
$row2['MAX'] > 0) 
                { 
                        echo "Debug:".$row['table_name']." - Ist: 
".$row['nextid']." Soll: ".$row2['MAX']."\n"; 
                        $sql3="UPDATE ids SET nextid=".$row2['MAX']." WHERE 
table_name='".$row['table_name']."' AND nodeid =1"; 
                        echo "$sql3\n"; 
                        mysql_unbuffered_query($sql3,$link); 
                } 

        } 

?>
</SNIP>

But, next to some time, the error will coming back. Also a find entries with 
nodeid 0 on table ids. There error will show in manually add
entries and add by import!

Also in some cases of discovery, there error is effencted on auto creation of 
items, triggers or graphs. The erremessage in zabbix_server.log are
the same information.

Additional depended packages:
ii      zabbix-frontend-php              1:2.2.7+dfsg-2 



-- System Information:
Debian Release: 8.1
  APT prefers stable-updates
  APT policy: (500, 'stable-updates'), (500, 'stable')
Architecture: amd64 (x86_64)
Foreign Architectures: i386

Kernel: Linux 4.1.2 (SMP w/8 CPU cores)
Locale: LANG=de_DE.UTF-8, LC_CTYPE=de_DE.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash
Init: systemd (via /run/systemd/system)

Versions of packages zabbix-server-mysql depends on:
ii  adduser           3.113+nmu3
ii  fping             3.10-2
ii  libc6             2.19-18
ii  libcurl3-gnutls   7.38.0-4+deb8u2
ii  libiksemel3       1.4-2
ii  libldap-2.4-2     2.4.40+dfsg-1
ii  libmysqlclient18  5.5.43-0+deb8u1
ii  libodbc1          2.3.1-3
ii  libopenipmi0      2.0.16-1.4
ii  libsnmp30         5.7.2.1+dfsg-1
ii  libssh2-1         1.4.3-4.1
ii  libxml2           2.9.1+dfsg1-5
ii  lsb-base          4.1+Debian13+nmu1
ii  ucf               3.0030

Versions of packages zabbix-server-mysql recommends:
ii  mysql-server  5.5.43-0+deb8u1
ii  snmpd         5.7.2.1+dfsg-1

Versions of packages zabbix-server-mysql suggests:
ii  logrotate             3.8.7-1+b1
ii  snmp-mibs-downloader  1.1
ii  zabbix-frontend-php   1:2.2.7+dfsg-2

-- Configuration Files:
/etc/default/zabbix-server changed [not included]

-- no debconf information


-- 
To UNSUBSCRIBE, email to [email protected]
with a subject of "unsubscribe". Trouble? Contact [email protected]

Reply via email to