-
Notifications
You must be signed in to change notification settings - Fork 1
Home
This is a rather simple program for extracting JMX information and turning it into xymon/hobbit/big brother data.
From there you can then do things like:
- Check a service is up
- Check that a service is receiving/sending messages
- Draw graphs of internal information
- etc.
To use with the standard jmx java.lang exports, follow the steps below. This will give you graphs of cpu time and memory usage. Obviously any other figure exported by jmx can be got at in a similar way. The lessThan test will trigger a red light if memory use exceeds 10M. Probably way too low, but handy if you want to prove that it works.
Create config files in xymon/client/etc/jmx
- vm.conf
vm,cpuTime,@port@,java.lang,OperatingSystem,ProcessCpuTime
vmmem,memInit,@port@,java.lang,Memory,HeapMemoryUsage.init
vmmem,memCommitted,@port@,java.lang,Memory,HeapMemoryUsage.committed
vmmem,memMax,@port@,java.lang,Memory,HeapMemoryUsage.max
vmmem,memUsed,@port@,java.lang,Memory,HeapMemoryUsage.used,lessThan(10000000)
- Add some lines in bb-hosts as script fodder
0.0.0.0 tomcat # noconn jmxhost=localhost jmxport=1070 \
jmx=jmx/vm.conf
- Add a hobbitlaunch entry for the monitor
[jmxmonitor]
ENVFILE /home/pab/xymon/client/etc/hobbitclient.cfg
CMD $BBHOME/scripts/jmx_wrapper.sh
LOGFILE $BBSERVERLOGS/jmx.log
INTERVAL 30s
jmx_wrapper.sh is in the doc directory, for no good reason.
- Add some graph type stuff to hobbitserver.cfg (or in /etc/xymon/hobbitserver.d). Here I go for cpuTime and memory use. You might want thread counts, or whatever.
TEST2RRD="$TEST2RRD,vm=ncv"
SPLITNCV_vm="cpuTime:DERIVE,loadAvg:GAUGE"
TEST2RRD="$TEST2RRD,vmmem=ncv"
SPLITNCV_vmmem="memUsed:GAUGE,memCommitted:GAUGE,memMax:GAUGE"
- and a graph definition to hobbitgraph.cfg
[vm] TITLE Java Cpu Time YAXIS Time DEF:cpuTime=vm,cpuTime.rrd:lambda:AVERAGE LINE:cpuTime#000000:Cpu Time GPRINT:cpuTime:LAST: \: %5.1lf (cur)
[vmmem] TITLE Java Virtual Memory YAXIS Time DEF:memMax=vmmem,memMax.rrd:lambda:AVERAGE DEF:memUsed=vmmem,memUsed.rrd:lambda:AVERAGE DEF:memComm=vmmem,memCommitted.rrd:lambda:AVERAGE CDEF:memPercent=memUsed,100,*,memMax,/ CDEF:memCPercent=memComm,100,*,memMax,/ LINE:memPercent#000000:Mem Used LINE:memCPercent#000000:Mem Committed\n GPRINT:memUsed:LAST:Used \: %5.1lf GPRINT:memPercent:LAST:(%0.2lf%%) \n GPRINT:memComm:LAST:Committed \: %5.1lf GPRINT:memCPercent:LAST:(%0.2lf%%) \n GPRINT:memMax:LAST:Max \: %5.1lf \n
And you get graphs of your tomcat mem usage and cpu.