Home > Backend Development > PHP Tutorial > zabbix自定义key测试失败

zabbix自定义key测试失败

WBOY
Release: 2016-06-06 20:40:13
Original
1544 people have browsed it

要做一个很简单的收集系统内存使用情况的监控,根据网上各种资料获得方法如下:
修改zabbix_agentd.conf中的几个配置

<code>UnsafeUserParameters=1
UserParameter=mem.usage,/usr/bin/free -m |grep Mem | awk '{print $3}'
</code>
Copy after login
Copy after login

然后zabbix_agentd -t mem.usage,返回报错

<code>mem.usage                                     [m|ZBX_NOTSUPPORTED] [Unsupported item key.]
</code>
Copy after login
Copy after login
Copy after login
Copy after login

试过另外一个感觉一样的方法:
修改zabbix_agentd.conf中的几个配置

<code>UnsafeUserParameters=1
Include=/app/local/zabbix/conf/zabbix_agentd/*.conf
</code>
Copy after login
Copy after login

然后在/app/local/zabbix/conf/zabbix_agentd/中创建mem_usage.conf文件

mem_usage.conf中的内容为

<code>UserParameter=mem.usage,HOME=/app/local/zabbix/sh/mem_usage.sh
</code>
Copy after login
Copy after login

在/app/local/zabbix/sh/中创建mem_usage.sh文件,内容为

<code>#!/bin/bash
/usr/bin/free -m |grep Mem |awk '{print $3}'
</code>
Copy after login
Copy after login

运行此脚本能正确返回结果,但使用zabbix_agentd -t mem.usage,返回报错

<code>mem.usage                                     [m|ZBX_NOTSUPPORTED] [Unsupported item key.]
</code>
Copy after login
Copy after login
Copy after login
Copy after login

求大神指点。。。。

回复内容:

要做一个很简单的收集系统内存使用情况的监控,根据网上各种资料获得方法如下:
修改zabbix_agentd.conf中的几个配置

<code>UnsafeUserParameters=1
UserParameter=mem.usage,/usr/bin/free -m |grep Mem | awk '{print $3}'
</code>
Copy after login
Copy after login

然后zabbix_agentd -t mem.usage,返回报错

<code>mem.usage                                     [m|ZBX_NOTSUPPORTED] [Unsupported item key.]
</code>
Copy after login
Copy after login
Copy after login
Copy after login

试过另外一个感觉一样的方法:
修改zabbix_agentd.conf中的几个配置

<code>UnsafeUserParameters=1
Include=/app/local/zabbix/conf/zabbix_agentd/*.conf
</code>
Copy after login
Copy after login

然后在/app/local/zabbix/conf/zabbix_agentd/中创建mem_usage.conf文件

mem_usage.conf中的内容为

<code>UserParameter=mem.usage,HOME=/app/local/zabbix/sh/mem_usage.sh
</code>
Copy after login
Copy after login

在/app/local/zabbix/sh/中创建mem_usage.sh文件,内容为

<code>#!/bin/bash
/usr/bin/free -m |grep Mem |awk '{print $3}'
</code>
Copy after login
Copy after login

运行此脚本能正确返回结果,但使用zabbix_agentd -t mem.usage,返回报错

<code>mem.usage                                     [m|ZBX_NOTSUPPORTED] [Unsupported item key.]
</code>
Copy after login
Copy after login
Copy after login
Copy after login

求大神指点。。。。

修改zabix-agentd.conf后需要重新启动一下,然后可以使用zabbix自带的软件来测试一下自定义KEY

<code>zabbix-get -s agent_ip -p 10050 -k mem.usage
</code>
Copy after login

版本不同,导致的坑爹货!
https://www.zabbix.com/documentation/3.0/manual/config/items/userparameters/extending_agent

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template