|
@@ -8,7 +8,7 @@
|
|
|
#
|
|
|
#!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
|
|
|
|
|
-MOSHELVERSION="2.1.4"
|
|
|
+MOSHELVERSION="2.1.5"
|
|
|
|
|
|
#---------------------------------------------------------
|
|
|
# init library and files
|
|
@@ -83,6 +83,9 @@ CheckValueUnder () {
|
|
|
Value="$4"
|
|
|
Message="$5"
|
|
|
|
|
|
+ if [ -n "MAINTENANCE" ]; then
|
|
|
+ return 1
|
|
|
+ fi
|
|
|
RESULT=$( /bin/bash -c "$Command" | awk "$Awk" | cut -d "." -f 1 | cut -d "," -f 1 )
|
|
|
|
|
|
if [ -z "$RESULT" ]; then
|
|
@@ -106,6 +109,9 @@ CheckValueOver () {
|
|
|
Value="$4"
|
|
|
Message="$5"
|
|
|
|
|
|
+ if [ -n "MAINTENANCE" ]; then
|
|
|
+ return 1
|
|
|
+ fi
|
|
|
RESULT=$( /bin/bash -c "$Command" | awk "$Awk" | cut -d "." -f 1 | cut -d "," -f 1 )
|
|
|
|
|
|
if [ -z "$RESULT" ]; then
|
|
@@ -129,6 +135,9 @@ CheckCountLessThan () {
|
|
|
Value="$4"
|
|
|
Message="$5"
|
|
|
|
|
|
+ if [ -n "MAINTENANCE" ]; then
|
|
|
+ return 1
|
|
|
+ fi
|
|
|
RESULT=$( /bin/bash -c "$Command" | awk "$Awk" | wc -l )
|
|
|
|
|
|
if [ -z "$RESULT" ]; then
|
|
@@ -151,6 +160,9 @@ CheckCountMoreThan () {
|
|
|
Value="$4"
|
|
|
Message="$5"
|
|
|
|
|
|
+ if [ -n "MAINTENANCE" ]; then
|
|
|
+ return 1
|
|
|
+ fi
|
|
|
RESULT=$( /bin/bash -c "$Command" | awk "$Awk" | wc -l )
|
|
|
|
|
|
if [ -z "$RESULT" ]; then
|
|
@@ -172,6 +184,9 @@ CheckFileChanges () {
|
|
|
Filename="$2"
|
|
|
DIFFF=$( mktemp )
|
|
|
|
|
|
+ if [ -n "MAINTENANCE" ]; then
|
|
|
+ return 1
|
|
|
+ fi
|
|
|
diff $CMPDIR/$Name $Filename > $DIFFF
|
|
|
if [ -s $DIFFF ]; then
|
|
|
MSG=''
|
|
@@ -194,6 +209,9 @@ ActionOnAlert () {
|
|
|
Name="$1"
|
|
|
Action="$2"
|
|
|
|
|
|
+ if [ -n "MAINTENANCE" ]; then
|
|
|
+ return 1
|
|
|
+ fi
|
|
|
DIFFF=$( mktemp )
|
|
|
diff $DATADIR/alertoldold $DATADIR/alertold | grep -F "> ${MYNAME} : ${Name} ! " > "$DIFFF"
|
|
|
if [ -s $DIFFF ]; then
|
|
@@ -213,6 +231,9 @@ ActionOnAlert () {
|
|
|
|
|
|
#---------------------------------------------------------
|
|
|
LocalAlertMail () {
|
|
|
+ if [ -n "MAINTENANCE" ]; then
|
|
|
+ return 1
|
|
|
+ fi
|
|
|
LALERTTO="$1"
|
|
|
# alert handling
|
|
|
# first handle old states, used to identify&deny flip-flopping alerts
|
|
@@ -278,14 +299,26 @@ CleanUp () {
|
|
|
|
|
|
# output+logging
|
|
|
echo "<html><head><meta http-equiv=\"refresh\" content=\"300\" /><title>MoSheL - $MYNAME</title></head><body><h1>MoSheL - $MYNAME</h1>$DATUM $ZEIT - <a href=\"graphs.html\">Graphs</a><ul>" > $WWWDIR/index.html
|
|
|
- cat /tmp/tmp.$$.moshel_collected.tmp >> $WWWDIR/index.html
|
|
|
+ if [ -n "MAINTENANCE" ]; then
|
|
|
+ cat /tmp/tmp.$$.moshel_collected.tmp >> $WWWDIR/index.html
|
|
|
+ else
|
|
|
+ echo "<b>MAINTENANCE MODE</b> : $MAINTENANCE" >> $WWWDIR/index.html
|
|
|
+ fi
|
|
|
echo '</ul></body></html>' >> $WWWDIR/index.html
|
|
|
|
|
|
echo "<p><a href=\"$WEBURL\">$MYNAME</a> - $DATUM $ZEIT<br>" > /tmp/tmp.$$.moshel_snippet.tmp
|
|
|
- cat $DATADIR/alert >> /tmp/tmp.$$.moshel_snippet.tmp
|
|
|
+ if [ -n "MAINTENANCE" ]; then
|
|
|
+ cat $DATADIR/alert >> /tmp/tmp.$$.moshel_snippet.tmp
|
|
|
+ else
|
|
|
+ echo "$MYNAME : Maintenance Mode: $MAINTENANCE<br>" >> /tmp/tmp.$$.moshel_snippet.tmp
|
|
|
+ fi
|
|
|
|
|
|
echo "<html><head><meta http-equiv=\"refresh\" content=\"300\" /><title>MoSheL - $MYNAME</title><script type=\"text/javascript\" src=\"data/dygraph-combined.js\"></script></head><body><h1>MoSheL - $MYNAME</h1>$DATUM $ZEIT - <a href=\"index.html\">Text</a><p>" > $WWWDIR/graphs.html
|
|
|
- cat /tmp/tmp.$$.moshel_graphclips.tmp >> $WWWDIR/graphs.html
|
|
|
+ if [ -n "MAINTENANCE" ]; then
|
|
|
+ cat /tmp/tmp.$$.moshel_graphclips.tmp >> $WWWDIR/graphs.html
|
|
|
+ else
|
|
|
+ echo "<b>MAINTENANCE MODE</b> : $MAINTENANCE" >> $WWWDIR/graphs.html
|
|
|
+ fi
|
|
|
echo '</body></html>' >> $WWWDIR/graphs.html
|
|
|
|
|
|
|