I run a weekly CRONTAB that collects hardware info from 40+ remote servers and creates a weekly log file on our report server at the home office. I have a script that I run against this weekly file to output only specific status lines to my display.
#!/bin/sh
# store newest filename to variable
DD_FILE="$(ls -t /home/user/ddinfo/|head -1)"
# List the site name, disk ID (virtual & physical), Status and State of each ID, Failure Prediction for each physical disk, and the site divider
grep -w 'Site\|^ID\|^State\|^Status\|^Failure Predicted\|^##' /home/user/ddinfo/$DD_FILE
echo "/home/user/ddinfo/"$DD_FILE
exit 0
This is a sample output:
Accessing Site: site01
ID : 0
Status : Ok
State : Ready
ID : 0:0:0
Status : Ok
State : Online
Failure Predicted : No
ID : 0:0:1
Status : Ok
State : Online
Failure Predicted : No
################################################
Accessing Site: site02
ID : 0
Status : Ok
State : Ready
ID : 0:0:0
Status : Non-Critical
State : Online
Failure Predicted : Yes
ID : 0:0:1
Status : Ok
State : Online
Failure Predicted : No
################################################
Is there a way to cat / grep / sed / awk / perl / this output so that any lines that end with either Critical or Yes, get colorized?
