用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 ...
随机推荐
- openGL之坐标变换
- svn服务器镜像备份
server master 192.168.0.100-->源版本库 server slave 192.168.0.101-->镜像版本库 1.初始化svnsync init s ...
- bzoj 1175: The stairways of Saharna
一道杨氏矩阵的题,萌新初入门,还不是很懂,这篇 blog 讲的超级好(就是看图有点麻烦) 据说这玩意儿可以代替堆和平衡树用,支持插入.删除.查询,跑得还挺快的(慢着,复杂度好像是 n^2 ? 而且空间 ...
- VS2013中编译openssl的步骤和使用设置
一.VS2013中编译openssl的步骤 版本号:openssl-1.0.1e 1.下载 OpenSSL http://www.openssl.org/,并解压到d:\openssl-1.0.1e目 ...
- This project is not a myeclipse hibernate project . Assuming Hibernate 3 capabilities configuration editor
开某工程Hibernate配置文件时出现提示,信息大概如标题. 根据网友提供,选中工程,点击MyEclipse-->Project capabilities-->add hibernate ...
- 006_tcpdump专题
抓包是排查问题非常重要的一种方式,这里汇总常用的排查日常问题的,tcpdump在linux机器上的使用姿势. 一.排查statsd打点情况. 线上出现statsd打点的指标无法正常显示的情况,需要排查 ...
- ubuntu html5开发工具brackets
Brackets 是一款使用 HTML,CSS,JavaScript 创建的开源的针对 Web 开发的编辑器.实时预览,快速编辑,跨平台,可扩展,开源,让 Brackets 成为一款非常优秀的编辑器. ...
- Docker从0开始之部署一套2048小游戏
本文记录一下在docker部署一套2048小游戏的过程,在娱乐中熟悉docker的应用部署.docker 安装不在本文讲述之中,参考我的其它博客. 1.获取image镜像. 方法一:daocloud. ...
- 【原创】大数据基础之Marathon(2)marathon-lb
marathon-lb 官方:https://github.com/mesosphere/marathon-lb 一 简介 Marathon load balancer (Marathon-LB) i ...
- [javascript]multipart/form-data上传格式表单自定义创建
<!DOCTYPE html> <html> <head> <title></title> </head> <body&g ...