zabbix历史数据相关表研究

history和trends相关表

history和trends都是存储历史数据的地方。一般是通过监控项(item)配置里、匹配更新监控项(item)和设置HouseKeeper tasks来设置保留数据的时长。

Housekeeper 会定期删除过期的数据。如果不是特别有意义,建议你把保留时间设置短一些, 如果想看以前的数 据图怎么办?这里趋势数据就派上用场了,一般只要小时平均即可这样话趋势据保留久一点即可,趋势数据的计算源数据来自history表。如果将history设置为0那么就只会获取item的值然后用于触发器,不会存历史数据到数据库。

监控项前端配置:

  • history相关表

    MariaDB [rtm]> show tables like 'history%';
    +--------------------------+
    | Tables_in_rtm (history%) |
    +--------------------------+
    | history |
    | history_log |
    | history_str |
    | history_text |
    | history_uint |
    +--------------------------+
    • history

      history 表存放信息类型为浮点数的监控项历史数据,类型在配置监控项是指定

      itemid: 监控项唯一标识id

      clock: 时间戳整数部分

      value: 监控项的值

      ns: 纳秒数

      MariaDB [rtm]> desc history;
      +--------+---------------------+------+-----+---------+-------+
      | Field | Type | Null | Key | Default | Extra |
      +--------+---------------------+------+-----+---------+-------+
      | itemid | bigint(20) unsigned | NO | MUL | NULL | |
      | clock | int(11) | NO | | 0 | |
      | value | double(16,4) | NO | | 0.0000 | |
      | ns | int(11) | NO | | 0 | |
      +--------+---------------------+------+-----+---------+-------+ MariaDB [rtm]> select * from history limit 10;
      +-----------+------------+---------+----+
      | itemid | clock | value | ns |
      +-----------+------------+---------+----+
      | 300161484 | 1545404400 | 1.9616 | 0 |
      | 300161484 | 1545379200 | 2.3494 | 0 |
      | 300161484 | 1545382800 | 2.7355 | 0 |
      | 300161484 | 1545386400 | 3.3068 | 0 |
      | 300161484 | 1545390000 | 3.2508 | 0 |
      | 300161484 | 1545393600 | 4.2648 | 0 |
      | 300161484 | 1545397200 | 4.0263 | 0 |
      | 300161484 | 1545400800 | 2.7983 | 0 |
      | 300161485 | 1545404400 | 16.8910 | 0 |
      | 300161485 | 1545379200 | 20.5173 | 0 |
      +-----------+------------+---------+----+
    • history_log

      history_log 表存放信息类型为日志的监控项历史数据,类型在配置监控项是指定

      MariaDB [rtm]> desc history_log;
      +------------+---------------------+------+-----+---------+-------+
      | Field | Type | Null | Key | Default | Extra |
      +------------+---------------------+------+-----+---------+-------+
      | id | bigint(20) unsigned | NO | PRI | NULL | |
      | itemid | bigint(20) unsigned | NO | MUL | NULL | |
      | clock | int(11) | NO | | 0 | |
      | timestamp | int(11) | NO | | 0 | |
      | source | varchar(64) | NO | | | |
      | severity | int(11) | NO | | 0 | |
      | value | text | NO | | NULL | |
      | logeventid | int(11) | NO | | 0 | |
      | ns | int(11) | NO | | 0 | |
      +------------+---------------------+------+-----+---------+-------+
    • history_str

      history_str 表存放信息类型为字符的监控项历史数据,类型在配置监控项是指定

      MariaDB [rtm]> desc history_str;
      +--------+---------------------+------+-----+---------+-------+
      | Field | Type | Null | Key | Default | Extra |
      +--------+---------------------+------+-----+---------+-------+
      | itemid | bigint(20) unsigned | NO | MUL | NULL | |
      | clock | int(11) | NO | | 0 | |
      | value | varchar(255) | NO | | | |
      | ns | int(11) | NO | | 0 | |
      +--------+---------------------+------+-----+---------+-------+ MariaDB [rtm]> select * from history_str limit 2\G;
      *************************** 1. row ***************************
      itemid: 23307
      clock: 1545384507
      value: localhost.localdomain
      ns: 410719216
      *************************** 2. row ***************************
      itemid: 23312
      clock: 1545384512
      value: Linux localhost.localdomain 3.10.0-862.el7.x86_64 #1 SMP Fri Apr 20 16:44:24 UTC 2018 x86_64
      ns: 411996428
    • history_text

      history_text 表存放信息类型为文本的监控项历史数据,类型在配置监控项是指定

      MariaDB [rtm]> desc history_text;
      +--------+---------------------+------+-----+---------+-------+
      | Field | Type | Null | Key | Default | Extra |
      +--------+---------------------+------+-----+---------+-------+
      | id | bigint(20) unsigned | NO | PRI | NULL | |
      | itemid | bigint(20) unsigned | NO | MUL | NULL | |
      | clock | int(11) | NO | | 0 | |
      | value | text | NO | | NULL | |
      | ns | int(11) | NO | | 0 | |
      +--------+---------------------+------+-----+---------+-------+ MariaDB [rtm]> select * from history_text limit 10;
      +---------+--------+------------+---------------------+-----------+
      | id | itemid | clock | value | ns |
      +---------+--------+------------+---------------------+-----------+
      | 1937748 | 30436 | 1545381354 | 10/11/2017 14:28:06 | 892072527 |
      | 1937749 | 28311 | 1545381364 | N/A | 146021861 |
      | 1937750 | 27186 | 1545381374 | N/A | 934199968 |
      | 1937751 | 26936 | 1545381376 | N/A | 146546842 |
      | 1937752 | 28936 | 1545381378 | N/A | 189324808 |
      | 1937753 | 24686 | 1545381380 | N/A | 89381118 |
      | 1937754 | 25061 | 1545381383 | N/A | 484549259 |
      | 1937755 | 28061 | 1545381385 | N/A | 699330874 |
      | 1937756 | 27061 | 1545381389 | N/A | 559602805 |
      | 1937757 | 30686 | 1545381391 | N/A | 303467948 |
      +---------+--------+------------+---------------------+-----------+
    • history_uint

      history_unit 表存放信息类型为数字(无正负)的监控项历史数据,类型在配置监控项是指定

      MariaDB [rtm]> desc history_uint;
      +--------+---------------------+------+-----+---------+-------+
      | Field | Type | Null | Key | Default | Extra |
      +--------+---------------------+------+-----+---------+-------+
      | itemid | bigint(20) unsigned | NO | MUL | NULL | |
      | clock | int(11) | NO | | 0 | |
      | value | bigint(20) unsigned | NO | | 0 | |
      | ns | int(11) | NO | | 0 | |
      +--------+---------------------+------+-----+---------+-------+ MariaDB [rtm]> select * from history_uint limit 10;
      +-----------+------------+-------+----+
      | itemid | clock | value | ns |
      +-----------+------------+-------+----+
      | 100029541 | 1545404700 | 4311 | 0 |
      | 100029541 | 1545405000 | 4276 | 0 |
      | 100029541 | 1545405300 | 4242 | 0 |
      | 100029541 | 1545405600 | 4207 | 0 |
      | 100029541 | 1545405900 | 4172 | 0 |
      | 100029541 | 1545406200 | 4137 | 0 |
      | 100029541 | 1545406500 | 4102 | 0 |
      | 100029541 | 1545406800 | 4067 | 0 |
      | 100029541 | 1545407100 | 4032 | 0 |
      | 100029541 | 1545407400 | 3997 | 0 |
      +-----------+------------+-------+----+
  • trends相关表

    MariaDB [rtm]> show tables like 'trends%';
    +-------------------------+
    | Tables_in_rtm (trends%) |
    +-------------------------+
    | trends |
    | trends_uint |
    +-------------------------+
    • trends

      itemid: 监控项唯一标识id

      clock: 时间戳整数部分

      num: 该小时内用了多少数据用于计算平均值、最小值、最大值

      value_min: 趋势时间内最小值(趋势数据时间间隔为一小时)

      value_avg: 趋势时间内平均值(趋势数据时间间隔为一小时)

      value_max: 趋势时间内最大值(趋势数据时间间隔为一小时)

      MariaDB [rtm]> desc trends;
      +-----------+---------------------+------+-----+---------+-------+
      | Field | Type | Null | Key | Default | Extra |
      +-----------+---------------------+------+-----+---------+-------+
      | itemid | bigint(20) unsigned | NO | PRI | NULL | |
      | clock | int(11) | NO | PRI | 0 | |
      | num | int(11) | NO | | 0 | |
      | value_min | double(16,4) | NO | | 0.0000 | |
      | value_avg | double(16,4) | NO | | 0.0000 | |
      | value_max | double(16,4) | NO | | 0.0000 | |
      +-----------+---------------------+------+-----+---------+-------+ MariaDB [rtm]> select * from trends limit 10;
      +--------+------------+-----+-----------+-----------+-----------+
      | itemid | clock | num | value_min | value_avg | value_max |
      +--------+------------+-----+-----------+-----------+-----------+
      | 23252 | 1538211600 | 60 | 0.0000 | 0.0006 | 0.0169 |
      | 23252 | 1538215200 | 60 | 0.0000 | 0.0008 | 0.0169 |
      | 23252 | 1538218800 | 60 | 0.0000 | 0.0008 | 0.0169 |
      | 23252 | 1538222400 | 60 | 0.0000 | 0.0003 | 0.0169 |
      | 23252 | 1538226000 | 60 | 0.0000 | 0.0008 | 0.0169 |
      | 23252 | 1538229600 | 60 | 0.0000 | 0.0017 | 0.0508 |
      | 23252 | 1538233200 | 60 | 0.0000 | 0.0011 | 0.0169 |
      | 23252 | 1538236800 | 60 | 0.0000 | 0.0014 | 0.0169 |
      | 23252 | 1538240400 | 60 | 0.0000 | 0.0008 | 0.0169 |
      | 23252 | 1538244000 | 60 | 0.0000 | 0.0003 | 0.0169 |
      +--------+------------+-----+-----------+-----------+-----------+
    • trends_unit

      MariaDB [rtm]> desc trends_uint;
      +-----------+---------------------+------+-----+---------+-------+
      | Field | Type | Null | Key | Default | Extra |
      +-----------+---------------------+------+-----+---------+-------+
      | itemid | bigint(20) unsigned | NO | PRI | NULL | |
      | clock | int(11) | NO | PRI | 0 | |
      | num | int(11) | NO | | 0 | |
      | value_min | bigint(20) unsigned | NO | | 0 | |
      | value_avg | bigint(20) unsigned | NO | | 0 | |
      | value_max | bigint(20) unsigned | NO | | 0 | |
      +-----------+---------------------+------+-----+---------+-------+ MariaDB [rtm]> select * from trends_uint limit 10;
      +--------+------------+-----+-----------+-----------+-----------+
      | itemid | clock | num | value_min | value_avg | value_max |
      +--------+------------+-----+-----------+-----------+-----------+
      | 23271 | 1538211600 | 6 | 0 | 0 | 0 |
      | 23271 | 1538215200 | 6 | 0 | 0 | 0 |
      | 23271 | 1538218800 | 6 | 0 | 0 | 0 |
      | 23271 | 1538222400 | 6 | 0 | 0 | 0 |
      | 23271 | 1538226000 | 6 | 0 | 0 | 0 |
      | 23271 | 1538229600 | 6 | 0 | 0 | 0 |
      | 23271 | 1538233200 | 6 | 0 | 0 | 0 |
      | 23271 | 1538236800 | 6 | 0 | 0 | 0 |
      | 23271 | 1538240400 | 6 | 0 | 0 | 0 |
      | 23271 | 1538244000 | 6 | 0 | 0 | 0 |
      +--------+------------+-----+-----------+-----------+-----------+

zabbix历史数据相关表研究的更多相关文章

  1. C#实现 OPC历史数据存取研究

    来源:http://blog.csdn.net/gjack/article/details/5641794 C#实现 OPC历史数据存取研究 (原文)Research of Accessing the ...

  2. Zabbix 历史数据存储到 Elasticsearch

    Zabbix 历史数据存储到 Elasticsearch Zabbix 3.4.6 版本开始支持历史数据存储到 Elasticsearch, 早就想测试这个功能,最近有个需求需保存 zabbix 的历 ...

  3. 清理 zabbix 历史数据, 缩减 mysql 空间

    zabbix 由于历史数据过大, 因此导致磁盘空间暴涨,  下面是结局方法步骤 1. 停止 ZABBIX SERER 操作 [root@gd02-qa-plxt2-nodomain-web-95 ~] ...

  4. Zabbix历史数据清理

    特别提醒: a.文中测试的Zabbix版本为 3.0.3 . b.清理数据属于高危操作,请在测试环境中验证后再执行线上操作!!! 1.统计数据库中每个表所占的空间: mysql> SELECT ...

  5. zabbix历史数据全部清楚

    #这种方法会出现 监控项不可用的情况 1.停掉zabbix_server 2.重重名表 RENAME TABLE history to history_20180117; RENAME TABLE h ...

  6. zabbix监控历史数据清理

    2018/12/24 14:00:57  zabbix监控运行一段时间以后,会留下大量的历史监控数据,zabbix数据库一直在增大:可能会造成系统性能下降,查看历史数据室查询速度缓慢. zabbix里 ...

  7. zabbix的历史数据存储到elasticsearch中

    基本配置项 https://www.jianshu.com/p/bffca8128e8f 官方说这个实验性的功能支持es的版本是5.0.x - > 6.1.x,如果使用早期或更高版本的Elast ...

  8. zabbix报警逻辑初探

    zabbix报警逻辑初探 首先贴出一张网上找的一张关于zabbix报警相关表结构及表关联逻辑图: actions表 actions表对应前端配置是动作(actions) action由conditio ...

  9. zabbix通过jmx监控tomcat

    Zabbix版本: Zabbix 3.0.2 一.服务端配置 1.安装jdk(版本1.7.0_79) 安装与配置比较简单,过程省略.执行java -version命令,出现类似界面表示成功.   2. ...

随机推荐

  1. Spring Boot web简介及原理 day04

    一.SpringBoot创建web开发(三部曲) 1.快速构建SpringBoot项目,并以jar包的形式构建 2.选择对应的功能模块 (选定场景,配置少量的配置就可运行,不配置有默认值) 3.编写自 ...

  2. 在win7上跑基于任少卿作者代码修改的RPN+BF实验

    1.前言 之前在win10上成功的跑起来faster-rcnn的实验,并且跑了一下CaltechPedestrian的数据集,但是效果一直不理想,折腾了好久也没弄清楚到底原因出在哪里,直到读了Is F ...

  3. oracle 表空间,用户的创建及授权,表空间基本操作

    参考地址:https://www.cnblogs.com/zhaideyou/articles/5845271.html Oracle安装完后,其中有一个缺省的数据库,除了这个缺省的数据库外,我们还可 ...

  4. ThinkPHP 5 验证码

    <div> <form action="{:url('index/check')}" method="post"> <img sr ...

  5. Java 基础 多线程和线程池基础

    一,多线程 1.1 多线程介绍 进程:进程指正在运行的程序.确切的来说,当一个程序进入内存运行,即变成一个进程,进程是处于运行过程中的程序,并且具有一定独立功能. 线程:线程是进程中的一个执行单元,负 ...

  6. JVM TI

    JVM TI JVM TI全名Java Virtual Machine Tool Interface,是开发虚拟机监控工具使用的编程接口,它可以监控JVM内部时间的执行,也可以控制JVM的某些行为,可 ...

  7. andorid开发build.gradle 增加几种产品的方法

    因为需要有些ndk的开发,cmakelists里需要定义不同的变量,这个在网上搜索解决方案,不是很容易就直接找到答案. 尝试了不少,最后找到解决方案.升级Gradle3.0,这个文章价值高. 在ras ...

  8. FB面经Prepare: Email User

    有一些账号,账号里面有一个或多个email, 如果两个账号有共同的email,则认为这两个账号是同一个人,找出哪些账号是同一个人 输入是这样的:数字是用户,字母是邮箱,有很多人有多个邮箱,找出相同的用 ...

  9. MATLAB 通过对话框返回值选择下一步操作

    学习来源:http://muchong.com/t-10428977-1-pid-1 Userchoice = questdlg(['您确定导入彩色图像?'],'提示','转为灰度图处理','展示彩色 ...

  10. 执行curl 提示curl: (35) SSL connect error

    安装acme证书时,执行如下 curl https://get.acme.sh | sh 提示如下报错: curl: (35) SSL connect error curl -v 跟踪时 发现 NSS ...