Using JConsole in combination with SNMP

I have created a simple agent (using version 5 JDK) to handle an MBean. Within this agent I have created two adapters; an HTML and SNMP adapter. The HTML adapter is working fine via the browser (i can execute the operations on the MBean).

Question is; Can I use JConsole to connect to the SNMP adapter?; if not how then?

Code:

publicvoid addSnmpAdapter(int port)

throws Exception{

// Register and start the SNMP adapter

SnmpAdaptorServer snmpAdapter =new SnmpAdaptorServer();

ObjectName snmpAdapterName =new ObjectName(

"MBeanAgent:name=snmpadapter,type=SNMP,port=" + port);

snmpAdapter.setPort(port);

mbs.registerMBean(snmpAdapter, snmpAdapterName);

snmpAdapter.start();

System.out.println("SnmpAdapter on port " + port);

}

Start command:

java -Dcom.sun.management.jmxremote -Dcom.sun.management.snmp.acl=false -Dcom.sun.management.snmp.port=162 MBeanAgent

[1324 byte] By [WillemTijma] at [2007-11-15]
# 1

Hi Willem,

No you cannot use JConsole to "connect to the SNMP adapter".

JConsole is a JMX Console, not an SNMP console.

What are you trying to do with that SNMP Adaptor anyway?

If you use Java DMK to start an SNMP adapter, and do nothing more,

the adaptor will show you nothing. It is empty. You still need to

generate, implement, and add at least one SNMP MIB to the adaptor.

For more information on this, see the Java DMK documentation.

http://java.sun.com/products/jdmk/jdmk_docs.html

Java SE 5.0 has a built-in SNMP agent that can be started using System

properties on the Java command line. This agent implements a single MIB,

the JVM-MANAGEMENT-MIB, that exposes the JVM Management and Monitoring

data through SNMP.

See here for more info on the JVM SNMP Agent:

What is the JVM SNMP Agent?

http://blogs.sun.com/jmxetc/entry/what_is_the_jvm_snmp

See also here for a discussion of using SNMP versus JMX to monitor your JVMs.

JVM Monitoring: JMX or SNMP?

http://blogs.sun.com/jmxetc/entry/jmx_vs_snmp

Hope this helps,

-- daniel

JMX, SNMP, Java, etc...

http://blogs.sun.com/jmxetc

dfuchsa at 2007-7-12 > top of java,Core,Monitoring & Management...
# 2

Thanks for your reply Daniel. I will check your links. And will get back in case of any questions.

Background; I am currently working on a proof of concept to be able to monitor a native Java application via Tivoli. In my opinion, SNMP might be the way to achieve this. Any suggestions from your side?

WillemTijma at 2007-7-12 > top of java,Core,Monitoring & Management...
# 3

Hi,

It depends on what exactly you want to monitor, but it might well be that

the JVM SNMP agent and its JVM_MANAGEMENT_MIB are enough for your

needs.

The JVM_MANAGEMENT_MIB exposes almost all the information that you

can see in JConsole (except for stack traces and Sun's extension).

You will find plenty of information on that subject on my blog.

Hope this help,

-- daniel

JMX, SNMP, Java, etc...

http://blogs.sun.com/jmxetc

dfuchsa at 2007-7-12 > top of java,Core,Monitoring & Management...