Hello,
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):
So, I read some other forum message, that the problems its depend to the table ids. Interest on my System is, that some entries also depend on node 0 - but I have actually only the node 1.:
52 rows in set (0.00 sec)
So I delete all Node 0 entries and set all entries depend on node 1 to max of the depend table. My PHP Script for this:
But, next to some time, the error will coming back. Also a find entries with nodeid 0 on table ids.
My question are:
It is a bug in this version?
Is there some patches we can send the Debian maintainer of this package?
Regards
Robert
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):
Code:
[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')".
So, I read some other forum message, that the problems its depend to the table ids. Interest on my System is, that some entries also depend on node 0 - but I have actually only the node 1.:
Code:
select * from ids; +--------+----------------------+--------------------------+-----------------+ | 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 | +--------+----------------------+--------------------------+-----------------+
So I delete all Node 0 entries and set all entries depend on node 1 to max of the depend table. My PHP Script for this:
PHP Code:
#!/usr/bin/php
<?php
$link = mysql_connect('localhost','root','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);
}
}
?>
My question are:
It is a bug in this version?
Is there some patches we can send the Debian maintainer of this package?
Regards
Robert