wview Weather Station On The Raspberry Pi 2

RaspiWviewWview is weather station software used to collect, store, process, and publish weather data from a hardware based weather station. Wview is open source and Unix based so there are versions for Linux, BSD, Mac OSX, and more.

The NetCodger has been running wview on an old Linux PC for about three years, collecting data from a Davis Vantage Vue weather station. Wview has proven to be very powerful, reliable, and very customizable. Though customization does take a lot of work.

In the course of testing the newly released Raspberry Pi 2, the NetCodger sought to move his present wview installation over to a Raspberry Pi 2 to see if the Pi was up to the task. Not to mention free up some office space and reduce the electric bill.As it turns out the Raspberry Pi 2 can run wview with ease. CPU and memory use were minimal on the Raspberry Pi 2 while running wview.

Wview, like so many other software packages, assumes that it will be run with an Apache 2 webserver. The NetCodger is confident that the Raspberry Pi 2 could manage wview and Apache 2. But, he feels that the memory use and overall “weight” of Apache 2 is just unwarranted on a resource constrained device like the Raspberry Pi and instead opted to use the Lighttpd webserver to replace Apache 2.

Unrealeted to the webserver, there were performance issues on the Raspberry Pi 2 with a feature of wview that regenerates Hi/Low data records at startup if the Hi/Low database is missing or corrupted. Hi/Low regeneration can take a long time and the wview documentation warns of this. This is true of any system, but on the Pi it was taking more than 30 seconds per week’s worth of records. This meant that to regenerate from a three year data set of over 200,000 records it took well over an hour on the Raspberry Pi 2. That’s a very long startup. The need for such regeneration shouldn’t happen often, if ever, but it has been known to happen and this lengthy process is a cause for codgerly concern.

In an effort to reduce disk writes on the Raspberry Pi’s micro SD flash card and in hopes of speeding up wview’s Hi/Low regeneration, the NetCodger implemented a RAM disk and set up wview to store the Hi/Low Sqlite3 database(wview-hilow.sdb) and some other frequently changed files there. An init script to save the data to persistent storage on shutdown and load data from persistent storage on startup was also implemented. This significantly reduces the disk writes to the micro SD card, but regeneration performance was not improved. This perplexes the NetCodger.

Overall, wview is a fine choice for weather station software and wview runs very well on the Raspberry Pi 2. If you’d like to try it for yourself, the NetCodger has provided the following Bash script to quickly update a new Rasbian OS install, install wview, and create the RAM disk and startup environment for wview. There’s also a second optional script that can be used to import data from an existing wview installation, if you choose to retire your existing system. To use it, save it in a file on your Raspberry Pi. Make sure to make the file executable with the sudo chmod +x installWview.sh command and then run the file with sudo ./installWview.sh

installWview.sh

#!/bin/bash

# installWview.sh
#
# Script to install WView weather station software on new Rapsberry Pi.
#  This script is not meant to be used on an already configured system. 
#  This script could overwrite or break an existing confgiuration.
#
#    By NetCodger 3/27/2015
#


# Make sure this script only runs on a Raspberry Pi.
if ! uname -a | grep "raspberrypi"; then
     echo "This script is meant to only run on a Raspberry Pi."
     echo "This does not appear to be a Raspberry Pi."
     read -n 1 -p "Pres any key exit"
     exit -1
fi


# Make sure that we are root
 if [ $(id -u) != 0 ]; then
     echo "Insufficient privilege to execute this script."
     echo 
     echo "Please re-run the script with sudo installWView.sh"
     read -n 1 -p "Pres any key exit"
     exit -1
fi



# Are you sure?
echo "This script is for installing WView on a new Raspberry Pi installatoin."
echo "Installing on an already configured system could destroy any previous modifications."

read -p "Are you sure you want to continue? (y/n)" -n 1 -r
echo    # (optional) move to a new line
if [[ ! $REPLY =~ ^[Yy]$ ]]; then
    exit 1
fi


# Update /etc/apt/sources.list to include download location for Wview software, if it does not already exist.
if ! grep -Fxq "deb http://www.wviewweather.com/apt/wheezy wheezy main" /etc/apt/sources.list; then
     echo "deb http://www.wviewweather.com/apt/wheezy wheezy main" >> /etc/apt/sources.list
     echo "deb-src http://www.wviewweather.com/apt/wheezy wheezy main" >> /etc/apt/sources.list
fi


# Update installed Raspbian(Debian) software.
apt-get update
apt-get --assume-yes --force-yes upgrade


# Update Pi firmware.
rpi-update


# Prompt user to set timezone as necessary.
dpkg-reconfigure tzdata


# Install web server and PHP
apt-get --no-install-recommends --assume-yes --force-yes --fix-missing install lighttpd

apt-get --no-install-recommends --assume-yes --force-yes --fix-missing install php5 php5-sqlite php5-cgi


# Configure lighttpd to enable PHP
if ! grep -Fxq '.php" => "/usr/bin/php5-cgi' /etc/lighttpd/conf-enabled/10-cgi-php.conf; then
     echo 'server.modules += ("mod_cgi")' >> /etc/lighttpd/conf-enabled/10-cgi-php.conf
     echo ' cgi.assign = (".php" => "/usr/bin/php5-cgi")' >> /etc/lighttpd/conf-enabled/10-cgi-php.conf
fi

lighttpd-enable-mod fastcgi fastcgi-php


# Install WView weather station software.(But without installing Apache2.)
apt-get --no-install-recommends --assume-yes --force-yes --fix-missing install wview apache2-


# Create simlinks manually, since WView only does it for Apache2.
cd /var/www
ln -s /var/lib/wview/img weather
ln -s /var/lib/wviewmgmt wviewmgmt

cd /var/lib/wviewmgmt
ln -s system_status.php index.php


# Adjust fille permissions.
# Make wview config files writable for http user.
chmod 777 /etc/wview
chmod 666 /etc/wview/wview-conf.sdb
chmod 666 /etc/wview/wview-binary

# Create a ramdisk for Hi Low data.
# Saves SD card write cycles and
# speeds up Hi Low regeneration.
if ! grep -Fxq "tmpfs           /wviewtmp          tmpfs   defaults,mode=0755,size=30m 0       0" /etc/fstab; then
     mkdir /wviewtmp
     echo "tmpfs           /wviewtmp          tmpfs   defaults,mode=0755,size=30m 0       0" >> /etc/fstab
     mount -a
fi


# Create persistent data store. Needed due to ramdisk.
mv /var/lib/wview/archive /var/lib/wview/archive-persistent
mv /var/lib/wview/img /var/lib/wview/img-persistent


# Link database files so that WView can find them.
if [ ! -d /var/lib/wview/archive ]; then 
     mkdir /var/lib/wview/archive
     
     cat > /var/lib/wview/archive/README-IMPORTANT << 'EOT1'
      Due to the use of a ramdisk for the /wviewtmp directory 
      this directory should contain the following soft links.
     
      ln -s /var/lib/wview/archive-persistent/wview-archive.sdb /var/lib/wview/archive/wview-archive.sdb
      ln -s /var/lib/wview/archive-persistent/wview-archive.sql /var/lib/wview/archive/wview-archive.sql
      ln -s /var/lib/wview/archive-persistent/wview-history.sdb /var/lib/wview/archive/wview-history.sdb
      ln -s /var/lib/wview/archive-persistent/wview-noaa.sdb /var/lib/wview/archive/wview-noaa.sdb
      ln -s /wviewtmp/wview-hilow.sdb /var/lib/wview/archive/wview-hilow.sdb

EOT1

     ln -s /var/lib/wview/archive-persistent/wview-archive.sdb /var/lib/wview/archive/wview-archive.sdb
     ln -s /var/lib/wview/archive-persistent/wview-archive.sql /var/lib/wview/archive/wview-archive.sql
     ln -s /var/lib/wview/archive-persistent/wview-history.sdb /var/lib/wview/archive/wview-history.sdb
     ln -s /var/lib/wview/archive-persistent/wview-noaa.sdb /var/lib/wview/archive/wview-noaa.sdb
     ln -s /wviewtmp/wview-hilow.sdb /var/lib/wview/archive/wview-hilow.sdb
     
     ln -s /wviewtmp/img /var/lib/wview/img
fi



# Create a service script that copies wview-hilow.sdb on startup or shutdown.
cat > /etc/init.d/tmpfsToPersistent << 'EOT2'
#! /bin/bash
# /etc/init.d/tmpfsToPersistent

### BEGIN INIT INFO
# Provides:          tmpfsToPersistent
# Required-Start:    $local_fs $network $time $syslog ntp
# Required-Stop:     $local_fs $network $time $syslog ntp
# Default-Start:     2 3 4 5
# Default-Stop:      0 1 6
# Short-Description: Script to save data at shutdown.
# Description:       Copies wview database from persistent to tmpfs at start and vice versa at shutdown.
### END INIT INFO


case "$1" in
  start)
    echo "Starting copy /var/lib/wview/archive-persistent/wview-hilow.sdb to /wviewtmp/wview-hilow.sdb a tmpfs location."
    if mount | grep "tmpfs on /wviewtmp" > /dev/null; then
       cp -a /var/lib/wview/archive-persistent/wview-hilow.sdb /wviewtmp/
       cp -ar /var/lib/wview/img-persistent/ /wviewtmp/img/
    else
       echo "/wview not mounted on tmpfs"
    fi
    ;;
  stop)
    echo "Stopping copying /wviewtmp/wview-hilow.sdb to persistent storage"
    cp -a /wviewtmp/wview-hilow.sdb /var/lib/wview/archive-persistent/
    cp -ar /wviewtmp/img/* /var/lib/wview/img-persistent/
    ;;
  *)
    echo "Usage: /etc/init.d/tmpfsToPersistent {start|stop}"
    exit 1
    ;;
esac

exit 0  

EOT2

chmod 755 /etc/init.d/tmpfsToPersistent

update-rc.d tmpfsToPersistent defaults 10 50


# Setup automatic WView service start/stop
sed -i 's#$local_fs $network $time $syslog#$local_fs $network $time $syslog tmpfsToPersistent#' /etc/init.d/wview

update-rc.d wview defaults 90 10

# Reboot and begin configuration of WView.
echo
echo "----------------------------------"
echo "Reboot Raspberry Pi and begin using Wview?"
echo "See WView manual about wviewconfig."
echo
echo "Choose NO if you plan to run the RestoreWview script to import prior data."
echo
read -p "Press y to reboot and n to exit" -n 1 -r
echo    # (optional) move to a new line
if [[ $REPLY =~ ^[Yy]$ ]]; then
    reboot
fi

RestoreWview.sh

#!/bin/bash

# RestoreWview.sh
#
# Script to import WView weather station databases from Sqlite3 dumps.
# It is intended to facilitate moving Wview data to a new system.
# It is not a complete backup/restore utility.
#
#    By NetCodger 3/27/2015
#


# 
# Important Note! Paths are for Debain based Raspbian distributions.
# Verify and adjust desination path for new system if necessary.
#

ArchivePath="/var/lib/wview/archive-persistent"
ConfPath="/etc/wview"


# Dump databases on source system with
# sudo sqlite3 /var/lib/wview/archive/wview-archive.sdb .dump > wview-archive.sdb.sql
# sudo sqlite3 /var/lib/wview/archive/wview-hilow.sdb .dump > wview-hilow.sdb.sql
# sudo sqlite3 /var/lib/wview/archive/wview-history.sdb .dump > wview-history.sdb.sql
# sudo sqlite3 /etc/wview/wview-conf.sdb .dump > wview-conf.sdb.sql


# Then copy dumped .sql files to target system.
# Also copy /etc/wview/wview-binary from source to destination system.



# Make sure that we are root
 if [ $(id -u) != 0 ]; then
     echo "Insufficient privilege to execute this script."
     echo 
     echo "Please re-run the script with sudo RestoreWView.sh"
     read -n 1 -p "Pres any key exit"
     exit -1
fi



# Are you sure?
echo "This script is for restoring WView databases onto a new installatoin."
echo "Installing on an existing Wview system will clobber any previous modifications."

read -p "Are you sure you want to continue? (y/n)" -n 1 -r
echo    # (optional) move to a new line
if [[ ! $REPLY =~ ^[Yy]$ ]]; then
    exit 1
fi

# Stop WView.
/etc/init.d/wview stop


# Remove existing files
echo "Deleting old database files."
rm $ArchivePath/wview-archive.sdb
rm $ArchivePath/wview-hilow.sdb
rm $ArchivePath/wview-history.sdb
rm $ConfPath/wview-conf.sdb

echo "Importing data dumps."
sqlite3 "$ArchivePath/wview-archive.sdb" < ./wview-archive.sdb.sql
sqlite3 "$ArchivePath/wview-hilow.sdb" < ./wview-hilow.sdb.sql
sqlite3 "$ArchivePath/wview-history.sdb" < ./wview-history.sdb.sql
sqlite3 "$ConfPath/wview-conf.sdb" < ./wview-conf.sdb.sql
cp ./wview-binary /etc/wview/


# Run wviewconfig to import config database.
echo "Running wvconfig. Press Enter to accept previous settings(default)."
wviewconfig get > $PWD/tempconf.txt
wviewconfig set $PWD/tempconf.txt
rm $PWD/tempconf.txt


# Flush and import files stored on tmpfs
rm -rf /wviewtmp/*

cp -a /var/lib/wview/archive-persistent/wview-hilow.sdb /wviewtmp/
cp -ar /var/lib/wview/img-persistent/ /wviewtmp/img/


# Start WView.
echo 
echo "WView is ready to start."
echo "If Hi Low data must be regenerated, it can take a long time to start."
echo "If the archive database is large, it can take a VERY long time."
echo "Tail /var/log/messages, to see if HiLow is regenerating."

read -p "Do you wish to start WView? (y/n)" -n 1 -r
echo    # (optional) move to a new line
if [[ ! $REPLY =~ ^[Yy]$ ]]; then
    exit 1
else
    /etc/init.d/wview start
fi




# Hi/Lo regeneration is painfully slow at 38 seconds per week on a Raspberry Pi 2.

Raspberry Pi Headless Or Remote OS Reinstall

RAsberry Pi NOOBS in VNC viewer.

Raspberry Pi NOOBS in VNC viewer.

The Raspberry Pi series of credit card sized computer boards comes with a full-sized HDMI output interface. It’s pretty great and with the built-in GPU hardware acceleration it works very well, even when playing 1080p video content.

But, there are endless cases where you might choose to run the Raspberry Pi as a “headless” server. This means running without any kind of monitor attached to the Pi and, for that matter usually no keyboard or mouse either.

Once Raspbian is installed, running your Pi headless is no problem at all. Any interaction that you need to perform on it can be done via an SSH session from another computer with monitor, keyboard, and maybe even a mouse. That’s great! Right up to the point that you decide that you need to re-install Raspbian or you want to install one of the other OS options. At that point, you need to connect an HDMI display to your Pi and a keyboard etc. Alternatively, you may prefer to pull the micro SD card and re-image it from another computer, but there may be an easier way.

The Raspbery Pi developers have thoughtfully provided an option that will allow you to install or reinstall your OS using their NOOBS installer utility. Unfortunately, they don’t seem to talk(document) about it much. But, if NOOBS was used to install your OS, then you can easily access your Pi and install or reinstall your OS remotely on a headless Pi.

To accomplish this you’ll need to make a simple edit of a text file in the NOOBS partition and then connect to the Pi with a VNC viewer application. The first step will be to gain access to your NOOBS partition from the Pi command line in order to edit the necessary file. This might be old hat to Linux veterans, but the NetCodger will go through the motions anyway, beginning right after you’ve logged into the Pi via SSH.

You need to create a directory to serve as a mount point for the NOOBS partition.

pi@raspberrypi ~ $ mkdir n00bs

Next we mount the partition.

pi@raspberrypi ~ $ sudo mount /dev/mmcblk0p1 n00bs/

Next we alter the file.

pi@raspberrypi ~ $ sudo nano n00bs/recovery.cmdline

Inside the recovery.cmdline file we append the command line to look like this.

quiet vt.cur_default=1 elevator=deadline vncinstall forcetrigger

Notice the vncinstall keyword. This starts a VNC server when the N00bs utility is booted. The forcetrigger keyword forces the Pi to boot to the NOOBS utility on the next boot, rather than back into Raspbian. This is similar to holding the Shift key, on a keyboard attached to the Pi, while it initially boots.

At this point you’re done. Save the recovery.cmdline file and reboot with the sudo reboot command. Your Pi will then boot up into the NOOBS utility and have a VNC server running. Use your preferred VNC viewer and connect to your Pi’s IP address for a nice graphical OS installer/reinstaller.

After N00bs has finished and you click the final OK button, NOOBS will boot your Pi into the newly installed OS(Raspbian). This will end your VNC session. You must now connect to your Pi again via SSH to the newly installed OS and you should probably run the Pi’s initial configuration utility sudo raspi-config to set your internationalization settings and timezone.

But, you’re not done yet. Your NOOBS configuration has not changed back and if you restart your Raspberry Pi now, you will be booted back into the NOOBS utility to begin the install process all over again. If this happens to you, simply reconnect via your VNC viewer and click the Exit icon. But to prevent this form happening again, you must remove the changes that you previously made, from the recovery.cmdline file.

pi@raspberrypi ~ $ mkdir n00bs
pi@raspberrypi ~ $ sudo mount /dev/mmcblk0p1 n00bs/
pi@raspberrypi ~ $ sudo nano n00bs/recovery.cmdline

For ease of use in the future, so that the NetCodger doesn’t have to look up the commands, he leaves them in the file but on a separate line, as follows.

quiet vt.cur_default=1 elevator=deadline 

vncinstall forcetrigger

The second line is ignored at boot and your Pi will boot into the normal OS without issue.

Save the file and dismount the partition.

pi@raspberrypi ~ $ sudo umount n00bs/

And you’re done!

Nagios 3 On A Raspberry Pi 2

Nagios screen with Nuvola skin.

Nagios 3 with Nuvola skin.

Nagios 3 is a popular choice for network host and service monitoring. This open source project can be relatively simple to setup and have working quickly. Compared to more in-depth network monitoring systems, both commercial and open source, Nagios may seem somewhat crude and limited at first. But, the beauty of Nagios 3 is the ease of adding service checks or monitors and expanding the system yourself. This makes Nagios 3 have a low barrier to entry while still having the ability to grow to very large and complex systems. Nagios 3 is pretty powerful and though it is routinely panned for not being “scalable”, it actually scales quite well and is used to monitor everything from small networks with just a handful of systems to very large networks with hundreds of nodes and thousands of services.

While more powerful than previous versions, the Raspberry Pi 2 is a low powered computer and I don’t expect it to have the same capabilities of a PC with an Intel i5 or i7 processor with lots of RAM. That’s why, when looking to install Nagios 3 on the Raspberry Pi 2, I kept a wary eye on dependencies that might impact the Raspberry Pi 2’s performance.

The biggest consumer of computing resources with the Nagios 3 stack is the defacto use of the Apache 2 web server. The Raspberry Pi 2 is indeed capable of running Apache 2 very well, especially for a low number of concurrent connections. But, Apache 2 is just not needed for serving something like Nagios 3. For this reason, the NetCodger chose to eschew Apache 2 and use the very much leaner Lightttpd webserver. Lighttpd consumes a tiny fraction of the computer’s resources, compared to Apache 2 and is a great choice for this use case.

There are many how-tos about getting Nagios 3 running as well as several that are Raspberry Pi specific. Since this installation was to be an experimentation and testing project, the NetCodger anticipated numerous reinstalls and wrote the following Bash script to automate the installation process.

The following script takes a fresh installation of Raspbian, updates it and the Raspberry Pi firmware, and installs and configures Nagios and Lighttpd. Since Raspberry Pi and Raspbian is a Debian system the default mail system, used for Nagios notifications, is Exim 4. The NetCodger prefers to work with Postfix, so this script excludes Exim and installs Postfix instead. Upon completion of the script, one simply configures Postfix to their needs and can then begin the standard Nagios setup or configuration of checks. Alternatively, if you are migrating from another system you can easily copy over the check configurations of an existing Nagios 3 system.

 

#!/bin/bash

#
# Script to install Nagios 3 network monitoring software on new Rapsberry Pi Raspbian sinatalltion.
#  This script is not meant to be used on an already configured system. 
#  This script could overwrite or break an existing confgiuration.
#
#    By NetCodger 3/25/2015
#



# Make sure this script only runs on a Raspberry Pi.
if ! uname -a | grep "raspberrypi"; then
     echo "This script is meant to only run on a Raspberry Pi."
     echo "This does not appear to be a Raspberry Pi."
     read -n 1 -p "Pres any key exit"
     exit -1
fi


# Make sure that we are root
 if [ $(id -u) != 0 ]; then
     echo "Insufficient privilege to execute this script."
     echo 
     echo "Please re-run the script with sudo installNagios3.sh"
     read -n 1 -p "Pres any key exit"
     exit -1
fi



# Are you sure?
echo "This script is for installing Nagios 3 on a new Raspberry Pi installatoin."
echo "Installing on a modified system could clobber any previous modifications."
read -p "Are you sure you want to continue? (y/n)" -n 1 -r
echo    # (optional) move to a new line
if [[ ! $REPLY =~ ^[Yy]$ ]]; then
    exit 1
fi



# Update installed Raspbian(Debian) software.
apt-get update
apt-get --assume-yes --force-yes upgrade


# Update Pi firmware.
rpi-update


# Prompt user to set timezone as necessary.
dpkg-reconfigure tzdata


# Install web server and PHP
apt-get --no-install-recommends --assume-yes --force-yes --fix-missing install lighttpd

apt-get --assume-yes --force-yes --fix-missing install php5-cgi

apt-get --assume-yes --force-yes --fix-missing install postfix bsd-mailx exim4-base-


# Configure lighttpd to enable PHP
if ! grep -Fxq '.php" => "/usr/bin/php5-cgi' /etc/lighttpd/conf-enabled/10-php5-cgi.conf; then
     echo ' cgi.assign += (".php" => "/usr/bin/php5-cgi")' >> /etc/lighttpd/conf-enabled/10-php5-cgi.conf
fi

lighttpd-enable-mod cgi auth status php5-cgi



# Install Nagios 3.
apt-get --assume-yes --force-yes --fix-missing install nagios3

#Configure lighttpd for Nagios
if ! grep -Fxq '/cgi-bin/nagios3" => "/usr/lib/cgi-bin/nagios3' /etc/lighttpd/conf-available/10-nagios3.conf; then
     echo 'alias.url =     (' >> /etc/lighttpd/conf-available/10-nagios3.conf
     echo '                "/cgi-bin/nagios3" => "/usr/lib/cgi-bin/nagios3",' >> /etc/lighttpd/conf-available/10-nagios3.conf
     echo '                "/nagios3/cgi-bin" => "/usr/lib/cgi-bin/nagios3",' >> /etc/lighttpd/conf-available/10-nagios3.conf
     echo '                "/nagios3/stylesheets" => "/etc/nagios3/stylesheets",' >> /etc/lighttpd/conf-available/10-nagios3.conf
     echo '                "/nagios3" => "/usr/share/nagios3/htdocs"' >> /etc/lighttpd/conf-available/10-nagios3.conf
     echo '                )' >> /etc/lighttpd/conf-available/10-nagios3.conf
     echo '' >> /etc/lighttpd/conf-available/10-nagios3.conf
     echo '' >> /etc/lighttpd/conf-available/10-nagios3.conf
     echo '$HTTP["url"] =~ "^/nagios3/cgi-bin" {' >> /etc/lighttpd/conf-available/10-nagios3.conf
     echo '        cgi.assign = ( "" => "" )' >> /etc/lighttpd/conf-available/10-nagios3.conf
     echo '}' >> /etc/lighttpd/conf-available/10-nagios3.conf
     echo ''  >> /etc/lighttpd/conf-available/10-nagios3.conf
     echo '$HTTP["url"] =~ "nagios" {' >> /etc/lighttpd/conf-available/10-nagios3.conf
     echo '        auth.backend = "htpasswd"' >> /etc/lighttpd/conf-available/10-nagios3.conf
     echo '        auth.backend.htpasswd.userfile = "/etc/nagios3/htpasswd.users"'  >> /etc/lighttpd/conf-available/10-nagios3.conf
     echo '        auth.require = ( "" => (' >> /etc/lighttpd/conf-available/10-nagios3.conf
     echo '                "method" => "basic",' >> /etc/lighttpd/conf-available/10-nagios3.conf
     echo '                "realm" => "nagios",' >> /etc/lighttpd/conf-available/10-nagios3.conf
     echo '                "require" => "user=nagiosadmin"' >> /etc/lighttpd/conf-available/10-nagios3.conf
     echo '                )' >> /etc/lighttpd/conf-available/10-nagios3.conf
     echo '        )' >> /etc/lighttpd/conf-available/10-nagios3.conf
     echo '        setenv.add-environment = ( "REMOTE_USER" => "user" )' >> /etc/lighttpd/conf-available/10-nagios3.conf
     echo '}' >> /etc/lighttpd/conf-available/10-nagios3.conf
fi

lighttpd-enable-mod nagios3


# Optional install Nuvola skin.
wget "https://exchange.icinga.org/exchange/Nuvola+Style/files/145/nagios-nuvola-1.0.3.tar.gz"
mkdir nuvola
cd nuvola
tar -xzvf ../nagios-nuvola-1.0.3.tar.gz
cp -a html/* /usr/share/nagios3/htdocs/
cp -a html/stylesheets/* /etc/nagios3/stylesheets/.
cd ..
rm nagios-nuvola-1.0.3.tar.gz
rm -rf nuvola/


# Configure Nuvola
sed -i -r 's#/nagios/#/nagios3/#' /usr/share/nagios3/htdocs/config.js
mv /usr/share/nagios3/htdocs/side.html /usr/share/nagios3/htdocs/side.php

# Create the Nagiosadmin user and set a password.
htpasswd -cb /etc/nagios3/htpasswd.users nagiosadmin nagios


# Reboot and begin configuration of Nagios.
echo
echo "----------------------------------"
echo "Reboot Raspberry Pi and begin using Nagios?"
echo "See Nagios manual about configuring Nagios."
read -p "Press y to reboot and n to exit" -n 1 -r
echo    # (optional) move to a new line
if [[ $REPLY =~ ^[Yy]$ ]]; then
    reboot
fi

Raspberry Pi 2

Raspberry Pi 2 on a credit card on a Galaxy S4

Raspberry Pi 2 on a credit card on a Galaxy S4

Late to the party as always, NetCodger has been meaning to try out a Raspberry Pi for going on three years. It’s very small and consumes little power, but despite the endless raving about how fabulous Raspberry Pi is, it also doesn’t have too much processing power and thus limits its usefulness to the NetCodger. That is, until now. The Raspberry Pi Foundation recently released Raspberry Pi 2.

The Raspberry Pi 2 ups the ante quite a bit. It is presented as being up to 600% faster than the previous Raspberry Pi version, thanks to a quad core 900Mhz ARMv7 processor and 1GB of RAM. At $70, after adding the requisite micro SD card, case, micro USB card, power supply brick, and shipping, I could no longer make an excuse for not giving the Raspberry Pi a try.

I’m all for testing things and for playing with new stuff, just because. But, I’m more interested in finding out if the Pi 2 is genuinely useful for more than hobbyist tinkering and supposedly teaching children about the “exciting” world of computer programming. In fairness, the general purpose input/output(GPIO) pin options provided by the Pi is a compelling factor. But my limited needs for such control have so far been better served by Arduino Nano, so I have no immediate need for this from the Pi and it has never been a driving force for me.

I do have a few real-world applications that, if the Pi 2 is up to the task, would be beneficial in reducing the power and physical space presently being used by existing machines running network monitoring software(Nagios3), a personal weather station, and a custom built webcam streamer/recording script. I don’t really expect the Pi 2 to manage the latter, but if it can actually manage stitching jpegs together into H.264 videos in a timely fashion, then the NetCodger will be really impressed.

Now that I’ve received my Raspberry Pi 2, I’ve played with installing and reinstalling the Raspbian(Debian 7 – Weezy) OS. I’ve quickly become comfortable with this tiny PC and I’ll start testing for my applications next. It really feels like any Linux PC at this point, using Debian was a very good choice.

I’m still of the mind that there are significantly better hardware platforms than the Raspberry Pi 2 for about the same price or just a little more than the Pi. Devices such as cheap smartphones and tablets presently running Android, that have similar processing power to the Raspberry Pi 2 but also offer built in battery power, touch screen, camera(s), WiFi, Bluetooth, and more and all in a form factor that is even smaller than the Pi. However, I’m not aware of anyone who has figured out how to easily run Debian or any other Linux distribution natively, rather than slow and limited chrooted apps, on them like you can with the Raspberry Pi. The Raspberry Pi is an open platform by design, while the Android devices are still very much closed hardware.