Re: how to start snmpd in Ubuntu

Abraham Varricatt <[email protected]>
Newsgroups gmane.network.net-snmp.user
Message-ID <[email protected]>
Well, to answer my own question, I got it to run ... kindof. Here's what I did,

First I needed to add an entry 'LD_LIBRARY_PATH="/usr/local/lib" ' to
my /etc/environment file. That helps sudo to know what path to look
into. Now, just blindly running the command with "sudo" didn't still
help me. I had to use the "-i" setting. So, the final command I ran is
this,

> sudo -i snmpd -f -Lo -C -c /home/abraham/snmpd.conf
NET-SNMP version 5.5

The console window the just stays stuck there without any activity
(running "ps -ae" from another console shows that snmpd is running)

Now, from another console I try to run this,

> snmpget -v 2c -c private localhost sysUpTime.0
Timeout: No Response from localhost.
> snmpget -v 2c -c private 127.0.0.1 sysUpTime.0
Timeout: No Response from 127.0.0.1.

For some reason snmpget isn't getting any responses. Just to confirm
that the port 161 is ACTUALLY in use by snmpd, I run this,

> sudo sockstat
USER     PROCESS              PID      PROTO  SOURCE ADDRESS
 FOREIGN ADDRESS           STATE
root     sshd                 536      tcp4   *:22
 *:*                       LISTEN
avahi    avahi-daemon         555      udp4   *:5353
 *:*                       CLOSED
avahi    avahi-daemon         555      udp4   *:58068
 *:*                       CLOSED
root     dhclient             577      udp4   *:68
 *:*                       CLOSED
root     cupsd                774      tcp4   127.0.0.1:631
 *:*                       LISTEN
root     sshd                 1204     tcp4   192.168.1.3:22
 192.168.1.4:4585          ESTABLISHED
root     sshd                 1273     tcp4   192.168.1.3:22
 192.168.1.4:4585          ESTABLISHED
root     sshd                 1311     tcp4   192.168.1.3:22
 192.168.1.4:4592          ESTABLISHED
root     sshd                 1375     tcp4   192.168.1.3:22
 192.168.1.4:4592          ESTABLISHED
root     ping                 1392     raw    *:1
 *:*                       CLOSED
root     snmpd                1411     udp4   *:161
 *:*                       CLOSED


The good news is that snmpd has indeed latched itself to UDP:161. BUT,
the status is shown as "CLOSED". Did I compile it wrong? For reference
here is the configuration file I'm using (created with snmpconf)

> cat snmpd.conf
###########################################################################
#
# snmpd.conf
#
#   - created by the snmpconf configuration program
#

###########################################################################
# SECTION: Access Control Setup
#
#   This section defines who is allowed to talk to your running
#   snmp agent.

# rocommunity: a SNMPv1/SNMPv2c read-only access community name
#   arguments:  community [default|hostname|network/bits] [oid]

rocommunity  public

>

For the sake of legibility, I've removed a lot of blank lines from the
above output.

Anyone have any clues on what could be going on here?

Stumped,
Abraham Varricatt




On Thu, Sep 2, 2010 at 6:14 PM, rakesh zingade <[email protected]> wrote:
> I guess the port 161 is in use .. try with some other port
>
> check using
> # netstat -an | grep 161
> before running snmpd on udp161 ..
>
>
> On Thu, Sep 2, 2010 at 4:44 PM, Abraham Varricatt
> <[email protected]> wrote:
>>
>> I think I'm almost there now. Running your suggestion gave me this,
>>
>> > snmpd -f -Lo -C -c snmpd.conf
>> Error opening specified endpoint ""
>> Server Exiting with code 1
>>
>> I felt that the endpoint needed to get mentioned so,
>>
>> > snmpd -f -Lo udp:161 -C -c snmpd.conf
>> Error opening specified endpoint "udp:161"
>> Server Exiting with code 1
>>
>> I read online about using "sockstat" to see if the port was in-use,
>> but it turns out nothing's running there. A little later I discovered
>> that ports below 1024 are locked out of regular users. So I tried
>> running the above command with sudo (there is no root user in ubuntu)
>> and I get this,
>>
>> > sudo snmpd -f -Lo udp:161 -C -c snmpd.conf
>> snmpd: error while loading shared libraries: libnetsnmpagent.so.20:
>> cannot open shared object file: No such file or directory
>>
>> It's similar to my first problem (different email) but I can't figure
>> out how to get sudo to recognize my "LD_LIBRARY_PATH" variable that I
>> mentioned in my ".bashrc" file.
>>
>> Hints/Help?
>>
>> Even more puzzled,
>> Abraham Varricatt
>>
>> On Thu, Sep 2, 2010 at 4:06 PM, rakesh zingade <[email protected]>
>> wrote:
>> > Try executing snmpd on foreground
>> >
>> > # snmpd -f -Lo -C -c <path for snmpd.conf>
>> >
>> > see if it generate any error message ..
>> >
>> > check for valid config stuff in snmpd.conf.. snmpconf -g basic_setup may
>> > help to configure snmpd.conf
>> >
>> >
>> >
>> > On Thu, Sep 2, 2010 at 3:52 PM, Abraham Varricatt
>> > <[email protected]> wrote:
>> >>
>> >> I've done a compile & install of net-snmp 5.5 according to the
>> >> instructions in INSTALL. How do I start the snmpd agent on my system ?
>> >> (Ubuntu 10.04 running in VirtualBox)
>> >>
>> >> This doesn't work,
>> >>
>> >> > snmpd -c .snmp/snmpd.conf
>> >> > snmpget -v 2c -c private localhost SNMPv2-MIB::sysUpTime.0
>> >> Timeout: No Response from localhost.
>> >>
>> >> In fact, I don't see snmpd anywhere when I try "ps -ae" either !
>> >>
>> >> Puzzled,
>> >> Abraham Varricatt
>> >>
>> >>
>> >>
>> >> ------------------------------------------------------------------------------
>> >> This SF.net Dev2Dev email is sponsored by:
>> >>
>> >> Show off your parallel programming skills.
>> >> Enter the Intel(R) Threading Challenge 2010.
>> >> http://p.sf.net/sfu/intel-thread-sfd
>> >> _______________________________________________
>> >> Net-snmp-users mailing list
>> >> [email protected]
>> >> Please see the following page to unsubscribe or change other options:
>> >> https://lists.sourceforge.net/lists/listinfo/net-snmp-users
>> >
>> >
>> >
>> > --
>> > Rakesh P. Zingade
>> > +919420626099
>> >
>
>
>
> --
> Rakesh P. Zingade
> +919420626099
>

------------------------------------------------------------------------------
This SF.net Dev2Dev email is sponsored by:

Show off your parallel programming skills.
Enter the Intel(R) Threading Challenge 2010.
http://p.sf.net/sfu/intel-thread-sfd
_______________________________________________
Net-snmp-users mailing list
[email protected]
Please see the following page to unsubscribe or change other options:
https://lists.sourceforge.net/lists/listinfo/net-snmp-users
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.