[ZBX-18950] Items cannot be updated due to "Timeout" field validation problem Created: 2021 Jan 31 Updated: 2021 Feb 19 Resolved: 2021 Feb 19 |
|
Status: | Closed |
Project: | ZABBIX BUGS AND ISSUES |
Component/s: | Frontend (F) |
Affects Version/s: | 5.0.8, 5.2.4 |
Fix Version/s: | None |
Type: | Problem report | Priority: | Trivial |
Reporter: | Philip Iezzi | Assignee: | Edgars Melveris |
Resolution: | Commercial support required | Votes: | 0 |
Labels: | None | ||
Remaining Estimate: | Not Specified | ||
Time Spent: | Not Specified | ||
Original Estimate: | Not Specified | ||
Environment: |
Debian Buster, PHP 7.3, latest deb packages from https://repo.zabbix.com/zabbix/5.2 |
Attachments: |
![]() |
Description |
Steps to reproduce:
Result: Validation error pops up:
Page received incorrect data
Field "Timeout" is not correct: a time unit is expected
See screenshot. This happens on both Zabbix 5.0.8 and 5.2.4. I cannot modify any item, this happens on all items. There is no field "Timeout" in items, so I don't know where this validation error comes from. When I export the whole template, I see a timeout property: items: - name: 'Certbot letsencrypt.log WARNING lines' type: ZABBIX_ACTIVE key: 'log[/var/log/letsencrypt/letsencrypt.log,WARNING]' trends: '0' value_type: LOG description: 'WARNING log lines from certbot letsencrypt.log' applications: - name: 'Let''s Encrypt' logtimefmt: 'ypMpdph:m:s' timeout: '' status_codes: '' Expected: Successful saving item modifications. |
Comments |
Comment by Edgars Melveris [ 2021 Feb 17 ] |
What DB backend are you using? show create table items \G |
Comment by Philip Iezzi [ 2021 Feb 18 ] |
hey @zux, thanks, this is very helpful! You pointed me into the right direction. I am running Zabbix 5.2.4 on MySQL 8.0. Did a table schema dump (mysqldump --no-data zabbix items): CREATE TABLE `items` ( `itemid` bigint unsigned NOT NULL, `type` int NOT NULL DEFAULT '0', `snmp_oid` varchar(512) COLLATE utf8_bin NOT NULL, `hostid` bigint unsigned NOT NULL, `name` varchar(255) COLLATE utf8_bin NOT NULL, `key_` varchar(2048) COLLATE utf8_bin NOT NULL DEFAULT '', `delay` varchar(1024) COLLATE utf8_bin NOT NULL, `history` varchar(255) COLLATE utf8_bin NOT NULL, `trends` varchar(255) COLLATE utf8_bin NOT NULL, `status` int NOT NULL DEFAULT '0', `value_type` int NOT NULL DEFAULT '0', `trapper_hosts` varchar(255) COLLATE utf8_bin NOT NULL, `units` varchar(255) COLLATE utf8_bin NOT NULL, `formula` varchar(255) COLLATE utf8_bin NOT NULL, `logtimefmt` varchar(64) COLLATE utf8_bin NOT NULL, `templateid` bigint unsigned DEFAULT NULL, `valuemapid` bigint unsigned DEFAULT NULL, `params` text COLLATE utf8_bin NOT NULL, `ipmi_sensor` varchar(128) COLLATE utf8_bin NOT NULL, `authtype` int NOT NULL DEFAULT '0', `username` varchar(64) COLLATE utf8_bin NOT NULL, `password` varchar(64) COLLATE utf8_bin NOT NULL, `publickey` varchar(64) COLLATE utf8_bin NOT NULL, `privatekey` varchar(64) COLLATE utf8_bin NOT NULL, `flags` int NOT NULL DEFAULT '0', `interfaceid` bigint unsigned DEFAULT NULL, `description` text COLLATE utf8_bin NOT NULL, `inventory_link` int NOT NULL DEFAULT '0', `lifetime` varchar(255) COLLATE utf8_bin NOT NULL, `evaltype` int NOT NULL DEFAULT '0', `jmx_endpoint` varchar(255) COLLATE utf8_bin NOT NULL, `master_itemid` bigint unsigned DEFAULT NULL, `timeout` varchar(255) COLLATE utf8_bin NOT NULL, `url` varchar(2048) COLLATE utf8_bin NOT NULL, `query_fields` varchar(2048) COLLATE utf8_bin NOT NULL, `posts` text COLLATE utf8_bin NOT NULL, `status_codes` varchar(255) COLLATE utf8_bin NOT NULL, `follow_redirects` int NOT NULL DEFAULT '1', `post_type` int NOT NULL DEFAULT '0', `http_proxy` varchar(255) COLLATE utf8_bin NOT NULL, `headers` text COLLATE utf8_bin NOT NULL, `retrieve_mode` int NOT NULL DEFAULT '0', `request_method` int NOT NULL DEFAULT '0', `output_format` int NOT NULL DEFAULT '0', `ssl_cert_file` varchar(255) COLLATE utf8_bin NOT NULL, `ssl_key_file` varchar(255) COLLATE utf8_bin NOT NULL, `ssl_key_password` varchar(64) COLLATE utf8_bin NOT NULL, `verify_peer` int NOT NULL DEFAULT '0', `verify_host` int NOT NULL DEFAULT '0', `allow_traps` int NOT NULL DEFAULT '0', `discover` int NOT NULL DEFAULT '0', PRIMARY KEY (`itemid`), KEY `items_3` (`status`), KEY `items_4` (`templateid`), KEY `items_5` (`valuemapid`), KEY `items_6` (`interfaceid`), KEY `items_7` (`master_itemid`), KEY `items_1` (`hostid`,`key_`(1021)), CONSTRAINT `c_items_1` FOREIGN KEY (`hostid`) REFERENCES `hosts` (`hostid`) ON DELETE CASCADE ON UPDATE RESTRICT, CONSTRAINT `c_items_2` FOREIGN KEY (`templateid`) REFERENCES `items` (`itemid`) ON DELETE CASCADE ON UPDATE RESTRICT, CONSTRAINT `c_items_3` FOREIGN KEY (`valuemapid`) REFERENCES `valuemaps` (`valuemapid`) ON DELETE RESTRICT ON UPDATE RESTRICT, CONSTRAINT `c_items_4` FOREIGN KEY (`interfaceid`) REFERENCES `interface` (`interfaceid`) ON DELETE RESTRICT ON UPDATE RESTRICT, CONSTRAINT `c_items_5` FOREIGN KEY (`master_itemid`) REFERENCES `items` (`itemid`) ON DELETE CASCADE ON UPDATE RESTRICT ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin; then compared it to /usr/share/doc/zabbix-server-mysql/create.sql.gz on Debian Buster, and here we go: `timeout` varchar(255) DEFAULT '3s' NOT NULL, Somehow, I was missing the DEFAULT '3s'. How could this have happened? Did not find any upgrade notes about manual db schema migrations for Zabbix 4.x -> 5.0 or any 5.x -> 5.2 upgrades. So this is my quickfix: ALTER TABLE items MODIFY `timeout` varchar(255) COLLATE utf8_bin NOT NULL DEFAULT '3s'; But the problem still occurs, as existing items still have empty timeout values. Only if I replace those, item editing (and cloning) works again. But I only did this for a single item (from a template that is applied to 15 hosts): UPDATE items SET timeout = '3s' WHERE timeout != '3s' AND name = 'Certbot WARNING lines'; -- Query OK, 15 rows affected What should I do with all the other items that have empty timeout values? SELECT itemid, type, name, timeout FROM items WHERE timeout != '3s'; -- 1951 rows in set Isn't it too risky to change all those items' timeout values to '3s'? Could this be done for all items, no matter which type they are?
|
Comment by Philip Iezzi [ 2021 Feb 18 ] |
Seems like the timeout field is only used for script items. so, one workaround would be to change an item's type to "Script", fill timeout "3s", then switch back to the original type (e.g. Zabbix agent, Zabbix agent (active),..) and then hit the Update button. This works. But next time I edit the item, the timeout value is again blanked out and I run into the same issue. This really seems a bug in item edit form validation. Submitting a form with empty timeout value should be possible. Setting the DEFAULT '3s' in items table schema does not make any difference here. |
Comment by Edgars Melveris [ 2021 Feb 19 ] |
I'm closing this as not a bug, as the problem is caused by non-default DB schema. It should be safe to update all items that currently have empty timeout with the default. Don't change all that have !=3s as there might be other entries there. |