Simple Disk Pool Manager (DPM) Nagios Test


Written by

There are several DPM testing tools and a suite of DPM nagios plugins (see the monitoring docs) but these utilise NRPE and are relatively complex compared the the quick and useful DPM-Tester.py

This is a script that wraps that test tool for nagios; the original test script doesn’t exit with any exit codes, so it is grep’ing for the word fail and counting the number of lines, it is also checking to see if the script seg faults as it does randomly seg fault if a proxy isn’t set.

This assumes you have half a clue of what you’re doing and are running the script on the nagios host, a host certificate with the appropriate permissions in DPM and a passwordless key.

The latest version of this script can be found on github

 

#!/bin/bash
# Nagios Plugin Wrapper for checking DPM
# Adam Boutcher - May 2017 - GPLv3
#   I would suggest reading this script and implementing your own version of it.
#   Put your host certificate & key in /etc/nagios/ and 400 it to nagios.
#   Add a Grid Map for this host certiciate to your DPM Test PATH on your DPM Server.
#   requires dpm-tester.py

if [[ -z "$1" ]]; then
echo "No Arguments Supplied"
echo "Check --usage for usaged details."
exit 1
elif [ $1 = "-u" ] || [ $1 = "--help" ] || [ $1 = "--usage" ]; then
echo "check_dpm Super Simple DPM tester for Nagios - I personally wouldn't use it."
echo "Usage:"
echo "-h --host Hostname"
echo "-t --test Test [davs, root, gsiftp, combined]"
echo "-p --path Path to test"
echo " --help Same as -u --usage"
echo "-u --usage This screen"
exit 0
else
while [[ $# -gt 1 ]]
do
key="$1"

case $key in
-h|--host)
DHOST="$2"
shift
;;
-t|--test)
DTEST="$2"
shift
;;
-p|--path)
DPATH="$2"
shift
;;
*)
echo "Wrong Arguments Supplied."
echo "Check --usage for usaged details."
exit 1
;;
esac
shift
done
# Get a Proxy from host cert - chmod 400 these files and own it by your nagios user.
# Only renew if it's expired
export X509_USER_CERT=/etc/nagios/hostcert.pem
export X509_USER_KEY=/etc/nagsu ios/hostkey.pem
SECPROX=$(arcproxy -i validityEnd)
SECNOW=$(date +%s --date "30 seconds")
if [ $SECPROX -le $SECNOW ]; then
arcproxy >/dev/null 2>&1
fi

DIFF=$(dpm-tester.py --host ${DHOST} --path ${DPATH} --tests ${DTEST} --cleanup | grep -i FAIL | wc -l)

# Test for the number of FAIL lines counted OR segfault Exit code (dpm-tester.py hasn't got exit codes implemented)
if [[ "$DIFF" > "0" || "$?" > "0" ]]; then
OUTPUT=$(dpm-tester.py --host ${DHOST} --path ${DPATH} --tests ${DTEST} --cleanup | tail -n1)
echo "CRITICAL - DPM ${DTEST} - ${OUTPUT}";
exit 2;
else
echo "OK - DPM ${DTEST}";
exit 0;
fi
fi

Windows & LLDP


Written by

After spending countless hours tracing network cables around my workplace to figure out what switch port they go into, I finaly gave in and looked for a little LLDP tool, I was wanting something small and simple much like lldpd mentioned in my previous post.

I have found a neat little tool called LDWin that collects LLDP and CDP information; its small and simple and only requires admin access to listen on the interface. Great if you’ve got LLDP setup on your network switches and can save precious time tracing messy patch cabling.LDWin

Linux Servers & LLDP


Written by

If you’ve ever tried to locate a server’s uplink port on a switch then you’ve probably wondered why there isnt CDP/LLDP being utilised within the server networking world, well there are a few implementations but the easiest I’ve used is lldpd. This means you can now easily locate linux systems from your switches or figureout what switch port you’re in from linux all utilising lldp.

Just run the following command once installed and you get a lovely simple output.

lldpctl
-------------------------------------------------------------------------------
LLDP neighbors:
-------------------------------------------------------------------------------
Interface:    eth0, via: LLDP, RID: 1, Time: 0 day, 00:32:05
  Chassis:
    ChassisID:    mac 00:xx:xx:xx:61:52
  Port:
    PortID:       ifname ge.1.40
-------------------------------------------------------------------------------

Windows Server 2012 R2 Core & File Server Resource Manager


Written by

After fidling around for a while trying to make FSRM work to connect to a 2012 R2 Core server as it kept complaining that the RPC server was unavailable even though other MMC snap-ins were working correctly; I finally found out it was the firewall blocking the ports.

 

Use this command if you cant make it work:

netsh advfirewall firewall set rule group=”Remote File Server Resource Manager Management” new enable=yes

Linux Mint Debian (LMDE) , PulseAudio and Bluetooth Speakers


Written by

So it’s been a while since I last blogged about anything and today I’ve had a hell of a time with PulseAudio and Bluetooth and trying to find an actual solution to my woes (Jump to the guide).

I recently bought an Intel 7260AC Wireless and Bluetooth PCIe card for my laptop and also decided to try Linux as my main OS again. Now I prefer Debian as a distro but have found it to be a little stale in some aspects mainly surrounding it’s stable repos. I have in the past tried Ubuntu but it’s such a hassle removing the default crap like the horrid Unity Amazon integration and I dislike unity so that’s totally out of the question. I have however decided to try Linux Mint Debian Edition (LMDE) as it’s 100% Debian testing compatible which is nice and actually cinnamon is a nice DM/GUI which has finally matured sufficiently.

Everything installed perfectly fine via the DVD and I was greeted with a very nice login manager (although I can see the screen refresh which I can’t be bothered to fix as its only a minor annoyance) and then a very simple and nice Cinnamon desktop manager. Cinnamon is a fork of GTK3+3 / GNOME developed for Mint with the classic gnome look and feel. The default layout is a single pane on the bottom of the screen and a menu bar, a few launcher icons, the task bar, notifications and a clock.

desktop

Everything surprisingly worked out of the box, including the WiFi, graphics and Bluetooth which are all things I’ve had issues with in the past.

The Problem…

But here comes my problem, I went to use one of my bluetooth speakers from my laptop to have a play around. I could pair the devices perfectly fine but then the laptop refused to use the bluetooth speakers as an output.

Now audio in linux isn’t an entirely simple affair and tracking down at what stage the fault was at was hard but I was fairly certain it was between PulseAudio and the bluetooth (Bluez), there is a packaged lib for pulseaudio and bluetooth called ‘pulseaudio-module-bluetooth’ which is reported to fix issues but it was already installed which meant the issue wasn’t with pulseaudio directly but something was meaning the modules were not being loaded correctly after the bluetooth was paired which wasn’t enabling the A2DP Sink, I tried manually loading the modules with no success.

I then stumbled across some posts about that discussed editing the way the bluetooth stack connects this involved editing a couple of core config files for bluetooth. I tried a couple of different configurations, some of which caused bluetooth to stop pairing all together but I finally found a working config.

The Solution…

So if you’re struggling to get a bluetooth speaker or headset to work after pairing it then try the following:

su
nano /etc/bluetooth/audio.conf

add the following underneath [General]

Disable=Socket
Enable=Media,Source,Sink,Gateway

Save & exit

service bluetooth restart

This allowed me to re-pair my device and have it show up correctly in PulseAudio.