VMware Cloud Community
rrspyder_hyperi
Contributor
Contributor

snmp.SNMPException: Failed to initialize snmp session

Hello all,

I am new to Hyperic and currently in the process of trying to get it setup and functional on Debian etch. I used the installer and installed both the agent, and server on one box. Everything seems operational but I cannot get SNMP logging to work. I am trying to get this functional to monitor Cisco switches.

I read the documentation detailing how to set this up and I have added the appropriate snmpTrapReceiver.listenAddress=udp:0.0.0.0/1620 to the agent.properties and restarted the agent. I then login to hyperic add a new platform specify all of the details required for the snmp and click submit and instantly get back a "Failed to initialize snmp session" error. I have tried both the current stable version and beta version and have received this error in both. However, on the same box I installed the Vmware version from the site and conducted the same steps to enable SNMP and it worked perfectly. So, is there some undocumented extra step that needs to be conducted to fix this?

I set my agent to log level debug mode and this is the information that I receive. (Please note I have removed the snmpcommunity and snmpip.

Any help you can provide would be greatly appreciated as I have scoured the forums but were unable to find anything useful.

Also, I was able to use snmpwalk on the same box and access the device so connectivity is not an issue.

2007-07-15 06:51:53,139 DEBUG [MeasurementCommandsServer] Getting real time measurement: Cisco IOS:snmp:snmpIp=xx.xx.xx.xx,snmpPort=161,snmpVersion=v2c,snmpCommunity=xxx,snmpUser=username,snmpPassword=,snmpAuthType=md5,Avail=true:ifNumber
2007-07-15 06:51:53,140 DEBUG [MeasurementCommandsServer] Error getting real time measurement 'Cisco IOS:snmp:snmpIp=xx.xx.xx.xx,snmpPort=161,snmpVersion=v2c,snmpCommunity=xxx,snmpUser=username,snmpPassword=,snmpAuthType=md5,Avail=true:ifNumber': Plugin error: Failed to initialize snmp session
org.hyperic.hq.product.PluginException: Failed to initialize snmp session
at org.hyperic.hq.product.SNMPMeasurementPlugin.getSession(SNMPMeasurementPlugin.java:521)
at org.hyperic.hq.product.SNMPMeasurementPlugin.getValue(SNMPMeasurementPlugin.java:248)
at org.hyperic.hq.product.MeasurementPluginManager.getPluginValue(MeasurementPluginManager.java:171)
at org.hyperic.hq.product.MeasurementPluginManager.getValue(MeasurementPluginManager.java:269)
at org.hyperic.hq.product.MeasurementPluginManager.getValue(MeasurementPluginManager.java:130)
at org.hyperic.hq.product.MeasurementPluginManager.getValue(MeasurementPluginManager.java:122)
at org.hyperic.hq.measurement.agent.server.MeasurementCommandsServer.getMeasurements(MeasurementCommandsServer.java:289)
at org.hyperic.hq.measurement.agent.server.MeasurementCommandsServer.dispatchCommand(MeasurementCommandsServer.java:467)
at org.hyperic.hq.agent.server.CommandDispatcher.processRequest(CommandDispatcher.java:112)
at org.hyperic.hq.agent.server.CommandListener.listenLoop(CommandListener.java:203)
at org.hyperic.hq.agent.server.AgentDaemon.start(AgentDaemon.java:680)
at org.hyperic.hq.agent.server.AgentDaemon$RunnableAgent.run(AgentDaemon.java:744)
at org.hyperic.hq.agent.server.AgentDaemon.main(AgentDaemon.java:762)
Caused by: org.hyperic.snmp.SNMPException: Failed to initialize snmp session
at org.hyperic.snmp.SNMPClient.getSession(SNMPClient.java:257)
at org.hyperic.hq.product.SNMPMeasurementPlugin.getSession(SNMPMeasurementPlugin.java:519)
... 12 more
Caused by: org.hyperic.snmp.SNMPException: monitorwh01: monitorwh01
at org.hyperic.snmp.SNMPSession_v1.init(SNMPSession_v1.java:107)
at org.hyperic.snmp.SNMPClient.getSession(SNMPClient.java:240)
... 13 more
Caused by: java.net.UnknownHostException: monitorwh01: monitorwh01
at java.net.InetAddress.getLocalHost(Unknown Source)
at org.snmp4j.transport.DefaultUdpTransportMapping.<init>(Unknown Source)
at org.hyperic.snmp.SNMPSession_v1.getSessionInstance(SNMPSession_v1.java:64)
at org.hyperic.snmp.SNMPSession_v1.init(SNMPSession_v1.java:105)
... 14 more
0 Kudos
1 Reply
dougm_hyperic
VMware Employee
VMware Employee

It looks like this is happening within SNMP4J, the call to InetAddress.getLocalHost():

public DefaultUdpTransportMapping() throws IOException {
super(new UdpAddress(InetAddress.getLocalHost(), 0));
socket = new DatagramSocket(udpAddress.getPort());
}

http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=4665037

We can change our code to avoid this, but if you follow that bug link, sounds like tweaking /etc/hosts might work around the problem.
0 Kudos