Skip to content

Instantly share code, notes, and snippets.

@Decstasy
Last active January 21, 2021 09:46
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Decstasy/98c0f9b5bf987b88afe630972f91fb84 to your computer and use it in GitHub Desktop.
Save Decstasy/98c0f9b5bf987b88afe630972f91fb84 to your computer and use it in GitHub Desktop.
#!/bin/bash
if [[ $# -ne 1 ]]; then
echo "$0 [path to sysstat file made with: \"LANG=POSIX LC_ALL=C sar -Adp\"]"
exit 1
fi
_FILE = "$1"
# Der Parser von ksar mag bestimmte sachen nicht und beendet sich dann mit einer exception
# Daher werden hier, sofern grep etwas findet, mit perl einige Blöcke aus dem Report entfernt.
if grep -qs 'kbhugfree\|irec/s\|ihdrerr/s\|imsg/s\|ierr/s\|active/s\|degC\|idvendor' $_FILE; then
PTMP=$(mktemp)
perl -n -e 'print unless /^[\d:]{8}\s+(kbhugfree|irec\/s|ihdrerr\/s|imsg\/s|ierr\/s|active\/s|TEMP|BUS)/../^$/' $_FILE > $PTMP
mv $PTMP $_FILE
fi
# java -jar /opt/ksar/kSar.jar -cpuFixedAxis -noEmptyDisk -input $_FILE -outputPDF /tmp/report.pdf
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment