要做一個很簡單的收集系統內存使用情況的監控,根據網上各種資料獲得方法如下:
修改zabbix_agentd.conf中的幾個配置
UnsafeUserParameters=1UserParameter=mem.usage,/usr/bin/free -m |grep Mem | awk '{print $3}'
然後zabbix_agentd -t mem.usage,返回報錯
mem.usage [m|ZBX_NOTSUPPORTED] [Unsupported item key.]
試過另外一個感覺一樣的方法:
修改zabbix_agentd.conf中的幾個配置
UnsafeUserParameters=1Include=/app/local/zabbix/conf/zabbix_agentd/*.conf
然後在/app/local/zabbix/conf/zabbix_agentd/中創建mem_usage.conf文件
mem_usage.conf中的內容爲
UserParameter=mem.usage,HOME=/app/local/zabbix/sh/mem_usage.sh
在/app/local/zabbix/sh/中創建mem_usage.sh文件,內容爲
#!/bin/bash/usr/bin/free -m |grep Mem |awk '{print $3}'
運行此腳本能正確返回結果,但使用zabbix_agentd -t mem.usage,返回報錯
mem.usage [m|ZBX_NOTSUPPORTED] [Unsupported item key.]