LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 01-30-2015, 02:15 AM   #1
selportion
LQ Newbie
 
Registered: Jan 2015
Posts: 3

Rep: Reputation: Disabled
(net)-SNMP can GET, fails to SET [OpenWRT]


Hello,

I am running OpenWRT (tried several versions, latest kernel 3.14) in a TP-LINK WDR3600, with snmpd and snmp utils installed.
I have two issues were I am having trouble finding documentation:
1)I can read from whatever MIBs are supported but not write:

SNMPGET

Code:
    root@OpenWrt:/# snmpget -v 1 -c public 10.0.0.2 iso.3.6.1.2.1.1.5.0
    MIB search path: /root/.snmp/mibs:/usr/share/snmp/mibs
    Cannot find module (SNMP-VIEW-BASED-ACM-MIB): At line 0 in (none)
    Cannot find module (SNMP-COMMUNITY-MIB): At line 0 in (none)
    Cannot find module (SNMP-FRAMEWORK-MIB): At line 0 in (none)
    Cannot find module (SNMP-MPD-MIB): At line 0 in (none)
    Cannot find module (SNMP-USER-BASED-SM-MIB): At line 0 in (none)
    Cannot find module (TUNNEL-MIB): At line 0 in (none)
    Cannot find module (IPV6-FLOW-LABEL-MIB): At line 0 in (none)
    Cannot find module (UCD-DLMOD-MIB): At line 0 in (none)
    Cannot find module (NET-SNMP-PASS-MIB): At line 0 in (none)
    Cannot find module (SNMPv2-MIB): At line 0 in (none)
    Cannot find module (IF-MIB): At line 0 in (none)
    Cannot find module (IP-MIB): At line 0 in (none)
    Cannot find module (TCP-MIB): At line 0 in (none)
    Cannot find module (UDP-MIB): At line 0 in (none)
    Cannot find module (HOST-RESOURCES-MIB): At line 0 in (none)
    Cannot find module (NOTIFICATION-LOG-MIB): At line 0 in (none)
    Cannot find module (DISMAN-EVENT-MIB): At line 0 in (none)
    Cannot find module (DISMAN-SCHEDULE-MIB): At line 0 in (none)
    iso.3.6.1.2.1.1.5.0 = STRING: "HeartOfGold"
SNMPSET
Code:
    root@OpenWrt:/# snmpset -v 1 -c private 10.0.0.2 iso.3.6.1.2.1.1.5.0 s test
    MIB search path: /root/.snmp/mibs:/usr/share/snmp/mibs
    Cannot find module (SNMP-VIEW-BASED-ACM-MIB): At line 0 in (none)
    Cannot find module (SNMP-COMMUNITY-MIB): At line 0 in (none)
    Cannot find module (SNMP-FRAMEWORK-MIB): At line 0 in (none)
    Cannot find module (SNMP-MPD-MIB): At line 0 in (none)
    Cannot find module (SNMP-USER-BASED-SM-MIB): At line 0 in (none)
    Cannot find module (TUNNEL-MIB): At line 0 in (none)
    Cannot find module (IPV6-FLOW-LABEL-MIB): At line 0 in (none)
    Cannot find module (UCD-DLMOD-MIB): At line 0 in (none)
    Cannot find module (NET-SNMP-PASS-MIB): At line 0 in (none)
    Cannot find module (SNMPv2-MIB): At line 0 in (none)
    Cannot find module (IF-MIB): At line 0 in (none)
    Cannot find module (IP-MIB): At line 0 in (none)
    Cannot find module (TCP-MIB): At line 0 in (none)
    Cannot find module (UDP-MIB): At line 0 in (none)
    Cannot find module (HOST-RESOURCES-MIB): At line 0 in (none)
    Cannot find module (NOTIFICATION-LOG-MIB): At line 0 in (none)
    Cannot find module (DISMAN-EVENT-MIB): At line 0 in (none)
    Cannot find module (DISMAN-SCHEDULE-MIB): At line 0 in (none)
    Error in packet.
    Reason: (noSuchName) There is no such variable name in this MIB.
    Failed object: iso.3.6.1.2.1.1.5.0
SNMP CONF
Code:
root@OpenWrt:/# cat etc/snmp/snmpd.conf
agentaddress UDP:161
sysLocation office
sysContact bofh@example.com
sysName HeartOfGold
com2sec ro default public
com2sec rw default private
group public v1 ro
group public v2c ro
group public usm ro
group private v1 rw
group private v2c rw
group private usm rw
view all included .1
access public "" any noauth exact all none none
access private "" any noauth exact all all all
exec  filedescriptors /bin/cat /proc/sys/fs/file-nr
I thought of the community string and tried to give readwrite priviledges to public but nothing changed.
Any hints?




2) I tried to load the MIBs following the
http://www.net-snmp.org/docs/FAQ.htm...XX_MIB___mean_
and downloading them from random sources but this produced more errors. The get/set should work with just OIDs anyway.
Where does the code of (write to OID)->(produce an effect) lie?


Thank you
 
Old 01-30-2015, 10:10 PM   #2
jayjwa
Member
 
Registered: Jul 2003
Location: NY
Distribution: Slackware, Termux
Posts: 769

Rep: Reputation: 242Reputation: 242Reputation: 242
Do you have some incompatible/bad MIB's installed from some other programs? Sometimes programs will install theirs into net-snmp's MIB directory. I have net-snmp-5.7.3 installed with additional MIB's from Proftpd and Rsyslog. Seems like you should be getting error-free results with a basic install. Remember, net-snmp can have configuration files in /usr/share/snmp as well. While I have /etc/snmp/snmp.conf as you, most of my configuration is in /usr/share/snmp/snmpd.conf, created via the snmpconf program.

Code:
snmpget -v 1 -c public 192.168.10.2 iso.3.6.1.2.1.1.5.0
SNMPv2-MIB::sysName.0 = STRING: vdrl

snmpset -v 1 -c system 192.168.10.2 iso.3.6.1.2.1.1.5.0 s test
SNMPv2-MIB::sysName.0 = STRING: test

snmpget -v 1 -c public 192.168.10.2 iso.3.6.1.2.1.1.5.0       
SNMPv2-MIB::sysName.0 = STRING: test
Code:
/etc/snmp/snmp.conf:

mibdirs                 /usr/share/snmp/mibs:/usr/share/snmp
mibs                    ALL
persistentDir           /var/lib/snmp
tempFilePattern         /var/tmp/snmpdXXXXXX
defVersion              2c
defCommunity            public
defSecurityName         root
defAuthType             MD5
defPrivType             AES
defSecurityLevel        authNoPriv
showMibErrors           false
strictCommentTerm       false
mibAllowUnderline       false
mibWarningLevel         0
logTimestamp            true
Sorry I don't know that much about snmp to say exactly what's wrong.
 
Old 02-02-2015, 04:23 AM   #3
selportion
LQ Newbie
 
Registered: Jan 2015
Posts: 3

Original Poster
Rep: Reputation: Disabled
Thanks for having the time to give it a look.

An update: By including -m ALL in the flags I get rid of the "Cannot find module.." errors. But still cannot write.
Actually in version 2c the error is:
Quote:
Error in packet.
Reason: notWritable (That object does not support modification)
Failed object: iso.3.6.1.2.1.1.5.0
which does not make sense, because we are talking about the sysName.

I have no snmp folder in /usr/share/ at all. No MIBs there, no config.
My config is in etc/snmp/snmpd.conf as posted above, and if I am not mistaken it is generated from /etc/config/snmpd

Code:
root@OpenWrt:/# cat /etc/config/snmpd
config agent
        option agentaddress UDP:161

config com2sec public
        option secname ro
        option source default
        option community public

config com2sec private
        option secname rw
        option source localhost
        option community private

config group public_v1
        option group public
        option version v1
        option secname ro

config group public_v2c
        option group public
        option version v2c
        option secname ro

config group public_usm
        option group public
        option version usm
        option secname ro

config group private_v1
        option group private
        option version v1
        option secname rw

config group private_v2c
        option group private
        option version v2c
        option secname rw

config group private_usm
        option group private
        option version usm
        option secname rw

config view all
        option viewname all
        option type included
        option oid .1

config access public_access
        option group public
        option context none
        option version any
        option level noauth
        option prefix exact
        option read all
        option write none
        option notify none

config access private_access
        option group private
        option context none
        option version any
        option level noauth
        option prefix exact
        option read all
        option write all
        option notify all

config system
        option sysLocation      'office'
        option sysContact       'bofh@example.com'
        option sysName          'HeartOfGold'
#       option sysServices      72
#       option sysDescr         'adult playground'
#       option sysObjectID      '1.2.3.4'

config exec
        option name     filedescriptors
        option prog     /bin/cat
        option args     /proc/sys/fs/file-nr
#       option miboid   1.2.3.4
This is how OpenWRT works. Basically I take any distribution of it, fresh, or compile my own and I install "snmpd" and "snmp utils" packages. Maybe I should modify the init.d file to load a Snmp config as in any other linux system.. I do not get much support from their forums.
But shouldn't SNMP get and set work even without MIBs since we are referring to OIDs?

Last edited by selportion; 02-02-2015 at 06:49 AM.
 
Old 02-03-2015, 10:40 AM   #4
selportion
LQ Newbie
 
Registered: Jan 2015
Posts: 3

Original Poster
Rep: Reputation: Disabled
Solution:
OIDs set in the config file become read-only so this is why iso.3.6.1.2.1.1.5.0 is writable only if sysName is not set in config.
To have meaningful MIBs, able to write to them and produce effect, one must load them or extend the agent himself.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] NET-SNMP make fails dharm_sk Linux - Software 10 11-18-2015 09:06 PM
net time set Command Fails with Success jfmorales Red Hat 1 07-13-2010 12:39 AM
Net-SNMP writing a Subagent - snmp.conf Unknown token: master AustinMarton Programming 0 12-16-2008 07:34 PM
SLES9 net-snmp-5.1-80.16 fails to load marscoast Linux - Networking 1 02-04-2008 07:33 AM
Net-SNMP Fails to Build (RH ES 4.0) jhmathis Linux - Enterprise 1 10-26-2007 04:00 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 04:43 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration