LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Software (https://www.linuxquestions.org/questions/linux-software-2/)
-   -   Trouble configuring snmpd on Debian etch. Running exec scripts (https://www.linuxquestions.org/questions/linux-software-2/trouble-configuring-snmpd-on-debian-etch-running-exec-scripts-796275/)

Doug86i 03-18-2010 07:53 AM

Trouble configuring snmpd on Debian etch. Running exec scripts
 
Hi All,

First post here (despite frequenting this exelent resource) and I'm having a little trouble configuring snmpd under debian etch.

Ultimately im trying to get snmpd to poll the result of apcaccess (via a script) in order to report the status of a UPS over SNMP.

however I'm having trouble getting anything other than the default information from an snmpwalk.

I installed snmpd using aptitude

Code:

#aptitude install snmpd
and edited /etc/snmp/snmpd.conf as suggested here.

then doing an snmp walk returns the following (my test box is called kryten)

Code:

kryten:/etc/apt# snmpwalk -v 1 -c public localhost
SNMPv2-MIB::sysDescr.0 = STRING: Linux kryten 2.6.18-6-686 #1 SMP Sat Dec 27 09:31:05 UTC 2008 i686
SNMPv2-MIB::sysObjectID.0 = OID: NET-SNMP-MIB::netSnmpAgentOIDs.10
DISMAN-EVENT-MIB::sysUpTimeInstance = Timeticks: (83298) 0:13:52.98
SNMPv2-MIB::sysContact.0 = STRING: Root <root@localhost> (configure /etc/snmp/snmpd.local.conf)
SNMPv2-MIB::sysName.0 = STRING: kryten
SNMPv2-MIB::sysLocation.0 = STRING: Unknown (configure /etc/snmp/snmpd.local.conf)
SNMPv2-MIB::sysORLastChange.0 = Timeticks: (1) 0:00:00.01
SNMPv2-MIB::sysORID.1 = OID: IF-MIB::ifMIB
SNMPv2-MIB::sysORID.2 = OID: SNMPv2-MIB::snmpMIB
SNMPv2-MIB::sysORID.3 = OID: TCP-MIB::tcpMIB
SNMPv2-MIB::sysORID.4 = OID: IP-MIB::ip
SNMPv2-MIB::sysORID.5 = OID: UDP-MIB::udpMIB
SNMPv2-MIB::sysORID.6 = OID: SNMP-VIEW-BASED-ACM-MIB::vacmBasicGroup
SNMPv2-MIB::sysORID.7 = OID: SNMP-FRAMEWORK-MIB::snmpFrameworkMIBCompliance
SNMPv2-MIB::sysORID.8 = OID: SNMP-MPD-MIB::snmpMPDCompliance
SNMPv2-MIB::sysORID.9 = OID: SNMP-USER-BASED-SM-MIB::usmMIBCompliance
SNMPv2-MIB::sysORDescr.1 = STRING: The MIB module to describe generic objects for network interface sub-layers
SNMPv2-MIB::sysORDescr.2 = STRING: The MIB module for SNMPv2 entities
SNMPv2-MIB::sysORDescr.3 = STRING: The MIB module for managing TCP implementations
SNMPv2-MIB::sysORDescr.4 = STRING: The MIB module for managing IP and ICMP implementations
SNMPv2-MIB::sysORDescr.5 = STRING: The MIB module for managing UDP implementations
SNMPv2-MIB::sysORDescr.6 = STRING: View-based Access Control Model for SNMP.
SNMPv2-MIB::sysORDescr.7 = STRING: The SNMP Management Architecture MIB.
SNMPv2-MIB::sysORDescr.8 = STRING: The MIB for Message Processing and Dispatching.
SNMPv2-MIB::sysORDescr.9 = STRING: The management information definitions for the SNMP User-based Security Model.
SNMPv2-MIB::sysORUpTime.1 = Timeticks: (0) 0:00:00.00
SNMPv2-MIB::sysORUpTime.2 = Timeticks: (0) 0:00:00.00
SNMPv2-MIB::sysORUpTime.3 = Timeticks: (0) 0:00:00.00
SNMPv2-MIB::sysORUpTime.4 = Timeticks: (0) 0:00:00.00
SNMPv2-MIB::sysORUpTime.5 = Timeticks: (0) 0:00:00.00
SNMPv2-MIB::sysORUpTime.6 = Timeticks: (0) 0:00:00.00
SNMPv2-MIB::sysORUpTime.7 = Timeticks: (1) 0:00:00.01
SNMPv2-MIB::sysORUpTime.8 = Timeticks: (1) 0:00:00.01
SNMPv2-MIB::sysORUpTime.9 = Timeticks: (1) 0:00:00.01
End of MIB


Right, so all seems well. snmpd is working and responing.

I then edited /etc/snmp/snmpd.conf and uncommented the test exec:

Code:

# a simple hello world
exec echotest /bin/echo hello world

# Run a shell script containing:
#
# #!/bin/sh
# echo hello world
# echo hi there
# exit 35
#
# Note:  this has been specifically commented out to prevent
# accidental security holes due to someone else on your system writing
# a /tmp/shtest before you do.  Uncomment to use it.
#
#exec shelltest /bin/sh /tmp/shtest

# Then,
# % snmpwalk -v 1 -c public localhost .1.3.6.1.4.1.2021.8

so I want to check If thats worked before I try with my script.

Code:

kryten:/etc/snmp# /etc/init.d/snmpd restart
Restarting network management services: snmpd.
kryten:/etc/snmp# snmpwalk -v 1 -c public localhost .1.3.6.1.4.1.2021.8
End of MIB
kryten:/etc/snmp# snmpwalk -v 1 -c public localhost .1.3.6.1.4.1
End of MIB

if I run a complete snmpwalk, I get the same output as I did before I edited snmp.conf

I've also tried adding a script to snmpd.conf with no luck.

Can anyone tell me what I'm doing wrong here? I've never tried to configure snmpd before so I fully expect that i'm just doing something silly. It's almost like I'm editing the wrong conf file (if I rename the file and restart the daemon it doesn't complain) but I can't find another snmpd.conf.

Many thanks in advance :)

Doug86i 03-18-2010 08:10 AM

I've just tested the "Edidting the wrong conf file" theory by changing the system contact and the change was reflected in the output... now im totaly stumped :s


All times are GMT -5. The time now is 09:20 PM.