Skip to content

Instantly share code, notes, and snippets.

@WimObiwan
Created October 24, 2019 15:17
Show Gist options
  • Save WimObiwan/2206fa550564c9246ca98a4f00aaa207 to your computer and use it in GitHub Desktop.
Save WimObiwan/2206fa550564c9246ca98a4f00aaa207 to your computer and use it in GitHub Desktop.
Remove values from Zabbix

On Zabbix server, connect to MariaDB by running:

mysql

And go to the correct database, e.g.:

USE zabbix;

Look up the itemid, which can be found in the URL when going to the configuration in the Zabbix web GUI. Or you can look it up by querying the database:

SELECT hostid, name FROM hosts WHERE name like '%XXX%'; -- --> <HOSTID>
SELECT itemid, name FROM items WHERE hostid = <SOMEID> and name like '%YYY%';  -- --> <ITEMID>

Then look for the values that need to be removed, e.g.

SELECT * 
FROM history 
WHERE itemid IN (31179, 31180, 31181, 31182) 
  and (clock between UNIX_TIMESTAMP("2019-10-23 19:30:00") 
    and UNIX_TIMESTAMP("2019-10-23 19:45:00")
    );

When 100% sure which records to be removed, you can remove them by replace the SELECT * by DELETE.

DELETE
FROM history 
WHERE itemid IN (31179, 31180, 31181, 31182) 
  and (clock between UNIX_TIMESTAMP("2019-10-23 19:30:00") 
    and UNIX_TIMESTAMP("2019-10-23 19:45:00")
    );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment