Cacti (home)ForumsDocumentation
Cacti: offical forums and support
It is currently Tue Jul 17, 2018 6:46 am

All times are UTC - 5 hours




Post new topic Reply to topic  [ 16 posts ]  Go to page 1, 2  Next
Author Message
 Post subject: Another JVM Monitoring template
PostPosted: Mon Oct 01, 2007 4:51 pm 
Offline

Joined: Mon Sep 18, 2006 1:45 pm
Posts: 2
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]


Attachments:
Screenshot-cacti - Mozilla Firefox.png
Screenshot-cacti - Mozilla Firefox.png [ 56.49 KiB | Viewed 39362 times ]
jvm_mem.xml.txt [3.72 KiB]
Downloaded 2413 times
cacti_graph_template_jvm_jvmmempooltable.xml.txt [39.07 KiB]
Downloaded 1863 times
Top
 Profile  
 
 Post subject: Scritp file ?
PostPosted: Tue Mar 11, 2008 7:48 am 
Offline
Cacti User

Joined: Mon Feb 11, 2008 3:46 am
Posts: 137
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' ?


Top
 Profile  
 
 Post subject: Work?
PostPosted: Mon Aug 11, 2008 7:23 pm 
Offline

Joined: Thu May 22, 2008 10:23 pm
Posts: 12
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


Top
 Profile  
 
 Post subject:
PostPosted: Tue Aug 12, 2008 8:22 pm 
Offline

Joined: Mon Oct 09, 2006 2:48 pm
Posts: 8
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-M ... /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.


Top
 Profile  
 
 Post subject: Yet another JVM Graph Templates
PostPosted: Sun Dec 13, 2009 9:15 pm 
Offline

Joined: Thu Aug 13, 2009 4:29 pm
Posts: 16
Location: Canada
Here are my JVM templates.

Instructions - http://java.sun.com/javase/6/docs/techn ... /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


Attachments:
jvm_classes.png
jvm_classes.png [ 22.23 KiB | Viewed 31547 times ]
cacti_graph_template_jvm_-_threads.xml [21.77 KiB]
Downloaded 1119 times
File comment: Objects pending finalization.
cacti_graph_template_jvm_-_opf.xml [12.67 KiB]
Downloaded 883 times
cacti_graph_template_jvm_-_num_of_classes.xml [17.5 KiB]
Downloaded 1117 times
cacti_graph_template_jvm_-_memory.xml [20.06 KiB]
Downloaded 1183 times

_________________
Manas


Last edited by mgupta on Sun Dec 13, 2009 9:32 pm, edited 2 times in total.
Top
 Profile  
 
 Post subject: JVM : Screenshots for the rest of the graphs.
PostPosted: Sun Dec 13, 2009 9:20 pm 
Offline

Joined: Thu Aug 13, 2009 4:29 pm
Posts: 16
Location: Canada
Creating a separate post since a post just allows 5 attachments.


Attachments:
jvm_threads.png
jvm_threads.png [ 24.19 KiB | Viewed 31545 times ]
jvm_opf.png
jvm_opf.png [ 20.27 KiB | Viewed 31545 times ]
jvm_mem.png
jvm_mem.png [ 29.03 KiB | Viewed 31545 times ]

_________________
Manas
Top
 Profile  
 
 Post subject: Re: JVM : Screenshots for the rest of the graphs.
PostPosted: Wed Jan 13, 2010 2:54 pm 
Offline

Joined: Wed Jan 13, 2010 2:52 pm
Posts: 2
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.


Top
 Profile  
 
 Post subject: Re: JVM : Screenshots for the rest of the graphs.
PostPosted: Wed Jan 13, 2010 2:58 pm 
Offline

Joined: Thu Aug 13, 2009 4:29 pm
Posts: 16
Location: Canada
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]

_________________
Manas


Top
 Profile  
 
 Post subject: Re: JVM : Screenshots for the rest of the graphs.
PostPosted: Wed Jan 13, 2010 3:10 pm 
Offline

Joined: Wed Jan 13, 2010 2:52 pm
Posts: 2
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.


Top
 Profile  
 
 Post subject:
PostPosted: Wed Jan 20, 2010 9:04 am 
Offline

Joined: Wed Jan 20, 2010 8:58 am
Posts: 1
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


Top
 Profile  
 
 Post subject: Missing CF
PostPosted: Wed Jan 27, 2010 3:03 am 
Offline

Joined: Thu Aug 13, 2009 4:29 pm
Posts: 16
Location: Canada
You can try changing the CF in the graph template. There's a lot of other threads about missing CFs.

_________________
Manas


Top
 Profile  
 
 Post subject:
PostPosted: Fri Jan 29, 2010 6:24 am 
Offline
Cacti User

Joined: Fri Jun 24, 2005 10:16 am
Posts: 54
Change the CF from LAST to Average and the graphs will be ok.

Just wondering how to collect garbage collection.


Top
 Profile  
 
 Post subject: No Such Object available on this agent at this OID
PostPosted: Thu Jun 24, 2010 1:31 pm 
Offline

Joined: Fri May 08, 2009 11:34 am
Posts: 28
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!


Top
 Profile  
 
 Post subject: Re: Another JVM Monitoring template
PostPosted: Thu Oct 27, 2011 11:19 am 
Offline

Joined: Wed Oct 19, 2011 12:44 pm
Posts: 5
ianand0204 wrote:
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]



I'm having trouble importing this jvm_mem.xml.txt file you've attached, I get nothing back from cacti - no response it just uploads the file and returns nothing.

After some more digging I've found that when exporting a data template I don't see OIDs listed but the source xml file has OIDs as part of the template. In the ones coming out of cacti right now I see lots of <hash> tags but can't tell what they reference.

Something else to note here:
Code:
[[email protected] cacti]# snmpwalk -v2c -c public test.host.com 1.3.6.1.4.1.42 | grep -i G1
SNMPv2-SMI::enterprises.42.2.145.3.163.1.1.2.100.1.2.2 = STRING: "G1 Young Generation"
SNMPv2-SMI::enterprises.42.2.145.3.163.1.1.2.100.1.2.3 = STRING: "G1 Old Generation"
SNMPv2-SMI::enterprises.42.2.145.3.163.1.1.2.110.1.2.2 = STRING: "G1 Eden"
SNMPv2-SMI::enterprises.42.2.145.3.163.1.1.2.110.1.2.3 = STRING: "G1 Survivor"
SNMPv2-SMI::enterprises.42.2.145.3.163.1.1.2.110.1.2.4 = STRING: "G1 Old Gen"
SNMPv2-SMI::enterprises.42.2.145.3.163.1.1.2.110.1.2.5 = STRING: "G1 Perm Gen"
SNMPv2-SMI::enterprises.42.2.145.3.163.1.1.2.120.1.2.2.2 = STRING: "G1 Young Generation"
SNMPv2-SMI::enterprises.42.2.145.3.163.1.1.2.120.1.2.2.3 = STRING: "G1 Young Generation"
SNMPv2-SMI::enterprises.42.2.145.3.163.1.1.2.120.1.2.3.2 = STRING: "G1 Old Generation"
SNMPv2-SMI::enterprises.42.2.145.3.163.1.1.2.120.1.2.3.3 = STRING: "G1 Old Generation"
SNMPv2-SMI::enterprises.42.2.145.3.163.1.1.2.120.1.2.3.4 = STRING: "G1 Old Generation"
SNMPv2-SMI::enterprises.42.2.145.3.163.1.1.2.120.1.2.3.5 = STRING: "G1 Old Generation"
SNMPv2-SMI::enterprises.42.2.145.3.163.1.1.2.120.1.3.2.2 = STRING: "G1 Eden"
SNMPv2-SMI::enterprises.42.2.145.3.163.1.1.2.120.1.3.2.3 = STRING: "G1 Survivor"
SNMPv2-SMI::enterprises.42.2.145.3.163.1.1.2.120.1.3.3.2 = STRING: "G1 Eden"
SNMPv2-SMI::enterprises.42.2.145.3.163.1.1.2.120.1.3.3.3 = STRING: "G1 Survivor"
SNMPv2-SMI::enterprises.42.2.145.3.163.1.1.2.120.1.3.3.4 = STRING: "G1 Old Gen"
SNMPv2-SMI::enterprises.42.2.145.3.163.1.1.2.120.1.3.3.5 = STRING: "G1 Perm Gen"
SNMPv2-SMI::enterprises.42.2.145.3.163.1.1.4.20.1.2.3 = STRING: "-XX:+UseG1GC"
[[email protected] cacti]# snmpwalk -m /usr/share/snmp/mibs/JVM-MANAGEMENT-MIB.txt -v2c -c public test.host.com 1.3.6.1.4.1.42 | grep -i G1
JVM-MANAGEMENT-MIB::jvmMemManagerName.2 = STRING: G1 Young Generation
JVM-MANAGEMENT-MIB::jvmMemManagerName.3 = STRING: G1 Old Generation
JVM-MANAGEMENT-MIB::jvmMemPoolName.2 = STRING: G1 Eden
JVM-MANAGEMENT-MIB::jvmMemPoolName.3 = STRING: G1 Survivor
JVM-MANAGEMENT-MIB::jvmMemPoolName.4 = STRING: G1 Old Gen
JVM-MANAGEMENT-MIB::jvmMemPoolName.5 = STRING: G1 Perm Gen
JVM-MANAGEMENT-MIB::jvmMemMgrRelManagerName.2.2 = STRING: G1 Young Generation
JVM-MANAGEMENT-MIB::jvmMemMgrRelManagerName.2.3 = STRING: G1 Young Generation
JVM-MANAGEMENT-MIB::jvmMemMgrRelManagerName.3.2 = STRING: G1 Old Generation
JVM-MANAGEMENT-MIB::jvmMemMgrRelManagerName.3.3 = STRING: G1 Old Generation
JVM-MANAGEMENT-MIB::jvmMemMgrRelManagerName.3.4 = STRING: G1 Old Generation
JVM-MANAGEMENT-MIB::jvmMemMgrRelManagerName.3.5 = STRING: G1 Old Generation
JVM-MANAGEMENT-MIB::jvmMemMgrRelPoolName.2.2 = STRING: G1 Eden
JVM-MANAGEMENT-MIB::jvmMemMgrRelPoolName.2.3 = STRING: G1 Survivor
JVM-MANAGEMENT-MIB::jvmMemMgrRelPoolName.3.2 = STRING: G1 Eden
JVM-MANAGEMENT-MIB::jvmMemMgrRelPoolName.3.3 = STRING: G1 Survivor
JVM-MANAGEMENT-MIB::jvmMemMgrRelPoolName.3.4 = STRING: G1 Old Gen
JVM-MANAGEMENT-MIB::jvmMemMgrRelPoolName.3.5 = STRING: G1 Perm Gen
JVM-MANAGEMENT-MIB::jvmRTInputArgsItem.3 = STRING: -XX:+UseG1GC


Notice that when I don't pass the -m /path/JVM-MANAGEMENT-MIB.txt we don't get pretty names for the OIDs, could this be screwing stuff up?

I tried adding this to my snmpd.conf file in cacti mibs +ALL and I tried mibs +JVM-MANAGEMENT and a few others, but nothing seems to include this mib by default when running snmpwalk. Thanks in Advance.

edit: ok, so it looks like the file in question was actually a data_query and should be imported that way (as best I can tell) I started following the guide found here: http://forums.cacti.net/about4143.html but am still struggling a little bit to get everything to line up.


Top
 Profile  
 
 Post subject: Re: Another JVM Monitoring template
PostPosted: Fri Oct 28, 2011 1:35 pm 
Offline

Joined: Fri May 08, 2009 11:34 am
Posts: 28
ILikeVoltron

Did you have any issues with adding individual JVM to monitor via this template when specifying a different SNMP port number?

I have set up the following setting for each individual JVM that I am trying to monitor, specifying an individual port for each JVM as shown below

com.sun.management.snmp.interface=0.0.0.0
com.sun.management.snmp.port=1161
com.sun.management.snmp.acl=true

I get successful results when doing an snmpwalk when specifying the JVM-MANAGEMENT MIBS both from the local machine and from an external machine so I know that the set up seems to be correct.

I am running into errors though when trying to add the individual host (The JVM instance) to monitor via cacti and adding the the unique port that I set up above for the JVM instance. IT gives me an "SNMP ERROR"

The only port values that Catci seems to be happy with are the SNMP and Net-SNMP port values (161 and 163)

Attachment:
Cacti Error.png
Cacti Error.png [ 292.19 KiB | Viewed 22440 times ]


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 16 posts ]  Go to page 1, 2  Next

All times are UTC - 5 hours


Who is online

Users browsing this forum: No registered users and 5 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  

Protected by Anti-Spam ACP Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group