zabbix自定义key测试失败
要做一个很简单的收集系统内存使用情况的监控,根据网上各种资料获得方法如下:
修改zabbix_agentd.conf中的几个配置
<code>UnsafeUserParameters=1 UserParameter=mem.usage,/usr/bin/free -m |grep Mem | awk '{print $3}' </code>
然后zabbix_agentd -t mem.usage,返回报错
<code>mem.usage [m|ZBX_NOTSUPPORTED] [Unsupported item key.] </code>
试过另外一个感觉一样的方法:
修改zabbix_agentd.conf中的几个配置
<code>UnsafeUserParameters=1 Include=/app/local/zabbix/conf/zabbix_agentd/*.conf </code>
然后在/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>
在/app/local/zabbix/sh/中创建mem_usage.sh文件,内容为
<code>#!/bin/bash /usr/bin/free -m |grep Mem |awk '{print $3}' </code>
运行此脚本能正确返回结果,但使用zabbix_agentd -t mem.usage,返回报错
<code>mem.usage [m|ZBX_NOTSUPPORTED] [Unsupported item key.] </code>
求大神指点。。。。
回复内容:
要做一个很简单的收集系统内存使用情况的监控,根据网上各种资料获得方法如下:
修改zabbix_agentd.conf中的几个配置
<code>UnsafeUserParameters=1 UserParameter=mem.usage,/usr/bin/free -m |grep Mem | awk '{print $3}' </code>
然后zabbix_agentd -t mem.usage,返回报错
<code>mem.usage [m|ZBX_NOTSUPPORTED] [Unsupported item key.] </code>
试过另外一个感觉一样的方法:
修改zabbix_agentd.conf中的几个配置
<code>UnsafeUserParameters=1 Include=/app/local/zabbix/conf/zabbix_agentd/*.conf </code>
然后在/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>
在/app/local/zabbix/sh/中创建mem_usage.sh文件,内容为
<code>#!/bin/bash /usr/bin/free -m |grep Mem |awk '{print $3}' </code>
运行此脚本能正确返回结果,但使用zabbix_agentd -t mem.usage,返回报错
<code>mem.usage [m|ZBX_NOTSUPPORTED] [Unsupported item key.] </code>
求大神指点。。。。
修改zabix-agentd.conf后需要重新启动一下,然后可以使用zabbix自带的软件来测试一下自定义KEY
<code>zabbix-get -s agent_ip -p 10050 -k mem.usage </code>
版本不同,导致的坑爹货!
https://www.zabbix.com/documentation/3.0/manual/config/items/userparameters/extending_agent

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

Video Face Swap
Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics



PHP is used to build dynamic websites, and its core functions include: 1. Generate dynamic content and generate web pages in real time by connecting with the database; 2. Process user interaction and form submissions, verify inputs and respond to operations; 3. Manage sessions and user authentication to provide a personalized experience; 4. Optimize performance and follow best practices to improve website efficiency and security.

PHP uses MySQLi and PDO extensions to interact in database operations and server-side logic processing, and processes server-side logic through functions such as session management. 1) Use MySQLi or PDO to connect to the database and execute SQL queries. 2) Handle HTTP requests and user status through session management and other functions. 3) Use transactions to ensure the atomicity of database operations. 4) Prevent SQL injection, use exception handling and closing connections for debugging. 5) Optimize performance through indexing and cache, write highly readable code and perform error handling.

PHP and Python have their own advantages and disadvantages, and the choice depends on project needs and personal preferences. 1.PHP is suitable for rapid development and maintenance of large-scale web applications. 2. Python dominates the field of data science and machine learning.

How to configure an Nginx domain name on a cloud server: Create an A record pointing to the public IP address of the cloud server. Add virtual host blocks in the Nginx configuration file, specifying the listening port, domain name, and website root directory. Restart Nginx to apply the changes. Access the domain name test configuration. Other notes: Install the SSL certificate to enable HTTPS, ensure that the firewall allows port 80 traffic, and wait for DNS resolution to take effect.

The methods that can query the Nginx version are: use the nginx -v command; view the version directive in the nginx.conf file; open the Nginx error page and view the page title.

Starting an Nginx server requires different steps according to different operating systems: Linux/Unix system: Install the Nginx package (for example, using apt-get or yum). Use systemctl to start an Nginx service (for example, sudo systemctl start nginx). Windows system: Download and install Windows binary files. Start Nginx using the nginx.exe executable (for example, nginx.exe -c conf\nginx.conf). No matter which operating system you use, you can access the server IP

PHP is a server-side scripting language used for dynamic web development and server-side applications. 1.PHP is an interpreted language that does not require compilation and is suitable for rapid development. 2. PHP code is embedded in HTML, making it easy to develop web pages. 3. PHP processes server-side logic, generates HTML output, and supports user interaction and data processing. 4. PHP can interact with the database, process form submission, and execute server-side tasks.

The core benefits of PHP include ease of learning, strong web development support, rich libraries and frameworks, high performance and scalability, cross-platform compatibility, and cost-effectiveness. 1) Easy to learn and use, suitable for beginners; 2) Good integration with web servers and supports multiple databases; 3) Have powerful frameworks such as Laravel; 4) High performance can be achieved through optimization; 5) Support multiple operating systems; 6) Open source to reduce development costs.
