zabbix 查詢剩余內(nèi)存一直大于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));

出現(xiàn)10次以上,最大內(nèi)存不足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;

--查詢月份內(nèi)存空閑
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;

最后編輯于
?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請聯(lián)系作者
【社區(qū)內(nèi)容提示】社區(qū)部分內(nèi)容疑似由AI輔助生成,瀏覽時請結(jié)合常識與多方信息審慎甄別。
平臺聲明:文章內(nèi)容(如有圖片或視頻亦包括在內(nèi))由作者上傳并發(fā)布,文章內(nèi)容僅代表作者本人觀點,簡書系信息發(fā)布平臺,僅提供信息存儲服務(wù)。

相關(guān)閱讀更多精彩內(nèi)容

  • rljs by sennchi Timeline of History Part One The Cognitiv...
    sennchi閱讀 7,854評論 0 10
  • pyspark.sql模塊 模塊上下文 Spark SQL和DataFrames的重要類: pyspark.sql...
    mpro閱讀 9,916評論 0 13
  • ORACLE自學(xué)教程 --create tabletestone ( id number, --序號usernam...
    落葉寂聊閱讀 1,243評論 0 0
  • 當回憶進入深沉,突然一只貓叫的聲音,把米蘭從回憶中驚醒。 她走到陳列架那里拿起一瓶白酒,到客廳坐在沙發(fā)上獨自喝起酒...
    李水心閱讀 286評論 1 2
  • 大概是以前不懂,現(xiàn)在失去了,才后悔了吧。
    慕氿閱讀 224評論 0 0

友情鏈接更多精彩內(nèi)容