zabbix 查询剩余内存一直大于2G的主机

select host,name from hosts where hostid in (select hostid from items where itemid in (select itemid from trends_uint where itemid in (select itemid from items where name="Available memory") group by itemid having min(value_min)>2000000000));

出现10次以上,最大内存不足500MB的主机
select name from hosts where hostid in (select hostid from items where itemid in (select itemid from trends_uint where itemid in (select itemid from items where name="Available memory") and value_max<500000000 group by itemid having count(*)>10));

select * from trends_uint where date_format(FROM_UNIXTIME(clock),'%Y-%m')="2018-11";
29124

select host,name from hosts where hostid in (select hostid from items where itemid in (select itemid from trends_uint where itemid in (select itemid from items where name="Available memory") and date_format(FROM_UNIXTIME(clock),'%Y-%m')="2018-11" ));

select hostid,min(b.value_min),max(b.value_max),avg(value_avg) from items join (select * from trends_uint where itemid in (select itemid from items where name="Available memory") and date_format(FROM_UNIXTIME(clock),'%Y-%m')="2018-11" and itemid=29124) as b on items.itemid=b.itemid group by hostid;

select hostid,min(b.value_min),max(b.value_max),avg(value_avg) from items join (select * from trends_uint where itemid in (select itemid from items where name="Available memory") and date_format(FROM_UNIXTIME(clock),'%Y-%m')="2018-11") as b on items.itemid=b.itemid group by hostid;

--查询月份内存空闲
select host,name,c.* into outfile '/tmp/availmemory.csv' fields terminated by ',' optionally enclosed by ' ' lines terminated by '\r\n' from hosts join (select hostid,min(b.value_min)/(102410241024),max(b.value_max)/(102410241024),avg(value_avg)/(102410241024) from items join (select * from trends_uint where itemid in (select itemid from items where name="Available memory" or name="Free memory") and date_format(FROM_UNIXTIME(clock),'%Y-%m')="2018-11") as b on items.itemid=b.itemid group by hostid) as c on hosts.hostid=c.hostid;

cpu load
select host,name,c.* into outfile '/tmp/cpuload.csv' fields terminated by ',' optionally enclosed by ' ' lines terminated by '\r\n' from hosts join (select hostid,min(b.value_min),max(b.value_max),avg(value_avg) from items join (select * from trends where itemid in (select itemid from items where name like "%1 min average per core%" or name="CPU Load") and date_format(FROM_UNIXTIME(clock),'%Y-%m')="2018-11") as b on items.itemid=b.itemid group by hostid) as c on hosts.hostid=c.hostid;

最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容

  • rljs by sennchi Timeline of History Part One The Cognitiv...
    sennchi阅读 7,486评论 0 10
  • pyspark.sql模块 模块上下文 Spark SQL和DataFrames的重要类: pyspark.sql...
    mpro阅读 9,539评论 0 13
  • ORACLE自学教程 --create tabletestone ( id number, --序号usernam...
    落叶寂聊阅读 1,150评论 0 0
  • 当回忆进入深沉,突然一只猫叫的声音,把米兰从回忆中惊醒。 她走到陈列架那里拿起一瓶白酒,到客厅坐在沙发上独自喝起酒...
    李水心阅读 240评论 1 2
  • 大概是以前不懂,现在失去了,才后悔了吧。
    慕氿阅读 196评论 0 0