zabbix-server安装:
1安装mysql、epel、zabbix源 rpm yuminstallepel-release rpm
更新系统 Yumupgrade
2安装mysql、php以及依赖环境 - <div align="left">yum installhttpdphpmysqlmysql-server</div><div align="left">php-mysqlphp-gdphp-xml</div><div align="left">php-mbstringphp-ldapphp-pear</div><div align="left">php-xmlrpcphp-bcmathmysql-connector-odbcmysql-devellibdbi-dbd-mysql</div><div align="left">net-snmp-develcurl-develmod_sslmod_perlmod_auth_mysql net-snmp</div><div align="left"></div>
复制代码3开启各项服务并设置为开机自动启动 - <div align="left">chkconfighttpd on</div><div align="left">chkconfigmysqld on</div><div align="left">service httpd start</div><div align="left">service mysqld start</div>
复制代码
4安装zabbix-server及zabbix-java-gateway - <div align="left">yum installzabbixzabbix-server zabbix-server-</div><div align="left">mysqlzabbix-web-mysqlzabbix-java-gateway</div>
复制代码
5创建并初始化zabbix数据库 - <div align="left"># mysql</div><div align="left">mysql> create database zabbix character setutf8;</div><div align="left">Query OK, 1 row affected (0.00 sec)</div><div align="left">mysql> grant all privileges on zabbix.* tozabbix@localhost identified by 'zabbix';</div><div align="left">Query OK, 0 rows affected (0.00 sec)</div><div align="left">mysql> exit</div><div align="left">Bye</div>
复制代码
导入初始化数据
- <div align="left"># cd/usr/share/doc/zabbix-server-mysql-2.0.9/create/</div><div align="left"># mysqlzabbix<schema.sql</div><div align="left"># mysqlzabbix<images.sql</div><div align="left"># mysqlzabbix<data.sql</div>
复制代码
6配置zabbix数据库文件,编辑文件/etc/zabbix/zabbix_server.conf中的下列内容 - <div align="left">DBHost=localhost</div><div align="left">DBName=zabbix</div><div align="left">DBUser=zabbix</div><div align="left">DBPassword=Zabbix</div>
复制代码
7启动zabbix-server并配置开启机起动 - <div align="left">service zabbix-server start</div><div align="left">chkconfigzabbix-server on</div>
复制代码
8编辑zabbix-server 页面配置文件/etc/httpd/conf.d/zabbix.conf修改下列内容 - <div align="left">php_valuemax_execution_time 300 </div><div align="left">php_valuememory_limit 128M</div><div align="left">php_valuepost_max_size 16M</div><div align="left">php_valueupload_max_filesize 2M</div><div align="left">php_valuemax_input_time 300 </div><div align="left">php_valuedate.timezone Asia/Shanghai</div>
复制代码
file:///C:/Users/Tim/AppData/Local/Temp/msohtmlclip1/01/clip_image001.jpg 根据页面提示内容点击下一步,直到完成安装初始化即可。
zabbix-java-gateway配置
1配置zabbix-java-gateway配置文件 配置文件路径/etc/zabbix/zabbix-java-gateway.conf 修改以下内容 - <div align="left">LISTEN_IP="0.0.0.0" #<font face="" "="">监听地址</font></div><div align="left">LISTEN_PORT=10052 #<font face="" "="">监听端口</font></div><div align="left">START_POLLERS=5 # <font face="" "="">开启的工作线程数(必须大于等于后面</font>zabbix_server.conf<font face="" "="">文件的</font>StartJavaPollers<font face="" "="">参数)</font></div><div align="left"></div>
复制代码2设置zabbix-java-gateway开机启动,并启动 - <div align="left">chkconfigzabbix-java-gateway on</div><div align="left">service zabbix-java-gateway start</div>
复制代码3配置zabbix-server配置文件 - <div align="left">JavaGateway=127.0.0.1 #JavaGateway <font face="宋体">服务器地址,</font>zabbix_server<font face="宋体">与</font>zabbix_java_gateway<font face="宋体">在同一台主机</font></div><div align="left">JavaGatewayPort=10052 #<font face="宋体">端口</font></div><div align="left">StartJavaPollers=5</div>
复制代码tomcat配置
1约定tomcat根目录以~/tomcat表示
2修改~/tomcat/bin/catalina.sh,添加如下内容: - <div align="left">CATALINA_OPTS="-Dcom.sun.management.jmxremote</div><div align="left">-Dcom.sun.management.jmxremote.authenticate=false</div><div align="left">-Dcom.sun.management.jmxremote.ssl=false</div><div align="left">-Dcom.sun.management.jmxremote.port=12330</div><div align="left">-Djava.rmi.server.hostname=172.16.20.3"</div>
复制代码
3添加jmxremote组件,并重新启动tomcat组件 cp catalina-jmx-remote.jar~/tomcat/lib/zabbix web界面添加tomcat主机1在zabbixweb界面菜单组态/主机中,单击右上角创建主机按钮,创建tomcat主机 2主机名称、所在群组为必填项 3根据上述tomcat配置,填写如下信息file:///C:/Users/Tim/AppData/Local/Temp/msohtmlclip1/01/clip_image003.png
4在模板菜单中,关联合适的模板,创建主机 总结
上述配置过程即可初步配置zabbix监控tomcat,由于tomcat需要监控的参数复杂,zabbix自带的tomcat监控模板无法满足对实际生产环境中对tomcat的监控要求,针对每一种tomcat应用都需要单独编写适合该应用的监控模板。我们将在下一节介绍如何在实际生产环境中定制化编辑tomcat监控模板。 |