linux-监控解决方案

tomcat 监控方案 (jmx)

zabbix javaGetway

  1. zabbix_server 编译安装需增加-enable-java,yum安装的需要安装java java-devel zabbix-java-gateway
  2. 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
  3. 启动/pathto/zabbix/sbin/zabbix_java/startup.sh 端口: 10052
  4. 修改zabbix_server.conf配置文件,启用javaPollers,指定javaGateway地址,
    • 217 行: JavaGateway=127.0.0.1 # ip
    • 225 行: JavaGatewayPort=10052 # 本地的端口
    • 235 行: StartJavaPollers=5 # 启动的进程书
  5. zabbix 创建主机,添加jmx接口监控,添加模版JMXTemplate JMX Generic/Template JMX Tomcat

mysql 监控方案 (percona + zabbix)

https://www.percona.com/doc/percona-monitoring-plugins/LATEST/zabbix/index.html#installation-instructions

安装依赖包 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 = '';