X-Git-Url: https://gerrit.linuxfoundation.org/infra/gitweb?a=blobdiff_plain;f=shell%2Fsysstat.sh;fp=shell%2Fsysstat.sh;h=e4e28ff6cffb0e0a97328698b60d37e7af7c5b4f;hb=c887df2200ea8a7a58e0aeb538affd0c93a48dfc;hp=0000000000000000000000000000000000000000;hpb=56864adf9a6062190e4b9bedc2944cb6a95f8014;p=releng%2Fglobal-jjb.git diff --git a/shell/sysstat.sh b/shell/sysstat.sh new file mode 100644 index 00000000..e4e28ff6 --- /dev/null +++ b/shell/sysstat.sh @@ -0,0 +1,38 @@ +#!/bin/bash +# @License EPL-1.0 +############################################################################## +# Copyright (c) 2017 The Linux Foundation and others. +# +# All rights reserved. This program and the accompanying materials +# are made available under the terms of the Eclipse Public License v1.0 +# which accompanies this distribution, and is available at +# http://www.eclipse.org/legal/epl-v10.html +############################################################################## +echo "---> lftools-sysstat.sh" +set +e # DON'T fail build if script fails. + +OS=$(facter operatingsystem) +case "$OS" in + Ubuntu) + SYSSTAT_PATH="/var/log/sysstat" + ;; + CentOS|RedHat) + SYSSTAT_PATH="/var/log/sa" + ;; + *) + # nothing to do + exit 0 + ;; +esac + +SAR_DIR="$WORKSPACE/archives/sar-reports" +mkdir -p "$SAR_DIR" +cp "$SYSSTAT_PATH/"* $_ +# convert sar data to ascii format +while IFS="" read -r s +do + [ -f "$s" ] && LC_TIME=POSIX sar -A -f "$s" > "$SAR_DIR/"sar${s//[!0-9]/} +done < <(find "$SYSSTAT_PATH" -name "sa[0-9]*" || true) + +# DON'T fail build if script fails. +exit 0