Backup your NEMS 1.1+ configuration files automatically

One of the worst things that can happen to your NEMS deployment is having your SD card fail. So keeping a current backup of your NEMS configuration is a smart idea.

Your NEMS Migrator snapshots are always accessible at http://NEMSIP/backup/ and will automatically generate and send a backup.nems file, which contains all the NEMS configuration settings, logs, data, etc. to allow an easy recovery by restoring to a new NEMS deployment.

Knowing this, it’s easy to add a NEMS backup to your daily backup script.

From your Linux server (where your backups run), simply add this to your backup task:

… where NEMSIP is the actual internal IP address of your NEMS server. From there, I recommend you have your backup script run an rdiff-backup of your /backup folder (in this example) to allow for versioning.

Setting up NRPE on Windows for NEMS

NRPE

  1. Grab the latest Windows client at https://www.nsclient.org/download/
  2. Install the client with the following settings:
    • Select to install the “Generic mode” NSClient++.
    • Choose “Complete installation” and if asked, choose to save config to ini file.
    • Under “Allowed Hosts” it should read 127.0.0.1,NEMSIP (where NEMSIP is the IP address of your NEMS server)
    • Clear the Password field for ease of deployment. NEMS sample scripts are setup to use NRPE without a password because I’m making the assumption that this is being deployed in a trusted LAN. If you do not blank the password here, you will have to edit all the scripts before NEMS will be able to communicate with this computer.
    • Enable all modules and change the NRPE mode to Legacy. NEMS uses Nagios 3.5.1 at present, and I suppose that’s technically “Legacy”. 🙂
    • Screen should look a little something like this:
      nsclient-setup
  3. Add your Windows host to NEMS. If you are using NEMS 1.1+ you can use the template “ourwinserver” in nconf. Just change the hostname and the IP address.

Please note: If you have a software firewall running on your Windows machine, setup an exception for your NEMS server IP to gain access through ports 5666 and 12489.

NEMS Migrator: NEMS 1.0 to 1.1

Thanks for being an early-adopter of NEMS! It’s been exciting to see this project really catching on, and I endeavor to make it the best it can be. Your suggestions along the way have helped me focus on some great features for NEMS 1.1.

But where does that leave you, oh precious NEMS 1.0 user?

Yeah, don’tcha worry; I’m thinking of you too.

NEMS 1.1 has a nifty backup and export tool called NEMS Migrator. While it comes pre-packaged in 1.1, I designed it specifically to run on 1.0 as well, giving you the opportunity to export your NEMS 1.0 configuration, deploy NEMS 1.1, and then restore the configuration to NEMS 1.1. Easy peasy!

Here’s what you need to do:

Note: These instructions are for NEMS 1.0 only. Do not do this on NEMS 1.1+ as the tool is already built-in.

  1. SSH into your NEMS server.
  2. Become root: sudo su
  3. Update repository data. Type: apt-get update
  4. Install Git. Type: apt-get install git
  5. Install NEMS-Migrator in /tmp. Type:
    cd /tmp && git clone https://github.com/Cat5TV/nems-migrator
  6. Create the backup config on your NEMS system. Type:
    cd /tmp/nems-migrator && ./backup.sh
  7. Download the backup to your computer by opening it in your web browser. In your favorite web browser, simply add /backup/ to the end of your NEMS server address. Eg., http://10.0.0.5/backup/
  8. Now that you have your backup.nems file, follow the instructions here to restore your configuration to a newer version of NEMS.

NEMS Migrator: Restore

If you’ve deployed NEMS v1.1, you’ll notice there is a new NEMS Migrator tool. This allows you to export/backup your NEMS configuration (backup.nems) as well as import a previous backup (through the Restore option).

The NEMS Migrator’s backup and restore options are great for keeping a safe backup without having to shutdown your NEMS server. Just download the file once in a while, or back it up automatically with your daily backup script.

NEMS Migrator is also helpful when upgrading from previous versions of NEMS, saving you having to reconfigure your NEMS deployment just to get the latest features.

Important Note
I am a firm believer in redundancy, and protecting your data. What I’d like you to do is, export your migration file, then install NEMS on a new MicroSD card. Then boot from that and restore your NEMS Migrator backup. Once you’ve confirmed everything worked well, you can deprecate the old one safely. However, if something went wrong, you can contact me to fix it for you, and continue running from the old SD card in the interim.

How to Restore a NEMS Migrator Backup
Requires NEMS 1.1+

  1. Place your backup.nems file on a USB flash drive. You can access this directly from your web browser at http://NEMSIP/backup/ where NEMSIP is the IP address of the NEMS server you wish to backup.
  2. Deploy the version of NEMS you wish to restore the backup to. Please heed my Important Note above.
  3. Boot the new NEMS deployment and mount the USB flash drive.
  4. Determine the location of backup.nems in relationship to your mountpoint. For example, if you mounted the USB flash drive on /mnt/flash you may determine the location to be /mnt/flash/backup.nems
  5. Armed with that information, run the following commands:
  6. Follow the prompts on screen to restore your configuration to the new NEMS deployment. If it fails for any reason, you can safely shut down and replace the SD card with your original deployment.

If you have any problems (or praise) please comment below.

Installing the Nagios NRPE Client Agent on Debian / Ubuntu

The Nagios Remote Plugin Executor (NRPE) allows your Nagios Enterprise Monitoring Server to communicate with the Linux machines on your server to determine things like free disk space, CPU load, and detect possible issues that a simple ping can’t determine.

There are countless instructions online to download tar.gz files and install manually, or use a PPA to install via apt-get, but you’ll be surprised to note the needed packages are in fact already in your Debian (and by proxy, Ubuntu) repositories.

To install the needed NRPE client on Debian / Ubuntu / other Debian-based Linux operating systems:

Don’t forget that you need to be root (Debian) or use sudo (Ubuntu).

Next, we just have to tell NRPE that it’s allowed to communicate with our Nagios server. On the client system, open the file /etc/nagios/nrpe.cfg

Find the line that reads: allowed_hosts=127.0.0.1

Now there are a few ways we can allow our server. First (and most obvious) is to add its IP address like this:

Where 192.168.0.5 is our Nagios/NEMS server.

Alternatively we can tell NRPE that it’s allowed to communicate with any local system:

Now, save the file and restart NRPE as follows:

And there we have it! Your Nagios/NEMS server should now be able to see your Linux machine.

Looking for a lightweight, affordable, easy-to-deploy enterprise monitoring server? Check out Nagios Enterprise Monitoring Server for Raspberry Pi 3!

Category5 TV Network license changed.

For the past 9 years, all Category5 TV Network programming has been licensed under Creative Commons Attribution 2.5 Canada.

In an effort to ensure both our own protection from the commercial reuse of our freely available content as well as to protect our viewers from companies adding protection such as DRM to our content, we are now moving all Category5 TV Network programming, retroactively, to the Creative Commons Attribution-NonCommercial-ShareAlike 3.0 Unported (CC BY-NC-SA 3.0).

Effective immediately under our new license, any commercial reuse of our material (eg., broadcasting on a commercial television channel, using our videos to generate revenue online, etc) must be approved in writing by myself.

Category5 TV remains entirely free for its viewers, no matter where they live in this big ol’ world of ours.

Enjoy the shows!

Robbie

Backup a Linux machine with LVM Snapshots and rdiff-backup

Here is the completed script I wrote on Episode 461. Make sure you check out the full episode for details on how to make this work for you.

And of course, here is the episode:

Drone Zone Skill Rating

With The Drone Zone about to take flight, I wanted a way to rate the skill level required (or rather, recommended) for each drone we review. The purpose is so viewers can gauge during a review, from the DZSR (Drone Zone Skill Rating) which drone(s) they should be looking at first.

I’m open to suggestions, so please post your comments and this will become a bit of a living list, updated as needed. I will also maintain a static copy on The Drone Zone web site.


DZSR Level A
This drone is perfect for a beginner pilot. It’s easy to learn, has a price point that won’t hurt your wallet too badly if you crash it, and is a good drone to start with. As you take on drone flight, it’s best to start at DZSR Level A so you can learn the controls, practice, and get ready for the next level.
Mature pilots will also enjoy drones in this level as they’re nice to be able to carry around so you can fly wherever you are just for fun, without much consideration, packing or planning.
Typical drones in this level: Nano quads.

DZSR Level B
If you’ve mastered drones at DZSR Level A, you’re ready to move on to DZSR Level B.
Typical drones in this level: Toy camera quads, Entry level FPV.

DZSR Level C
If you’ve mastered drones at DZSR Levels A and B, you’re ready to move on to DZSR Level C.
Typical Drones in this level: Video drones, drones with GPS, Racing drones.

DZSR Level D
If you’ve mastered drones at DZSR Levels A, B and C, you’re ready to move on to DZSR Level D.
Typical Drones in this level: High-end/custom quads/hexacopters, DIY quadcopters.

Plex Media Server on a Raspberry Pi 3

I wanted to document the instructions shared on Episode 459 to supplement the episode.

On the show, Jeff and I demonstrated how to turn a Raspberry Pi 3 with Raspbian Jessie into a Plex Media Server, giving you the chance to stream your entire music library to all your devices.

I won’t get into the full details here, since this is only a supplement to give you some copy-and-paste instructions, but I’d encourage you to watch the video.

What You Need

  1. A Raspberry Pi 3 Micro Computer. Please consider purchasing it through our store to support what we do: https://cat5.tv/pi
  2. Raspbian Jessie – A free download from raspberrypi.org
  3. Obvious stuff like a MicroSD card, Ethernet cable (preferred over wifi), keyboard and mouse… etc.

How to Do The Do

  1. In terminal, upgrade your distro to the latest and greatest.
  2. Reboot the Pi.
  3. Add the ability for apt to use https repositories.
  4. Add the Plex Media Server repository provided by Universität Leipzig.

    Add this line:
  5. Add the GPG key for the repository.
    This is the “easy” method (which didn’t work for us because my keyboard was in some weird mode with no pipe character):

    Alternate method (which I had to use on the show since I didn’t have a pipe character… I’ve cleaned it up a bit since the live show so it is cleaner since it was an unexpected twist and I kinda made it seem more confusing than it should):
  6. Update apt.
  7. Install Plex Media Server.
  8. Reboot one final time.

And there you have it! All the commands we used to get Plex Media Server installed on a Raspberry Pi 3 in a nice clean blog post  🙂

From there, we plugged in the USB flash drive (don’t do it! Use a proper external hard drive–this was only a demonstration) and after it mounted we used the following command to see its /dev assignment:

Since our drive was /dev/sda1, and of the filesystem type “fat32” this is what I did to make it work as the media library for Plex Media Server:

and add the following line:

I then created the mountpoint:

and made it so it can only be written to if mounted:

and finally, mounted the drive:

From there, I could easily add folders on my external drive to Plex using the web interface, which you’ll find on Port 32400 in the /web subfolder on your Pi.

To get my IP address, I brought up the terminal on the Pi and typed:

That showed the IP address of my Pi under “Ethernet”… 192.168.0.105

So to open Plex in my browser, from my computer I entered:

The IP address will most likely be different for yours, and you might even want to set it up as a static IP. Easiest way to do that would be to use your router’s DHCP reservations to hard-set the Pi to something outside your DHCP pool. For me, that’d be 192.168.0.5 or something like that, since the pool seemingly starts at 100.

Good luck, and if you have any questions or comments, please leave them below. Don’t forget, if this has helped you out, or if you just love supporting nice guys who wanna keep giving knowledge for free, please head over to our Patreon page, or throw a bit in the tip jar. Thanks!

NEMS – Nagios Enterprise Monitoring Server for Raspberry Pi 3

NEMS – Nagios Enterprise Monitoring Server for Raspberry Pi

NEMS is a pre-configured, customized and ready-to-deploy Nagios Core image designed to run on the Raspberry Pi 3 micro computer. At its core it is a lightweight Debian Jessie deployment optimized for performance, reliability and ease of use.

NEMS is free to download, deploy, and use.

[NEMS Documentation]

NEMS Featured on Category5 Technology TV

What Is Nagios Core?

Nagios® Core™ is an Open Source system and network monitoring application. It watches hosts and services that you specify, alerting you when things go bad and when they get better.

Some of the many features of Nagios Core include:

  • Monitoring of network services (SMTP, POP3, HTTP, NNTP, PING, etc.)
  • Monitoring of host resources (processor load, disk usage, etc.)
  • Simple plugin design that allows users to easily develop their own service checks
  • Parallelized service checks
  • Ability to define network host hierarchy using “parent” hosts, allowing detection of and distinction between hosts that are down and those that are unreachable
  • Contact notifications when service or host problems occur and get resolved (via email, pager, or user-defined method)
  • Ability to define event handlers to be run during service or host events for proactive problem resolution
  • Automatic log file rotation
  • Support for implementing redundant monitoring hosts
  • Optional web interface for viewing current network status, notification and problem history, log file, etc.

Why NEMS?

Nagios doesn’t need a big fancy supercomputer to offer exceptional enterprise monitoring of network assets and resources, so our temptation is to re-purpose older servers to perform this reasonably lightweight task.

If you ask me, that’s not only overkill, but the attempt to save money by reusing older hardware will actually cost more due to higher electricity usage vs. a tiny Raspberry Pi 3 Microcomputer… which ironically may in fact have more modern system specifications than that old beast of a server you’ve been using.

It can be a wee bit daunting to setup a Raspberry Pi Nagios server from scratch, and there were no projects I found which were actively maintained at a level adequate for professional use. So I decided to start a new project–called NEMS: Nagios Enterprise Monitoring Server (for Raspberry Pi).

This project uses freely available applications such as Debian Linux, Nagios Core and a variety of other goodies, and I too release a fully ready-to-use image for you to use within yours or your customer’s network environments.

If you like NEMS, please donate: donate.category5.tv

The Out-Of-The-Box NEMS Experience:

System Requirements

  • Raspberry Pi 3 Micro Computer
  • 8GB+ Micro SD Card (Recommend 16GB+)
  • Network Connection (will obtain IP address via DHCP: create your reservation in the DHCP server for ease of access)

Instructions

  • Purchase and assemble your Raspberry Pi 3.
  • Download the most current version of NEMS below.
  • Unzip and “Burn” the image to your Micro SD card.
  • Boot your NEMS server.
  • Login to NEMS console by either connecting a monitor and keyboard, or using ssh (Username: pi / Password: raspberry)
  • Type: sudo raspi-config
  • Expand the filesystem and exit raspi-config.
  • Edit /etc/nagios3/resource.cfg and add your SMTP information.
  • Reboot your Pi and enjoy NEMS when it comes online (see below for further details).

Buy The Needed Hardware

Raspberry Pi 3 Nagios ServerRaspberry Pi 3 are very affordable, and using our Micro SD image, you simply buy the device, “burn” the image to the Micro SD card, and boot it up.

Here’s our link to buy the device you’ll need, complete with the Micro SD card, a power adapter, a good solid case, and more: shop.category5.tv

Please buy it through that link, or let me know if you need a customized link to a different model. We get a small percentage of the sale, and it helps to make it possible to offer this as a free download.

About NEMS

The goal with NEMS is to provide a free, full-featured, up to date drop in Nagios Enterprise Monitoring Server for Raspberry Pi 3. It has all the bells and whistles while being optimized for solid stability and fast performance.

Based (with big thanks to Ryan Siegel) on NagiosPi, with many of the settings reflective of the NagiosPi Wheezy distro (which is now obsolete).

Here is what Ryan Siegel (the creator of NagiosPi) has to say about NEMS: “I’d love to upgrade NagiosPi, but i don’t have ability to make a GUI that can beat that of NEMS. I strongly feel that it has always been a necessary addition to NagiosPi and NEMS was able to deliver what is essentially an updated and improved version of NagiosPi. No reason not to start using NEMS for the time being. Nice work Robbie!” [source]

Download NEMS

NEMS 1.1 Raspberry Pi Image

NEMS 1.1 Image File (zipped) – 1.46 GB

Unzip and “burn” to 8 GB+ Raspberry Pi 3 Micro SD Card (I recommend you use at least a 16 GB card so there’s plenty of room for logs, configs, data and so-on).

Configuring Your NEMS Server:
Browse to: http://nems/nconf (or http://IPADDRESS/nconf)
Make changes to the config as needed for your environment (eg., add a host, service, edit a setting)
I’ve added a few sample configurations in there (v1.1+) to help you get started.
Click: “Generate Nagios Config”
If there are no errors, you will have the option to Deploy the new Nagios Config.

Using Your NEMS Server:
Browse to: http://nems  (or http://IPADDRESS)
Choose Nagios for a customized Nagios system (easy), or use the Reports to create sophisticated reports and custom dashboards (advanced).
To add hosts or configure your environment, use the built in “Configure Nagios” feature.

Passwords:
NOTE: You should change these defaults when setting up your NEMS server.
Nagios – U: nagiosadmin / P: nagiosadmin
Reports – U: admin / P: admin

Changelog:

Version 1.1 – November 13, 2016
– NagVis upgraded to 1.8.5. (1.9 is still beta).
– Check_MK livestatus upgraded to 1.2.8p13.
– Added Check_MK Multisite 1.2.8p13.
– Added PNP4Nagios 0.6.16-2.
– Added a few sample configurations to NConf to help users figure out the initial setup and/or to use as templates. Included samples are: test if an external web site is up via ping, monitor a Linux server, monitor a Windows server.
– Created NEMS Migrator. New feature allows backing up and restoring your NEMS configuration, making migration or recovery a breeze.
Upgrade from NEMS 1.0.
– Added sendemail 1.56-5 and setup email config in /etc/nagios3/resource.cfg (you’ll need to add your SMTP info as per the instructions above).
– Added git, htop.
– raspi-config upgraded to 20161108.
– Linux kernel upgraded to 4.4.26-v7.
– Apache2 upgraded to 2.4.10-10+deb8u7.
– OpenSSL upgraded to 1.0.1t-1+deb8u5.
– MySQL upgraded to 5.5.52-0+deb8u1.
– Exim4 upgraded to 4.84.2-2+deb8u1.
– PHP upgraded to 5.6.27-0+deb8u1.
– PHPMyAdmin upgraded to 4.2.12-2+deb8u2.
– Python upgraded to 2.7.9-2+deb8u1.
– Network and Bluetooth firmwares upgraded.
– Various system components upgraded.
– Reduced the amount of memory dedicated to Raspberry Pi graphics adapter.

Version 1.0 – May 8, 2016 (Discontinued November 13, 2016, Downloaded 409 Times)
– Initial release. Built and tested on Raspberry Pi 3. Based on Raspbian Jessie. Inspired by NagiosPi, which in April 2016 was still running on the old Raspbian Wheezy. I started this new distro since NagiosPi seems to be out of date, and I want to have an easy drop-in Nagios img for the Raspberry Pi. Figured I’d share it with the world while I’m at it since there are probably others (possibly less tech savvy) who might want the same thing. I decided to leave most of the settings the same as NagiosPi (eg., usernames, passwords) so those coming from that distro can seamlessly transition, or so if NagiosPi wants to use our build to bring things up to date, they may do so with minimal effort.
– This initial build is using default repositories in a lot of cases and is meant to be rock-solid, not bleeding edge (eg., Nagios 3.5.1 instead of Nagios 4.1.1.
– Using the rpi-4.4.y Linux kernel tree (Currently 4.4.7-v7+ #876 SMP), firmware updated to 1e84c2891c1853a3628aed59c06de0315d13c4f1. Use rpi-update to check for upgrades, if needed.
– Includes rpi-update tool – an easier way to update the firmware on the Raspberry Pi – See https://github.com/Hexxeh/rpi-update
– On-board Bluetooth disabled due to potential stability issues. Use rpi-update to check for kernel updates and see if it is fixed, and then edit /boot/config.txt to re-enable. Until they fix it, use USB Bluetooth dongle if needed.
– Installed and configured: mysql-server mysql-client phpmyadmin apache2 nagios3 nagios-nrpe-plugin
– To keep things consistent for those coming from NagiosPi, I have used the same passwords. MySQL is: User: root Pass: nagiosadmin
– Installed w3m web browser to allow local testing in terminal: w3m localhost/phpmyadmin
– Manually installed NConf 1.3.0-0 “Final”, an Enterprise Nagios configuration tool. This tool was broken on NagiosPi’s instructions due to a missing symlink at /var/www/nconf, so I fixed that in my version. Access NConf via the “Configure Nagios” link on the main menu.
– Includes NagVis 1.7 – want to do 1.9 but not until out of beta.
– Built and integrated the first version of our menu system, which includes the first version of a custom Nagios skin to begin integrating a more modern interface. Menu accessible at http://nems/ (or http://IPADDRESS if that doesn’t work for you)
– Added a nice little MOTD.
– Added a simple cronjob to check our web site for the currently available version and warn you if yours is out of date.

Known Issues:

  • PNP4Nagios is installed, but not configured. You may encounter errors, which will be addressed in a future release.
  • If you encounter an issue, please report it in the comments below so I can work on a fix (or please post your fix to help others and possibly to have it integrated into the next build).

TO DO:
This list details features which are planned for future releases of NEMS. NEMS is released on a 6 month schedule, with a major release every May and November. Thanks to the NEMS Migrator, upgrading is a cinch.
– Further improve the mobile responsive layout for tablets and smartphones (It’s really rudimentary at the moment due to the nature of Nagios’ interface… frames? C’mon now.)
– Upgrade to Debian Stretch.
– Upgrade Nagios to Nagios Core 4.
– Upgrade NagVis to 1.9 (once it becomes “stable”).
– Add RPi-Monitor as per Hesh’s comment.
– Further streamline the implementation of Check_MK. Deploy check-mk-server.
– Expand the documentation to include setting up SMTP and mail alerts (while I added sendemail to NEMS 1.1, it appears people still have trouble figuring this part out). Admittedly, Nagios is complicated… but NEMS intends not to be. So this will be made either more clear, or more easily achievable.
– I’m open to suggestions! Please post your comments at http://baldnerd.com/nems

Things I Will Not Do:
This is a list of features I will not implement.
– Raspberry Pi Zero, 1 & 2 support. Buy a Raspberry Pi 3. The higher performance of a Pi 3 is a major asset for a project like NEMS, so I will not be focusing any of my efforts on supporting legacy hardware.
– GUI/Desktop. NEMS is a Linux server. If you require a GUI/Desktop Environment, you’re doing it wrong. I have built a very nice, easy to use web interface, and have worked hard to provide good documentation to ease the complication of configuration for novice users. NEMS itself should not even have a screen connected to it. Just power and Ethernet. Everything happens either through your browser, or for advanced users, an SSH connection.

Support What We Do:
This project is a part of something much bigger than itself, and we’re all volunteers. Please see our Patreon page for information about our network.
– Please support us by simply purchasing your Raspberry Pi at https://cat5.tv/pi
– We have some support links on the NEMS menu, such as buying from Amazon using our partner link. Please use these every time you use those stores. A small percentage of your purchase will go toward our projects.
– Your donations are VERY MUCH appreciated – https://donate.category5.tv – Please consider how many hours (and hours) of work this project has saved you, and how much you’ll save on hardware and even electrical costs as you consider contributing
– Our network also has a Patreon page – Please consider becoming a patron – https://patreon.com/Category5