ZABBIX|ZABBIX 监控 JBOSS 7.1.1
为什么80%的码农都做不了架构师?>>>
文章图片
一 环境
1.1 操作系统
[root@host-xxxsoft]# lsb_release -a
LSB Version::base-4.0-amd64:base-4.0-noarch:core-4.0-amd64:core-4.0-noarch:graphics-4.0-amd64:graphics-4.0-noarch:printing-4.0-amd64:printing-4.0-noarch
Distributor ID: CentOS
Description:CentOS release 6.6 (Final)
Release:6.6
Codename:Final
[root@host-xxx soft]#
1.2JBOSS
jboss7.1.1
安装请参考
https://my.oschina.net/tacg/blog/423835
https://my.oschina.net/tacg/blog/423867
1.3 zabbix
【ZABBIX|ZABBIX 监控 JBOSS 7.1.1】zabbix_server (Zabbix) 3.2.1
Revision 62890 30 September 2016, compilation time: Oct 12 2016 17:36:37
Copyright (C) 2016 Zabbix SIA
License GPLv2+: GNU GPL version 2 or later .
This is free software: you are free to change and redistribute it according to
the license. There is NO WARRANTY, to the extent permitted by law.
二监控架构
2.1 官方解释
参考 https://www.zabbix.com/documentation/3.2/manual/config/items/itemtypes/jmx_monitoring
JMX monitoring can be used to monitor JMX counters of a Java application.
JMX monitoring has native support in Zabbix in the form of a Zabbix daemon called “Zabbix Java gateway”, introduced since Zabbix 2.0.
To retrieve the value of a particular JMX counter on a host, Zabbix server queries the Zabbix Java gateway, which in turn uses the JMX management API to query the application of interest remotely.
翻译:JMX 监控能用于监控JAVA 程序,自从Zabbix 2.0 版本之后,引进了Zabbix Java gateway 用于支持JMX 监控。
为了获取JMX 的值,Zabbix Server 查询 Zabbix Java gateway, Zabbix Java gateway 查询JMX API 获取值。
2.2 监控图
图中 zabbixserver 与zabbix java gateway 部署在一台主机上。
文章图片
三 安装及运行
3.1 zabbix server & zabbix java gateway 安装
./configure--prefix=/usr/local/zabbix --enable-server --with-mysql --enable-ipv6 --with-net-snmp --with-libcurl --with-libxml2 --enable-proxy --enable-java makemake install
3.2 zabbix server 针对 java gate way 配置
说明:
JavaGateway : zabbix java gate way 主机IP
JavaGatewayPort:zabbixjava gate way 监听端口
StartJavaPollers less than or equal to START_POLLERS,
[root@host-10-59-2-163 etc]# grep Java zabbix_server.conf
#Number of pre-forked instances of pollers for unreachable hosts (including IPMI and Java).
#At least one poller for unreachable hosts must be running if regular, IPMI or Java pollers
### Option: JavaGateway
#IP address (or hostname) of Zabbix Java gateway.
#Only required if Java pollers are started.
# JavaGateway=
JavaGateway=10.59.2.163
### Option: JavaGatewayPort
#Port that Zabbix Java gateway listens on.
# JavaGatewayPort=10052
JavaGatewayPort=10052
### Option: StartJavaPollers
#Number of pre-forked instances of Java pollers.
# StartJavaPollers=0
StartJavaPollers=5
启动命令
/usr/local/zabbix/sbin/zabbix_server
3.3 zabbix java gateway 配置
官方文档:https://www.zabbix.com/documentation/3.2/manual/concepts/java
注: StartJavaPollers less than or equal to START_POLLERS
root@host-10-59-2-163 zabbix_java]# less settings.sh
# This is a configuration file for Zabbix Java Gateway.
# It is sourced by startup.sh and shutdown.sh scripts.### Option: zabbix.listenIP
#IP address to listen on.
#
# Mandatory: no
# Default:
# LISTEN_IP="0.0.0.0"### Option: zabbix.listenPort
#Port to listen on.
#
# Mandatory: no
# Range: 1024-32767
# Default:
# LISTEN_PORT=10052### Option: zabbix.pidFile
#Name of PID file.
#If omitted, Zabbix Java Gateway is started as a console application.
#
# Mandatory: no
# Default:
# PID_FILE=PID_FILE="/tmp/zabbix_java.pid"### Option: zabbix.startPollers
#Number of worker threads to start.
#
# Mandatory: no
# Range: 1-1000
# Default:
# START_POLLERS=5
START_POLLERS=10### Option: zabbix.timeout
#How long to wait for network operations.
#
# Mandatory: no
# Range: 1-30
# Default:
# TIMEOUT=3
启动命令
/usr/local/zabbix/sbin/zabbix_java/startup.sh
3.4 jboss 7.1.1 配置
修改配置 文件jboss-as-7.1.1.Final/bin/standalone.con
JAVA_OPTS="$JAVA_OPTS -Dcom.sun.management.jmxremote.port=12345"
JAVA_OPTS="$JAVA_OPTS -Dcom.sun.management.jmxremote.authenticate=false"
JAVA_OPTS="$JAVA_OPTS -Dcom.sun.management.jmxremote"
JAVA_OPTS="$JAVA_OPTS -Dcom.sun.management.jmxremote.ssl=false"
JAVA_OPTS="$JAVA_OPTS -Djava.util.logging.manager=org.jboss.logmanager.LogManager"
JAVA_OPTS="$JAVA_OPTS -Xbootclasspath/p: ${JB0SS_HOME}/modules/org/jboss/logmanager/main/jboss-logmanager-1.2.2.GA.jar"
JAVA_OPTS="$JAVA_OPTS -Xbootclasspath/p: ${JB0SS_HOME}/modules/org/jboss/logmanager/log4j/main/jboss-logmanager-log4j-1.0.0.GA.jar"
JAVA_OPTS="$JAVA_OPTS -Xbootclasspath/p: ${JB0SS_HOME}/modules/org/apache/log4j/main/log4j-1.2.16.jar -Djboss.modules.system.pkgs=org.jboss.logmanager"
说明:
1.${JB0SS_HOME}这个替换为你安装的JBOSS 目录
2.目前这个配置 ssl 和authenticate 都是false ,网上有部分文章将此处设为true ,此处会增加jre 的配置,我这边暂时忽略。
启动命令
nohup /wls/jbossserver/jboss-as-7.1.1.Final/bin/standalone.sh >/dev/null 2>&1 & \r
四 zabbix web端配置(待续)
转载于:https://my.oschina.net/tacg/blog/776549
推荐阅读
- 监控nginx
- sentry搭建错误监控系统(二)
- 网络|一文彻底搞懂前端监控
- linux|linux|常用的系统监控命令
- Linux监控工具(atop安装使用)
- jboss环境搭建
- influxDB|influxDB + grafana + python 监控windows服务器流量
- JVM监控工具教程
- 搭建监控
- pm2-zabbix安装