Akamit Blog

Enterprise sysadmin's blog

  • You are here: 
  • Home
  • Nagios

Creating Net-SNMP 5.5 package for Solaris 10

Posted on July 6th, 2010

Recently I’ve discovered a bug in net-snmp version 5.4, which I’ve downloaded from sunfreeware. So as there was no most recent version of net-snmp package I’ve decided to build it myself.
First, unpack the source, configure and install it into some location, for example in this case it will be
/soft/build/net-snmp/sparc

gunzip -cd net-snmp-5.5.tar.gz | tar xf -
./configure --prefix=/soft/build/net-snmp/sparc/usr/local \
--execprefix=/soft/build/net-snmp/sparc/usr/local
make
make install

Create smf starter script

#!/bin/sh
. /lib/svc/share/smf_include.sh
 
# Start processes required for snmpd
 
if [ -x /usr/local/sbin/snmpd ]; then
  /usr/local/sbin/snmpd
else
  echo "snmpd is missing or not executable."
  exit $SMF_EXIT_ERR_CONFIG
fi
 
exit $SMF_EXIT_OK

and place it in there too

mkdir -p /soft/build/net-snmp/sparc/lib/svc/method
cp svc-net-snmp /soft/build/net-snmp/sparc/lib/svc/method

Next, create some dir and place these file into it

Makefile
depend
postinstall
preremove

Makefile:

all:
        echo "i pkginfo" > prototype
        echo "i postinstall" >> prototype
        echo "i preremove" >> prototype
        echo "i depend" >> prototype
        echo PKG=NetSNMP-5-5-sol10-sparc > pkginfo
        echo NAME=NetSNMP package >> pkginfo
        echo ARCH=sparc >> pkginfo
        echo VERSION=5.5 >> pkginfo
        echo CATEGORY=system >> pkginfo
        echo BASEDIR=/usr/local >> pkginfo
        echo PSTAMP=\"`date '+%m/%d/%Y'`\" >> pkginfo
        pkgproto /soft/build/net-snmp/sparc=/ >> prototype
        pkgmk -o -b / -r /
        pkgtrans /var/spool/pkg  NetSNMP-5.5-sol10-sparc.pkg NetSNMP-5-5-sol10-sparc

depend:

P SMCossl OpenSSL
P SMClgcc346 libgcc

postinstall:

#!/bin/sh
 
cat >/tmp/snmp.xml<<EOF
<?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>
EOF
 
svccfg import /tmp/snmp.xml
svcadm enable net-snmp
rm /tmp/snmp.xml

preremove:

svcadm disable -s net-snmp
svccfg delete net-snmp

Next, make the package.

Filed under Nagios, Packages | No Comments »

Monitoring server overheat with ipmitool

Posted on June 22nd, 2010

Recently I was faced with sudden night Sun x4600 server shutdown. Investigation reveals that there was an conditioning failure and machine goes down on its own. I dig into logs and found that the shutdown was initiated by server’s system controller. Excerpt from the log follows:

System ACPI Power State : sys.acpi : S5/G2: soft-off
Power Supply : ps1.pwrok : State Deasserted
Power Supply : ps3.pwrok : State Deasserted
Power Supply : ps2.pwrok : State Deasserted
Temperature : p2.t_amb : Upper Non-recoverable going high : reading 46 > threshold 45 degrees C
Hot removal of /SYS/PS0
Entity Presence : ps0.prsnt : Device Absent
Processor : p0.cardfail : State Asserted
Temperature : p0.t_amb : Upper Critical going high : reading 39 > threshold 38 degrees C
Processor : p3.cardfail : State Asserted
Temperature : p3.t_amb : Upper Critical going high : reading 39 > threshold 38 degrees C
Processor : p1.cardfail : State Asserted
Temperature : p1.t_amb : Upper Critical going high : reading 39 > threshold 38 degrees C
Processor : p2.cardfail : State Asserted
Temperature : p2.t_amb : Upper Critical going high : reading 39 > threshold 38 degrees C

This nagios plugin for monitoring server overheat with ipmi will get me informed about that kind of event in the future and eliminate unexpected downtime.

Filed under Plugins, Sun Hardware | No Comments »

Monitoring HDS AMS storage with nagios using SNMP protocol

Posted on June 16th, 2010

We are going to get rid of HDS proprietary hi-track software and use industry standard SNMP protocol to monitor Hitachi midrange storage systems. NMS of choice will be Nagios. There are 2 ways of snmp monitoring in general and both are supported by Nagios. Your required to configure your storage system’s SNMP agent and specify SNMP community and SNMP trap destination. When done, check if it is working by executing check_snmp plugin.

# ./check_snmp -H ams-ctl0 -C public -o sysDescr.0 -P 1
SNMP OK - HITACHI  DF600F           Ver 0781/A-M |

Ok, you done with SNMP agent configuration, lets begin configure SNMP manager, i.e. Nagios.

1.  Active monitoring using plugin executing SNMP GET request for some OID. Here is a small Hitachi AMS storage monitoring nagios plugin which will do the task. It is ready for run with nagios embedded perl interpreter (ePN).

2. Passive monitoring using SNMP traps handling.
First, we need to install NetSNMP project’s snmptrapd daemon and point it to the program which will be handling all the traps coming in. We choose to run snmptt on every trap event. snmptrapd configuration will look like:

traphandle default /usr/sbin/snmptt
disableAuthorization yes
donotlogtraps  yes

Next, we configure snmptt iteslf to give it some understanding of what to do on receiving traps. Open snmptt.ini config and create section [TrapFiles]:

[TrapFiles]
snmptt_conf_files = <<END
/usr/local/etc/snmptt.conf.AMS500
END

Next, create snmptt.conf.AMS500 by running snmpttconvertmib tool on dfraid.mib which resides on AMS500 SNMP CD.

# export PATH=$PATH:/usr/local/bin
# snmpttconvertmib --in=dfraid.mib \
> --out=/usr/local/etc/snmptt.conf.AMS500 \
> --exec='/usr/local/nagios/libexec/eventhandlers/submit_check_result $r TRAP 1'

snmpttconvertmib calls snmptranslate from NetSNMP package not using full path, so you should correct your path to include directory in which snmptranaslate resides. Next, we define TRAP service.
nagios templates.cfg:

define service {
   name                    snmptrap
   use                     generic-service
   register                0
   service_description     TRAP
   is_volatile             1
   max_check_attempts      1
   normal_check_interval   1
   retry_check_interval    1
   passive_checks_enabled  1
   check_period            none
   check_command           check-host-alive
   notification_interval   31536000
}

And we use this template when defining actual services like this:

define service{
        use                             snmptrap,alltime_sms
        host_name                   amsctl0
        }

alltime_sms is a host template with defined contact groups, having sms targets in it.

Summary: storage sends trap, snmptrapd daemon handle it by calling snmptt trap handler, snmptt then calls submit_check_result script to submit passive check result to nagios. Nagios dispatches this submission to corresponding host service and takes appropiate action.

Filed under Nagios, Plugins, Storage | No Comments »

Graphing nagios trends with cacti

Posted on April 5th, 2010

1. Brief overview
The system will be comprised of nagios server, which collects performance data and generates alerts and the
graphing software which takes performance data and displays nice looking trend pictures.
Nagios + Cacti System Schema
2. Installing cacti (http://www.cacti.net)
Cacti is a Apache+PHP+Mysql driven application. First, you need to intall
1) apache web server
2) mysql database
3) all graphics libraries
4) RRDtool
5) apache php module
3. Deploying nagios2cacti (http://code.google.com/p/nagios2cacti/)

Exact sequence of steps needed to achieve this depends on OS you are using

Filed under Nagios | No Comments »

Monitoring Sun A1000 Array with nagios and nrpe

Posted on January 21st, 2010

I’ve got legacy Sun E3500 system with Sun A1000 array. It runs Solaris 8. This is how this array could be monitored using nagios NMS.
Read the rest of this entry »

Filed under Plugins, Storage, Sun Hardware | No Comments »

Monitoring correctable memory errors

Posted on January 20th, 2010

If you have Sun Fire server, from time to time you can see that kernel trying to notify you about correctable memory errors. If there are too many errors on a memory module, the kernel removes corresponding physical page from service. If too many pages were removed then dimm must be replaced. You like to monitor CE errors and DIMM status so that you could proactively react on these events.
Read the rest of this entry »

Filed under Plugins, Sun Hardware | No Comments »