2

I have been searching all over the net to find if openjdk 7 has SNMP. This is on ubuntu 13.04, openjdk-7 installed using "sudo apt-get install openjdk-7-jdk". The acl file (java-7-openjdk-i386/jre/lib/management/snmp.acl) is there.

Checking the rt.jar shows me at least that the com.sun.management.snmp.* is not available.

Anybody any idea on how to run snmp with openjdk?

Ron
  • 776
  • 8
  • 14
  • Use SNMP4J. I've never heard of SNMP being built into the JRE, other than the agent used for JMX, which isn't general-purpose, and isn't a client. – user207421 May 08 '14 at 22:02
  • If you plan to monitor JVM via SNMP, then this question is duplicate. If you want to create an SNMP client/server, you should follow @EJP's advice. – Lex Li May 09 '14 at 02:55
  • 2
    Actually it is not a duplicate. The other answer is not based on the fact that openjdk does *not* have the snmp classes but answers the question how to start the snmp monitoring. One needs the classes to start the monitoring. – Ron May 10 '14 at 05:23
  • 2
    This is definitely not a duplicate, but a relevant new question concerning snmp not part of any OpenJDK. SNMP is the standard protocol for system monitoring and the ability not to be forced to use the proprietary JMX (from a Ops point of view) with a monitoring console is important for many. – jforge Mar 30 '16 at 08:28
  • It was suggested that this was a duplicate of [this question](https://stackoverflow.com/q/15519673/372643), but this question is specific to OpenJDK (and the answers in the other question don't seem to work in this particular case). Note that SNMP support is likely to be removed in future versions anyway: https://bugs.openjdk.java.net/browse/JDK-8071367 – Bruno Jul 24 '18 at 18:41

1 Answers1

2

In the source code, jdk/make/CompileJavaClasses.gmk contains this:

ifdef OPENJDK
  EXCLUDES += sun/dc \
      com/sun/jmx/snmp \
      sun/management/snmp \
      com/sun/script
endif

(The files are actually distributed with the OpenJDK 8 source bundle, and they seem to have the same GPL with classpath exception headers, although they've been removed in OpenJDK 9. It's also deprecated in JDK 10 and removed in JDK 11.)

You might be able to implement something similar to replace this feature using SNMP4J-AgentJMX.

Bruno
  • 119,590
  • 31
  • 270
  • 376