Skip to content

Commit

Permalink
Feature enhancement to replace the graphing sub-system.
Browse files Browse the repository at this point in the history
Replaced Fenxi with jqplot.
Added support for graphing Linux stats for vmstat, nicstat as follows:
    a) Add timestamps to vmstat,iostat by calling the scripts in bin/Linux
    b) Call the post-processing scripts for the tools to create the xan versions
    c) Added a 'View' controller and 'xan_view.jsp' to handle display of xan files
    d) Changed links in the statistics view to use the View controller for xan files
    e) Added support for 'top' command to display just the top 10 processes
Since this is a major enhancement, this is release 1.1
  • Loading branch information
shanti committed Dec 27, 2012
1 parent 831bf74 commit f2d99c1
Show file tree
Hide file tree
Showing 23 changed files with 1,599 additions and 15 deletions.
5 changes: 4 additions & 1 deletion harness/bin/Linux/iostat
Expand Up @@ -11,5 +11,8 @@ addtime() {
done
}

iostat $@ | addtime
exec /usr/bin/iostat $@ | addtime &
pid=$!
trap "kill $pid" 2 9 15
wait

132 changes: 132 additions & 0 deletions harness/bin/Linux/iostat-post
@@ -0,0 +1,132 @@
#!/bin/awk -f
# Script to parse iostat output on linux
# We assume that the default faban linux parameters are used to run
# iostat i.e. iostat -
# Output from iostat should look like (time col optional):
# Device: rrqm/s wrqm/s r/s w/s rkB/s wkB/s avgrq-sz avgqu-sz await svctm %util
# 02:04:02 sdb 0.14 278.92 0.96 85.28 17.16 1456.98 34.18 7.26 84.20 0.89 7.67

# Note that we don't do any syntax checking so if the output is in a
# different format, strange things/erros may occur. We do however account
# for cpu data being present (since that's the default vmstat output)

BEGIN {
# number of disks
numdisks = 0;
inhdr = 0;
rows = 0;
col1 = 0;
}

# Skip possible headers and data we don't care about
/Linux/ {
next;
}
/avg-cpu/ {
# If cpu data is present, we need to skip data row
incpu = 1;
next;
}

/Device/ {
if (inhdr == 0 && numdisks == 0) {
inhdr = 1;
} else {
# Need to add the stats
inhdr = 0;
rows++;
}
next;
}

# Normal dataset - we use the first set to find out the disks
{
# We skip cpu data if that's what this is
if (incpu == 1) {
incpu = 0;
} else if (inhdr == 1) {
# Determine if row includes a timestamp
n = split($1,time,":");
if ( n == 3 ) {
# Rows have time col. Shift all columns by 1
col1 = 1;
}
disks[++numdisks] = $(col1 + 1);
} else {
# Now start processing stats
# If time exists, use it. Otherwise, use row#
if (col1 == 1)
time[rows] = $1;
else
time[rows] = rows;
# we use disk name to index
d = $(col1 + 1);
rrqm[d "," rows] = $(col1 + 2);
wrqm[d "," rows] = $(col1 + 3);
rds[d "," rows] = $(col1 + 4);
tot_rds[d] += $(col1 + 4);
wts[d "," rows] = $(col1 + 5);
tot_wts[d] += $(col1 + 5);
rKB[d "," rows] = $(col1 + 6);
tot_rKB[d] += $(col1 + 6);
wKB[d "," rows] = $(col1 + 7);
tot_wKB[d] += $(col1 + 7);
rqsz[d "," rows] = $(col1 + 8);
qusz[d "," rows] = $(col1 + 9);
wait[d "," rows] = $(col1 + 10);
tot_wsvct[d] += $(col1 + 10);
svct[d "," rows] = $(col1 + 11);
tot_asvct[d] += $(col1 + 11);
util[d "," rows] = $(col1 + 12);
tot_util[d] += $(col1 + 12);
}
}

# In the end, let's print out the data
END {
print "Title: Iostat Output\n";
print_summary();
print_col("Read Throughput in KB/s", rdKB);
print_col("Write Throughput in KB/s", wtKB);
print_col("Avg. Service Time (ms)", svct);
print_col("Avg. Wait Time (ms)", wait);
print_col("%Utilization", util);
print_col("Read Throughput in requests/s", rds);
print_col("Write Throughput in requests/s", wts);
print_col("Avg. Queue Length", qusz);
print_col("Avg. Request Size (bytes)", rqsz);
print_col("Avg. Read Requests Merged/s", rrqm);
print_col("Avg. Write Requests Merged/s", wrqm);
}

function print_summary() {
print "Section: Disk Summary";
print "Device Avg_rds Avg_wts Avg_rd_KB Avg_wt_KB Avg_wsvct Avg_asvct Avg_util%";
for (i = 1; i <= numdisks; i++) {
device = disks[i];
printf("%s %.02f %.02f %.02f %.02f %.02f %.02f %.02f\n",
device, tot_rds[device]/rows, tot_wts[device]/rows, tot_rKB[device]/rows,
tot_wKB[device]/rows, tot_wsvct[device]/rows, tot_asvct[device]/rows, tot_util[device]/rows);
}
printf("\n");
}

function print_col(str, var) {
printf("Section: %s\n", str);
print "Display: Line";
printf( "Time ");
for ( j = 1; j <= numdisks; j++)
printf("%s ",disks[j]);
printf("\n");
# Now print the data
for (i = 1; i <= rows; i++) {
printf("%s", time[i]);
for (j = 1; j <= numdisks; j++) {
disk = disks[j];
printf(" %0.2f", var[disk "," i]);
}
printf("\n");
}
printf ("\n");
}

141 changes: 141 additions & 0 deletions harness/bin/Linux/nicstat-post
@@ -0,0 +1,141 @@
#!/bin/awk -f
# Script to parse nicstat output and generate xan output
# We assume that nicstat is run with the default faban parameters.
# Sample output should look like:
# Time Int rKB/s wKB/s rPk/s wPk/s rAvs wAvs %Util Sat
#21:53:38 lo 0.01 0.01 0.07 0.07 93.63 93.63 0.00 0.00
#21:53:38 eth0 51.30 83.64 738.3 618.8 71.16 138.4 0.00 0.00


BEGIN {
rows = 0;
num_intf = 0; #number of interfaces
inhdr = 0;
}

/Time/ {
if (inhdr == 0 && num_intf == 0) {
inhdr = 1;
} else {
# Need to add the stats
inhdr = 0;
rows++;
}
next;
}

# Normal dataset
{
# We use the 1st set to get the interfaces
if (inhdr == 1) {
interfaces[++num_intf] = $2;
tot_util[$2] = 0;
tot_rdKB[$2] = 0; tot_wtKB[$2] = 0;
}
# Now start processing stats
time[rows] = $1;
# rd/wt KBs
rdKB[$2 "," rows] = $3;
wtKB[$2 "," rows] = $4;
tot_rdKB[$2] += $3;
tot_wtKB[$2] += $4;
# rd/wt packets.
rdPkt[$2 "," rows] = $5;
wtPkt[$2 "," rows] = $6;
# rd/wt avg. size
rdAsz[$2 "," rows] = $7;
wtAsz[$2 "," rows] = $8;
# util
util[$2 "," rows] = $9;
tot_util[$2] += $9;
# We ignore sat column
}

# In the end, let's print out the data
END {
print "Title: Nicstat Output\n";
print_summary();
print_rdKB();
print_wtKB();
print_rdPkt();
print_wtPkt();
print_rdAsz();
print_wtAsz();
print_util();
}

function print_summary() {
print "Section: Network Summary";
print "Interface Avg_Read_KB Avg_Write_KB Avg_Util%";
for (i = 1; i <= num_intf; i++) {
intf = interfaces[i];
printf("%s %.02f %.02f %.02f\n", intf, tot_rdKB[intf]/rows,
tot_wtKB[intf]/rows, tot_util[intf]/rows);
}
printf("\n");
}

function print_rdKB() {
print "Section: Read Throughput in KB";
print_col(rdKB);
}

function print_wtKB() {
print "Section: Write Throughput in KB";
print_col(wtKB);
}

function print_rdPkt() {
print "Section: Read Throughput in Packets";
print_col(rdPkt);
}

function print_wtPkt() {
print "Section: Write Throughput in Packets";
print_col(wtPkt);
}

function print_rdAsz() {
print "Section: Average Bytes Per Read";
print_col(rdAsz);
}

function print_wtAsz() {
print "Section: Average Bytes Per Write";
print_col(wtAsz);
}

function print_util() {
# Print util. only if not 0. On Linux, nicstat can't determine util. sometimes
printUtil = 0;
for (j = 1; j <= num_intf; j++) {
intf = interfaces[j];
if (tot_util[intf] > 0) {
printUtil = 1;
break;
}
}
if (printUtil == 1) {
print "Section: Utilization";
print_col(util);
}
}

function print_col(var) {
print "Display: Line";
printf( "Time ");
for ( j = 1; j <= num_intf; j++)
printf("%s ",interfaces[j]);
printf("\n");
# Now print the data
for (i = 1; i <= rows; i++) {
printf("%s", time[i]);
for (j = 1; j <= num_intf; j++) {
intf = interfaces[j];
printf(" %0.2f", var[intf "," i]);
}
printf("\n");
}
printf ("\n");
}

32 changes: 32 additions & 0 deletions harness/bin/Linux/top
@@ -0,0 +1,32 @@
#!/bin/sh
# This script does two things: adds a timestamp at the top of every iteration of 'top' and truncates the listing to 20 lines total.

addtime() {
CNT=0
while read a
do
case $a in
[top]*)
echo $a
CNT=0;;
[PID]*)
DATE=`date +%I:%M:%S`
echo "$DATE $a";;
*)
CNT=`expr $CNT + 1`
if [ $CNT -lt 21 ]
then
echo " $a"
fi;;
esac
done
}

if [ $# -eq 1 ]
then
NUM="-n $1"
else
NUM=""
fi
top $NUM -d 10 -b | addtime

17 changes: 17 additions & 0 deletions harness/bin/Linux/vmstat
@@ -0,0 +1,17 @@
#!/bin/sh
addtime() {
while read a
do
case $a in
[0-9]*)
DATE=`date +%I:%M:%S`
echo "$DATE $a";;
*) echo " $a";;
esac
done
}

exec /usr/bin/vmstat $@ | addtime &
pid=$!
trap "kill $pid" 2 9 15
wait

0 comments on commit f2d99c1

Please sign in to comment.