Skip to content

Commit

Permalink
Update status script
Browse files Browse the repository at this point in the history
  • Loading branch information
JulienPeloton committed Dec 13, 2024
1 parent 2ab4ab7 commit d21ab7b
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 13 deletions.
4 changes: 2 additions & 2 deletions scheduler/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@ Operations for the night N start at 21.45pm UTC on the night N-1. There are 2 cr
0 12 1 * * /home/julien.peloton/fink-broker/scheduler/launch_sso_resolver.sh

# Operation reports twice a day
0 12 * * * /home/julien.peloton/fink-broker/scheduler/check_status.sh --night `date +"%Y%m%d"` --telegram
0 23 * * * /home/julien.peloton/fink-broker/scheduler/check_status.sh --night `date +"%Y%m%d"` --telegram
0 12 * * * /home/julien.peloton/fink-broker/scheduler/check_status.sh --telegram
0 23 * * * /home/julien.peloton/fink-broker/scheduler/check_status.sh --telegram
```

```bash
Expand Down
27 changes: 16 additions & 11 deletions scheduler/check_status.sh
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,15 @@
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
source ~/.bash_profile
source /home/julien.peloton/.bash_profile

message_help="./check_results <--night NIGHT> <--telegram>"

# Grab the command line arguments
while [ "$#" -gt 0 ]; do
case "$1" in
-h)
echo -e $message_help
echo -e "$message_help"
exit
;;
--night)
Expand All @@ -35,14 +37,17 @@ done

broadcastMessage () {
if [[ $TELEGRAM == true ]]; then
curl -X POST -d 'chat_id=@fink_bot_error' -d "text=$1" https://api.telegram.org/bot$FINK_TG_TOKEN/sendMessage
curl -X POST -d 'chat_id=@fink_bot_error' -d "text=$1" https://api.telegram.org/bot"$FINK_TG_TOKEN"/sendMessage
else
echo $1
echo "$1"
fi
}

if [[ -z "$NIGHT" ]]; then
NIGHT=$(date +"%Y%m%d")
fi

FILES=`/usr/bin/ls $FINK_HOME/broker_logs/*${NIGHT}*`
FILES=$(/usr/bin/ls "$FINK_HOME"/broker_logs/*"${NIGHT}"*)

if [[ -z "$FILES" ]]; then
broadcastMessage "Nothing found for $NIGHT"
Expand All @@ -52,29 +57,29 @@ fi
newline=$'\n'
MESSAGE=""
for file in $FILES; do
isPythonProblem=`grep -n Traceback $file`
isPythonProblem=$(grep -n Traceback "$file")
if [[ $isPythonProblem != "" ]]; then
MESSAGE+="SPARK FAILURE: $(basename $file) $newline"
fi

isHdfsProblem=`grep -n "Name node is in safe mode" $file`
isHdfsProblem=$(grep -n "Name node is in safe mode" "$file")
if [[ $isHdfsProblem != "" ]]; then
MESSAGE+="HDFS FAILURE: $(basename $file) $newline"
fi

isHdfsProblem=`grep -n "Dead nodes" $file`
isHdfsProblem=$(grep -n "Dead nodes" "$file")
if [[ $isHdfsProblem != "" ]]; then
MESSAGE+="HDFS FAILURE: $(basename $file) $newline"
fi

isHbaseProblem=`grep -n "RetriesExhaustedWithDetailsException" $file`
isHbaseProblem=$(grep -n "RetriesExhaustedWithDetailsException" "$file")
if [[ $isHbaseProblem != "" ]]; then
MESSAGE+="HBase FAILURE: $(basename $file) $newline"
hasProcessed=`grep -n "alerts pushed to HBase" $file`
hasProcessed=$(grep -n "alerts pushed to HBase" "$file")
if [[ $hasProcessed != "" ]]; then
MESSAGE+="|--> PUSHED OK $newline"
fi
hasProcessed=`grep -n "Output Path is null in commitJob" $file`
hasProcessed=$(grep -n "Output Path is null in commitJob" "$file")
if [[ $hasProcessed != "" ]]; then
MESSAGE+="|--> PUSHED OK $newline"
fi
Expand Down

0 comments on commit d21ab7b

Please sign in to comment.