当前位置:网站首页>Zabbix历史数据清理(保留以往每个项目每天一条数据)
Zabbix历史数据清理(保留以往每个项目每天一条数据)
2022-08-03 05:27:00 【谷凯Jump】
部门同事说zabbix数据太大,清理一下历史数据,结果以往数据一条都不见了。-_-!
看了网上的教程也都是说直接truncate两张表history和history_uint
我的想法是,以前的历史数据,每个项目每天保留一条,这样的话可以留一些数据供后期参考
先看一下这两张表

根据itemid日期取每天最小的clock
select itemid,date_format(from_unixtime(clock),'%Y-%m-%d'),count(*),min(clock) from history group by itemid,date_format(from_unixtime(clock), '%Y-%m-%d');执行删除
delete from history where (itemid,clock) not in
(select itemid,min(clock) from history group by itemid,date_format(from_unixtime(clock), '%Y-%m-%d'));
delete from history_uint where (itemid,clock) not in
(select itemid,min(clock) from history_uint group by itemid,date_format(from_unixtime(clock), '%Y-%m-%d'));
delete from trends_uint where (itemid,clock) not in
(select itemid,min(clock) from trends_uint group by itemid,date_format(from_unixtime(clock), '%Y-%m-%d'));边栏推荐
- 大佬!Maya+ZBrush+Substance制作泰坦野兽全流程!
- Eight, the difference between the interface of the abstract class
- 六、对比Vector、ArrayList、LinkedList有何区别?(设计、性能、安全)
- Oracle常用命令-基本命令
- JSP的基本使用
- 9. Please introduce the class loading process, what is the parent delegation model?
- 2021-06-20
- ZEMAX | 探索 OpticStudio中的序列模式
- AI智能剪辑,仅需2秒一键提取精彩片段
- servlet学习(七)ServletContext
猜你喜欢
随机推荐
使用ZBrush制作恶魔模型
二分查找2 - x的平方根
ZEMAX | 探究 OpticStudio 偏振分析功能
MATLAB给多组条形图添加误差棒
影响PoE供电传输距离的除了网线还有啥?
ue4入门学习笔记1(操作界面)
数组与字符串11-反转字符串
ZEMAX | 在 OpticStudio 中使用自由曲面进行设计
零基础小白想往游戏建模方向发展,3D游戏建模好学嘛?
ZEMAX | 如何使用ZOS-API创建自定义操作数
增强光学系统设计 | Zemax 全新 22.2 版本产品现已发布!
mib browser无法接收snmp trap消息解决
【随笔】平常心
What is parametric design, let's understand it through practical operation?| SOLIDWORKS How-To Videos
Eight, the difference between the interface of the abstract class
2021-06-15
ZBrush+Substance Designer2021制作高品质3D角色模型全流程!
g++ parameter description
802.1AS的BMCA(最佳主时钟选举)理解
数组与字符串8-最长回文子串









