lost and found ( for me ? )

FreeBSD 9.2: install net-snmp by using ports



# cd /usr/ports/net-mgmt/net-snmp/
# make install clean

clock OK

done!
bin/cat /usr/ports/net-mgmt/net-snmp/work/pkg-message
**** This port installs snmp daemon, header files and libraries but don't
    invokes snmpd by default.
    If you want to invoke snmpd and/or snmptrapd at startup, put these
    lines into /etc/rc.conf.

       snmpd_enable="YES"
       snmpd_flags="-a"
       snmpd_conffile="/usr/local/share/snmp/snmpd.conf /etc/snmpd.conf"
       snmptrapd_enable="YES"
       snmptrapd_flags="-a -p /var/run/snmptrapd.pid"

**** You may specify the following make variables:

       NET_SNMP_SYS_CONTACT="zi@FreeBSD.org"
       NET_SNMP_SYS_LOCATION="USA"
       DEFAULT_SNMP_VERSION=3
       NET_SNMP_MIB_MODULES="host smux mibII/mta_sendmail ucd-snmp/diskio"
       NET_SNMP_LOGFILE=/var/log/snmpd.log
       NET_SNMP_PERSISTENTDIR=/var/net-snmp

    to define default values (or overwriting defaults).  At least
    setting first two variables, you will not be prompted during
    configuration process.  You may also set

       BATCH="yes"

    to avoid interactive configuration.
/bin/mkdir -p /var/agentx
===>   Compressing manual pages for net-snmp-5.7.2_3
===>   Running ldconfig
/sbin/ldconfig -m /usr/local/lib
===>   Registering installation for net-snmp-5.7.2_3
===> SECURITY REPORT:
     This port has installed the following files which may act as network
     servers and may therefore pose a remote security risk to the system.
/usr/local/lib/libnetsnmp.so.30
/usr/local/lib/libnetsnmpagent.so.30

     This port has installed the following startup scripts which may cause
     these network services to be started at boot time.
/usr/local/etc/rc.d/snmpd
/usr/local/etc/rc.d/snmptrapd

     If there are vulnerabilities in these programs there may be a security
     risk to the system. FreeBSD makes no guarantee about the security of
     ports included in the Ports Collection. Please type 'make deinstall'
     to deinstall the port if this is a concern.

     For more information, and contact details about the security
     status of this software, see the following webpage:
http://net-snmp.sourceforge.net/
===>  Cleaning for perl-5.14.4
===>  Cleaning for net-snmp-5.7.2_3
#

edit /etc/rc.conf to boot SNMPD when booting the OS
# tail -4 /etc/rc.conf
snmpd_enable="YES"
snmpd_flags="-a -p /var/run/snmpd.pid"
snmptrapd_enable="YES"
snmptrapd_flags="-a -p /var/run/snmptrapd.pid"

make /usr/local/share/snmp/snmpd.conf
# cd /usr/local/share/snmp/

# cat snmpd.conf
com2sec notConfigUser  default       public
group   notConfigGroup v1           notConfigUser
group   notConfigGroup v2c           notConfigUser
view    systemview    included   .1
access  notConfigGroup ""      any       noauth    exact  systemview systemview none
access MyRWGroup ""      any       noauth    0      all    all    all
syslocation Unknown (edit /etc/snmp/snmpd.conf)
syscontact Root <root@localhost> (configure /etc/snmp/snmp.local.conf)
dontLogTCPWrappersConnects yes
master agentx
agentX Socket /var/agentx/master
trap2sink localhost public

start SNMPD
error..
# /usr/local/etc/rc.d/snmpd start
/usr/local/etc/rc.d/snmpd: ERROR: $snmpd_flags includes -p option. Please use $snmpd_pidfile instead.

edit /etc/rc.conf
# cat /etc/rc.conf

#snmpd_enable="YES"
#snmpd_flags="-a -p /var/run/snmpd.pid"
#snmptrapd_enable="YES"
#snmptrapd_flags="-a -p /var/run/snmptrapd.pid"

snmpd_enable="YES"
snmpd_flags="-a"
snmpd_conffile="/usr/local/share/snmp/snmpd.conf /etc/snmpd.conf"
snmptrapd_enable="YES"
snmptrapd_flags="-a -p /var/run/snmptrapd.pid"

start SNMPD.
other errors.
# /usr/local/etc/rc.d/snmpd start
/usr/local/etc/rc.d/snmpd: ERROR: snmpd configuration file /etc/snmpd.conf not found.

copy snmpd.conf to /etc
# cp /usr/local/share/snmp/snmpd.conf /etc/snmpd.conf

# /usr/local/etc/rc.d/snmpd start
Starting snmpd.

# netstat -an | grep 161
udp4       0      0 *.161                  *.*

run snmpwalk
# snmpwalk -v 2c -c public 127.0.0.1 . | head -10
SNMPv2-MIB::sysDescr.0 = STRING: FreeBSD bsd01.localdomain 9.2-RELEASE FreeBSD 9.2-RELEASE #0 r255898: Thu Sep 26 22:50:31 UTC 2013     root@bake.isc.freebsd.org:/usr/obj/usr/src/sys/GENERIC amd64
SNMPv2-MIB::sysObjectID.0 = OID: NET-SNMP-MIB::netSnmpAgentOIDs.8
DISMAN-EVENT-MIB::sysUpTimeInstance = Timeticks: (11611) 0:01:56.11
SNMPv2-MIB::sysContact.0 = STRING: Root <root@localhost> (configure /etc/snmp/snmp.local.conf)
SNMPv2-MIB::sysName.0 = STRING: bsd01.localdomain
SNMPv2-MIB::sysLocation.0 = STRING: Unknown (edit /etc/snmp/snmpd.conf)
SNMPv2-MIB::sysServices.0 = INTEGER: 72
SNMPv2-MIB::sysORLastChange.0 = Timeticks: (2) 0:00:00.02
SNMPv2-MIB::sysORID.1 = OID: SNMP-MPD-MIB::snmpMPDCompliance
SNMPv2-MIB::sysORID.2 = OID: SNMP-USER-BASED-SM-MIB::usmMIBCompliance

No comments:

Post a Comment

Note: Only a member of this blog may post a comment.