]> granicus.if.org Git - sysstat/commitdiff
sadf sometimes prints comment lines before the header.
authorDimitrios Apostolou <jimis@gmx.net>
Fri, 3 Apr 2015 19:57:48 +0000 (21:57 +0200)
committerDimitrios Apostolou <jimis@gmx.net>
Fri, 3 Apr 2015 19:57:48 +0000 (21:57 +0200)
contrib/sargraph/sargraph2

index c06497c98a17aa90dc81b9ee1ea0fddbe50b14ae..215ec8dbb2240a56f1fc7c6ac3216720721dc538 100755 (executable)
@@ -130,7 +130,7 @@ decompress_copy()
 cpu_gnuplot()                             # %iowait,%user,%nice,%system,%steal
 {
     # First make sure that the columns are where we expect them to be
-    HEADER=`head -1 $2 | cut -d ';' -f 5-10`
+    HEADER=`egrep -v ';LINUX-RESTART|;COM' $2 | head -1 | cut -d ';' -f 5-10`
     EXPECTED="%user;%nice;%system;%iowait;%steal;%idle"
     if [ "$HEADER" != "$EXPECTED" ]
     then
@@ -159,14 +159,14 @@ EOF
 mem_gnuplot()                    # free,used,buffers,cached / %commit,%swpused
 {
     # First make sure that the columns are where we expect them to be
-    HEADER=`head -1 $2 | cut -d ';' -f 4-10`
+    HEADER=`egrep -v ';LINUX-RESTART|;COM' $2 | head -1 | cut -d ';' -f 4-10`
     EXPECTED="kbmemfree;kbmemused;%memused;kbbuffers;kbcached;kbcommit;%commit"
     if [ "$HEADER" != "$EXPECTED" ]
     then
         echo "Headers not in right order: $HEADER" 1>&2
         exit 1
     fi
-    HEADER=`head -1 $3 | cut -d ';' -f 4-6`
+    HEADER=`egrep -v ';LINUX-RESTART|;COM' $3 | head -1 | cut -d ';' -f 4-6`
     EXPECTED="kbswpfree;kbswpused;%swpused"
     if [ "$HEADER" != "$EXPECTED" ]
     then
@@ -201,7 +201,7 @@ EOF
 io_gnuplot()                                      # %KBr/s,KBw/s / rIOPS,wIOPS
 {
     # First make sure that the columns are where we expect them to be
-    HEADER=`head -1 $2 | cut -d ';' -f 4-8`
+    HEADER=`egrep -v ';LINUX-RESTART|;COM' $2 | head -1 | cut -d ';' -f 4-8`
     EXPECTED="tps;rtps;wtps;bread/s;bwrtn/s"
     if [ "$HEADER" != "$EXPECTED" ]
     then