memetic dot org

Monitoring the Raspberry Pi with Observium

by on Jul.18, 2012, under Linux, Observium, Raspberry Pi, SNMP

I imagine a lot of people will be using their Raspberry Pis as low-power servers, perhaps file servers, web servers or just somewhere to ssh to to run an irssi session in tmux! Servers though, need monitoring and statistics. The Raspberry Pi’s resources are a little limiting, so you might not want to run Munin, Collectd on the device itself, but rather monitor it remotely with SNMP. As the leader of the Observium project, what else would I use?

Observium showing a Raspberry Pi

Observium showing a Raspberry Pi

Observium provides a pretty interface to a slew of statistics about your server including CPU, memory and disk usage, load average, network traffic and errors, number of users and processes, system swap i/o, per-disk i/o and disk operations. For the purposes of the Raspberry Pi we won’t use the Agent, which would provide a little more information but might be too heavy for the Pi.

Particularly of interest for the Pi will be how often it uses its swap file and the CPU utilisation.

To monitor a device you need an SNMP daemon to collect statistics and report them back to the central Observium installation, and Linux we use net-snmp.

apt-get install snmpd

We need to download the Observium distro script and move it to /usr/bin

wget http://www.observium.org/svn/observer/trunk/scripts/distro
mv distro /usr/bin
chmod 755 /usr/bin

We need to create a configuration file at /etc/snmp/snmpd.conf

com2sec readonly default #COMMUNITY#
group MyROGroup v1 readonly
group MyROGroup v2c readonly
group MyROGroup usm readonly
view all included .1 80
access MyROGroup “” any noauth exact all none none
syslocation #LOCATION#
syscontact #CONTACT#

#This line allows Observium to detect the host OS if the distro script is installed
extend .1.3.6.1.4.1.2021.7890.1 distro /usr/bin/distro

Replace #COMMUNITY# with a secret string and #LOCATION# and #CONTACT# with sensible values for your Pi.

Also change the SNMPDOPTS in /etc/default/snmpd to match this:

SNMPDOPTS=’-Lsd -Lf /dev/null -u snmp -g snmp -p /var/run/snmpd.pid’

Restart snmpd:

/etc/init.d/snmpd restart

You’re now ready to add the Raspberry Pi to an Observium installation.

If you’d like to monitor your Raspberry Pi but don’t have anywhere to run the monitoring software, I’ve set up a communal Observium instance at http://raspberrypi.observium.org. If you’d like to add your Raspberry Pi to it, contact me! You’ll need to have either a static IP or a hostname pointed at your dynamic IP. If your Pi is behind NAT you’ll need to forward SNMP (UDP port 161) to it and allow the Observium server (46.105.127.13) to access this port.


16 Comments for this entry

  • Job

    Hi Adama,

    I see a small mistake in your suggested snmpd.conf:

    You state: “com2sec readonly #COMMUNITY# default”

    But it should be the other way around “com2sec readonly default #COMMUNITY#”

    • adama

      Thanks Job! WordPress helpfully removed the originals i used because of the <>, i must have replaced the community in the wrong place!

  • Leigh

    The topically applied medication is waterproof and easy to apply.
    In umteen cases, things in the close surround can lever an
    asthma criticise, especially junk and smoke. With organic pest control , everyone comes out a winner.

  • Jancis

    Thanks a lot! Small correction needed tho’:

    chmod 755 /usr/bin
    should be
    chmod 755 /usr/bin/distro

  • mcgyver83

    I followed this guide but when I run

    /etc/init.d/snmpd restart

    this is the output

    /etc/init.d/snmpd: 12: /etc/default/snmpd: -Lf: not found

    I also don’t need to create /etc/snmp/snmpd.conf beacuse is already present, I added at the end the lines suggested.
    What happen?

  • mcgyver83

    Another thing: how can I contact you to add my raspberry to your Observium instance?

  • Matthew Bingham

    Hey great product. I have it up and running except one thing. The CPU graphs are not displaying but everything else appears to be fine and looks great. Anything I can dig into to determine what might be causing this. Thanks and again great web app.

  • Matthew Bingham

    Just wanted to let you know. All is working now.

    current setup:

    CentOS 6.3
    Observium 3403
    Apache 2.2.15 (Centos0
    php 5.3.3
    MySql 5.1.61
    RRD Tool 1.3.8

  • Guilmxm

    Hi,

    Thanks for your tuto, a small mistake through:

    “chmod 755 /usr/bin” is missing “distro”

  • Mikkel

    Any ideas why this works fine on the latest debian 7 but im missing the entire processors/cpu section?

  • PG

    Looks like the demo account doesn’t work….did someone change the password?

  • Matthijs

    Hi,

    How can I contact you to add my Raspberry Pi?

    Kind regards,

    Matthijs

  • Wooley

    Hey,
    trying to install SNMPD on my latest Raspbian image and it appears that like mcgyver83 explained above. It appears to fail to find that directory and it even appears that the install fails too. With errors, I even tried aptitude remove snmpd && aptitude install snmpd

    Errors were encountered while processing:
    snmpd
    E: Sub-process /usr/bin/dpkg returned an error code (1)
    A package failed to install. Trying to recover:

    So now I am totally loss, my Linux powers of awesomeness are quite weak.

    help pls,

    • Wooley

      I reloaded Raspbian from my image backup.
      I followed the steps again and I did not see an error after installing snmp, yet still when I go to

      /etc/init.d/snmpd restart
      /etc/init.d/snmpd: 11: /etc/default/snmpd: -Lf: not found

      What am I doing wrong?

  • BHUNESHWAR PRASAD

    Hey,

    Great Post.
    Could you help in creating a dummy account so that i can add my raspberry pi.

    Thanks

Leave a Reply

Looking for something?

Use the form below to search the site:

Still not finding what you're looking for? Drop a comment on a post or contact us so we can take care of it!

Blogroll

A few highly recommended websites...

Archives

All entries, chronologically...