警告
本文最后更新于 2022-06-22,文中内容可能已过时。
zabbix javaGetway
- zabbix_server 编译安装需增加
-enable-java
,yum安装的需要安装java java-devel zabbix-java-gateway
Tomcat
开启远程监控功能, /pathto/tomcat/bin/catalina.sh
大概97行添加CATALINA_OPTS="$CATALINA_OPTS -Dcom.sun.management.jmxremote -Dcom.sun.management.jmxremote.port=12345 -Dcom.sun.management.jmxremote.authenticate=false -Dcom.sun.management.jmxremote.ssl=false -Djava.rmi.server.hostname=<tomcat主机ip>"
配置,并解析<tomcat主机ip> tomcat
- 启动
/pathto/zabbix/sbin/zabbix_java/startup.sh
端口: 10052
- 修改
zabbix_server.conf
配置文件,启用javaPollers
,指定javaGateway
地址,
- 217 行:
JavaGateway=127.0.0.1
# ip
- 225 行:
JavaGatewayPort=10052
# 本地的端口
- 235 行:
StartJavaPollers=5
# 启动的进程书
- zabbix 创建主机,添加
jmx
接口监控,添加模版JMX
的Template JMX Generic
/Template JMX Tomcat
https://www.percona.com/doc/percona-monitoring-plugins/LATEST/zabbix/index.html#installation-instructions
1
2
3
4
5
6
7
8
9
10
11
12
|
安装依赖包
yum install -y php php-mysql
# 注意 安装php 会默认安装httpd,建议手动编译
wget 'https://www.percona.com/downloads/percona-monitoring-plugins/percona-monitoring-plugins-1.1.8/binary/redhat/7/x86_64/percona-zabbix-templates-1.1.8-1.noarch.rpm'
rpm -ivh percona-zabbix-templates-1.1.8-1.noarch.rpm
cp /var/lib/zabbix/percona/templates/userparameter_percona_mysql.conf /usr/local/zabbix/etc/zabbix/zabbix_agentd.d/
修改php脚本配置
vim /var/lib/zabbix/percona/scripts/ss_get_mysql_stats.php
$mysql_user = '';
$mysql_pass = '';
|
https://segmentfault.com/a/1190000007568413
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
|
useradd zabbix -M -s /sbin/nologin
sudo usermod -aG docker zabbix
/opt/soft
mkdir zabbix32
cd zabbix32
svn co svn://svn.zabbix.com/branches/3.2 .
./bootstrap.sh
./configure --enable-agent --prefix=/opt/zabbix.docker
make install
mkdir src/modules/zabbix_module_docker
cd src/modules/zabbix_module_docker
wget https://raw.githubusercontent.com/monitoringartist/Zabbix-Docker-Monitoring/master/src/modules/zabbix_module_docker/zabbix_module_docker.c
wget https://raw.githubusercontent.com/monitoringartist/Zabbix-Docker-Monitoring/master/src/modules/zabbix_module_docker/Makefile
make
mkdir /opt/zabbix.docker/module/
cp zabbix_module_docker.so /opt/zabbix.docker/module/
# zabbix_agentd.conf
LoadModulePath=/opt/zabbix.docker/module/
LoadModule=zabbix_module_docker.so
|
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
|
### influxdb ###
[root@00 ~]# docker run -d --name influxdb --net monitor -p 8083:8083 -p 8086:8086 tutum/influxdb
# 管理页面
# http://<ip>:8083/
##
# 以下可输入命令在选择框中均有提示
# 创建cadvisor 数据库 ,在输入栏中输入:CREATE DATABASE "cadvisor" 然后回车
# 查看创建的数据,在输入栏中输入: SHOW DATABASES 然后回车
# 创建grafana 连接用户,在输入栏中输入: CREATE USER "grafana" WITH PASSWORD 'xxxxxx' 然后回车
# 查看创建的用户,在输入栏输入: SHOW USERS 然后回车,
##
### cadvisor ###
[root@00 ~]# docker run -d --name=cadvisor --net monitor -p 8084:8080 -v /:/rootfs:ro -v /var/run:/var/run -v /sys:/sys:ro -v /var/lib/docker:/var/lib/docker:ro google/cadvisor -storage_driver=influxdb -storage_driver_db=cadvisor -storage_driver_host=influxdb:8086
# [root@00 ~]# docker run -d --name=cadvisor --net monitor -p 8084:8080 --mount type=bind,src=/,dst=/rootfs,ro --mount type=bind,src=/var/run,dst=/var/run --mount type=bind,src=/sys,dst=/sys,ro --mount type=bind,src=/var/lib/docker,dst=/var/lib/docker,ro google/cadvisor -storage_driver=influxdb -storage_driver_db=cadvisor -storage_driver_host=influxdb:8086
#管理页面
#http://<ip>:8084/
### grafana ###
[root@00 ~]# docker run -d --name grafana --net monitor -p 3000:3000 grafana/grafana
#管理页面
# http://<ip>:3000/
|