nikimaxim / zbx-smartmonitor

Zabbix template for monitoring disk attributes
GNU General Public License v3.0
37 stars 14 forks source link

can't import template into Zabbix 5.4 #11

Open speculatrix opened 3 years ago

speculatrix commented 3 years ago

I get this error on the zabbix console, I am logged in as admin when I try and import the XML template file into my Zabbix server running 5.4.4 on Ubuntu.

Error in query [INSERT INTO items (name,type,delay,trends,value_type,description,uuid,snmp_oid,history,status,discover,units,params,ipmi_sensor,authtype,username,password,publickey,privatekey,inventory_link,logtimefmt,jmx_endpoint,timeout,url,query_fields,posts,status_codes,follow_redirects,post_type,http_proxy,headers,retrieve_mode,request_method,output_format,allow_traps,ssl_cert_file,ssl_key_file,ssl_key_password,verify_peer,verify_host,key_,trapper_hosts,hostid,master_itemid,flags,itemid) VALUES ('{#STORAGE.NAME}: Error сount','18','0','0','1','HDD\r\nSSD\r\nNVME','8172fb0ab1df4a7ba09e02b1f496c838','','90d','0','0','','','','0','','','','','0','','','3s','','','','200','1','0','','','0','0','0','0','','','','0','0','storage.error[\"{#STORAGE.CMD}\"]','','10126','25203','2','25204'),('{#STORAGE.NAME}: Test result','18','0','0','1','HDD\r\nSSD','42718d36f25946b0941cb02bc93ad956','','90d','0','0','','','','0','','','','','0','','','3s','','','','200','1','0','','','0','0','0','0','','','','0','0','storage.health[\"{#STORAGE.CMD}\"]','','10126','25203','2','25205'),('{#STORAGE.NAME}: Device model','18','0','0','1','HDD\r\nSSD\r\nNVME','e02b26d159714a14ae5c52e984414185','','90d','0','0','','','','0','','','','','0','','','3s','','','','200','1','0','','','0','0','0','0','','','','0','0','storage.model[\"{#STORAGE.CMD}\"]','','10126','25203','2','25206'),('{#STORAGE.NAME}: Serial number','18','0','0','1','HDD\r\nSSD\r\nNVME','21fa0ab926a04364824fe26ec12a884c','','90d','0','0','','','','0','','','','','0','','','3s','','','','200','1','0','','','0','0','0','0','','','','0','0','storage.sn[\"{#STORAGE.CMD}\"]','','10126','25203','2','25207'),('{#STORAGE.NAME}: ID 05 Reallocated sectors count','18','0','365d','3','HDD\r\nSSD','9a9ae335f86e49a8b4bff1b635f2fe1f','','90d','0','0','','','','0','','','','','0','','','3s','','','','200','1','0','','','0','0','0','0','','','','0','0','storage[\"{#STORAGE.CMD}\", 05 Reallocated_Sector_Ct]','','10126','25203','2','25208'),('{#STORAGE.NAME}: ID 09 Power on hours','18','0','365d','3','HDD\r\nSSD\r\nNVME','191e995761a24bf4abadfade95221e5d','','90d','0','0','s','','','0','','','','','0','','','3s','','','','200','1','0','','','0','0','0','0','','','','0','0','storage[\"{#STORAGE.CMD}\", 09 Power_On_Hours]','','10126','25203','2','25209'),('{#STORAGE.NAME}: ID 10 Spin retry count','18','0','365d','3','HDD','aa79f34515bf4353a2c3a2084c72e27e','','90d','0','0','','','','0','','','','','0','','','3s','','','','200','1','0','','','0','0','0','0','','','','0','0','storage[\"{#STORAGE.CMD}\", 10 Spin_Retry_Count]','','10126','25203','2','25210'),('{#STORAGE.NAME}: ID 190/194 Temperature','18','0','365d','3','HDD\r\nSSD\r\nNVME','869eb22bb22b4d6e92653428fdaf8429','','90d','0','0','°С','','','0','','','','','0','','','3s','','','','200','1','0','','','0','0','0','0','','','','0','0','storage[\"{#STORAGE.CMD}\", 190/194 Temperature_Celsius]','','10126','25203','2','25211'),('{#STORAGE.NAME}: ID 197 Current pending sector count','18','0','365d','3','HDD','e14b593365be4c0dbdf05baba9ecb1fd','','90d','0','0','','','','0','','','','','0','','','3s','','','','200','1','0','','','0','0','0','0','','','','0','0','storage[\"{#STORAGE.CMD}\", 197 Current_Pending_Sector]','','10126','25203','2','25212'),('{#STORAGE.NAME}: ID 198 Uncorrectable errors count','18','0','365d','3','HDD\r\nSSD','21145caa5cfb4868bc93f61c3cc3ceab','','90d','0','0','','','','0','','','','','0','','','3s','','','','200','1','0','','','0','0','0','0','','','','0','0','storage[\"{#STORAGE.CMD}\", 198 Offline_Uncorrectable]','','10126','25203','2','25213'),('{#STORAGE.NAME}: ID 199/218 CRC error count','18','0','365d','3','HDD\r\nSSD\r\nNVME','e13719f6027143018a7ba2d293e096fa','','90d','0','0','','','','0','','','','','0','','','3s','','','','200','1','0','','','0','0','0','0','','','','0','0','storage[\"{#STORAGE.CMD}\", 199/218 UDMA_CRC_Error]','','10126','25203','2','25214'),('{#STORAGE.NAME}: ID 231 SSD life left','18','0','365d','3','SSD\r\nNVME','aaabd1f881c64ff9abefd1b08c7f98d9','','90d','0','0','%','','','0','','','','','0','','','3s','','','','200','1','0','','','0','0','0','0','','','','0','0','storage[\"{#STORAGE.CMD}\", 231 SSD_Life_Left]','','10126','25203','2','25215')] [Incorrect string value: '\xD1\x81ount' for column 'name' at row 1]
SQL statement execution has failed "INSERT INTO items (name,type,delay,trends,value_type,description,uuid,snmp_oid,history,status,discover,units,params,ipmi_sensor,authtype,username,password,publickey,privatekey,inventory_link,logtimefmt,jmx_endpoint,timeout,url,query_fields,posts,status_codes,follow_redirects,post_type,http_proxy,headers,retrieve_mode,request_method,output_format,allow_traps,ssl_cert_file,ssl_key_file,ssl_key_password,verify_peer,verify_host,key_,trapper_hosts,hostid,master_itemid,flags,itemid) VALUES ('{#STORAGE.NAME}: Error сount','18','0','0','1','HDD\r\nSSD\r\nNVME','8172fb0ab1df4a7ba09e02b1f496c838','','90d','0','0','','','','0','','','','','0','','','3s','','','','200','1','0','','','0','0','0','0','','','','0','0','storage.error[\"{#STORAGE.CMD}\"]','','10126','25203','2','25204'),('{#STORAGE.NAME}: Test result','18','0','0','1','HDD\r\nSSD','42718d36f25946b0941cb02bc93ad956','','90d','0','0','','','','0','','','','','0','','','3s','','','','200','1','0','','','0','0','0','0','','','','0','0','storage.health[\"{#STORAGE.CMD}\"]','','10126','25203','2','25205'),('{#STORAGE.NAME}: Device model','18','0','0','1','HDD\r\nSSD\r\nNVME','e02b26d159714a14ae5c52e984414185','','90d','0','0','','','','0','','','','','0','','','3s','','','','200','1','0','','','0','0','0','0','','','','0','0','storage.model[\"{#STORAGE.CMD}\"]','','10126','25203','2','25206'),('{#STORAGE.NAME}: Serial number','18','0','0','1','HDD\r\nSSD\r\nNVME','21fa0ab926a04364824fe26ec12a884c','','90d','0','0','','','','0','','','','','0','','','3s','','','','200','1','0','','','0','0','0','0','','','','0','0','storage.sn[\"{#STORAGE.CMD}\"]','','10126','25203','2','25207'),('{#STORAGE.NAME}: ID 05 Reallocated sectors count','18','0','365d','3','HDD\r\nSSD','9a9ae335f86e49a8b4bff1b635f2fe1f','','90d','0','0','','','','0','','','','','0','','','3s','','','','200','1','0','','','0','0','0','0','','','','0','0','storage[\"{#STORAGE.CMD}\", 05 Reallocated_Sector_Ct]','','10126','25203','2','25208'),('{#STORAGE.NAME}: ID 09 Power on hours','18','0','365d','3','HDD\r\nSSD\r\nNVME','191e995761a24bf4abadfade95221e5d','','90d','0','0','s','','','0','','','','','0','','','3s','','','','200','1','0','','','0','0','0','0','','','','0','0','storage[\"{#STORAGE.CMD}\", 09 Power_On_Hours]','','10126','25203','2','25209'),('{#STORAGE.NAME}: ID 10 Spin retry count','18','0','365d','3','HDD','aa79f34515bf4353a2c3a2084c72e27e','','90d','0','0','','','','0','','','','','0','','','3s','','','','200','1','0','','','0','0','0','0','','','','0','0','storage[\"{#STORAGE.CMD}\", 10 Spin_Retry_Count]','','10126','25203','2','25210'),('{#STORAGE.NAME}: ID 190/194 Temperature','18','0','365d','3','HDD\r\nSSD\r\nNVME','869eb22bb22b4d6e92653428fdaf8429','','90d','0','0','°С','','','0','','','','','0','','','3s','','','','200','1','0','','','0','0','0','0','','','','0','0','storage[\"{#STORAGE.CMD}\", 190/194 Temperature_Celsius]','','10126','25203','2','25211'),('{#STORAGE.NAME}: ID 197 Current pending sector count','18','0','365d','3','HDD','e14b593365be4c0dbdf05baba9ecb1fd','','90d','0','0','','','','0','','','','','0','','','3s','','','','200','1','0','','','0','0','0','0','','','','0','0','storage[\"{#STORAGE.CMD}\", 197 Current_Pending_Sector]','','10126','25203','2','25212'),('{#STORAGE.NAME}: ID 198 Uncorrectable errors count','18','0','365d','3','HDD\r\nSSD','21145caa5cfb4868bc93f61c3cc3ceab','','90d','0','0','','','','0','','','','','0','','','3s','','','','200','1','0','','','0','0','0','0','','','','0','0','storage[\"{#STORAGE.CMD}\", 198 Offline_Uncorrectable]','','10126','25203','2','25213'),('{#STORAGE.NAME}: ID 199/218 CRC error count','18','0','365d','3','HDD\r\nSSD\r\nNVME','e13719f6027143018a7ba2d293e096fa','','90d','0','0','','','','0','','','','','0','','','3s','','','','200','1','0','','','0','0','0','0','','','','0','0','storage[\"{#STORAGE.CMD}\", 199/218 UDMA_CRC_Error]','','10126','25203','2','25214'),('{#STORAGE.NAME}: ID 231 SSD life left','18','0','365d','3','SSD\r\nNVME','aaabd1f881c64ff9abefd1b08c7f98d9','','90d','0','0','%','','','0','','','','','0','','','3s','','','','200','1','0','','','0','0','0','0','','','','0','0','storage[\"{#STORAGE.CMD}\", 231 SSD_Life_Left]','','10126','25203','2','25215')".
speculatrix commented 3 years ago

I think part of the problem is that I already have an itemid of 25204, if I amend the "name" value to be something else then I get this error:

ERROR 1062 (23000): Duplicate entry '25204' for key 'PRIMARY'

this is what is at itemid 25204:

mysql> select * from items where itemid=25204;
+--------+------+----------+--------+---------------------------+---------------------------+-------+---------+--------+--------+------------+---------------+-------+---------+------------+------------+------------+--------+-------------+----------+----------+----------+-----------+------------+-------+-------------+---------------------------------------------------------+----------------+----------+----------+--------------+---------------+---------+-----+--------------+-------+--------------+------------------+-----------+------------+---------+---------------+----------------+---------------+---------------+--------------+------------------+-------------+-------------+-------------+----------+------+
| itemid | type | snmp_oid | hostid | name                      | key_                      | delay | history | trends | status | value_type | trapper_hosts | units | formula | logtimefmt | templateid | valuemapid | params | ipmi_sensor | authtype | username | password | publickey | privatekey | flags | interfaceid | description                                             | inventory_link | lifetime | evaltype | jmx_endpoint | master_itemid | timeout | url | query_fields | posts | status_codes | follow_redirects | post_type | http_proxy | headers | retrieve_mode | request_method | output_format | ssl_cert_file | ssl_key_file | ssl_key_password | verify_peer | verify_host | allow_traps | discover | uuid |
+--------+------+----------+--------+---------------------------+---------------------------+-------+---------+--------+--------+------------+---------------+-------+---------+------------+------------+------------+--------+-------------+----------+----------+----------+-----------+------------+-------+-------------+---------------------------------------------------------+----------------+----------+----------+--------------+---------------+---------+-----+--------------+-------+--------------+------------------+-----------+------------+---------+---------------+----------------+---------------+---------------+--------------+------------------+-------------+-------------+-------------+----------+------+
|  25204 |    0 |          |  10106 | dmidecode.system.prodname | dmidecode.system.prodname | 8h    | 30d     | 0      |      0 |          4 |               |       |         |            |      25057 |       NULL |        |             |        0 |          |          |           |            |     0 |           3 | /usr/sbin/dmidecode -t system and grep for Product Name |             14 | 30d      |        0 |              |          NULL | 3s      |     |              |       | 200          |                1 |         0 |            |         |             0 |              0 |             0 |               |              |                  |           0 |           0 |           0 |        0 |      |
+--------+------+----------+--------+---------------------------+---------------------------+-------+---------+--------+--------+------------+---------------+-------+---------+------------+------------+------------+--------+-------------+----------+----------+----------+-----------+------------+-------+-------------+---------------------------------------------------------+----------------+----------+----------+--------------+---------------+---------+-----+--------------+-------+--------------+------------------+-----------+------------+---------+---------------+----------------+---------------+---------------+--------------+------------------+-------------+-------------+-------------+----------+------+
1 row in set (0.00 sec)
nikimaxim commented 3 years ago

Hi Have you not had such a template imported before? Show the import parameters

speculatrix commented 3 years ago

I've successfully imported templates only just recently.

I am not doing anything unusual, just clicking import template, browsing to the xml file. I tried both git and the release file linked off the Zabbix site. Screenshot from 2021-10-15 12-15-24 Screenshot from 2021-10-15 12-15-47

nikimaxim commented 3 years ago

Zabbix 5.4.3 and Zabbix 5.4.5 This problem did not appear. Everything is imported normally and without problems.

nikimaxim commented 3 years ago

Check if you have such a item key "smartctl.version" Maybe zabbix started using it