Commit 404f6b27 authored by Dan Reading's avatar Dan Reading
Browse files

report format changes

parent 2548a757
...@@ -484,6 +484,12 @@ setdirstructure() { ...@@ -484,6 +484,12 @@ setdirstructure() {
done done
} }
declare h4="no"
ph4() {
[[ ! $h4 ]] && { echo "================================= $1 =================================" >> /tmp/Report_CheckNode; h4="no"; }
}
genreport_main() { genreport_main() {
reporting=1 reporting=1
[[ -z "${CHECKNODE_CRONJOB-}" ]] && declare CHECKNODE_CRONJOB="NO" [[ -z "${CHECKNODE_CRONJOB-}" ]] && declare CHECKNODE_CRONJOB="NO"
...@@ -504,20 +510,33 @@ genreport_main() { ...@@ -504,20 +510,33 @@ genreport_main() {
nodes2do=$allnodes nodes2do=$allnodes
for node in $nodes2do ; do for node in $nodes2do ; do
allnodes=$node allnodes=$node
echo "================================= $node =================================" >> /tmp/Report_CheckNode h4=''
# echo "================================= $node =================================" >> /tmp/Report_CheckNode
if [ -s /proj/emulab-ops/nodecheck/$node/diff ] ; then if [ -s /proj/emulab-ops/nodecheck/$node/diff ] ; then
echo "----------------------- inconsistency with db ---------------------------" >> /tmp/Report_CheckNode # chop top off diff report and remove UNKNOWN lines
tail -n +5 /proj/emulab-ops/nodecheck/$node/diff >> /tmp/Report_CheckNode tail -n +5 /proj/emulab-ops/nodecheck/$node/diff | grep -v UNKNOWN | grep -v MISSING > /tmp/diffchop
# do we still have something to report?
if [ -s /tmp/diffchop ] ; then
diffDate=$(stat -f %Sm -t "%H:%M %d%b%g" /proj/emulab-ops/nodecheck/$node/diff)
ph4 $node
echo "----------------------- $diffDate inconsistency with db -------------" >> /tmp/Report_CheckNode
# remove pesky empty line
grep -v '^$' /tmp/diffchop >> /tmp/Report_CheckNode
rm -f /tmp/diffchop
fi
fi fi
gentbsql_main $node > /tmp/genreport gentbsql_main $node > /tmp/genreport
if [ -s /tmp/genreport ] ; then if [ -s /tmp/genreport ] ; then
echo "--------------------------- suggested db updates -----------------------" >> /tmp/Report_CheckNode ph4 $node
cat /tmp/genreport >> /tmp/Report_CheckNode echo ">>>> Run gen_sql for suggested db updates" >> /tmp/Report_CheckNode
# echo "--------------------------- suggested db updates -----------------------" >> /tmp/Report_CheckNode
# cat /tmp/genreport >> /tmp/Report_CheckNode
fi fi
checkdrift_main $node > /tmp/driftreport checkdrift_main $node | grep -v '^$' > /tmp/driftreport
if [ -s /tmp/driftreport ] ; then if [ -s /tmp/driftreport ] ; then
ph4 $node
echo "--------------------------- changes over time ---------------------------" >> /tmp/Report_CheckNode echo "--------------------------- changes over time ---------------------------" >> /tmp/Report_CheckNode
cat /tmp/driftreport >> /tmp/Report_CheckNode cat /tmp/driftreport >> /tmp/Report_CheckNode
fi fi
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment