First, monitoring the Tomcat principle
Zabbix_server Open the Java Poller,zabbix_java Open Javagateway, the port is: 10052,tomcat JMX on 12345 provides performance data.
Data acquisition: Java poller--javagateway:10052-tomcat:12345
Ii. installation of Tomcat
Tomcat installs many tutorials on the web.
Third, configure Tomcat JMX
Need to edit Tomcat under/bin/catalina.sh, add configuration:
[Email protected] bin]# cd/usr/local/tomcat-8.0. -/bin[[email protected] bin]# vim catalina.sh# logging_manager="-djava.util.logging.manager=org.apache.juli.classloaderlogmanager"# -----------------------------------------------------------------------------# Insert the following code Java_home=/usr/local/jdk1.8. 0_77java_bin= $JAVA _home/BinPath=$PATH: $JAVA _binclasspath= $JAVA _home/lib/dt.jar: $JAVA _home/lib/tools.jarexport java_home java_bin PATH classpathcatalina_opts="-server-xms256m-xmx512m-xx:permsize=64m-xx:maxpermsize=128m-dcom.sun.management.jmxremote- Dcom.sun.management.jmxremote.authenticate=false-dcom.sun.management.jmxremote.ssl=false- dcom.sun.management.jmxremote.port=12345"
Start Tomcat
[[email protected] bin]# sh startup.sh Using catalina_base:/usr/local/tomcat-8.0. -Using catalina_home:/usr/local/tomcat-8.0. -Using Catalina_tmpdir:/usr/local/tomcat-8.0. -/tempusing jre_home:/usr/local/jdk1.8. 0_77using CLASSPATH:/usr/local/tomcat-8.0. -/bin/bootstrap.jar:/usr/local/tomcat-8.0. -/bin/tomcat-Juli.jartomcat started. [Email protected] bin]# netstat-ntplu | Grep12345TCP0 0:::12345:::* LISTEN52472/java# Startup Success
Zabbix_server Configuration
Java Support
Compile and install Zabbix server needs to add--enable-java to support JMX monitoring
Zabbix Basic Installation: http://www.cnblogs.com/hukey/p/5458622.html
Start Zabbix_java
[Email protected] zabbix_java]# cd/usr/local/zabbix-2.4. 8/sbin/10052tcp 0 0 :::10052 :::* LISTEN 52733/java # Start success
zabbix_server.conf Configuration
[[email protected] ~]# grep java/usr/local/zabbix-2.4.8/etc/zabbix_server.conf | grep =Javagateway=127.0.0.1Javagatewayport=10052startjavapollers=5
[[Email protected] ~]# service zabbix_server Restart # restart Zabbix_server
Shutting down zabbix_server: [OK]
Starting zabbix_server: [OK]
Iv. Import Templates
Because the Zabbix original template is not compatible with Tomcat and so on. The template needs to be re-imported.
Configuration--Hosts
Click Update Submission
Configuration--Templates---Import
Template: Link: http://pan.baidu.com/s/1b0Hm02 Password: 631h
On--Import template imports complete.
Configuration--Hosts--Templates
Customtomcat is the imported template, which is used here.
Here you can find that JMX also turns green, indicating a successful connection.
Data has been generated and tomcat monitoring is complete.
Five, tomcat failure automatic restart
Modify the agentd.conf configuration file, change the restart to take effect
[[email protected] bin]# grep enableremotecommands/usr/local/zabbix-2.4. 8/etc/zabbix_agentd.conf### option:enableremotecommandsenableremotecommands=1 # Modified to 1
[Email protected] bin]# service Zabbix_agentd restart
Shutting down ZABBIX_AGENTD: [OK]
Starting ZABBIX_AGENTD: [OK]
Configure sudo to give permissions to Zabbix users, or zabbix_agent cannot execute commands.
[email protected] bin]# Visudo root all =(All) Allzabbix all =nopasswd: Allzabbix all =nopasswd: /usr/ local/tomcat-8.0. /bin/- Zabbix /home/zabbix:no such file or directory -bash- 4.1$
Server-side configuration:
Create Item
Add
Create Trigger
Add
The place with the red box is the place to be adjusted.
Update submission.
So far, the Zabbix_server configuration is complete.
Turn off Tomcat for the test restart function.
[email protected] bin]# pwd/usr/local/tomcat-8.0. -/bin[[email protected] bin]# sh shutdown.sh Using catalina_base:/usr/local/tomcat-8.0. -Using catalina_home:/usr/local/tomcat-8.0. -Using Catalina_tmpdir:/usr/local/tomcat-8.0. -/tempusing jre_home:/usr/local/jdk1.8. 0_77using CLASSPATH:/usr/local/tomcat-8.0. -/bin/bootstrap.jar:/usr/local/tomcat-8.0. -/bin/tomcat-juli.jar
[[email protected] bin]# visudo#defaults Requiretty in Visudo comment out this is the weight of the heavy, remember. Otherwise, viewing the status of Zabbix on the web is sent. But the agent does not actually execute the command.
8080 TCP 0 0 0.0. 0.0:8080 0.0. 0.0:* LISTEN 4179/java
Auto start successful.
"Zabbix"-tomcat monitoring and failure restart service