Mt Xia: Technical Consulting Group
Business Continuity / Disaster Recovery / High Availability Data Center Automation / Audit Response / Audit Compliance
#!/usr/bin/ksh93 ################################################################ function dst_header { FD="${1:?# ERROR: file descriptor number not specified}" DC="${2:?# ERROR: data center identifier not specified}" print -u ${FD} -- "<!-- Begin \"dst${DC}vioUpdates.content.shtml\" -->" print -u ${FD} -- "\n<P><H2>Daylight Savings Time (DST) System Compliance</H2></P>" print -u ${FD} -- "\n<P><H3>VIO Servers</H3></P>" print -u ${FD} -- "\n<P><TABLE Border=\"1\">" print -u ${FD} -- "<P><TR>" print -u ${FD} -- "<TH Bgcolor=\"lightgrey\"><A Href=\"dst${DC}byhostname.shtml\">Host Name</A></TH>" print -u ${FD} -- "<TH Bgcolor=\"lightgrey\"><A Href=\"dst${DC}byoslevel.shtml\">OS Level</A></TH>" print -u ${FD} -- "<TH Bgcolor=\"lightgrey\"><A Href=\"dst${DC}byfileset.shtml\">Fileset</A></TH>" print -u ${FD} -- "<TH Bgcolor=\"lightgrey\"><A Href=\"dst${DC}bycomply.shtml\">Compliance</A></TH>" print -u ${FD} -- "<TH Bgcolor=\"lightgrey\">Description</TH>" print -u ${FD} -- "</TR></P>" } ################################################################ function dst_footer { FD="${1:?# ERROR: file descriptor number not specified}" DC="${2:?# ERROR: data center identifier not specified}" DATESTAMP="$( date )" print -u ${FD} -- "</TABLE></P>" print -u ${FD} -- "<P><I>${DATESTAMP}</I></P>" print -u ${FD} -- "\n<!-- End \"dst${DC}vioUpdates.content.shtml\" -->" } ################################################################ typeset -L3 DC="${1:?# ERROR: 3 character lowercase datacenter identifier must be specified (mdc|ddc)}" if [[ "${DC}" != @(mdc|ddc) ]] then print -u 2 -- "# ERROR: invalid datacenter identifier \"${DC}\": valid identifiers are mdc|ddc" exit 1 fi exec 3>/tmp/dstscriptvio${$}.out FD="3" #### amms.list is copied from NIMserver:/root/amms.list to users home directory cut -d"|" -f2 ./vioserver.list | while read -- CNAME do OS=$( ssh -x root@${CNAME} '/usr/ios/cli/ioscli ioslevel' ) print -u 2 -- "# ${CNAME} ${OS}" COMPLY="Compliant" [[ "_${OS}" < "_1.3.0.1-FP-8.1" ]] && COMPLY="<STRONG><FONT Color=\"red\">Non-Compliant</FONT></STRONG>" print -u ${FD} -n -- "<P><TR>" print -u ${FD} -n -- "<TD>${CNAME}</TD><!-- | -->" print -u ${FD} -n -- "<TD>${OS}</TD><!-- | -->" print -u ${FD} -n -- "<TD> </TD><!-- | -->" print -u ${FD} -n -- "<TD>${COMPLY}</TD><!-- | -->" print -u ${FD} -n -- "<TD> </TD><!-- | -->" print -u ${FD} -- "</TR></P>" done exec 3>&- #### create HTML content file sorted by hostname exec 3>/tmp/dst${DC}viobyhostname.content.shtml dst_header 3 ${DC} sort -f -t '|' +0 +2 /tmp/dstscriptvio${$}.out >&3 dst_footer 3 ${DC} exec 3>&- #### create HTML content file sorted by fileset name exec 3>/tmp/dst${DC}viobyfileset.content.shtml dst_header 3 ${DC} sort -f -t '|' +2 +0 /tmp/dstscriptvio${$}.out >&3 dst_footer 3 ${DC} exec 3>&- #### create HTML content file sorted by whether it is DST compliant exec 3>/tmp/dst${DC}viobycomply.content.shtml dst_header 3 ${DC} sort -f -t '|' +3 +2 +0 /tmp/dstscriptvio${$}.out >&3 dst_footer 3 ${DC} exec 3>&- #### create HTML content file sorted by oslevel exec 3>/tmp/dst${DC}viobyoslevel.content.shtml dst_header 3 ${DC} sort -f -t '|' +1 +0 /tmp/dstscriptvio${$}.out >&3 dst_footer 3 ${DC} exec 3>&- rm -f /tmp/cat${$}.out rm -f /tmp/dstscriptvio${$}.out