• zabbix监控tomcat


    1、安装zabbix-java-gateway。我这里直接装在zabbix-server上了。

    # yum install -y zabbix-java-gateway
    # rpm -ql zabbix-java-gateway
    /etc/zabbix/zabbix_java_gateway.conf
    /etc/zabbix/zabbix_java_gateway_logback.xml
    /usr/lib/systemd/system/zabbix-java-gateway.service
    /usr/lib/tmpfiles.d/zabbix-java-gateway.conf
    /usr/sbin/zabbix_java_gateway
    /usr/share/doc/zabbix-java-gateway-3.4.7
    /usr/share/doc/zabbix-java-gateway-3.4.7/AUTHORS
    /usr/share/doc/zabbix-java-gateway-3.4.7/COPYING
    /usr/share/doc/zabbix-java-gateway-3.4.7/ChangeLog
    /usr/share/doc/zabbix-java-gateway-3.4.7/NEWS
    /usr/share/doc/zabbix-java-gateway-3.4.7/README
    /usr/share/zabbix-java-gateway
    /usr/share/zabbix-java-gateway/bin
    /usr/share/zabbix-java-gateway/bin/zabbix-java-gateway-3.4.7.jar
    /usr/share/zabbix-java-gateway/lib
    /usr/share/zabbix-java-gateway/lib/android-json-4.3_r3.1.jar
    /usr/share/zabbix-java-gateway/lib/logback-classic-0.9.27.jar
    /usr/share/zabbix-java-gateway/lib/logback-core-0.9.27.jar
    /usr/share/zabbix-java-gateway/lib/slf4j-api-1.6.1.jar
    /var/log/zabbix
    /var/run/zabbix
    
    # systemctl start zabbix-java-gateway.service
    # systemctl enable zabbix-java-gateway.service
    

    2、修改服务端配置,重启zabbix-server。

    # vim /etc/zabbix/zabbix_server.conf
    JavaGateway=127.0.0.1
    JavaGatewayPort=10052
    StartJavaPollers=5
    
    # systemctl restart zabbix-server.service
    

    3、修改tomcat配置,启用JMX远程连接端口。

    # vim /data/usr/local/apache-tomcat-7.0.82_front/bin/setenv.sh
    CATALINA_OPTS="-Dcom.sun.management.jmxremote -Dcom.sun.management.jmxremote.authenticate=false -Dcom.sun.management.jmxremote.ssl=false -Djava.rmi.server.hostname=10.0.1.61 -Dcom.sun.management.jmxremote.port=12345"
    

    4、下载catalina-jmx-remote.jar,放到tomcat的lib目录。

    # cd /data/usr/local/apache-tomcat-7.0.82_front/lib/
    # wget https://archive.apache.org/dist/tomcat/tomcat-7/v7.0.82/bin/extras/catalina-jmx-remote.jar
    

    5、修改hosts添加主机名解析(要不然tomcat无法启动)。

    # vim /etc/hosts
    127.0.0.1   localhost localhost.localdomain localhost4 localhost4.localdomain4 meitu01
    

    6、重启tomcat。

    # service tomcat_front stop
    # service tomcat_front start
    

    7、下载cmdline-jmxclient-0.10.3.jar查看java属性。

    # wget http://crawler.archive.org/cmdline-jmxclient/cmdline-jmxclient-0.10.3.jar
    

    查看堆内存

    # java -jar cmdline-jmxclient-0.10.3.jar - 127.0.0.1:12345 java.lang:type=Memory HeapMemoryUsage
    03/11/2018 18:01:17 +0000 org.archive.jmx.Client HeapMemoryUsage:
    committed: 2147483648
    init: 2147483648
    max: 2147483648
    used: 532234232
    

    查看请求数

    # java -jar cmdline-jmxclient-0.10.3.jar - 127.0.0.1:12345 Catalina:name="http-bio-8081",type=GlobalRequestProcessor requestCount
    03/11/2018 19:54:29 +0000 org.archive.jmx.Client requestCount: 18
    

    错误请求数

    # java -jar cmdline-jmxclient-0.10.3.jar - 127.0.0.1:12345 Catalina:name="http-bio-8081",type=GlobalRequestProcessor errorCount
    03/11/2018 19:55:25 +0000 org.archive.jmx.Client errorCount: 18
    

    8、在web上链接模板。默认的模板需要修改一下key才能获取到数据。

  • 相关阅读:
    mysql的CURRENT_TIMESTAMP【转】
    php开发中emoji表情的问题3种方法轻松处理【转】
    JavaScript 正则表达式【转】
    使用 内置函数strtok()函数实现 loadrunner 字符串替换
    python打开文件失败,报错'gbk' codec can't decode byte 0xbf in position 2: illegal multibyte sequence
    txt文本程序 打开python文件 另存为原来的文件名,不能覆盖原来的文件解决
    linux 文件解压
    tar.xz 解压
    设置xampp开机自动启动
    Can’t connect to local MySQL server through socket的解决方法
  • 原文地址:https://www.cnblogs.com/keithtt/p/8574022.html
Copyright © 2020-2023  润新知