Application level monitoring in Tomcat using Zabbix/Nagios
I am pretty comfortable with Nagios and a newbie in Zabbix. I have a tomcat in which I have deployed 3 war files. I am able to monitor the Tomcat as such using Nagios but I am not able to monitor the individual status of the 3 applications. Is it possible to individually monitor those applications using Nagios/Zabbix ?
Information regarding either of them would be amazing, but I would personally like it in Nagios since I am used to it. Thanks a lot.
Since you are connecting to Tomcat (or whatever application server) using JMX, I'd recommend you to monitor the status of your application using jmx too.
In zabbix you'd have to create an item for every metric you want to monitor.
In your application you have to register a MBean.
public void registerNotikumiMBean(String app){
MBeanServer mBeanServer = ManagementFactory.getPlatformMBeanServer();
Hashtable<String, String> tb = new Hashtable<String, String>();
tb.put("type", "yourcustomtype");
tb.put("subtype", "yourcustomid");
ObjectName on = null;
try {
on = new ObjectName("your.pa.cka.ge", tb);
YourCustomBean mbean = new YourCustom();
mBeanServer.registerMBean(mbean, on);
} catch (MalformedObjectNameException e) {
} catch (InstanceAlreadyExistsException e) {
} catch (MBeanRegistrationException e) {
} catch (NotCompliantMBeanException e) {
}
}
You can find everything you need about mbeans in link below http://docs.oracle.com/javase/tutorial/jmx/mbeans/standard.html
链接地址: http://www.djcxy.com/p/59714.html