Personal tools
You are here: Home Linux MythTV OpsView/Nagios monitoring of MythTV

OpsView/Nagios monitoring of MythTV

Download the latest version (v1.1) to '/usr/local/nagios/libexec/' and mark the script as executable. Install perl dependencies:

# yum install perl-libwww-perl perl-XML-Simple

Ensure the opsview/nagios machine can access the IPv4 TCP port 6544 on the mythtv backend. By default the perl simple library will use a web proxy if it is configured (e.g. with 'http_proxy' in the environment). I created a modified script that uses the UserAgent object instead of the Simple client. This allows control over the proxy (which by default is not enabled).

Create a  'Service Checks' for the script

Create MythTV Service Check.png


Add a host to the configuration and apply the service to the host.





---    2011-10-02 17:12:46.000000000 +1300
+++     2011-10-02 17:23:40.000000000 +1300
@@ -23,7 +23,7 @@
 use lib "/usr/lib64/nagios/plugins";
 use utils qw($TIMEOUT %ERRORS &print_revision &support);
 use Getopt::Long;
-use LWP::Simple;
+use LWP::UserAgent;
 use XML::Simple;
 my ($opt_p, $opt_H, $port, $hostname);
 sub print_usage ();
@@ -71,10 +71,16 @@

 # Main code
+my $ua = LWP::UserAgent->new;
+my $response = $ua->get("http://$hostname:$port/xml");
+if (!$response->is_success) {
+       print "Failed to get http://$hostname:$port/xml\n";
+       exit $ERRORS{'CRITICAL'};

-my $xml = get("http://$hostname:$port/xml");
+my $xml = $response->decoded_content;
 if (!defined $xml) {
-       print "Failed to get http://$hostname:$port/xml\n";
+       print "Failed to decode response from  http://$hostname:$port/xml\n";
        exit $ERRORS{'CRITICAL'};

Document Actions