Thx for this solution.

I have made the changement of the link destination on my /etc/init.d/snmpd


Now the file is like this :


set -e

. /lib/lsb/init-functions

export PATH=/usr/local/sbin

test -x /usr/local/sbin/snmpd || exit 0
test -x /usr/local/sbin/snmptrapd || exit 0

# Defaults
export MIBDIRS=/usr/share/mibs/netsnmp
SNMPDRUN=yes
SNMPDOPTS='-Lsd -Lf /dev/null -p /var/run/snmpd.pid'
TRAPDRUN=no
TRAPDOPTS='-Lsd -p /var/run/snmptrapd.pid'

# Reads config file (will override defaults above)
[ -r /etc/default/snmpd ] && . /etc/default/snmpd

# Cd to / before starting any daemons.
cd /

# Create compatibility link to old AgentX socket location
if [ "$SNMPDCOMPAT" = "yes" ] && [ "$1" != status ]; then
  ln -sf /var/agentx/master /var/run/agentx
fi

case "$1" in
  start)
    log_daemon_msg "Starting network management services:"
    if [ "$SNMPDRUN" = "yes" -a -f /etc/snmp/snmpd.conf ]; then
        start-stop-daemon --quiet --start --oknodo --exec /usr/local/sbin/snmpd 
\
            -- $SNMPDOPTS
        log_progress_msg " snmpd"
    fi
    if [ "$TRAPDRUN" = "yes" -a -f /etc/snmp/snmptrapd.conf ]; then
        start-stop-daemon --quiet --start --oknodo --exec 
/usr/local/sbin/snmptrapd \
            -- $TRAPDOPTS
        log_progress_msg " snmptrapd"
    fi
    ;;
  stop)
    log_daemon_msg "Stopping network management services:"
    start-stop-daemon --quiet --stop --oknodo --exec /usr/local/sbin/snmpd
    log_progress_msg " snmpd"
    start-stop-daemon --quiet --stop --oknodo --exec /usr/local/sbin/snmptrapd
    log_progress_msg " snmptrapd"
    ;;
  restart)
    log_daemon_msg "Restarting network management services:"
    start-stop-daemon --quiet --stop --oknodo --exec /usr/local/sbin/snmpd
    start-stop-daemon --quiet --stop --oknodo --exec /usr/local/sbin/snmptrapd
    # Allow the daemons time to exit completely.
    sleep 2
    if [ "$SNMPDRUN" = "yes" -a -f /etc/snmp/snmpd.conf ]; then
        start-stop-daemon --quiet --start --exec /usr/local/sbin/snmpd -- 
$SNMPDOPTS
        log_progress_msg " snmpd"
    fi
   if [ "$TRAPDRUN" = "yes" -a -f /etc/snmp/snmptrapd.conf ]; then
        # Allow snmpd time to start up.
        sleep 1
        start-stop-daemon --quiet --start --exec /usr/local/sbin/snmptrapd -- 
$TRAPDOPTS
        log_progress_msg " snmptrapd"
    fi
    ;;
  reload|force-reload)
    log_daemon_msg "Reloading network management services:"
    if [ "$SNMPDRUN" = "yes" -a -f /etc/snmp/snmpd.conf ]; then
        start-stop-daemon --quiet --stop --signal 1 \
            --pidfile /var/run/snmpd.pid --exec /usr/local/sbin/snmpd
        log_progress_msg " snmpd"
    fi
    ;;
  status)
    status=0
    status_of_proc /usr/local/sbin/snmpd snmpd || status=$?
    status_of_proc /usr/local/sbin/snmptrapd snmptrapd || status=$?
    exit $status
    ;;
  *)
    echo "Usage: /etc/init.d/snmpd 
{start|stop|restart|reload|force-reload|status}"
    exit 1
esac

exit 0


(I have change every /usr/sbin by /usr/local/sbin).


But when I'm doing /etc/init.d/snmpd restart, I got this error :
/etc/init.d/snmpd: 39: ln: not found


That's the line 
if [ "$SNMPDCOMPAT" = "yes" ] && [ "$1" != status ]; then
  ln -sf /var/agentx/master /var/run/agentx
fi


but I don't know how to pass throught it ? simply delete it ?



Cordialement,


Jérôme BELLEGARDE



---------------------------------------------------------------------------

-----Message d'origine-----
De : Dave Shield [mailto:d.t.shi...@liverpool.ac.uk] 
Envoyé : mardi 15 mai 2012 15:52
À : Jérôme BELLEGARDE
Cc : Net-SNMP users
Objet : Re: Problem installing a MIB

    [ First - *please* don't mail me privately, without copying
     any responses to the mailing list.  I don't have the time
     or inclination to offer private, unpaid, SNMP consultancy.
     Keep discussions to the list, where others can both learn
     and offer advice.  Thanks.   ]

On 15 May 2012 13:51, Jérôme BELLEGARDE
<j.bellega...@alpha-direct-services.com> wrote:
> Hey,
>
>>> So the binary was installed into /usr/local/sbin/snmpd - yes?
>
> Yes, inded I have a snmpd file and a snmptrapd file into that folder.

Good.


>>> If you want to query this object, then you need to be running the 
>>> new version of the agent, not the original one.
>
> Ok I get it, so I put the file in right folder (mean I saved 
> /usr/sbin/snmpd, and then I put the file from /usr/local/sbin/ into 
> /usr/sbin/).

No.
What I mean is that you should tweak the /etc/init.d/snmpd script so that it 
runs the binary /usr/local/sbin/snmpd, rather than /usr/sbin/snmpd (And 
similarly for the trap receiver).


Dave

------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
Net-snmp-users mailing list
Net-snmp-users@lists.sourceforge.net
Please see the following page to unsubscribe or change other options:
https://lists.sourceforge.net/lists/listinfo/net-snmp-users

Reply via email to