Lead Image © Chris Gendreau; Fotolia

Lead Image © Chris Gendreau; Fotolia

Nagios on a Rasp Pi 3 with NEMS

Small but Mighty

Article from ADMIN 41/2017
By
We show you how to install and use the NEMS distribution of Nagios network monitoring on a Raspberry Pi.

Enterprise asset monitoring can be a daunting and expensive task. If you are interested in asset monitoring but have avoided it in the past because of price or complexity, you can now get a fully configured open source Nagios distribution made for easy deployment on affordable hardware. Nagios Enterprise Monitoring Server (NEMS) [1] is a pre-configured, customized, and ready-to-deploy Nagios Core [2] image designed to run on the Raspberry Pi 3 microcomputer and the Odroid XU4/4Q – so far. NEMS was developed by Robbie Ferguson [3] to be a nearly turnkey package; that is, the majority of the work required to integrate the various open source software components has been done for you.

NEMS begins with a lightweight Debian Stretch deployment optimized for performance, reliability, and ease of use. It monitors network-attached servers, switches, applications, and services, generating alerts when things go wrong and again when the problem has been resolved.

The Hardware

I run NEMS on a Raspberry Pi 3, which needs a minimum 8GB microSD card (a 16GB+ card is recommended). My server has been running for more than a year with a 32GB microSD without coming close to filling the disk.

Access is through a browser and SSH, in which case no other hardware is necessary (i.e., a keyboard, monitor, or mouse). The Pi is powered by a 5V micro-USB. To avoid power issues, use a power supply that provides 2.5A to the Pi.

The Software

In this article, I cover the download and installation of the latest version of NEMS with a subsequent installation of the most current rolling updates. At the time of writing, the latest version was 1.2.1, with rolling updates upgrading the system to version 1.2.2. The latest version of NEMS is available from the developer's website [1].

After downloading the ZIP file of about 1.27GB, extract the image file from the archive. The software you use to copy the image file to the microSD is dependent on the operating system you are using to create the microSD. The NEMS web page has links to instructions for Windows, Linux, and Mac systems.

Installation

Before inserting the imaged microSD card into your Pi, make sure it is not plugged in or is turned off. Plugging in the Pi power supply will boot NEMS. The server will then obtain an IP address via DHCP and connect to your network. For ease of access via SSH and browsers, reserve an IP address on your DHCP server.

Using an SSH program (e.g., PuTTY), you connect to the server on port 22 with the reserved IP address. The default username is pi , and the default password is raspberry (Figure 1). Now enter

sudo nems-init
Figure 1: The NEMS initial terminal page. Note that the NEMS Version shown is older than the Current Version available (first line).

to initialize NEMS. The nems-init process:

  • allows you to set the Pi user password,
  • requests a username and password for use by the NEMS applications,
  • asks you to set your time zone,
  • resizes the root partition to take advantage of all the available microSD storage, and
  • reboots the device.

As of version 1.2.1, you do not have to download and re-image when a newer point release becomes available, although major releases will require re-imaging.

The NEMS logon splash screen displays the version running, along with the most current version available. To update to the most current version, enter:

sudo nems-upgrade

The upgrade process includes downloading and installing project and operating system updates. Depending on the number of updates required, it can take anywhere from five to 20 minutes. After the upgrade is complete, reboot the server.

Once the reboot is complete, connect again via SSH and use the Nano editor to modify the resource.cfg file:

sudo nano /etc/nagios3/resource.cfg

Now add your SMTP information to the sendemail section (Listing 1). The settings in this section are used by the server to send email notifications. For a more detailed look at how to set your SMTP information for your specific needs, please see the documentation on the NEMS website.

Listing 1

resource.cfg (Excerpt)

### sendemail SMTP Config added in NEMS 1.1
# The "from address" for notifications
$USER5$=example@gmail.com
# The SMTP server
$USER7$=smtp.gmail.com
# the SMTP authentication username and password
$USER9$=example@gmail.com
$USER10$=examplepassword

Once more, reboot after changing and saving the settings. NEMS setup is now complete, and you'll see the updated version information on the splash screen.

Buy this article as PDF

Express-Checkout as PDF
Price $2.95
(incl. VAT)

Buy ADMIN Magazine

SINGLE ISSUES
 
SUBSCRIPTIONS
 
TABLET & SMARTPHONE APPS
Get it on Google Play

US / Canada

Get it on Google Play

UK / Australia

Related content

  • Nagios Passive Checks
    Why spam yourself with useless notifications every time a script completes successfully? You can use Nagios to screen the notices and just send the ones that need action.
  • Network monitoring with Icinga and Raspberry Pi
    Icinga on the Raspberry Pi monitors your network, letting you see the good, the bad, and the ugly, so you can address problems proactively.
  • Remote Sys Admin
  • Nagios alerts implemented via VoIP
    Out of the box, Nagios can only alert you by email when a service fails, but these email messages can be easily overlooked. A call is more sustainable.
  • All for Admins
    Our Admin special edition was so popular we're back, with a new quarterly magazine that is all for admins. Welcome to the first issue of Admin: Network and Security – a magazine for administrators of heterogenous networks.
comments powered by Disqus
Subscribe to our ADMIN Newsletters
Subscribe to our Linux Newsletters
Find Linux and Open Source Jobs



Support Our Work

ADMIN content is made possible with support from readers like you. Please consider contributing when you've found an article to be beneficial.

Learn More”>
	</a>

<hr>		    
			</div>
		    		</div>

		<div class=