Monitor MythTV with Nagios

I have been using MythTV (http://www.mythtv.org) for several years, and recently realized I should better monitor the health of the system. Nagios (http://www.nagios.org) is currently deployed to monitor most of the components (i.e. memory, cpu, disk usage, processes, etc). However, it is not uncommon for issues to arise, which may cause problems with obtaining the Guide Data. I have a desire to create a more thorough system, but have temporarily made a simple check for how many days of guide data is currently available.
The script checks the MythTV status port (6544) and finds the number of days of information available.

I first edited /etc/nagios/checkcommands.cfg and added:

define command {
command_name check_mythtv_gd
command_line $USER1$/check_http -H $HOSTADDRESS$ -p 6544 -r "($ARG1$ days)|($ARG2$ days)"
}

UPDATE :
As of MythWeb 0.25, I had to change the command to :

command_line $USER1$/check_http -H $HOSTADDRESS$ -p 6544 -u /Status/GetStatusHTML -r "($ARG1$ days)|($ARG2$ days)"

Next I edted the services.cfg file, adding:

# Service definition
define service{
use generic-service ; Name of service template to use
host_name mythtvhost1
service_description MYTHTV_GD
is_volatile 0
check_period 24x7
max_check_attempts 3
normal_check_interval 3
retry_check_interval 1
contact_groups system-admins
notification_interval 120
notification_period 24x7
notification_options w,u,c,r
check_command check_mythtv_gd!14!13
}

The 14 and 13 above represent the expected “days” of guide data that will be available. My MythTV system typically has 13 or 14 days of information, and if there is less information there is a problem. Others implementing this monitoring may find that they need to tune these numbers to what they typically see.

While this allows you to monitor the guide data of MythTV with Nagios, it is also validating that the backend is running.

Leave a Reply

Your email address will not be published. Required fields are marked *