Welcome to It-Slav.Net blog
Peter Andersson
peter@it-slav.net

I've already got a female to worry about. Her name is the Enterprise.
-- Kirk, "The Corbomite Maneuver", stardate 1514.0

At my home the most critical system is the MythTV system and a MythTV downtime will create a revolt at home. This article will describe howto make sure that a MythTV backend can be surveillanced with Nagios or op5 Monitor.


I have in earlier articles described howto install and configure both the backend and the frontend.


To monitor MythTV backend I have identified the following parts:

  • MySQL database, contains data about TV records and program listings.
  • Mythbackend, the process that controls the MythTV backend.
  • Mythfilldatabase, runs XMLTV that puts programlistings in the MySQL database.
  • Webserver.
  • Internet access to grab TV show listings.

I created a service group called MythTV


A screenshot from op5 Monitor

Theory

A short description of how the nagios checks works and what they do.


MySQL

This check verifies that MySQL is working, I use login mythtv and passowrd mythtv, the default mythtv login and password that the frontend would use.


Mythbackend

The mythbackend uses TCP port 6543 for status information. I assume that if this port responds, mythbackend is up and running.


Mythfilldatabase

The status of how many days data in the Listings database can be found at the webpage http://<mythtvbackend>:6544


If the page contains “13 days” or “14 days” or “15 days”, I think mythfilldatabase as OK.

I’ve got the idea from http://www.techsneeze.com/monitor-mythtv-nagios


Mythweb

Check that http://<mythtvbackend>/mythweb responds. (I know that if the webserver is down the mythfilldatabase check will also be CRITICAL but it might be so that the database do not contain 13 or more days of Listings while the webserver still works.)


Ping

A simple ping to make sure that the system with MythTV backend is up.


System Load

If the MythTV backend system has to much to do, the MythTV service will not work.


Internet

The mythfilldatabase uses Internet to grab the Listings. I ping a couple of well known hosts on internet and if none of them responds I assume that my Internet connection is down.


Implementation

These files contains the Nagios configuration. I have choosen not to include the actual scripts that are used, most of them are included in a standard Nagios installation or op5 Monitor installation.


hosts.cfg:

# host 'ibsen'
 define host{
 use                            default-host-template
 host_name                      ibsen
 alias                          MythTV
 address                        10.1.1.11
 hostgroups                     unix-servers
 contact_groups                 it-slav,call_it-slav,it-slav_msn
 }
# host 'internet'
 define host{
 use                            default-host-template-internet
 host_name                      internet
 alias                          Internet
 address                        194.71.11.69
 parents                        first_router
 check_command                  check_internet!ftp.sunet.se www.google.com www.yahoo.com www.ibm.com
 contact_groups                 it-slav,call_it-slav,it-slav_msn
 }

services.cfg

# service 'MySQL'
 define service{
 use                            default-service
 host_name                      ibsen
 service_description            MySQL
 check_command                  check_mysql!mythtv!mythtv
 servicegroups                  it-slav,MythTV
 contact_groups                 it-slav_msn,it-slav
 }
# service 'Mythbackend'
 define service{
 use                            default-service
 host_name                      ibsen
 service_description            Mythbackend
 check_command                  check_tcp!6543
 servicegroups                  it-slav,MythTV
 contact_groups                 it-slav_msn,it-slav
 }
# service 'Mythfilldatabase'
 define service{
 use                            default-service
 host_name                      ibsen
 service_description            Mythfilldatabase
 check_command                  check_http_url_regex_port!"/"!"(15 days)|(14 days)|(13 days)"!6544
 servicegroups                  MythTV
 contact_groups                 it-slav_sms,it-slav_msn,it-slav_mail
 }
# service 'Mythweb'
 define service{
 use                            default-service
 host_name                      ibsen
 service_description            Mythweb
 check_command                  check_http_url!/mythweb
 servicegroups                  MythTV
 }
 # service 'PING'
 define service{
 use                            default-service
 host_name                      ibsen
 service_description            PING
 check_command                  check_ping!100,20%!500,60%
 servicegroups                  it-slav,MythTV
 contact_groups                 it-slav,it-slav_msn
 # service 'System Load'
 define service{
 use                            default-service
 host_name                      ibsen
 service_description            System Load
 check_command                  check_nrpe!load
 servicegroups                  it-slav,MythTV
 contact_groups                 it-slav,it-slav_msn
 }
####################################################
 #
 # Services for host internet
 #
# service 'Kolla Internet'
 define service{
 use                            default-service
 host_name                      internet
 service_description            Kolla Internet
 check_command                  check_internet!ftp.sunet.se www.google.com www.yahoo.com www.ibm.com
 servicegroups                  MythTV
 contact_groups                 it-slav,it-slav_msn
 }

checkcommands.cfg:

# command 'check_mysql'
 define command{
 command_name                   check_mysql
 command_line                   $USER1$/check_mysql -H $HOSTADDRESS$ -u $ARG1$ -p $ARG2$
 }
 # command 'check_tcp'
 define command{
 command_name                   check_tcp
 command_line                   $USER1$/check_tcp -H $HOSTADDRESS$ -p $ARG1$
 }
 # command 'check_http_url_regex_port'
 define command{
 command_name                   check_http_url_regex_port
 command_line                   $USER1$/check_http -H $HOSTADDRESS$ -u $ARG1$ -r $ARG2$ -p $ARG3$
 }
 # command 'check_http_url'
 define command{
 command_name                   check_http_url
 command_line                   $USER1$/check_http -H $HOSTADDRESS$ -u $ARG1$
 }
 # command 'check_internet'
 define command{
 command_name                   check_internet
 command_line                   $USER1$/custom/check_internet.sh "$ARG1$"
 }

servicegroups.cfg:

# servicegroup 'MythTV'
define servicegroup{
 servicegroup_name              MythTV
 alias                          MythTV
 }

Links


One Response to “MythTV part4, Monitor MythTV backend with Nagios or op5 Monitor”

  1. Using Nagios or op5 Monitor eventhandler to start a service that has stopped | An It-Slave in the digital saltmine Says:

    […] every third day the MythTVbackend server stops and need to be started again. I have wriiten an earlier article about howto monitor MythTV with Nagios or op5 Monitor so I get noticed that it has stopped. But I […]

Leave a Reply





Book reviews
FreePBX 2.5
Powerful Telephony Solutions






Asterisk 1.6
Build a feature rich telephony system with Asterisk






Learning NAGIOS 3.0





Cacti 0.8 Network Monitoring,
Monitor your network with ease!