Login | Register For Free | Help
Search for: (Advanced)

Mailing List Archive: MythTV: Users

Monit help needed! Howto monitor myth's log file?

 

 

MythTV users RSS feed   Index | Next | Previous | View Threaded


william_munson at comcast

Jul 4, 2009, 1:15 PM

Post #1 of 4 (506 views)
Permalink
Monit help needed! Howto monitor myth's log file?

First off, I really suck at regex. That out of the way I want to set up
monit to monitor mythbackend log for a logged failure to record from
firewire event and to restart the backend. I already have a patch in
place to re-sync the STB as part of a restart of the backend service so
that part is taken care of. What I need help with is the regex and
control statement for the monitrc file. A failed firewire recording
always generates the following text in the log:

Canceled recording (Recorder Failed)

I dont care at the moment what the recording is only that the system
restart to clear the error. What is the correct regex to match that
exact text anywhere in the line?

I think I need to use something like this:

#/etc/monit/monitrc

set daemon 120
set httpd port 2812

check file mythbackend.log at /var/log/mythtv/mythbackend.log
if <fill in the regex> then exec "/etc/init.d/mythbackend restart"

however this results in a syntax error on the command following the exec
command. Any thoughts on a more correct way to do this? I also get an
error if i add the conditional statement "with start delay 60" to the
daemon line even though the man pages plainly show it should work. I
wonder if I have a really old version of monit? System is fully up to
date afaik.

I am running ubuntu 8.10 if that matters.

TIA,
Bill

_______________________________________________
mythtv-users mailing list
mythtv-users [at] mythtv
http://mythtv.org/cgi-bin/mailman/listinfo/mythtv-users


william_munson at comcast

Jul 4, 2009, 1:23 PM

Post #2 of 4 (477 views)
Permalink
Re: Monit help needed! Howto monitor myth's log file? [In reply to]

William wrote:
> First off, I really suck at regex. That out of the way I want to set
> up monit to
FYI monit -V output:

This is monit version 4.10.1
Copyright (C) 2000-2007 by the monit project group. All Rights Reserved.


_______________________________________________
mythtv-users mailing list
mythtv-users [at] mythtv
http://mythtv.org/cgi-bin/mailman/listinfo/mythtv-users


william_munson at comcast

Jul 4, 2009, 3:39 PM

Post #3 of 4 (476 views)
Permalink
Re: Monit help needed! Howto monitor myth's log file? [In reply to]

William wrote:
> William wrote:
>> First off, I really suck at regex. That out of the way I want to set
>> up monit to
> FYI monit -V output:
>
> This is monit version 4.10.1
> Copyright (C) 2000-2007 by the monit project group. All Rights Reserved.
>
Ok, now we are making progress. Found that the latest version is 5.03 so
manually compiled and installed it after removing the packaged version.
Now its happy with the config file and is up and running . Still could
use some help with the regex. At the moment I have it match the
following: "Recorder Failed" which the web page correctly reports. I
guess my question is... Is that a proper regex or should I use something
else? If nothing else I will know once I have another recorder failure.

TIA,
Bill

_______________________________________________
mythtv-users mailing list
mythtv-users [at] mythtv
http://mythtv.org/cgi-bin/mailman/listinfo/mythtv-users


william_munson at comcast

Jul 5, 2009, 10:46 AM

Post #4 of 4 (436 views)
Permalink
Re: Monit help needed! Howto monitor myth's log file? [In reply to]

Following up to my own post. Spent some time getting to know regex and I
think I have things set up correctly now. For those who are interested,
here is my monitrc minus the personal info.


----------------------

# check the backend log for strings indicating a problem with a firewire
# activity. If found run the external script monit-actions-mythtv to clean
# up the mess.
check file mythbackend.log with path /var/log/mythtv/mythbackend.log
if match ".*Canceled recording \(Recorder Failed\).*" then exec
monit-actions-mythtv
if match ".*Failed to set channel.*" then exec
monit-actions-mythtv
if match ".*Unable to get handle for port.*" then exec
monit-actions-mythtv


# check the backend process to see if its died. allow the pid file to change
# and only alert on the event as a log file event will cause the pid to
change.
check process mythbackend with pidfile /var/run/mythtv/mythbackend.pid
start program = "/etc/init.d/mythtv-backend restart"
stop program = "/etc/init.d/mythtv-backend stop"
if failed port 6544 proto http for 3 times within 5 cycles then restart
if changed pid then alert
depends on mysql


# check the mysql process. any change in this should trigger a restart.
check process mysql with pidfile /var/run/mysqld/mysqld.pid
start program = "/etc/init.d/mysql start"
stop program = "/etc/init.d/mysql stop"
if failed port 3306 then restart


_______________________________________________
mythtv-users mailing list
mythtv-users [at] mythtv
http://mythtv.org/cgi-bin/mailman/listinfo/mythtv-users

MythTV users RSS feed   Index | Next | Previous | View Threaded
 
 


Interested in having your list archived? Contact Gossamer Threads
 
  Web Applications & Managed Hosting Powered by Gossamer Threads Inc.