lsdwyl 发表于 2019-1-18 06:27:55

zabbix 监控 Resin

  一、环境介绍
服务器信息:
zabbix-server:172.16.4.6
zabbix-java-gateway:172.16.0.7
Resin:172.16.0.6软件环境:
zabbix版本:Zabbix server v2.4.6
zabbix-java-gateway:zabbix-java-gateway-2.4.6-1.el6.x86_64.rpm
测试jar:cmdline-jmxclient-0.10.3.jar  

  二、安装zabbix
  zabbix安装可以参考zabbix官网介绍,这里就不在详细说明了,参考如下网址:
https://www.zabbix.com/documentation/2.4/manual/installation/install_from_packages  zabbix-java-gateway下载地址:
http://www.zabbix.com/download.php  zabbix-java-gateway官网安装介绍:
https://www.zabbix.com/documentation/2.4/ru/manual/concepts/java?s[]=java  测试jar下载地址:(需要翻。。。)
http://crawler.archive.org/cmdline-jmxclient/cmdline-jmxclient-0.10.3.jar  

  三、安装zabbix-java-gateway网关:
  安装
# rpm -ihv zabbix-java-gateway-2.4.6-1.el6.x86_64.rpm
Preparing...                ###########################################
   1:zabbix-java-gateway    ###########################################   修改配置文件:
# grep-Ev "(^#|^$)" /etc/zabbix/zabbix_java_gateway.conf
LISTEN_IP="172.16.0.7"   \\zabbix-java-gateway 网关监听地址
LISTEN_PORT=10052      \\zabbix-java-gateway网关监听端口
PID_FILE="/var/run/zabbix/zabbix_java.pid" \\zabbix-java-gateway 的pid文件路径
START_POLLERS=5    \\启动5个线程
TIMEOUT=10      \\超时时长  启动zabbix-java-gateway网关

# /etc/init.d/zabbix-java-gateway start  检查zabbix-java-gateway网关是否启动成功

# netstat -tpln | grep 10052
tcp      0      0 172.16.0.7:10052            0.0.0.0:*                   LISTEN      6976/java  

  四、配置Resin,启用JMX
  在Resin家目录下的conf/目录中,修改resin.conf配置文件,添加一下信息:
  可以参考官网介绍:http://caucho.com/resin-4.0/admin/advanced-jmx.xtp
      -Dcom.sun.management.jmxremote
      -Dcom.sun.management.jmxremote.port=12345
      -Dcom.sun.management.jmxremote.ssl=false
      -Dcom.sun.management.jmxremote.authenticate=false
      -Djava.rmi.server.hostname=172.16.0.6 \\此项可选  在resin中添加完Resin后,重启启动resin
# /etc/init.d/resin stop
# /etc/init.d/resin start  在zabbix-server端启用zabbix-java-gateway选项:
# grep -Ev "(^#|^$)" /etc/zabbix/zabbix_server.conf | grep -i java
JavaGateway=172.16.0.7 \\zabbix-java-gateway的地址
JavaGatewayPort=10052   \\zabbix-java-gateway的端口号
StartJavaPollers=5       \\启动5个线程  

  五、在zabbix-java-gateway服务器上,利用cmdline-jmxclient-0.10.3.jar获取resin服务器的key
  获取key
# java -jar cmdline-jmxclient-0.10.3.jar- 172.16.0.6:12345 | sort
com.alibaba.druid:id=1924372698,type=DruidDataSource
com.alibaba.druid:type=DruidDataSourceStat
com.alibaba.druid:type=DruidDriver
com.alibaba.druid:type=DruidStatService
com.alibaba.druid:type=MockDriver
com.sun.management:type=HotSpotDiagnostic
java.lang:name=CMS Old Gen,type=MemoryPool
java.lang:name=CMS Perm Gen,type=MemoryPool
java.lang:name=CodeCacheManager,type=MemoryManager
java.lang:name=Code Cache,type=MemoryPool
java.lang:name=ConcurrentMarkSweep,type=GarbageCollector
java.lang:name=Par Eden Space,type=MemoryPool
java.lang:name=ParNew,type=GarbageCollector
java.lang:name=Par Survivor Space,type=MemoryPool
java.lang:type=ClassLoading
java.lang:type=Compilation
java.lang:type=Memory
java.lang:type=OperatingSystem
java.lang:type=Runtime
java.lang:type=Threading
java.util.logging:type=Logging
JMImplementation:type=MBeanServerDelegate
resin:Host=www.magedu.com,name=deploy,type=EarDeploy
resin:Host=www.magedu.com,name=deploy,type=ResourceDeploy
resin:Host=www.magedu.com,name=/resin-doc,type=WebApp
resin:Host=www.magedu.com,name=/solr,type=WebApp
resin:Host=www.magedu.com,name=/,type=WebApp
resin:Host=www.magedu.com,name=webapps,type=WebAppDeploy
resin:Host=www.magedu.com,WebApp=/,name=/data/web/www.magedu.com/WEB-INF/rewrite.xml,type=RewriteImport
resin:Host=www.magedu.com,WebApp=/resin-doc,name=jdbc/resin,type=ConnectionPool
resin:Host=www.magedu.com,WebApp=/resin-doc,name=jdbc/resin,type=JdbcDriver
resin:Host=www.magedu.com,WebApp=/resin-doc,name=/resin-doc/examples/amber-basic-field,type=WebApp
resin:Host=www.magedu.com,WebApp=/resin-doc,name=/resin-doc/examples/amber-basic,type=WebApp
resin:Host=www.magedu.com,WebApp=/resin-doc,name=/resin-doc/examples/amber-create,type=WebApp
resin:Host=www.magedu.com,WebApp=/resin-doc,name=/resin-doc/examples/amber-inherit,type=WebApp
resin:Host=www.magedu.com,WebApp=/resin-doc,name=/resin-doc/examples/amber-many2many,type=WebApp
resin:Host=www.magedu.com,WebApp=/resin-doc,name=/resin-doc/examples/amber-many2one,type=WebApp
resin:Host=www.magedu.com,WebApp=/resin-doc,name=/resin-doc/examples/amber-one2many,type=WebApp
resin:Host=www.magedu.com,WebApp=/resin-doc,name=/resin-doc/examples/amber-query,type=WebApp
resin:Host=www.magedu.com,WebApp=/resin-doc,name=/resin-doc/examples/amber-session,type=WebApp
。。。。。。。。。。。。。。。。。。。。
。。。。。。。。。。。。。。。。。。。。\\此处省略一些信息
resin:name=127.0.0.1-6800,type=Port
resin:name=app-tier,type=Cluster
resin:name=hosts,type=HostDeploy
resin:name=INADDR_ANY-8002,type=Port
resin:name=www.magedu.com,type=Host
resin:type=BlockManager
resin:type=PersistentStore
resin:type=ProxyCache
resin:type=Resin
resin:type=Server
resin:type=ThreadPool  获取value
# java -jar cmdline-jmxclient-0.10.3.jar- 172.16.0.6:12345"resin:type=ThreadPool" \\利用此key可以获取此key中的多个属性,然后利用属性获取值
Attributes:
Name: The name property of the JMX ObjectName (type=java.lang.String)
ObjectName: The JMX ObjectName for the MBean (type=javax.management.ObjectName)
ThreadActiveCount: The current number of active threads (type=int)
ThreadCount: The current number of managed threads (type=int)
ThreadIdleCount: The current number of idle threads (type=int)
ThreadIdleMax: The configured maximum number of idle threads (type=int)
ThreadIdleMin: The configured minimum number of idle threads (type=int)
ThreadMax: The configured maximum number of threads (type=int)
Type: The type property of the JMX ObjectName (type=java.lang.String)# java -jar cmdline-jmxclient-0.10.3.jar- 172.16.0.6:12345"resin:type=ThreadPool"ThreadMax\\利用"resin:type=ThreadPool" 获取ThreadMax的值
04/01/2016 18:29:58 +0800 org.archive.jmx.Client ThreadMax: 15000  

  六、作为zabbix使用的key、value都获取到以后,我们接下来制作zabbix模板
  创建一个名为Resin的模板

http://s3.运维网.com/wyfs02/M00/7E/6C/wKiom1b-TtOR1V5BAABDidzgf7c827.png
  添加Applications;以下是我自己添加的;大家可以根据自己的需求添加:

http://s4.运维网.com/wyfs02/M00/7E/6C/wKiom1b-TzHijy_RAADEsygDJyM284.png
  添加完Applications以后,在添加item,在这里以MemoryPool_Eden为例,添加item
http://s4.运维网.com/wyfs02/M00/7E/68/wKioL1b-UFCjM8QVAAG0CPGD5kE779.png添加完item以后,在添加图形;以下是我自己添加的绘图信息:
http://s1.运维网.com/wyfs02/M00/7E/68/wKioL1b-UJ6AQSoBAAFgaUwLNCE650.png
  到此模板制作完成,现在开始在主机中关联模板:
http://s2.运维网.com/wyfs02/M01/7E/6C/wKiom1b-UG2AJlIkAACfdzxy9p4834.png
  添加完后,可以看到此主机的JMX变为绿色:
http://s2.运维网.com/wyfs02/M01/7E/68/wKioL1b-UUzxdTWOAAApP280Lbs376.png
  到此我们可以静心心来,查看绘制的图形信息了
http://s1.运维网.com/wyfs02/M02/7E/6C/wKiom1b-UOvTIO88AAGJjMJk5d4755.png
  到此,监控已经完成,如有做的不好的地方,请大家帮忙指正,O(∩_∩)O谢谢



页: [1]
查看完整版本: zabbix 监控 Resin