Monitoring JMX metrics with Nagios can be a painful task. Why ? Because for each jmx metric (like the heap memory used, non heap memory used, thread count […]), you have to create a service attached to service group (it depends actually on your modeling). Usually, if you want to do it well, you’ll have to create at least 6 services to monitor your JVM.
Here is an example of metrics you can monitor :
I have developed a year ago a wizard which allows you to do it in 3 minutes (really !), let’s see how it works.
Install jmx-wizard-nagios wizard
Last year, I developed jmx-wizard-nagios wizard. You just have to install it :
- Download .zip archive
- Upload it online on « Admin => Config wizard » page
It’s done. If you’ve got an issue, feel free to contact me or open an issue on GitHub repository.
Monitor JMX metrics
- Go to « Configure => Configuration Wizards => JMX Metrics«
- Fill JMX Configuration settings
- Select JMX metrics you want to monitor and Define (optional) critical level (it will generate an alert)
Note: usually, if
HeapMemoryUsed is superior to 95% HeapMemoryMax, your Java app will crash => you have to restart it.
- Define how you want to monitor these metrics
- Define contact group (best practice !), host and host group, as usual.
Nagios will create as many services as jmx metrics you defined.
Exploit JMX metrics
Monitoring for monitoring is useless. If you have metrics, watch them ! You must know your app, it’s behavior to define warning and critical alert as reliable as possible.
Here are some charts we can get :
I really hope this wizard will make your life easier. This wizard can be improved, let me know if you want to contribute.