In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-16 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >
Share
Shulou(Shulou.com)06/01 Report--
Zabbix Platform Construction and Deployment Based on Rhel7.2 (IV)
I. Implementation of zabbix Add monitoring items, add monitoring of Linux hosts,
Note: first add host monitoring in "configuration"-"host", monitor os resources: memory, cpu, io, load, bandwidth, etc.
(1) Log in zabbix and click "Create Host" in "Configuration"-"Host":
(2) In the "Host" tab, fill in the relevant information
Note: The host name must be exactly the same as the hostname. The ip used here is the ip of the monitored host.
Other options are available by default.
(3) In the "Template" tab, fill in the relevant information
At this point, Zabbix monitoring Linux host settings are complete, as shown in the following figure:
(4) After a period of time, you can observe whether the effect of the monitoring chart has come out.
Second, add mysql monitoring for Linux hosts
Description: zabbix3.0 server has its own mysql template, just configure the agent client, and then add a template to the host on the web side.
Step 1: First add permissions to mysql on the client, that is, this machine uses zabbix account to connect to local mysql (operated on zabbix_agent client)
[root@mysql ~]# mysql -uroot -p123456
mysql> grant all on *.* to zabbix@'localhost' identified by '123456';
Query OK, 0 rows affected, 1 warning (0.08 sec)
mysql> flush privileges;
Query OK, 0 rows affected (0.00 sec)
mysql> exit
Bye
Step 2: Create the.my.cnf connection file in the zabbix_agent service directory (note that there is a ". ")
Note: zabbix installation directory is/usr/local/zabbix
[root@mysql ~]# cd /usr/local/zabbix/etc/
[root@mysql etc]# vim .my.cnf
Note:
(1) If the database grant is granted for localhost, there is no need to add host parameter in this.my.cnf [just like the configuration above]
(2) If the grant is granted to the IP of the local machine (such as 192.168.1.9), then the host parameter should be added to the.my.cnf file to specify it.
That is, in the.my.cnf file, add:
host=192.168.1.9
socket=/usr/local/mysql/mysql.sock
user=zabbix
password=123456
Step 3: Configure mysql key file
Note: This can be copied from zabbix3.2 installation decompression package
Extract the directory/usr/src/zabbix-3.2.3/conf/zabbix_agentd/userparameter_mysql.conf from the zabbix_server installation to/usr/local/zabbix/etc/zabbix_agentd.conf.d/on the zabbix_agent client.
[root@mysql ~]# cd /usr/local/zabbix/etc/zabbix_agentd.conf.d/
[root@mysql zabbix_agentd.conf.d]# cp /usr/src/zabbix-3.2.3/conf/zabbix_agentd/userparameter_mysql.conf ./
[root@mysql zabbix_agentd.conf.d]# ls
userparameter_mysql.conf
Step 4: Look at the userparameter_mysql.conf file and see a path setting like HOME=/var/lib/zabbix. Replace all paths with/usr/local/zabbix/etc/, which is the directory path where the.my.cnf file is located above.
Also, note the mysql command path in the userparameter_mysql.conf file (make mysql system environment variables in advance, in case mysql commands are not recognized by the system).
Step 5: Restart zabbix_agent service
[root@mysql ~]# systemctl stop zabbix_agentd
[root@mysql ~]# netstat -lnp |grep zabbix_agentd
[root@mysql ~]# systemctl start zabbix_agentd
[root@mysql ~]# netstat -lnp |grep zabbix_agentd
tcp 0 0 0.0.0.0:10050 0.0.0.0:* LISTEN 3295/zabbix_agentd
Step 6: Then run a command-line test on zabbix_server
[root@zabbix ~]# /usr/local/zabbix/bin/zabbix_get -s 192.168.100.120 -p 10050 -k "mysql.status[Uptime]"
sh: mysql: command not found
The above command is incorrect! I can't find the MySQL command!
The solution is as follows:
Add absolute path before mysql command in userparameter_mysql.conf (on zabbix_agent)
[root@mysql ~]# vim /usr/local/zabbix/etc/zabbix_agentd.conf.d/userparameter_mysql.conf
Change three places.
Restart Service (Client)
[root@mysql ~]# systemctl stop zabbix_agentd
[root@mysql ~]# netstat -lnp |grep zabbix_agentd
[root@mysql ~]# systemctl start zabbix_agentd
[root@mysql ~]# netstat -lnp |grep zabbix_agentd
tcp 0 0 0.0.0.0:10050 0.0.0.0:* LISTEN 4403/zabbix_agentd
Go back to zabbix_server again for command-line testing:
[root@zabbix ~]# /usr/local/zabbix/bin/zabbix_get -s 192.168.100.120 -p 10050 -k"mysql.status[Uptime]"
10158
Note 1: If a string of numbers similar to this key appears, it means that the configuration is ok, and the server can monitor the mysql data of the client!
After success, add MySQL template corresponding to the host in the monitoring interface.
Note 2:
zabbix_get command introduction
Parameter Description:
-s--host: Specify client hostname or IP (monitored client)
-p--port: client port, default 10050
-I--source-address: Specify the source IP, write the IP address of zabbix server, generally leave blank, if the server has multiple IPs, you specify one.
-k--key: the key you want to get
zabbix_get Get data:
BM load
[root@zabbix ~]# /usr/local/zabbix/bin/zabbix_get -s 192.168.100.120 -p 10050 -k"system.cpu.load[all,avg15]"
0.050000
obtain the host name
[root@zabbix ~]# /usr/local/zabbix/bin/zabbix_get -s 192.168.100.120 -p 10050 -k"system.hostname"
mysql
Step 7: Log in to zabbix monitoring interface. You can see the mysql monitoring template in "Configuration"-"Template".
Step 8: Add mysql monitoring template (zabbix comes with) to the corresponding host monitoring configuration:
Select: server-192.168.100.120 This host!
Step 9: mysql monitoring item renderings
Monitoring mysql bandwidth: the zabbix front end allows real-time viewing of the number of bytes mysql sends and receives. where bytes received represents the number of bytes received from all clients and bytes sent represents the number of bytes sent to all clients.
Monitoring mysql operation status: zabbix front-end can be real-time view of the number of operations per second of various SQL statements.
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.