monitors:msgs

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
monitors:msgs [2014/01/29 11:46] – [tasks.d/msgs] shadymintmonitors:msgs [2014/08/29 14:43] (current) shadymint
Line 5: Line 5:
 ^ Requirements | unix | ^ Requirements | unix |
 ^ Download | None | ^ Download | None |
-^ Last Update | 2014-01-26 |+^ Last Update | 2014-08-29 |
  
 ===== Description ===== ===== Description =====
Line 30: Line 30:
  
 #!/bin/sh #!/bin/sh
-#ident  "@(#)msgs.sh 0.1.0"+#ident  "@(#)msgs.sh 0.2.0"
 #****************************************************************************** #******************************************************************************
-# $Id: msgs.sh 155 2014-01-26 22:12:21Z asmith69 $ +# $Id: msgs.sh 225 2014-08-29 14:28:47Z asmith69 $ 
-# $Revision: 155 $+# $Revision: 225 $
 # $Author: asmith69 $ # $Author: asmith69 $
-# $Date: 2014-01-26 22:12:21 +0000 (Sun26 Jan 2014) $+# $Date: 2014-08-29 15:28:47 +0100 (Fri29 Aug 2014) $
 # $HeadURL: svn://galahad/xymon_addons/trunk/Extensions/msgs.sh $ # $HeadURL: svn://galahad/xymon_addons/trunk/Extensions/msgs.sh $
 #****************************************************************************** #******************************************************************************
Line 45: Line 45:
 #   0.0.0  a while ago   abs First version #   0.0.0  a while ago   abs First version
 #   0.1.0  2014-01-26    abs cleaned up and made portable #   0.1.0  2014-01-26    abs cleaned up and made portable
 +#   0.2.0  2014-08-29    abs send message via stdin to avoid command line
 +#                            length issues.
 +#                            add a blank line between all paragraphs to ensure
 +#                            only the correct parts of the original page are
 +#                            presented, also, discard the full log and cater
 +#                            for any markup conflicts.
 ############################################################################### ###############################################################################
 # embedded debug command .... # embedded debug command ....
Line 50: Line 56:
 #Command=`basename $0 .sh` #Command=`basename $0 .sh`
 Command=`basename $0` Command=`basename $0`
-Version=`sed '/^\#ident.*@(#).*$/!d; s/^\(#ident.*@(#)\)\([^    ]*\)\([        ]*\)\([^         ]*\)\([         ]*\)\([^        ]*\)\([         ]*\)\([^       ]*\)"$/\4/;q' $0`+Version=`sed '/^\#ident.*@(#).*$/!d; s/^\(#ident.*@(#)\)\([^    ]*\)\([         ]*\)\([^        ]*\)\([         ]*\)\([^        ]*\)\([         ]*\)\([^        ]*\)"$/\4/;q' $0`
  
 whichunix(){ whichunix(){
Line 158: Line 164:
 # Send text status to xymon for display on the page, set the # Send text status to xymon for display on the page, set the
 # colour as appropriate. # colour as appropriate.
-$XYMON $XYMSRV "status ${MACHINE}.$COLUMN $COLOR `date`+echo "status ${MACHINE}.$COLUMN $COLOR `date`
 $MSG $MSG
-${MyBadge} $COLUMN tested in $Duration Seconds"+${MyBadge} $COLUMN tested in $Duration Seconds" | $XYMON $XYMSRV "@"
 } }
 ############################################################################### ###############################################################################
Line 182: Line 188:
   # Send text status to xymon for display on the page, set the   # Send text status to xymon for display on the page, set the
   # colour as appropriate.   # colour as appropriate.
-  $XYMON $XYMSRV "status ${MACHINE}.$COLUMN clear `date`+ 
 +  echo "status ${MACHINE}.$COLUMN clear `date`
 ${TheError} ${TheError}
-${ThePage} +${ThePage}" | $XYMON $XYMSRV "@"
-"+
 } }
 ############################################################################### ###############################################################################
Line 191: Line 197:
   # grab the full message log that Xymon already analysed   # grab the full message log that Xymon already analysed
   # for all the defined msgs tests   # for all the defined msgs tests
 +  # make sure there is a blank line between all paragraphs
   MSGLOG=`$XYMONCOMMS $XYMSRV \   MSGLOG=`$XYMONCOMMS $XYMSRV \
     "xymondlog ${MACHINE}.msgs" \     "xymondlog ${MACHINE}.msgs" \
     | sed -n '2,$p' \     | sed -n '2,$p' \
 +    | sed '/Full log\|\(Critical entries\|Warnings\|No entries\) in/{x;p;x;}' \
     `     `
  
Line 210: Line 218:
     $Comment Status=$Status     $Comment Status=$Status
  
-    # cut out the paragraphs in the full message log that refer to this +    # cut out the paragraphs in the full message log that refer to the 
-    # logfile only+    # analysis of this logfile only
     PLogPath=`$ECHO "$LogPath" | sed 's;\([[$/.]\);\\\\\1;g'`     PLogPath=`$ECHO "$LogPath" | sed 's;\([[$/.]\);\\\\\1;g'`
     $Comment PLogPath=$PLogPath     $Comment PLogPath=$PLogPath
 +    # the first sed will leave a leading blank line which needs to be trimmed
 +    # using the second sed.  Also, the warning case in analysis will insert
 +    # gratuitous <pre> and </pre> tags which need to be trimmed as well.
     Loglines=`$ECHO "$MSGLOG" | sed \     Loglines=`$ECHO "$MSGLOG" | sed \
                                    -e '/./{H;$!d;}' \                                    -e '/./{H;$!d;}' \
-                                   -e 'x;/'$PLogPath'/!d;'` +                                   -e 'x;/\(Critical entries\|Warnings\|No entries\) in .*'$PLogPath'/!d;' 
-                                   #-e 'x;/'$PLogPath'/!d;/Full log/!d'`+                              | sed \ 
 +                                   -e '/^$/d' \ 
 +                                   -e '/<pre>/d'
 +                                   -e '/<\/pre>/d'
 +                              | sed \ 
 +                                   -e '/\(Critical entries\|Warnings\|No entries\) in .*'$PLogPath'/G' \ 
 +                                   -e '2,$s/</\&lt;/g' \ 
 +                                   -e '2,$s/>/\&gt;/g
 +                                   -e '2,$s/^\./\&#91;/'
 +                                   -e '2,$s/^\(&\(yellow\|red\)\) \./\1 \&#91;/'
 +                                   ` 
 +    # in the last sed, add a blank line after the heading anchor 
 +    # and replace potential markup conflicts 
     MSG="     MSG="
  
Line 417: Line 441:
   * **2014-01-26**   * **2014-01-26**
     * Initial release     * Initial release
 +  * **2014-08-29**
 +    * send message via stdin to avoid command line length issues.
 +    * add a blank line between all paragraphs to ensure only the correct parts of the original page are presented.
 +    * discard the full log and cater for any markup conflicts.
  
  • monitors/msgs.txt
  • Last modified: 2014/08/29 14:43
  • by shadymint