Nagios Raspberry Pi Zero Temperature Sensor – Part 1

So this is my first Raspberry Pi Zero project! The goal of this project is to build a low cost temperature sensor that could be used to monitor a server room for example. I have broken it down into two blog posts:

  • Part 1 – Building the hardware
  • Part 2 – Software configuration

I will be using a remote server running Nagios Core with the NRPE plugin. I have also installed pnp4nagios to graph the temperature reading. (the remote server install will not be covered)

The parts list:

  • Raspberry Pi Zero
  • DS18B20 Temperature Sensor (with cable)
  • Micro SD Card
  • Micro USB NIC (or wifi adapter)
  • 4.7K Resister
  • Micro USB Phone Charger (not pictured)

The Parts

You will also need a soldering iron, some solder and a cable tie.

Continue reading

Posted in Linux | Tagged , , | Comments Off on Nagios Raspberry Pi Zero Temperature Sensor – Part 1

Geek Christmas Office Decoration

Xmas Countdown

The standard IT Christmas decoration…. Not bad for one spare evening!

Posted in Uncategorized | Tagged , | Comments Off on Geek Christmas Office Decoration

Windows Nagios MPIO Path Plugin/Check

Recently I was installing and configuring a Fiber Channel SAN. The setup consisted of a NetApp E2760 with around 40TB of space, connected to some IBM Blades running Window Server 2012 R2 via redundant SAN controllers and brocade fabric switches. The resilient design enabled the servers to have a total of 4 8Gb FC paths to the storage.

I wanted to setup a check in Nagios to monitor the number of active paths so we would be alerted if any of the redundant cables/components failed. Below is very simply Powershell script that I wrote to do just that. The script returns a warning when a path is lost and a critical status when two or less paths are active. The script took around 10 minutes to write and was built to do one job, so it is simplistic. You could easily add improvements such as the use of arguments so the settings could be modified from the Nagios side.

I am guessing the script will work for MPIO iSCSI however I have not tested it.

# Name: MPIO Path Check 
# Version: 0.1 
# Author: Thomas Chubb 
# Date: 13/11/2015

# Clear host
Clear-Host

# Settings
$TotalPaths = 4
$WarningPaths = 3
$CriticalPaths = 2

# Get active MPIO paths
$PathCount = ((Get-WmiObject -Namespace root\wmi -Class MPIO_PATH_INFORMATION -ErrorAction SilentlyContinue).Pathlist | Measure-Object).Count
if (!$?){Write-Host "UNKNOWN - Error Querying WMI";Exit 3}

# Return results
switch ($PathCount){
    $TotalPaths              {Clear-Host;Write-Host "OK - All Paths Active ($PathCount/$TotalPaths)";Exit 0}
    0                        {Clear-Host;Write-Host "CRITICAL - No Active Paths Detected ($PathCount/$TotalPaths)";Exit 2}
    {$_ -le $CriticalPaths}  {Clear-Host;Write-Host "CRITICAL - Failed Path Detected ($PathCount/$TotalPaths)";Exit 2}
    {$_ -le $WarningPaths}   {Clear-Host;Write-Host "WARNING - Failed Path Detected ($PathCount/$TotalPaths)";Exit 1}
    default                  {Clear-Host;Write-Host "UNKNOWN - Error determining state";Exit 3}
}

MPIO_Path_Check_0.1

Posted in Server | Tagged , , | Comments Off on Windows Nagios MPIO Path Plugin/Check

MariaDB on a Small VPS

So I am in the process of migrating from a CentOS 5 VPS to a CentOS 7 one. I run various services on my VPS, most of the services are light on resources. I am running MariaDB for this blog, and only for this blog. I am not using MyISAM tables, meaning I can disable InnoDB. This will free up some RAM on the box.
Continue reading

Posted in CentOS, Linux | Tagged , | Comments Off on MariaDB on a Small VPS

Nagios OpenVPN User Count Plugin/Check

So this is one of my first checks I have written for Nagios in Python. I developed the script originally just to return performance data and always return a status of ‘0’ (ok). This was so I can view the total users connected and plot the data in a graph. However I have also added some switches so a warning and critical event can be triggered.

This script has been tested on CentOS 5.11 running Nagios Core 4 and Python 2.4. You will need a basic understanding on how to configure Nagios to install this check. The example below is for a local check, meaning OpenVPN is running on the same box as Nagios itself.

Installing the check:

  1. First ensure that the nagios user can read ‘/etc/openvpn/openvpn-status.log’ and ‘status openvpn-status.log’ is set in your OpenVPN config file.
  2. Save the below script to ‘/usr/local/nagios/libexec/check_openvpn_totalusers.py’.
    Continue reading
Posted in Linux | Tagged , , , , | Comments Off on Nagios OpenVPN User Count Plugin/Check

I am Back!

So it has been nearly 5 years since I last posted on here! Cannot believe it!

I am always working on projects in my spare time, its time I started posting them. In my day job I have written a fair few Powershell scripts that I would like to share. Recently I have started doing more Python programing so I will be posting that on here too.

My home lab has grown massively, I have a full blow Windows enterprise environment running a powerful Dell PowerEdge 2900 using VMWare ESXi. This is connected to a HyperV 2012 R2 cluster made up of a few HP DL380s.

Watch this space!

Polaris A1 Nuclear Missile Tube Indicator Project!

 

 

Posted in Uncategorized | Tagged | Comments Off on I am Back!

Fileserver Update!

At last I have ordered the final parts for my fileserver :) The parts should all be hear before the end of the week and the case hopefully will be here early next week. I will do some posts on the build and configuring of the server. The motherboard I have gone with is a Gigabyte GA-D525TUD Intel Atom D525 / NM10 Motherboard. 1.8GHz dual core atom (1mb cache) with 2GB of DDr3 ram.

Posted in Atom Fileserver | Tagged , , , , | 1 Comment

Shared Windows XP Printer With Vista/Win7

For a while I have had a simple shared printer on a Windows XP machine. I added it to my Windows Vista Laptop and all was good. The problem started when I went to add the printer to my Windows Vista desktop that runs a 64Bit version of windows. Continue reading

Posted in Client | Tagged | Comments Off on Shared Windows XP Printer With Vista/Win7

Fileserver Update

I now have the drives for my raid 5 array! Ebuyer had an offer on Samsung F3 (1TB) for £40!!!!!! So I got 3 for a total of 2TB useable space before formating. I will be using ext3 with LVM. I also grabbed some 24inch latching sata cables.

Posted in Atom Fileserver | Tagged , , , , | Comments Off on Fileserver Update

Plans for New Fileserver!

I have been wanting to build a low powered fileserver with a ton of storage for some time. Hopefully soon I will build the new machine with the following parts:

  • Gigabyte GA-D510UD £68.26 (1.6 dual core atom)
  • 2gb of DDR 2 ram. £29
  • 3x 1TB Sata II drives. £132
  • 4u case. £48
  • 8gb CF card for OS. £15

Plus some stuff I already have.

  • IDE to CF card reader.
  • PSU.
  • Sata cables.

I will post more details when I order the parts :) I will be using CentOS 5.5 and use software raid to create a Raid 5!

Posted in Atom Fileserver | Tagged , , , , | Comments Off on Plans for New Fileserver!