This film is related to the blog of zabbix installation and deployment: https://blog.csdn.net/Ying_smile/article/details/81736349
Add nginx monitoring item
zabbix-agent:
[root@server6 ~]# rpm -ivh nginx-1.8.0-1.el6.ngx.x86_64.rpm
[root@server6 ~]# cd /etc/nginx/conf.d/
[root@server6 conf.d]# vim default.conf
12 location /status {
13 stub_status on;
14 access_log off;
15 }
[root@server6 conf.d]# nginx -t
[root@server6 conf.d]# /etc/init.d/nginx start
Browser view:
Accept: allow request, handled: establish tcp connection, requests: response
[root@server6 conf.d]# vim default.conf
12 location /status {
13 stub_status on;
14 access_log off;
15 allow 127.0.0.1; //Set local access only
16 deny all;
17 }
[root@server6 conf.d]# nginx -s reload
[root@server6 conf.d]# curl http://127.0.0.1/status
Active connections: 1
server accepts handled requests
1 1 1
Reading: 0 Writing: 1 Waiting: 0
[root@server6 conf.d]# curl http://172.25.35.56/status
<html>
<head><title>403 Forbidden</title></head>
<body bgcolor="white">
<center><h1>403 Forbidden</h1></center>
<hr><center>nginx/1.8.0</center>
</body>
</html>
[root@server6 conf.d]# cd /etc/zabbix/zabbix_agentd.d/
[root@server6 zabbix_agentd.d]# cp userparameter_mysql.conf userparameter_nginx.conf
[root@server6 zabbix_agentd.d]# vim userparameter_nginx.conf
UserParameter=nginx.active,curl -s http://127.0.0.1/status | grep Active | awk '{print $NF}' //NF Represents the last column, which can also be used $3
UserParameter=nginx.accepts,curl -s http://127.0.0.1/status | awk NR==3 | awk '{print $1}'
UserParameter=nginx.handled,curl -s http://127.0.0.1/status | awk NR==3 | awk '{print $2}'
UserParameter=nginx.requests,curl -s http://127.0.0.1/status | awk NR==3 | awk '{print $3}'
[root@server6 zabbix_agentd.d]# /etc/init.d/zabbix-agent start
[root@server6 zabbix_agentd.d]# chkconfig zabbix-agent on
zabbix-server:
[root@server1 ~]# systemctl start mariadb
[root@server1 ~]# systemctl enable mariadb
[root@server1 ~]# systemctl start zabbix-server
[root@server1 ~]# systemctl enable zabbix-server
[root@server1 ~]# systemctl start zabbix-agent
[root@server1 ~]# systemctl enable zabbix-agent
[root@server1 ~]# rpm -ivh zabbix-get-3.4.6-1.el7.x86_64.rpm
[root@server1 ~]# zabbix_get -s 172.25.35.56 -p 10050 -k 'nginx.active' / / test whether the monitoring content added by ZABBIX agent can be viewed
1
[root@server1 ~]# zabbix_get -s 172.25.35.56 -p 10050 -k 'nginx.handled'
36
[root@server1 ~]# zabbix_get -s 172.25.35.56 -p 10050 -k 'nginx.accepts'
37
[root@server1 ~]# zabbix_get -s 172.25.35.56 -p 10050 -k 'nginx.requests'
38
zabbix web:
Click monitoring item - > create monitoring item
Fill in the user-defined name. The key value is the name in the server6 file userparameter? Nginx.conf
Click graph - > create graph
Custom name, add the monitoring item just created:
You can see the changes of the added monitoring items in the preview:
Add percona monitoring item
zabbix-server:
[root@server1 ~]# rpm -ivh percona-zabbix-templates-1.1.8-1.noarch.rpm
[root@server1 ~]# cd /var/lib/zabbix/percona/templates/
[root@server1 templates]# ls
userparameter_percona_mysql.conf
zabbix_agent_template_percona_mysql_server_ht_2.0.9-sver1.1.8.xml
[root@server1 templates]# cp userparameter_percona_mysql.conf /etc/zabbix/zabbix_agentd.d/
[root@server1 templates]# systemctl restart zabbix-agent
[root@server1 templates]# cd /var/lib/zabbix/percona/scripts/
[root@server1 scripts]# vim ss_get_mysql_stats.php.cnf
<?php
$mysql_user = 'root';
$mysql_pass = 'ZhanG@2424';
[root@server1 scripts]# /Var / lib / ZABBIX / percona / scripts / get ﹐ MySQL ﹐ stats ﹐ wrapper. Sh GG / / you can see the relevant parameters in the file / etc / ZABBIX / ZABBIX ﹐ agentd. D / userparameter ﹐ percona ﹐ mysql. Conf
4
[root@server1 scripts]# cd /tmp
[root@server1 tmp]# cat localhost-mysql_cacti_stats.txt
[root@server1 tmp]# rm -f localhost-mysql_cacti_stats.txt
[root@server1 tmp]# cd
[root@server1 ~]# vim ~zabbix/.my.cnf
[client]
user = root
password = ZhanG@2424
[root@server1 ~]# systemctl restart zabbix-agent
[root@server1 ~]# zabbix_get -s 127.0.0.1 -p 10050 -k 'MySQL.Threads-cached'
0
Configuration: template, click Import
Browse... Select the file ZBx > percona > MySQL > template.xml (file share: https://pan.baidu.com/s/1hD39wQPFPn91TWByAEywZg)
Display the successful import and you can see 191 more monitoring items
Click Zabbix server
Add Template Percona MySQL Server template
More monitoring items can be seen after adding
Add java monitoring item
zabbix-agent:
[root@server6 ~]# rpm -ivh jdk-8u121-linux-x64.rpm
[root@server6 ~]# tar zxf apache-tomcat-7.0.90.tar.gz -C /usr/local/
[root@server6 ~]# cd /usr/local/
[root@server6 local]# ln -s apache-tomcat-7.0.90/ tomcat
[root@server6 local]# cd tomcat/
[root@server6 tomcat]# ls
bin CONTRIBUTING.md logs RELEASE-NOTES webapps
BUILDING.txt lib NOTICE RUNNING.txt work
conf LICENSE README.md temp
[root@server6 tomcat]# cd bin/
[root@server6 bin]# vim catalina.sh
107 CATALINA_OPTS='-Dcom.sun.management.jmxremote
108 -Dcom.sun.management.jmxremote.port=8888
109 -Dcom.sun.management.jmxremote.ssl=false
110 -Dcom.sun.management.jmxremote.authenticate=fales'
[root@server6 bin]# ./startup.sh
[root@server6 bin]# netstat -antlp | grep 8888
tcp 0 0 :::8888 :::* LISTEN 6158/java
zabbix-server:
[root@server1 ~]# yum install zabbix-java-gateway-3.4.6-1.el7.x86_64.rpm -y
[root@server1 ~]# cd /etc/zabbix/
[root@server1 zabbix]# vim zabbix_server.conf
262 JavaGateway=172.25.35.61
270 JavaGatewayPort=10052
278 StartJavaPollers=5
[root@server1 zabbix]# systemctl start zabbix-java-gateway
[root@server1 zabbix]# systemctl restart zabbix-server
[root@server1 zabbix]# netstat -antlp | grep 10052
tcp6 0 0 :::10052 :::* LISTEN 28118/java
zabbix web:
Click server6:
Add JMX interface:
Add Java template
After adding, refresh to see that JMX interface is available and java module is added:
The graphical interface can view: