Reputation: 211
I am newbie to SNMP, I am trying to use SNMP Operations, I am using http://techdive.in/snmp/snmp4j-snmp-get-example code But I am not able to get the expected output. I am getting NULL response as below:
SNMP GET Demo Sending Request to Agent... Got Response from Agent Snmp Get Response = [1.3.6.1.2.1.1.1.0 = Null]
As I am trying to get sysDescr for OID of MIB RFC 1213, the expected output should be as below:
SNMP GET Demo Sending Request to Agent... Got Response from Agent Snmp Get Response = [1.3.6.1.2.1.1.1.0 = Test Agent Simulator]
Where am I going wrong? Any help would be highly Aprreciated.
Upvotes: 1
Views: 4110
Reputation: 14638
First of all, try to use snmpget
from net-snmp-tools package (download here or install from distro repo if you have linux).
snmpget -v2c -c public localhost 1.3.6.1.2.1.1.1.0
Replace community and host with actual values.
It should produce something like this:
SNMPv2-MIB::sysDescr.0 = STRING: Linux XYZ 3.10.0-327.13.1.el7.x86_64 #1 SMP
If you got error, then adjust hostname/community to correct values and make sure that SNMP agent is running on target machine and firewall allows you to connect.
UPDATE
You can even use snmpwalk
to make sure that sysDescr
OID is available:
snmpwalk -v2c -c public localhost 1.3.6.1.2.1.1
Output:
SNMPv2-MIB::sysDescr.0 = STRING: Linux XYZ Thu Mar 31 16:04:38 UTC 2016 x86_64
SNMPv2-MIB::sysObjectID.0 = OID: NET-SNMP-MIB::netSnmpAgentOIDs.10
Upvotes: 2