用SQL语句查询zabbix的监控数据
- 参考地址:http://blog.51cto.com/sfzhang88/1558254
- -- 获取主机id -- 10084
- select hostid from hosts where host="Zabbix server";
- -- 查询剩余磁盘itemid --28537
- select itemid,key_ from items where hostid=10084 and key_="vfs.fs.size[/,free]";
- -- 最后N次探查的结果
- select from_unixtime(clock) as DateTime,value,ns from history_uint where itemid=28537 order by clock desc limit 10;
- select round(sum(1.0/i.delay),2) as qps from items i,hosts h where i.status='' and i.hostid=h.hostid and h.status='' and i.delay<>0;
- -- 主机流入量
- select itemid,name,key_ from items where hostid=10084 and key_="net.if.in[eth0]";
- select from_unixtime(clock) as DateTime,round(value/1024/1024,2) as Traffic_in from history_uint where itemid="28533" and from_unixtime(clock)>='2014-09-20' and from_unixtime(clock)<'2019-09-21' limit 20;
- -- 主机流出量
- select itemid,name,key_ from items where hostid=10084 and key_="net.if.out[eth0]";
- select from_unixtime(clock) as DateTime,round(value/1024/1024,2) as Traffic_out from history_uint where itemid="28534" and from_unixtime(clock)>='2014-09-20' and from_unixtime(clock)<'2014-09-21' limit 20;
- -- 下面SQL语句是汇总上面主机网卡的进出流量的
- select from_unixtime(clock,"%Y-%m-%d %H:%i") as DateTime,sum(round(value/1024/1024,2)) as Traffic_total from history_uint where itemid in (28533,28534) and from_unixtime(clock)>='2014-09-20'and from_unixtime(clock)<'2019-09-21' group by from_unixtime(clock,"%Y-%m-%d %H:%i") limit 20;
- -- 查询一天中主机流量的最大值,最小值和平均值。
- select date as DateTime,round(min(traffic)/2014/1024,2) as TotalMinIN,round(avg(traffic)/1024/1024,2) as TotalAvgIN,round(max(traffic)/1024/1024,2) as TotalMaxIN from (select from_unixtime(clock,"%Y-%m-%d") as date,sum(value) as traffic from history_uint where itemid in (28533,28534) and from_unixtime(clock)>='2014-09-20' and from_unixtime(clock)<'2019-09-21' group by from_unixtime(clock,"%Y-%m-%d %H:%i") ) tmp;
用SQL语句查询zabbix的监控数据的更多相关文章
- SQL语句查询某字段不同数据的个数(DISTINCT 的使用)
今天做了一个题,学到了一个知识点: 有一个高速收费表VF,如下: 统计收费涉及的车辆有多少: SQL语句: SELECT COUNT(DISTINCT VchReg) from VF ; 其中 ...
- sql语句查询某一天数据
--如果还有今天以后的数据 --一周内呢SELECT * FROM TB WHERE datediff(dd,DATE_TIME,getdate()) between 0 and 7 --从现在起往前 ...
- 如何用SQL语句查询Excel数据?
如何用SQL语句查询Excel数据?Q:如何用SQL语句查询Excel数据? A:下列语句可在SQL SERVER中查询Excel工作表中的数据. 2007和2010版本: SELECT*FROMOp ...
- 使用sql语句查询日期在一定时间内的数据
使用sql语句查询日期在一周内的数据 select * from ShopOrder where datediff(week,ordTime,getdate()-1)=0 //查询当天日期在一周年 ...
- sql语句查询
1. sql语句查询某位数字或者某几位数字开头的数据,字段类型为数字类: %’: 2. sql搜索以4开头和含有李字的数据: select * from wlzbpre_user where real ...
- 【转载】C#常用数据库Sqlserver通过SQL语句查询数据库以及表的大小
在Sqlserver数据库中,一般我们查看数据库的大小可以通过查找到数据库文件来查看,但如果要查找数据表Table的大小的话,则不可通过此方法,在Sqlserver数据库中,提供了相应的SQL语句来查 ...
- [转]关于oracle sql语句查询时表名和字段名要加双引号的问题
oracle初学者一般会遇到这个问题. 用navicat可视化创建了表,可是就是不能查到! 后来发现②语句可以查询到 ①select * from user; 但是,我们如果给user加上双引 ...
- 浅谈MySQL中优化sql语句查询常用的30种方法 - 转载
浅谈MySQL中优化sql语句查询常用的30种方法 1.对查询进行优化,应尽量避免全表扫描,首先应考虑在 where 及 order by 涉及的列上建立索引. 2.应尽量避免在 where 子句中使 ...
- 通过sql语句查询出来的结果字段没有到对应实体类时的处理方法
通过sql语句查询出来的结果字段没有到对应实体类时的处理方法,对于Person类获取用户第一个名字和年龄两个字段,常见的有两种方式: 1.在创建一个与查询结果字段对应的类,然后通过构造函数实现: Qu ...
随机推荐
- 拦截RESTful API并做相应处理的方式
⒈使用Filter(过滤器) package cn.coreqi.security.filter; import org.springframework.stereotype.Component; i ...
- web前端之性能
1.避免布局抖动 function resizeAllParagraphsToMatchBlockWidth() { // Puts the browser into a read-write-rea ...
- Alpha 冲刺 (3/10)
目录 摘要 团队部分 个人部分 摘要 队名:小白吃 组长博客:hjj 作业博客:冲刺3 团队部分 后敬甲(组长) 过去两天完成了哪些任务 文字描述 组织第一次团队编程 继续阅读小程序开发文档 接下来的 ...
- Mysql支持哪几种索引
从数据结构角度 1.B+树索引(O(log(n))):关于B+树索引,可以参考 MySQL索引背后的数据结构及算法原理 2.hash索引:a 仅仅能满足"=","IN&q ...
- ubuntu 安装 wireshark
1.添加 wireshark 源 sudo apt-add-repository ppa:wireshark-dev/stable 2.更新 sudo apt-get update 3.安装 w ...
- node学习第一天:nvm使用
nvm是什么? 学习node,首先要安装node的环境,nvm是一款工具,使用这款工具可以很方便的下载所需版本的node文件以及npm,十分的方便. nvm下载: nvm下载链接 注:下载文件名为 n ...
- datatables:如何禁用一列的排序
第一列是checkbox列,不需要排序,所以需要禁用掉. 代码如下: var table = $('#example1').DataTable( { 'paging' : true, 'lengthC ...
- Light OJ 1012
经典搜索水题...... #include<bits/stdc++.h> using namespace std; const int maxn = 20 + 13; const int ...
- java8 lambda方法引用
注意引用方法的参数列表与返回值类型要与函数式接口中的抽象方法的参数列表与返回值类型保持一致 主要有三种语法格式: * * 对象::实例方法名 * * 类::静态方法名 * * 类::实例方法名 pub ...
- MYSQL事务处理失效原因
mysql有多种存储引擎,有些版本(mysql5.5.5以前默认是MyISAM,mysql5.5.5以后默认是InnoDB)安装时默认的存储引擎是MyISAM,而MyISAM存储引擎是不支持事务处理的 ...