|
|
| Author |
Message |
ianand0204
Joined: 18 Sep 2006 Posts: 2
|
Posted: Mon Oct 01, 2007 4:51 pm Post subject: Another JVM Monitoring template |
|
|
This is my first template that I have created for cacti, so I would appreciate any feedback.
I thought I would append my template here for monitoring JVM stats. The values which are exported from the JVM correspond to the java.lang.management MXBean.
http://java.sun.com/j2se/1.5.0/docs/api/java/lang/management/package-summary.html
You still need to follow the instructions on sun's website for enabling SNMP polling on a JVM which are located at the link below.
http://java.sun.com/j2se/1.5.0/docs/guide/management/SNMP.html
In my case I created separate devices for my JVM's and then poll on a port other than 161. This allows me to poll snmpd as well as the jvm.
i.e.
snmpd listens on port 161
jvm snmp listens on port 163
When configuring the jvm device, change the snmp port to 163.
This template graph's the following values for the Memory Pools listed below:
PS - Code Cache
PS - Eden Space
PS - Old Gen
PS - Perm Gen
PS - Survivor Spa
The values which are graphed are:
Memory Pool Max Size
Memory Pool Initial Size
Memory Pool Used
Memory Pool Committed
Peak Max Memory Pool
Peak User Memory Pool
Peak Comited Memory Pool
Collected Max Memory Pool
Collected Used Memory Pool
Collected Committed Memory
The template is fairly generic so hopefully it will work for everyone.
*NOTE* The screen shot is a little misleading. All values listed in the index are graphed, it just so happens that this screen shot was taken off an idle machine and thus doesn't display much difference in data.
This template was exported from cacti 0.8.6j so you will probably need the same version.[/url]
| Description: |
|
| Filesize: |
56.49 KB |
| Viewed: |
12987 Time(s) |

|
| Description: |
|
 Download |
| Filename: |
jvm_mem.xml.txt |
| Filesize: |
3.72 KB |
| Downloaded: |
686 Time(s) |
| Description: |
|
 Download |
| Filename: |
cacti_graph_template_jvm_jvmmempooltable.xml.txt |
| Filesize: |
39.07 KB |
| Downloaded: |
524 Time(s) |
|
|
| Back to top |
|
 |
elayaraja.s Cacti User
Joined: 11 Feb 2008 Posts: 137
|
Posted: Tue Mar 11, 2008 7:48 am Post subject: Scritp file ? |
|
|
If any script file used for the above requirement to monitor JVM, please upload the script file and also ensure
1) the above attached xml file cacti_graph_template_jvm_jvmmempooltable.xml.txt is xml file which we need to import in cacti ?
2) why we require this file jvm_mem.xml.txt , is it Dataquery required to place in '<cacti_path>\resource\snmp_queries' ?
|
|
| Back to top |
|
 |
amacks
Joined: 22 May 2008 Posts: 8
|
Posted: Mon Aug 11, 2008 7:23 pm Post subject: Work? |
|
|
Has anyone gotten this template to work sucessfully? It imports for me, but complains that there is one missing data source. I feel like there is something small I'm missing
thanks
Aaron
|
|
| Back to top |
|
 |
will chung
Joined: 09 Oct 2006 Posts: 8
|
Posted: Tue Aug 12, 2008 8:22 pm Post subject: |
|
|
I got it to work, but it doesn't seem to graph anything correctly (atleast for me). I *always* got the same #'s for everything, and they never incremented so I knew something wasn't right. Plus when I checked on the host itself, the results I got back didn't correlate to what I was graphing.
So... I actually ended up making my own data templates and created my own graphs.
The OIDs are described here:
http://support.ipmonitor.com/mibs/JVM-MANAGEMENT-MIB/oids.aspx
I'm graphing permgen init size:
1.3.6.1.4.1.42.2.145.3.163.1.1.2.110.1.10.5
max:
.1.3.6.1.4.1.42.2.145.3.163.1.1.2.110.1.13.5
and used:
.1.3.6.1.4.1.42.2.145.3.163.1.1.2.110.1.12.5
I've verified the results back from doing a jstat -gcpermgencapacity <java pid> on the host itself and everything is Kosher. Hope this helps.
|
|
| Back to top |
|
 |
mgupta
Joined: 13 Aug 2009 Posts: 13 Location: Canada
|
Posted: Sun Dec 13, 2009 9:15 pm Post subject: Yet another JVM Graph Templates |
|
|
Here are my JVM templates.
Instructions - http://java.sun.com/javase/6/docs/technotes/guides/management/snmp.html
1. Configure SNMP on JVM
# cat snmp.acl
acl ={
{
communities = public
access = read-only
managers = localhost
}
}
# pwd
/usr/java/jdk1.6.0_16/jre/lib/management
# ls -lrth snmp.acl
-r-------- 1 root root 83 Dec 2 09:15 snmp.acl
2. Enable SNMP on JVM - Add the following argument when starting JVM
-Dcom.sun.management.snmp.port=9998
3. Put the following in your snmpd.conf (This enables you to poll remotely from ANY host, without specifying the port. See the snmpwalk below.)
proxy -v 2c -c public localhost:9998 .1.3.6.1.4.1.42
4. Restart SNMPd
5. Try - snmpwalk -v 2c -c public localhost .1.3.6.1.4.1.42
That should give you a listing. If not try netstat -an | grep 9998 to make sure that JVM is actually listening.
PS. In the JVM Mib, some counters dont really behave like counters with respect to Cacti.
If you look in my templates, almost everything is a Gauge.
Screenshots at - http://forums.cacti.net/viewtopic.php?p=178822#178822
| Description: |
|
| Filesize: |
22.23 KB |
| Viewed: |
5172 Time(s) |

|
| Description: |
|
 Download |
| Filename: |
cacti_graph_template_jvm_-_threads.xml |
| Filesize: |
21.77 KB |
| Downloaded: |
243 Time(s) |
| Description: |
| Objects pending finalization. |
|
 Download |
| Filename: |
cacti_graph_template_jvm_-_opf.xml |
| Filesize: |
12.67 KB |
| Downloaded: |
162 Time(s) |
| Description: |
|
 Download |
| Filename: |
cacti_graph_template_jvm_-_num_of_classes.xml |
| Filesize: |
17.5 KB |
| Downloaded: |
174 Time(s) |
| Description: |
|
 Download |
| Filename: |
cacti_graph_template_jvm_-_memory.xml |
| Filesize: |
20.06 KB |
| Downloaded: |
209 Time(s) |
Last edited by mgupta on Sun Dec 13, 2009 9:32 pm; edited 2 times in total |
|
| Back to top |
|
 |
mgupta
Joined: 13 Aug 2009 Posts: 13 Location: Canada
|
Posted: Sun Dec 13, 2009 9:20 pm Post subject: JVM : Screenshots for the rest of the graphs. |
|
|
Creating a separate post since a post just allows 5 attachments.
| Description: |
|
| Filesize: |
24.19 KB |
| Viewed: |
5170 Time(s) |

|
| Description: |
|
| Filesize: |
20.27 KB |
| Viewed: |
5170 Time(s) |

|
| Description: |
|
| Filesize: |
29.03 KB |
| Viewed: |
5170 Time(s) |

|
|
|
| Back to top |
|
 |
heynowjerry
Joined: 13 Jan 2010 Posts: 2
|
Posted: Wed Jan 13, 2010 2:54 pm Post subject: Re: JVM : Screenshots for the rest of the graphs. |
|
|
| mgupta wrote: | | Creating a separate post since a post just allows 5 attachments. |
Thanks...
Version 0.8.7d
Receiving this error for all 4 XML file after import.
Error: XML: Hash version does not exist.
Thanks in advance.
|
|
| Back to top |
|
 |
mgupta
Joined: 13 Aug 2009 Posts: 13 Location: Canada
|
Posted: Wed Jan 13, 2010 2:58 pm Post subject: Re: JVM : Screenshots for the rest of the graphs. |
|
|
I am on 0.8.7e. Could that be the problem?
[quote="heynowjerry"][quote="mgupta"]Creating a separate post since a post just allows 5 attachments.[/quote]
Thanks...
Version 0.8.7d
Receiving this error for all 4 XML file after import.
Error: XML: Hash version does not exist.
Thanks in advance.[/quote][b][/b]
|
|
| Back to top |
|
 |
heynowjerry
Joined: 13 Jan 2010 Posts: 2
|
Posted: Wed Jan 13, 2010 3:10 pm Post subject: Re: JVM : Screenshots for the rest of the graphs. |
|
|
Yep, the hashes are version specific, or so i've read.
Thanks anyways.we are eager to get up some templates for JVM monitoring..
| mgupta wrote: | I am on 0.8.7e. Could that be the problem?
| heynowjerry wrote: | | mgupta wrote: | | Creating a separate post since a post just allows 5 attachments. |
Thanks...
Version 0.8.7d
Receiving this error for all 4 XML file after import.
Error: XML: Hash version does not exist.
Thanks in advance. |
|
|
|
| Back to top |
|
 |
statistic fan
Joined: 20 Jan 2010 Posts: 1
|
Posted: Wed Jan 20, 2010 9:04 am Post subject: |
|
|
Thanks mgupta, your templates are very promising but after importing them, they aren't working for me.
The Memory statistics are fine, the rest won't generate. I checked the SNMP numbers and they all work.
e.g. the thread numbers:
| Code: |
$ snmpwalk -m ./JVM-MANAGEMENT-MIB.mib -v1 -c public localhost .1.3.6.1.4.1.42.2.145.3.163.1.1.3.1.0
JVM-MANAGEMENT-MIB::jvmThreadCount.0 = Gauge32: 19
$ snmpwalk -m ./JVM-MANAGEMENT-MIB.mib -v1 -c public localhost .1.3.6.1.4.1.42.2.145.3.163.1.1.3.2.0
JVM-MANAGEMENT-MIB::jvmThreadDaemonCount.0 = Gauge32: 5
$ snmpwalk -m ./JVM-MANAGEMENT-MIB.mib -v1 -c public localhost .1.3.6.1.4.1.42.2.145.3.163.1.1.3.3.0
JVM-MANAGEMENT-MIB::jvmThreadPeakCount.0 = Counter32: 19
|
The used command for rrdtool is the following:
| Code: |
/bin/rrdtool graph - \
--imgformat=PNG \
--start=1263909696 \
--end=1263996096 \
--title="server.onsteroids.org - JVM Threads" \
--base=1000 \
--height=120 \
--width=500 \
--alt-autoscale-max \
--lower-limit=0 \
--units-exponent=1 \
COMMENT:"From 2010/01/19 15\:01\:36 To 2010/01/20 15\:01\:36\c" \
COMMENT:" \n" \
--vertical-label="Number of threads" \
--slope-mode \
--font TITLE:12: \
--font AXIS:8: \
--font LEGEND:10: \
--font UNIT:8: \
DEF:a="/export/www/stats.myexample.org/htdocs/rra/server_onsteroids_org_jvm_daemonthreads_52.rrd":jvm_DaemonThreads:LAST \
DEF:b="/export/www/stats.myexample.org/htdocs/rra/server_onsteroids_org_jvm_threads_54.rrd":jvm_threads:LAST \
DEF:c="/export/www/stats.myexample.org/htdocs/rra/server_onsteroids_org_jvm_peak_threads_53.rrd":jvm_peak_threads:LAST \
LINE1:a#FF6044FF:"Daemon" \
GPRINT:a:LAST:" Current\:%8.0lf" \
GPRINT:a:AVERAGE:"Average\:%8.0lf" \
GPRINT:a:MAX:"Maximum\:%8.0lf\n" \
LINE2:b#00CF00FF:"Regular" \
GPRINT:b:LAST:"Current\:%8.0lf" \
GPRINT:b:AVERAGE:"Average\:%8.0lf" \
GPRINT:b:MAX:"Maximum\:%8.0lf\n" \
LINE3:c#FF0000FF:"Peak" \
GPRINT:c:LAST:" Current\:%8.0lf"
|
Using it in my shell it gives me:
| Code: | | ERROR: the RRD does not contain an RRA matching the chosen CF |
I have a lot of graphs in my cacti and everything works except "JVM Num of Classes", "JVM OPF" and "JVM Threads" - "JVM Memory", as mentioned, works.
I'm relativly new to cacti and I don't find the solution, can you give me a hint please?
p.s. cacti-0.8.7e
|
|
| Back to top |
|
 |
mgupta
Joined: 13 Aug 2009 Posts: 13 Location: Canada
|
Posted: Wed Jan 27, 2010 3:03 am Post subject: Missing CF |
|
|
| You can try changing the CF in the graph template. There's a lot of other threads about missing CFs.
|
|
| Back to top |
|
 |
Snake007uk Cacti User
Joined: 24 Jun 2005 Posts: 54
|
Posted: Fri Jan 29, 2010 6:24 am Post subject: |
|
|
Change the CF from LAST to Average and the graphs will be ok.
Just wondering how to collect garbage collection.
|
|
| Back to top |
|
 |
linebacker2
Joined: 08 May 2009 Posts: 25
|
Posted: Thu Jun 24, 2010 1:31 pm Post subject: No Such Object available on this agent at this OID |
|
|
when I do a snmpwalk I get the following result:
C:\usr\bin>snmpwalk -c public -v2c localhost:163 1.3.6.1.4.1.42.2.145.3.163.1.1.3.6
JVM-MANAGEMENT-MIB::jvmThreadCpuTimeMonitoring = No Such Object available on this agent at this OID
Anyone know why???
My Platform is Windows 2003 and have done the following to get Java apps monitored with Cacti.
- I have placed "JVM-MANAGEMENT-MIB.txt" in the mibs directory C:\usr\share\snmp\mibs
- changed the SNMP port TO run on port 163 instead of 161 under C:\WINDOWS\system32\drivers\etc\services
- Installed Net-SNMP and have it running as a service
- copied C:\Java\jdk-1.6-32\jre\lib\management\snmp.acl.template to copied C:\Java\jdk-1.6-32\jre\lib\management\snmp.acl
- set the following options in snmp.acl
acl ={
{
communities = public
access = read-only
managers = localhost
}
}
- Set the following parameters via wrapper.conf file for my java application:
wrapper.java.additional.1=-Dcom.sun.management.snmp.interface=0.0.0.0
wrapper.java.additional.2=-Dcom.sun.management.snmp.port=163
wrapper.java.additional.3=-Dcom.sun.management.snmp.acl=true
wrapper.java.additional.4=-Dcom.sun.management.snmp.acl.file=C:\Java\jdk-1.6-32\jre\lib\management\snmp.acl
- set the following in my snmpd.conf file:
proxy -v 2c -c public localhost:163 .1.3.6.1.4.1.42
This is a compilation of steps that I have researched and implemented.
What am I missing here? Any input would be greatly appreciated!
|
|
| Back to top |
|
 |
|