In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-02-24 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/02 Report--
The operating system cat / etc/issue,ubuntu 14.04.3 server of the monitored client
Zabbix-agent-version v2.2.2
Zabbix-server-version v4.0.7
This article is mainly about custom monitoring items.
Use a user with sudo privileges to do the following
Step 1: cat / etc/zabbix/scripts/rabbitmq.sh
#! / bin/bash
Passwd= "*" # here is the sudo password. Ignore it if it is executed by a root user.
Echo "$passwd" | sudo-S rabbitmqctl list_queues-p / | sed 1d | sed-n'/'$1cm p' | awk-F'{print $2}'
The purpose of this script is to output the number of queues below which the rabbitmq specifies the virtual host
After considering the security issue, the server password should not be exposed on the server. Decided to use sudo to solve this problem
Let ordinary users execute rabbitmqctl this command secret-free, other commands need a password. After testing
Add the following two sentences to sudo visudo, that is, / etc/sudoers. (I deleted the original% sudo ALL= (ALL:ALL) ALL and then added these two sentences.)
Wang ALL= (ALL) ALL
Wang ALL= (ALL) NOPASSWD:/usr/sbin/rabbitmqctl
It is recommended that the server disabled by root users unlock before setting a password for root users.
In case the configuration file is written incorrectly, ordinary users do not have sudo privileges and cannot log in to root users. Then only restart the server and enter single-user mode to modify
/ etc/sudoers file. So the final script content is
Cat scripts/rabbitmq.sh
#! / bin/bash
Sudo rabbitmqctl list_queues-p / test | sed 1d | sed-n'/'$1 print planner p' | awk-F'{print $2}'
Step 2: configure the client profile
UnsafeUserParameters=1 this change from 0 to 1 means that custom monitoring items are allowed.
AllowRoot=1 allows agent to execute as root user
Custom monitoring items can be added in / etc/zabbix/zabbix_agented.conf or create a new conf file under / etc/zabbix/zabbix_agentd.conf.d/ (provided that the configuration file has Include=/etc/zabbix/zabbix_agentd.conf.d/). I directly added a key value to each message queue in the configuration file. (if too many key values are not suitable for this method, please write your own script. There are 14 message queues under the virtual host I monitor. Here is an example)
UserParameter=$ key value, sh / etc/zabbix/scripts/rabbitmq.sh $1
$1 is the name of the message queue outputted by sudo rabbitmqctl list_queues-p / * | sed 1d | sed-n'/'$1squarep' | awk-F'{print $1}'
Restart the zabbix_agent service sudo service zabbix_agent restart
You can test it with zabbix_get (my system won't be tested without this command)
Step 3: log in to the zabbix web page side to create a rabbitmq host group, and then add the server to the host group.
Create a template, then create a monitoring project, and then create a trigger (divided into alarms, generally serious, severe)
Reference documentation:
Https://blog.csdn.net/baidu_38432732/article/details/90756509 reference documentation
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.