Skip to content

Instantly share code, notes, and snippets.

@linuxkidd
Created October 1, 2020 16:09
Show Gist options
  • Save linuxkidd/be0d42ad195b082454a6e858e70224d9 to your computer and use it in GitHub Desktop.
Save linuxkidd/be0d42ad195b082454a6e858e70224d9 to your computer and use it in GitHub Desktop.
Process sar disk await into a histogram
#!/usr/bin/awk -f
/^[0-9].*dev[0-9]*-[0-9]*/{
diskpos=2
awaitpos=8
if ( $2 ~ /(A|P)M/ ) {
diskpos=3
awaitpos=9
}
dev[$diskpos]=1
histo[$diskpos][int($awaitpos)]++
if(int($awaitpos)>max)
max=int($awaitpos)
}
END {
printf("Util%")
for(mydev in dev) {
printf(",%s",mydev)
}
printf("\n")
for(j=0;j<=max;j++) {
printf("%s",j)
for(mydev in dev) {
printf(",%s",histo[mydev][j])
}
printf("\n")
}
}
@linuxkidd
Copy link
Author

cat sar21 | ./proc_sar_disk_await_histo.awk > await_histo.csv

-- Generates output on stdout showing historgram data for await across all disks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment