SunSNMP

From My Admin Page
Jump to: navigation, search

Configure SNMP

The SMF service that SNMP runs from is SMA

  • SMA is started by the script /lib/svc/method/svc-sma
  • The SNA script uses /etc/sma/snmp/snmpd.conf. You will need to edit this.
  1. Change the line: #DISABLE=YES to #DISABLE=NO
  2. comment out rwcommunity line
  3. change the rocommunity password to either the sitewide community password or to something other than public
  4. restart SNMP: svcadm restart sma

There is also the SMF service SNMPDX

  • similar to above, but uses /etc/snmp/conf/snmpd.conf.

Setup NET-SNMP

(from here) The snmp daemon in Solaris doesn't support 64-bit counters, so you should compile net-snmp:

./configure --prefix=/usr/local --enable-mfd-rewrites '--with-mib-modules=host ucd-snmp/diskio' \
  --disable-embedded-perl --with-sys-contact="syscom@csclub.uwaterloo.ca" --with-sys-location="MC 3015" \
  --with-default-snmp-version=3 --with-logfile="/var/log/snmpd.log" --with-persistent-directory="/var/net-snmp"
* In include/net-snmp/system/solaris.h add '#define NEW_MIB_COMPLIANT 1' to the bottom.
make; make install

Create /tmp/net-snmp.xml:

<?xml version="1.0"?>
<!DOCTYPE service_bundle SYSTEM "/usr/share/lib/xml/dtd/service_bundle.dtd.1">
<service_bundle type='manifest' name='net-snmp'>
  <service name='system/net-snmp' type='service' version='1'>
    <create_default_instance enabled='false' />
    <single_instance/>
    <dependency name='milestone' grouping='require_all' restart_on='none' type='service'>
      <service_fmri value='svc:/milestone/sysconfig' />
    </dependency>
    <dependency name='filesystem' grouping='require_all' restart_on='none' type='service'>
      <service_fmri value='svc:/system/filesystem/local' />
    </dependency>
    <dependency name='name-services' grouping='require_all' restart_on='none' type='service'>
      <service_fmri value='svc:/milestone/name-services' />
    </dependency>
    <dependent name='net-snmp_single-user' grouping='optional_all' restart_on='none'>
      <service_fmri value='svc:/milestone/multi-user' />
    </dependent>
    <exec_method type='method' name='start' exec='/lib/svc/method/svc-net-snmp' timeout_seconds='60' />
    <exec_method type='method' name='stop' exec=':kill' timeout_seconds='60' />
    <exec_method type='method' name='refresh' exec=':kill -HUP' timeout_seconds='60' />
    <property_group name='general' type='framework'>
      <propval name='action_authorization' type='astring' value='solaris.smf.manage.net-snmp' />
    </property_group>
    <stability value='Unstable' />
    <template>
      <common_name>
        <loctext xml:lang='C'>net-snmp</loctext>
      </common_name>
      <documentation>
        <manpage title='net-snmp' section='1M' manpath='/usr/share/man' />
      </documentation>
    </template>
  </service>
</service_bundle>

Import the manifest:

svccfg import /tmp/net-snmp.xml

Create /lib/svc/method/svc-net-snmp:

#!/bin/sh
. /lib/svc/share/smf_include.sh

# Start processes required for snmpd

if [ -x /usr/local/sbin/snmpd ]; then
  /usr/local/sbin/snmpd -c /etc/snmp/conf/snmpd.conf
else
  echo "snmpd is missing or not executable."
  exit $SMF_EXIT_ERR_CONFIG
fi

exit $SMF_EXIT_OK

Set the permissions:

chown root:bin /lib/svc/method/svc-net-snmp
chmod 555 /lib/svc/method/svc-net-snmp