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