Installing Nagios as a Systems Monitor

I start with the Digital Ocean tutorial.

Install Nagios 4

First, install Apache and PHP.

$ sudo apt install autoconf gcc make unzip libgd-dev libmcrypt-dev libssl-dev dc snmp libnet-snmp-perl gettext

$ cd ~
$ curl -L -O https://github.com/NagiosEnterprises/nagioscore/archive/nagios-4.4.5.tar.gz

$ tar zxf nagios-4.4.5.tar.gz
$ cd nagioscore-nagios-4.4.4
./configure –with-httpd-conf=/etc/apache2/sites-enabled
make all
sudo make install-groups-users

sudo make install
sudo make install-daemoninit
sudo make install-commandmode
sudo make install-config

more

Install Nagios Plugins and NRPE Daemon on Host

sudo useradd nagios
sudo apt update
sudo apt install autoconf gcc libmcrypt-dev make libssl-dev wget dc build-essential gettext

cd ~
curl -L -O https://nagios-plugins.org/download/nagios-plugins-2.3.3.tar.gz
tar zxf nagios-plugins-2.3.3.tar.gz
cd nagios-plugins-2.3.3
./configure
make
sudo make install

cd ~
curl -L -O https://github.com/NagiosEnterprises/nrpe/releases/download/nrpe-4.0.0/nrpe-4.0.0.tar.gz
tar zxf nrpe-4.0.0.tar.gz
cd nrpe-4.0.0
./configure

Another try at getting a client to work: https://www.howtoforge.com/tutorial/ubuntu-nagios/

OpenVPN/pfsense Configuration

Lawrence Systems has an excellent video describing how to setup OpenVPN for remote access on pfsense. Once the setup is complete, add users from the System / User Manager / Users dialog in pfsense.

Windows Users

For Windows users, simply run VPN / OpenVPN / Client Export / Current Windows Installer. This creates an executable to run on the client machine.

Android Users

For Android users, create the inline configuration (.ovpn) file and copy to the device. Install OpenVPN from the play store and import the profile (.ovpn file).

Installing pfSense for Firewall/Router

I installed pfSense as a KVM guest using a variety of sources. The basic installation is pretty simple. I used a Crosstalk Solutions video to guide me.

One issue was that IP permanent reservations are implemented different from typical home routers. Static (permanent) IP addresses can’t be part of the DHCP address pool. Permanent addresses are assigned as static addresses in a different range. However, they will be assigned to the client by DHCP. This made it difficult to keep permanent assignments so my servers all got new IP addresses. Ugh.

Another issue is how to dedicate two new 1GB NICs to the pfSense machine. I opted to use the passthrough option for them when I created the virtual guest. They both negotiated at 100mbps/full duplex. The LAN side should have negotiated at 1GB which is an open issue.

My Ubuntu/KVM drive is a single 256MB Kingston SSD. Since it’s not mirrored, I need a good backup plan.

Dynamic DNS

Since my home IP address is not static, I need to use Dynamic DNS to update my NameCheap domain (lynnhargrove.com) when my IP address changes. I set up a cname record that points to host www at lynnhargrove.com and an aname record that points to host @ at 98.174.184.138. I used a NameCheap forum post to configure NameCheap and pfSense for DDNS, however I was unable to successfully test the update process.

NAT/Port Forwarding

Port forward is under Firewall/NAT in pfSense. When you create a port forward entry, a corresponding rule is written to allow the port through the firewall. What was not obvious is that under System/Advanced/Firewall & NAT/Network Address Translation, you must enable NAT reflection mode for port forwards. Of the two choices, Pure NAT didn’t work, but NAT + proxy did.

Unable to Get IP Address for Host Adapter

There may be a better way to configure networking, but I have a guest VM (pfSense) serving an IP address to the KVM host. Obviously, pfSense is not available when KVM starts so KVM doesn’t get an IP address. It seems to eventually resolve. I configured a static address in /etc/network/interfaces but that didn’t help. I added this to crontab:

sudo crontab -e

@reboot sleep 300 && dhclient

24/7 Low-Power Home Lab Server

I decided to make my AMD 5370 low-power (~55w) Ubuntu KVM virtualization server a “production” home lab server.  I just picked up a hand-me-down HP ProLiant DL360 Gen8 server which is not so low-power (~180w). This pushed me to run the AMD server continuously and to turn on the ProLiant when I want to play in the sandbox. Since Ubuntu/KVM lacks Smart Array drivers for the ProLiant, I’ll use VMware ESXi.

I run my Ubuntu file server as a guest on the AMD server. Since it will no longer be a sandbox, I added a couple of PCIe 1GB NICs and installed the pfSense firewall/router. I plan to include an OpenVPN server. I also plan to add Nagios (systems monitor), NextCloud and probably FreeNAS for my file server. I also run a PlayOn/Plex media server on a Lenovo M73 with is really low-power (~15w). I might move PlayOn and Plex to the AMD server. It might even be fun to put an Umbuntu software mirror on the AMD. I suspect I should get a life, but I think that ship has sailed.

For lack of a better place to note it, use tasksel to install packages from a command line menu after the initial installation.

Expand KVM Guest Root Partition without LVM

I installed KVM without LVM to keep it simple. My guest file server ran out of root partition space when I installed Plex Media Server. This guide helped me increase the size of my virtual disk.

SSH to kvm:

$ sudo virsh domblklist file2

fdisk -l /var/lib/libvirt/images/file2.qcow2

sudo qemu-img resize /var/lib/libvirt/images/file2.qcow2 +3G

SSH to file2:

lsblk (confirm new disk size)

sudo growpart /dev/vda 2

lsblk

sudo resize2fs /dev/vda2

df -h

Mac OS X on Lenovo X220

The Lenovo ThinkPad X220 is about the only  Hackintosh alternative under $300. and it’s one of the easiest MacOS installs. It is vintage 2011, but it does have an Intel Core i5-2540M 2.60 GHz Dual-core processor that may be my fastest computer at the moment. I was looking for a 13″ screen lightweight laptop that traveled well. It has a 12.5″ screen and weighs 3.8 pounds. I found a refurb on Newegg for $155 and a MAC OS X compatible WiFi card for $13.

Mac OS X Mojave 10.14 (9/24/18) does not easily support the ThinkPad X220 hardware. Therefore, Mac OS X High Sierra 10.13 (9/25/17) is what I will install with no plans to upgrade. I will use the McDonnel Tech guide for installation.

  1. Install the modified BIOS version 1.46 to remove the whitelist check and permit the installation of the Dell DW1510 WiFi card. Mac OS must be installed before installing the WiFi card.
  2. Create a USB installer using an existing Mac OS X computer following the guide.

MacOS Snow Leopard on Asus P5KPL-CM

I’m using the guide from tonymacx86 and a computer with an Asus P5KPL-CM motherboard, an E5300 @ 2.6GHz with 4 GB of memory.

  1. Follow guide. There was no ACHI mode in my BIOS so I skipped that part
  2. Boot iBoot and follow guide to install OS X 10.6 Snow Leopard from CD
  3. Download Mac OS X 10.6.8 Combo Update and MultiBeast for Snow Leopard
  4. The network did not work so I added a network card (?) and it worked