Skip to content

Commit

Permalink
Merge pull request #916 from salesforce/pmoineau.W-15897336.iostat
Browse files Browse the repository at this point in the history
W-15897336: fix iostat.log, add iostat version check
  • Loading branch information
pdmoineau authored Jun 3, 2024
2 parents f1c90e9 + 4d85652 commit ebac343
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 16 deletions.
3 changes: 3 additions & 0 deletions carbonj.service/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,9 @@ RUN yum update -y && \
yum install -y https://cdn.azul.com/zulu/bin/zulu-repo-1.0.0-1.noarch.rpm && \
yum install -y https://mirror.stream.centos.org/9-stream/AppStream/x86_64/os/Packages/pcp-conf-6.2.1-1.el9.x86_64.rpm && \
yum install -y https://mirror.stream.centos.org/9-stream/AppStream/x86_64/os/Packages/pcp-libs-6.2.1-1.el9.x86_64.rpm && \
#
# If sysstat version is updated, confirm iolog.sh execution and update associated version check in entrypoint.sh
#
yum install -y https://mirror.stream.centos.org/9-stream/AppStream/x86_64/os/Packages/sysstat-12.5.4-7.el9.x86_64.rpm && \
yum install -y https://repo.almalinux.org/almalinux/9/extras/x86_64/os/Packages/epel-release-9-5.el9.noarch.rpm && \
yum install -y https://dl.fedoraproject.org/pub/epel/9/Everything/x86_64/Packages/p/perl-URI-Encode-1.1.1-17.el9.noarch.rpm && \
Expand Down
9 changes: 9 additions & 0 deletions carbonj.service/src/main/docker/files/entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,15 @@ echo $JAVA_OPTS $JAVA_OPTS_OVERRIDE

env >> /etc/environment

# Confirm iostat version to ensure iolog.sh executes successfully
version=$(iostat -V | grep -oP 'sysstat version \K[\d.]+')
if [ "$version" = "12.5.4" ]; then
echo "sysstat version is 12.5.4"
else
echo "Unexpected sysstat version $version. Expected 12.5.4. Confirm iostat output is compatible with /app/bin/iolog.sh"
exit 1
fi

# no logs on disk
crontab -l | { cat; echo "* */6 * * * /app/bin/logCleanup.sh ${SERVICEDIR}/log/ 7 >/dev/null 2>&1"; } | crontab -
crontab -l | { cat; echo "*/1 * * * * /app/bin/fdlog.sh"; } | crontab -
Expand Down
24 changes: 8 additions & 16 deletions carbonj.service/src/main/docker/files/iolog.sh
Original file line number Diff line number Diff line change
Expand Up @@ -50,38 +50,30 @@ do

device=$( echo $stat | awk '{print $1}' )

r_iops=$( echo $stat | awk '{print $4}' )
r_iops=$( echo $stat | awk '{print $2}' )
message="$prefix.$device.read.iops $r_iops $time"
BLOB="$BLOB\n$message"

w_iops=$( echo $stat | awk '{print $5}' )
message="$prefix.$device.write.iops $w_iops $time"
BLOB="$BLOB\n$message"

r_kB=$( echo $stat | awk '{print $6}' )
r_kB=$( echo $stat | awk '{print $3}' )
message="$prefix.$device.read.kB $r_kB $time"
BLOB="$BLOB\n$message"

w_kB=$( echo $stat | awk '{print $7}' )
message="$prefix.$device.write.kB $w_kB $time"
r_await=$( echo $stat | awk '{print $6}' )
message="$prefix.$device.read.await $r_await $time"
BLOB="$BLOB\n$message"

await=$( echo $stat | awk '{print $10}' )
message="$prefix.$device.await $await $time"
w_iops=$( echo $stat | awk '{print $8}' )
message="$prefix.$device.write.iops $w_iops $time"
BLOB="$BLOB\n$message"

r_await=$( echo $stat | awk '{print $11}' )
message="$prefix.$device.read.await $r_await $time"
w_kB=$( echo $stat | awk '{print $9}' )
message="$prefix.$device.write.kB $w_kB $time"
BLOB="$BLOB\n$message"

w_await=$( echo $stat | awk '{print $12}' )
message="$prefix.$device.write.await $w_await $time"
BLOB="$BLOB\n$message"

svc=$( echo $stat | awk '{print $13}' )
message="$prefix.$device.svc $svc $time"
BLOB="$BLOB\n$message"

done

# Print to server
Expand Down

0 comments on commit ebac343

Please sign in to comment.