Zabbix - Suppression de valeurs erronées dans un historique


J'ai écrit un tutoriel rapide pour moi :

Récupérez le itemid depuis l'URL d'un graphique (par exemple : /history.php?action=showgraph&itemids[]=444871)
Accédez à votre base zabbix
Trouvez le type de données de votre élément
uint, text, str, log
pour savoir dans quelle table d'historique vous devez chercher
history_uint
history_text
history_str
history_log

Cherchez la bonne valeur dans la bonne table

select * from history_uint where itemid=444871 order by value DESC limit 5;
 itemid |   clock    |     value      |    ns
--------+------------+----------------+-----------
 444871 | 1543993500 | 29729269162576 | 606002333
 444871 | 1543964400 |    32170824376 | 384896023
 444871 | 1543965000 |    30664167112 | 514850665
 444871 | 1543964700 |    29971309024 | 862951334
 444871 | 1543965300 |    26845634240 | 455393174
(5 rows)
Simply remove the obviously wrong value from the table:
zabbix=# delete from history_uint where itemid=444871 and clock=1543993500 and value=29729269162576;
DELETE 1

Autres exemples de requêtes


select * from history_uint where itemid=444871 order by value DESC limit 5;
select * from history_str where itemid=48666 order by value DESC limit 5;
select * from history_str where itemid=48666 order by clock DESC limit 20;
select * from history_str where itemid=48666 and clock < 1755778983 and clock > 1755750666 order by clock DESC limit 20;
select * from history_str where itemid=48666 and clock < 1755778983 and clock > 1755750666;
select * from history_str where (itemid=48666 or itemid=48664) and clock < 1755778983 and clock > 1755750666;

select * from history_str where value='Sur ,NB sauvegardes OK : et NB sauvegardes : Le : | O0;W1;C2; 0' and itemid=48666;

delete from history_str where value='Sur ,NB sauvegardes OK : et NB sauvegardes : Le : | O0;W1;C2; 0' and (itemid>48600 or itemid<48700);

 

Sources : https://support.zabbix.com/browse/ZBXNEXT-683