讲述zabbix监控tomcat配置实例(二)
环境准备[*]zabbix-server服务器:centos6 ,ip:172.16.20.166
[*]zabbix-server版本:2.4.5
[*]tomcat服务器:centos6,ip:172.16.20.3
[*]jdk版本:jdk1.7
zabbix-server安装1安装mysql、epel、zabbix源rpm -ivhmysql-community-release-el6-5.noarch.rpmyuminstallepel-releaserpm-ivhzabbix/2.4/rhel/6/x86_64/zabbix-release-2.4-1.el6.noarch.rpm更新系统yumupgrade2安装mysql、php以及依赖环境yuminstallhttpdphpmysqlmysql-serverphp-mysqlphp-gdphp-xmlphp-mbstringphp-ldapphp-pearphp-xmlrpcphp-bcmathmysql-connector-odbcmysql-devellibdbi-dbd-mysqlnet-snmp-devel curl-develmod_sslmod_perlmod_auth_mysql net-snmp
3开启各项服务并设置为开机自动启动chkconfighttpd onchkconfigmysqld onservice httpd startservice mysqld start4安装zabbix-server及zabbix-java-gatewayyum install zabbixzabbix-serverzabbix-server-mysqlzabbix-web-mysqlzabbix-java-gateway5创建并初始化zabbix数据库# mysqlmysql> create database zabbix character set utf8;Query OK, 1 row affected (0.00 sec)mysql> grant all privileges on zabbix.* to zabbix@localhost identified by 'zabbix';Query OK, 0 rows affected (0.00 sec)mysql> exitBye导入初始化数据# cd /usr/share/doc/zabbix-server-mysql-2.0.9/create/# mysqlzabbix<schema.sql# mysqlzabbix<images.sql# mysqlzabbix<data.sql6配置zabbix数据库文件,编辑文件/etc/zabbix/zabbix_server.conf中的下列内容DBHost=localhostDBName=zabbixDBUser=zabbixDBPassword=zabbix7启动zabbix-server并配置开启机起动service zabbix-server startchkconfigzabbix-server on8编辑zabbix-server 页面配置文件/etc/httpd/conf.d/zabbix.conf修改下列内容php_valuemax_execution_time 300
php_valuememory_limit 128M php_valuepost_max_size 16M php_valueupload_max_filesize 2M php_valuemax_input_time 300php_valuedate.timezone Asia/Shanghai9重启http服务servicehttpdrestart
配置zabbix web界面1打开浏览器,输入zabbix,你就可以看到zabbix web的初始化安装界面根据页面提示内容点击下一步,直到完成安装初始化即可。zabbix-java-gateway配置1配置zabbix-java-gateway配置文件配置文件路径/etc/zabbix/zabbix-java-gateway.conf修改以下内容LISTEN_IP="0.0.0.0" #监听地址LISTEN_PORT=10052 #监听端口START_POLLERS=5 # 开启的工作线程数(必须大于等于后面zabbix_server.conf文件的StartJavaPollers参数)2设置zabbix-java-gateway开机启动,并启动chkconfigzabbix-java-gateway onservice zabbix-java-gateway start3配置zabbix-server配置文件JavaGateway=127.0.0.1 # JavaGateway 服务器地址,zabbix_server与zabbix_java_gateway在同一台主机JavaGatewayPort=10052 #端口StartJavaPollers=5tomcat配置1约定tomcat根目录以~/tomcat表示2修改~/tomcat/bin/catalina.sh,添加如下内容:CATALINA_OPTS="-Dcom.sun.management.jmxremote-Dcom.sun.management.jmxremote.authenticate=false-Dcom.sun.management.jmxremote.ssl=false-Dcom.sun.management.jmxremote.port=12330-Djava.rmi.server.hostname=172.16.20.3"3添加jmxremote组件,并重新启动tomcat组件cp catalina-jmx-remote.jar~/tomcat/lib/zabbix web界面添加tomcat主机1在zabbixweb界面菜单组态/主机中,单击右上角创建主机按钮,创建tomcat主机2主机名称、所在群组为必填项
3根据上述tomcat配置,填写如下信息
4在模板菜单中,关联合适的模板,创建主机
总结上述配置过程即可初步配置zabbix监控tomcat,由于tomcat需要监控的参数复杂,zabbix自带的tomcat监控模板无法满足对实际生产环境中对tomcat的监控要求,针对每一种tomcat应用都需要单独编写适合该应用的监控模板。我们将在下一节介绍如何在实际生产环境中定制化编辑tomcat监控模板。
原创:嘉盛泰科技
页:
[1]