linux memory:
mysql -u zabbix -p -h 127.0.0.1 zabbix -e "select h.name, 100-AVG(hi.value_avg) from hosts h join items i on h.hostid=i.hostid join trends_uint hi on i.itemid=hi.itemid where h.status=0 and i.key_='vm.memory.free.[percent]' and hi.clock >= 1535731200 and hi.clock <= 1538352000 group by h.name;" | awk '{print $1",",$2}' > /tmp/linux_memory.csv
mysql -u zabbix -p -h 127.0.0.1 zabbix -e "select h.name, 100-AVG(hi.value_avg) from hosts h join items i on h.hostid=i.hostid join trends_uint hi on i.itemid=hi.itemid where h.status=0 and i.key_='vm.memory.free.[percent]' and hi.clock >= 1535731200 and hi.clock <= 1538352000 group by h.name;" | awk '{print $1",",$2}' > /tmp/linux_memory.csv
linux CPU:
mysql -u zabbix -p -h 127.0.0.1 zabbix -e "select h.name, 100-AVG(hi.value_avg) from hosts h join items i on h.hostid=i.hostid join trends hi on i.itemid=hi.itemid where h.status=0 and i.key_='system.cpu.util[,idle]' and hi.clock >= 1535731200 and hi.clock <= 1538352000 group by h.name;" | awk '{print $1",",$2}' > /tmp/linux_cpu.csv
mysql -u zabbix -p -h 127.0.0.1 zabbix -e "select h.name, 100-AVG(hi.value_avg) from hosts h join items i on h.hostid=i.hostid join trends hi on i.itemid=hi.itemid where h.status=0 and i.key_='system.cpu.util[,idle]' and hi.clock >= 1535731200 and hi.clock <= 1538352000 group by h.name;" | awk '{print $1",",$2}' > /tmp/linux_cpu.csv
windows cpu:
mysql -u zabbix -p -h 127.0.0.1 zabbix -e "select h.name, AVG(hi.value_avg) from hosts h join items i on h.hostid=i.hostid join trends hi on i.itemid=hi.itemid where h.status=0 and i.name='Cpu use percent' and hi.clock >= 1535731200 and hi.clock <= 1538352000 group by h.name;" | awk '{print $1",",$2}' > /tmp/windows_cpu.csv
mysql -u zabbix -p -h 127.0.0.1 zabbix -e "select h.name, AVG(hi.value_avg) from hosts h join items i on h.hostid=i.hostid join trends hi on i.itemid=hi.itemid where h.status=0 and i.name='Cpu use percent' and hi.clock >= 1535731200 and hi.clock <= 1538352000 group by h.name;" | awk '{print $1",",$2}' > /tmp/windows_cpu.csv
windows memory:
mysql -u zabbix -p -h 127.0.0.1 zabbix -e "select h.name, AVG(hi.value_avg) from hosts h join items i on h.hostid=i.hostid join trends_uint hi on i.itemid=hi.itemid where h.status=0 and i.name='Used memory percent' and hi.clock >= 1535731200 and hi.clock <= 1538352000 group by h.name;" | awk '{print $1",",$2}' > /tmp/windows_memory.csv
mysql -u zabbix -p -h 127.0.0.1 zabbix -e "select h.name, AVG(hi.value_avg) from hosts h join items i on h.hostid=i.hostid join trends_uint hi on i.itemid=hi.itemid where h.status=0 and i.name='Used memory percent' and hi.clock >= 1535731200 and hi.clock <= 1538352000 group by h.name;" | awk '{print $1",",$2}' > /tmp/windows_memory.csv
此链接是unix/linux的时间戳转换格式
http://tool.chinaz.com/Tools/unixtime.aspx
http://tool.chinaz.com/Tools/unixtime.aspx