Nagios Monitoring on a Raspberry Pi




100 Points
Learning Objectives

These instructions will show you how to run Nagios 4.x on a Raspberry Pi.
This software allows you to run a machine monitoring program on a Raspberry Pi.

More information on Nagios Core is available online.
This software allows you to monitor devices on your network(s).

After completing this assignment you will be able to:

  1. Obtain Nagios
  2. Start Nagios Core and Plug-Ins on a Raspberry Pi
  3. Run Nagios
  4. Monitor a computer using Nagios

Assignment Overview
This assignment reviews basic computer concepts that you will need in this course and throughout your career.

You are expected to have a working knowledge of SBC hardware and software.
If you do not understand how to use an item, perform a Google Search, refer to the WSU Technology Knowledge Base,  ask a teaching assistant, or ask the instructor.


Exercise 1-Review Nagios Intallation

ref: Nagios Core Raspian Installation Instructions

  1. These steps have already been performed on the Raspberry Pi Image, and are for information purposes.
  2. Open a Terminal window and enter the following commands to ensure your Raspberry Pi is up to date
    sudo apt-get update
    sudo apt-get full-upgrade
  3. Open the Chromium broswer to the following url:
    https://support.nagios.com/kb/article/nagios-core-installing-nagios-core-from-source-96.html#Raspbian
    This article contains all the background information for this assignment.
  4. In the Terminal window enter the following sets of commands to install Nagios 4.x and required prerequisites:
    sudo apt-get install -y autoconf gcc libc6 make wget unzip apache2 apache2-utils php libgd-dev
    cd /tmp
    sudo wget -O nagioscore.tar.gz https://github.com/NagiosEnterprises/nagioscore/archive/nagios-4.4.5.tar.gz This downloads the code
    sudo tar xzf nagioscore.tar.gz
    cd /tmp/nagioscore-nagios-4.4.5/
    sudo ./configure --with-httpd-conf=/etc/apache2/sites-enabled
    sudo make all This compiles Nagios
    sudo make install-groups-users
    sudo usermod -a -G nagios www-data
    sudo make install
    sudo make install-daemoninit
    sudo make install-commandmode
    sudo make install-config
    sudo make install-webconf
    sudo a2enmod rewrite
    sudo a2enmod cgi
    sudo iptables -I INPUT -p tcp --destination-port 80 -j ACCEPT
    sudo apt-get install -y iptables-persistentAnswer YES twice to save existing rules
    sudo htpasswd -c /usr/local/nagios/etc/htpasswd.users nagiosadmin
    When prompted, set the password to: Nagio$

    Nagios PasswordNagios Password Prompt

    sudo systemctl restart apache2.service
    sudo systemctl start nagios.service This will start Nagios Core
  5. After the Nagios 4.4.6 install is complete, point your browser to the url: 127.0.0.1/nagios
    Enter username nagiosadmin and password Nagio$

    Nagios4Nagios4 Running

  6. It is a good idea to reboot the Raspberry Pi, then open Chromium to Nagios:
    http://127.0.0.1/nagios
  7. If the webpage does not appear, troubleshoot and resolve any issues.
  8. Note-you can also access the Raspberry Pi Nagios interface from another computer using the IP address: http://10.30.19.x

Exercise 2-Review Nagios Plug-Ins
  1. These steps have already been performed on your Raspberry Pi, they are here for review, or in case you decide to install additional plug-ins.
  2. Note, these steps can also be performed from another computer.
  3. On the RPi, open the browser to: 127.0.0.1/nagios
    If using another computer browse to: 10.38.19.x/nagios
  4. The home page contains links to the currrent status of your Raspberry Pi, and getting started.
  5. In the left column, under the Current Status section, click the 'Services' link and examine the details.
    You will notice some errors, so follow the steps below that will install the plug-ins to resolve this situation.

    Nagios4 Service ErrorsNagios4 Service Errors

  6. Open a Terminal window and enter the following commands:
    sudo apt-get install -y autoconf gcc libc6 libmcrypt-dev make libssl-dev wget bc gawk dc build-essential snmp libnet-snmp-perl gettext
    cd /tmp
    sudo wget --no-check-certificate -O nagios-plugins.tar.gz https://github.com/nagios-plugins/nagios-plugins/archive/release-2.2.1.tar.gz
    sudo tar zxf nagios-plugins.tar.gz
    cd /tmp/nagios-plugins-release-2.2.1/
    sudo ./tools/setup This command will take a while to execute
    sudo ./configure This command will take a while to complete
    sudo make This command will take a while to complete
    sudo make install
    In practice, it is a good idea to install the snmpd on each network host so that you can monitor it with Nagios.
    To do this, learn to add the new host to the Nagios configuration file.
    Installing snmpd is not required for this assignment.
  7. After installing the plug-ins, reboot the Raspberry Pi
  8. Open the Chromium browser to the following url:
    http://127.0.0.1/nagios
  9. Under the 'Current Status' section, select 'Services'
  10. Note that with the plug-ins installed most, if not all, of the services are now running

Exercise 3-ScreenShot

Point the browser to 127.0.0.1/nagios
or
10.30.19.x/nagios
From the homepage, under the 'Current Status' section, select 'Services' and you will see a page similar to below.

NagiosNagios4 Services

  1. On the Raspberry Pi, position the browser window next to your name on the desktop.
  2. Take a screenshot with Nagios Services displaying 'Service Status Details' to document your work.
    Note: this can be done using the Snipping Tool if you are running VNC, or use the scrot command if you are connected to the Raspberry Pi with a keyboard and mouse.
  3. On your laptop save the screenshot as "IOT05" in your ' ' folder.

ScreenShot IOT05


Upload Screenshot

Submit to the appropriate D2L Assignment folder a screenshot that documents your work.


(50) 1. Upload your screenshot to the 'IOT05' D2L Assignment Folder.


Exercise 4-Reflections

Based on your experience in this exercise, consider the value of Nagios for organizations, especially the Information Technology staff.
Think about what type of problems a Raspberry Pi equipped Nagios monitor could solve, and whether it could be cost-effective.
Businesses are deploying IoT 'solutions'-how can Nagios equipped Raspberry Pis support or automate these efforts?

References:
Nagios: Nagios Core
Nagios :  Users' Installation
Guru99 Nagios
Nagios: NCPA-Windows

 

(20) 2. Reflections-value
List a specific problem that a low-cost Nagios monitor could solve.


(20) 3. Reflections-content
Research the internet on the topic of network device monitoring.
Why would an organization's IT department use nmap to monitor their own organization's network?
Hint:  Nagios Tutorial

Submit Assignment

When all tasks are completed press the Submit button.


(10) 4. Assignment submission



Congratulations! You have used Nagios, a network monitoring tool, on a Raspberry Pi single board computer.


-- WHEN DONE --
SHUTDOWN THE RASPBERRY PI
TURN OFF THE POWER