DNS 325 - Funplug 0.7 : Supervise your NAS thru SNMP

Contents[Hide]

dropcap-dns325-snmp

If you own a DNS-325, you may have noticed that there is no simple way to supervise it.

Hopefully, thanks to funplug and to Mijzelf repository, it is possible to install Net-SNMP on this NAS.

Once it is installed, your DNS-325 becomes a fully featured SNMP device. A lot of possibilities are then opened in term of management and supervision.

This article explains how to setup an operational net-SNMP agent on a DNS-325 NAS running funplug.

This will allow you to supervise your DNS-325 thru SNMP with supervision softwares like Nagios, Munin, ...

A pre-requisite is to have have fully prepared your DNS-325 with fun_plug 0.7 and adds-on.

Even if not tested, this procedure should also be compatible with DNS-320 devices.

1. Install SNMP agent

In console mode, you can easily install the net_snmp package provided by mijzelf repository.

# slacker -a net_snmp

Just select the package and install it.

2. Create configuration files

Next step is to declare a default configuration file /ffp/etc/snmpd.conf for the new Net-SNMP agent.

Minimum data are :

  • rocommunity : read-only community name (usualy public)
  • syslocation : device information or location
  • syscontact : administration email contact

/ffp/etc/snmpd.conf

rocommunity     public
syslocation     DNS-325
syscontact      "This email address is being protected from spambots. You need JavaScript enabled to view it."

# wget --no-check-certificate -O /ffp/etc/snmpd.conf https://raw.githubusercontent.com/NicolasBernaerts/dns325-scripts/master/snmp/snmpd.conf

You just have to replace parameters according to your own setup.

When you install net_snmp package, no startup script is declared. So, we have to create a /ffp/start/snmpd.sh startup script, that will follow funplug startup script format.

Once the script is declared, we must start the snmpd daemon.

/ffp/start/snmpd.sh

#!/ffp/bin/sh
#
# SNMP agent startup script
#
# Installation instructions are available at
# http://bernaerts.dyndns.org/nas/313-dns325-ffp7-supervise-snmp-agent
#
# History :
#  25/06/2014, V1.0 - Creation by N. Bernaerts

# PROVIDE: snmpd
# REQUIRE: LOGIN


conf_file=/ffp/etc/snmpd.conf
pid_file=/ffp/var/run/snmpd.pid

snmpd_flags="-A -p $pid_file -a -c $conf_file"

snmpd_start()
{
  if [ ! -r "$conf_file" ]; then
    echo "Error: Missing config file $conf_file"
    exit 1
  fi

  echo "Starting /ffp/sbin/snmpd $snmpd_flags"
  /ffp/sbin/snmpd $snmpd_flags
}

snmpd_stop()
{
  if [ -r "$pid_file" ]; then
    kill $(cat $pid_file) 2>/dev/null
  fi
}

snmpd_status()
{
  if [ -r $pid_file ]; then
    snmpd_pid=$(cat $pid_file)
    if pidof snmpd | grep -wq $snmpd_pid; then
      echo "snmpd running: $snmpd_pid"
    else
      echo "snmpd not running ($pid_file stale)"
    fi
  else
    echo "snmpd not running"
  fi
}

case "$1" in
start)
  snmpd_start
  ;;
stop)
  snmpd_stop
  ;;
restart)
  snmpd_stop
  sleep 1
  snmpd_start
  ;;
status)
  snmpd_status
  ;;
*)
  echo "Usage: $(basename $0) start|stop|restart|status"
  exit 1
  ;;
esac

# wget --no-check-certificate -O /ffp/start/snmpd.sh https://raw.githubusercontent.com/NicolasBernaerts/dns325-scripts/master/snmp/snmpd.sh
# chmod +x /ffp/start/snmpd.sh
# /ffp/start/snmpd.sh start

Your DNS-325 Net-SNMP daemon is now running.

It should start automatically at every boot.

3. Test the DNS-325 new SNMP MIB

You can now test your DNS-325 SNMP MIB from any computer connected on the network :

# snmpwalk -v1 -cpublic your.dns.325.ip 2>/dev/null
iso.3.6.1.2.1.1.1.0 = STRING: "Linux NAS-FTO 2.6.22.18 #15 Wed May 25 15:23:11 CST 2011 armv5tejl"
iso.3.6.1.2.1.1.2.0 = OID: iso.3.6.1.4.1.8072.3.2.10
iso.3.6.1.2.1.1.3.0 = Timeticks: (7865354) 21:50:53.54
iso.3.6.1.2.1.1.4.0 = STRING: "\"This email address is being protected from spambots. You need JavaScript enabled to view it.\""
iso.3.6.1.2.1.1.5.0 = STRING: "NAS"
iso.3.6.1.2.1.1.6.0 = STRING: "DNS-325"
iso.3.6.1.2.1.1.8.0 = Timeticks: (3) 0:00:00.03
iso.3.6.1.2.1.1.9.1.2.1 = OID: iso.3.6.1.6.3.11.3.1.1
iso.3.6.1.2.1.1.9.1.2.2 = OID: iso.3.6.1.6.3.15.2.1.1
iso.3.6.1.2.1.1.9.1.2.3 = OID: iso.3.6.1.6.3.10.3.1.1
iso.3.6.1.2.1.1.9.1.2.4 = OID: iso.3.6.1.6.3.1
iso.3.6.1.2.1.1.9.1.2.5 = OID: iso.3.6.1.2.1.49
iso.3.6.1.2.1.1.9.1.2.6 = OID: iso.3.6.1.2.1.4
iso.3.6.1.2.1.1.9.1.2.7 = OID: iso.3.6.1.2.1.50
iso.3.6.1.2.1.1.9.1.2.8 = OID: iso.3.6.1.6.3.16.2.2.1
iso.3.6.1.2.1.1.9.1.2.9 = OID: iso.3.6.1.6.3.13.3.1.3
iso.3.6.1.2.1.1.9.1.2.10 = OID: iso.3.6.1.2.1.92
iso.3.6.1.2.1.1.9.1.3.1 = STRING: "The MIB for Message Processing and Dispatching."
iso.3.6.1.2.1.1.9.1.3.2 = STRING: "The management information definitions for the SNMP User-based Security Model."
iso.3.6.1.2.1.1.9.1.3.3 = STRING: "The SNMP Management Architecture MIB."
iso.3.6.1.2.1.1.9.1.3.4 = STRING: "The MIB module for SNMPv2 entities"
iso.3.6.1.2.1.1.9.1.3.5 = STRING: "The MIB module for managing TCP implementations"
...

Your favorite monitoring tool should now give you some interesting activity graphs.

Here is a munin example of ethernet port monitoring :

dns325-snmp egiga-day

 

Hope it helps.

Signature Technoblog

This article is published "as is", without any warranty that it will work for your specific need.
If you think this article needs some complement, or simply if you think it saved you lots of time & trouble,
just let me know at This email address is being protected from spambots. You need JavaScript enabled to view it.. Cheers !

icon linux icon debian icon apache icon mysql icon php icon piwik icon googleplus