Nagios is a highly versatile tool used for monitoring network hosts and services. One of its notable strengths is its customizability, allowing users to tailor it to their specific needs. In this blog post, I will introduce a bash script that monitors the amount of guide data available to MythTV, an open-source digital video recorder (DVR) software.

To make use of this script, follow these steps:

  1. Create a file called "check_mythtv_gd" in the directory "/usr/local/nagios/libexec/" (or the appropriate location for your libexec directory).
  2. Ensure that the new file has execute permissions and is owned by the "nagios" user.
  3. Copy the provided script into the "check_mythtv_gd" file.
  4. Replace "[IP ADDRESS]" in the script with the IP address of your MythTV backend server.
  5. Add a command definition to your Nagios configuration file.
  6. Create a service definition that references the "check_mythtv_gd" script.

Nagios Command Definition:

define command { command_name check_mythtv_gd command_line $USER1$/check_mythtv_gd }

Bash script:

#!/bin/bash
days="$(wget -q http://[IP ADDRESS]:6544/Status/GetStatusHTML -O - | \
grep -Po '(?<=\().*(?= days\).<br />)')"
if [ "$days" -ge 12 ]; then
echo "OK - $days days of guide data."
exit 0
elif [ "$days" -ge 8 ] && [ "$days" -le 11 ]; then
echo "WARNING - $days days of guide data."
exit 1
elif [ "$days" -le 7 ]; then
echo "CRITICAL - $days days of guide data."
exit 2
else
echo "UNKNOWN - Unknown guide data status."
exit 3
fi

I took a different approach to complete this task, but credit goes to TechSneeze for the idea of monitoring guide data on MythTV.

Tracking MythTV Guide Data with Nagios

Learn how to monitor guide data on MythTV using Nagios. Enhance your system's performance and stay updated with this easy-to-follow guide.