Thu Nov 16 11:03:38 PST 2006
- Previous message: [Slony1-commit] By cbbrowne: Add a new tool script, search-logs.sh, which may be used to
- Next message: [Slony1-commit] By cbbrowne: Add an "exclusions" system to the log watcher - you can
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Log Message: ----------- Add a new tool script, search-logs.sh, which may be used to do an hourly search for error messages in slon logs. Includes admin guide documentation... Tags: ---- REL_1_2_STABLE Modified Files: -------------- slony1-engine/doc/adminguide: monitoring.sgml (r1.29.2.1 -> r1.29.2.2) adminscripts.sgml (r1.40.2.2 -> r1.40.2.3) Added Files: ----------- slony1-engine/tools: search-logs.sh (r1.1.2.1) -------------- next part -------------- Index: adminscripts.sgml =================================================================== RCS file: /usr/local/cvsroot/slony1/slony1-engine/doc/adminguide/adminscripts.sgml,v retrieving revision 1.40.2.2 retrieving revision 1.40.2.3 diff -Ldoc/adminguide/adminscripts.sgml -Ldoc/adminguide/adminscripts.sgml -u -w -r1.40.2.2 -r1.40.2.3 --- doc/adminguide/adminscripts.sgml +++ doc/adminguide/adminscripts.sgml @@ -226,7 +226,7 @@ <para>This starts a slon daemon for the specified cluster and node, and uses slon_watchdog to keep it running.</para> </sect3> -<sect3><title>slon_watchdog</title> +<sect3 id="slonwatchdog"><title>slon_watchdog</title> <para>Used by <command>slon_start</command>.</para> @@ -534,7 +534,6 @@ environment variables, you will get a set of slonik scripts. They may not correspond, of course, to any database you actually want to use...</para> -</sect3> <sect3><title>Node-Specific Values</title> @@ -607,8 +606,7 @@ <para>There are two assumptions in this script that could be invalidated by circumstances:</para> -</listitem> -</itemizedlist> + <itemizedlist> <listitem><para> That all of the tables and sequences have been included.</para> @@ -626,7 +624,10 @@ linkend="stmttableaddkey">, you will have to modify this script by hand to accomodate that. </para></listitem> -<listitem><para> <filename> subscribe_set_2.slonik </filename></para> +</itemizedlist> +</listitem> + +<listitem><para> <filename> subscribe_set_2.slonik </filename> <para> And 3, and 4, and 5, if you set the number of nodes higher... </para> @@ -644,7 +645,7 @@ attempt running this step. To do otherwise would be rather foolish.</para> </listitem> </itemizedlist> -</sect3> + </sect2> </sect1> <!-- Keep this comment at the end of the file Index: monitoring.sgml =================================================================== RCS file: /usr/local/cvsroot/slony1/slony1-engine/doc/adminguide/monitoring.sgml,v retrieving revision 1.29.2.1 retrieving revision 1.29.2.2 diff -Ldoc/adminguide/monitoring.sgml -Ldoc/adminguide/monitoring.sgml -u -w -r1.29.2.1 -r1.29.2.2 --- doc/adminguide/monitoring.sgml +++ doc/adminguide/monitoring.sgml @@ -159,6 +159,23 @@ </sect2> +<sect2 id="search-logs"> <title> <command>search-logs.sh</command> </title> + +<para> This script is constructed to search for &slony1; log files at +a given path (<envar>LOGHOME</envar>), based both on the naming +conventions used by the <xref linkend="launchclusters"> and <xref +linkend="slonwatchdog"> systems used for launching &lslon; processes. + +<para> Errors, if found, are listed, by log file, and emailed to the +specified user (<ENVAR>LOGRECIPIENT</ENVAR>); if no email address is +specified, output goes to standard output. </para> + +<para> <ENVAR>LOGTIMESTAMP</envar> allows overriding what hour to +evaluate (rather than the last hour). </para> + +<para> An administrator might run this script once an hour to monitor +for replication problems. </para> + </sect1> <!-- Keep this comment at the end of the file Local variables: --- /dev/null +++ tools/search-logs.sh @@ -0,0 +1,33 @@ +#!/bin/sh +# $Id: search-logs.sh,v 1.1.2.1 2006/11/16 19:03:35 cbbrowne Exp $ + +# Search logs for errors from the last hour +LOGHOME=${LOGHOME:-"/opt/logs"} # Directory to search +LOGRECIPIENT=${LOGRECIPIENT:-""} # Email recipient - if not set, use STDOUT +LOGTIMESTAMP=${LOGTIMESTAMP:-""} # Override time - format should be "YYYY-MM-DD HH" + +if [[ -z $LOGTIMESTAMP ]] ; then + HRRE=`date -d "1 hour ago" +"%Y-%m-%d %H:[0-9][0-9]:[0-9][0-9] ${TZ}"` +else + HRRE="${LOGTIMESTAMP}:[0-9][0-9]:[0-9][0-9] ${TZ}" +fi + +for log in `find ${LOGHOME} -name "*.log" -mmin -60 | egrep "/node[0-9]+/[^/]+.log"` ; do + egrep "${HRRE} (ERROR|FATAL)" $log > /tmp/slony-errors.$$ + if [[ -s /tmp/slony-errors.$$ ]] ; then + echo " +Errors in log ${log} +===============================================================" >> /tmp/slony-summary.$$ + cat /tmp/slony-errors.$$ >> /tmp/slony-summary.$$ + fi +done + +if [[ -s /tmp/slony-summary.$$ ]] ; then + if [[ -z $LOGRECIPIENT ]] ; then + echo "Errors found!" + cat /tmp/slony-summary.$$ + else + mail -s "Slony-I log errors for ${HRRE}" ${LOGRECIPIENT} < /tmp/slony-summary.$$ + fi +fi +rm -f /tmp/slony-errors.$$ /tmp/slony-summary.$$
- Previous message: [Slony1-commit] By cbbrowne: Add a new tool script, search-logs.sh, which may be used to
- Next message: [Slony1-commit] By cbbrowne: Add an "exclusions" system to the log watcher - you can
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
More information about the Slony1-commit mailing list