Largely copying from the code for Redhat 6; I tested it against RHEL 7 and CentOS 7 (running sysstat 10.1.5).
There is one minor omission: sysstat 10.1.5 collects three new metrics under the memory statsistics (sar -r). They are kbactive, kbinact, kbdirty (for active/inactive/dirty memory). They occur after the %commit value, in that order. I did not include them because I was not sure what numbers to assign for those values. So, those values will not be collected by sar2ascii with the below code.
This also includes one minor change unrelated to RHEL7 support. In line 386 of sar2ascii, when parsing out SA_DATE from a sar file, I found some edge cases where the command chain would return a column of values after the date. That may or may not affect other commands later, but adding a | head -n1 | was a surefire way to strip out any trailing values. That command chain is used by RHEL6, RHEL7, and SuSe 11, so it should not cause compatibility issues.
Old line 386:
SA_DATE=`sar -b -f $SA_LOC/$FILE| grep -i $SC_OS | grep -i -v restart | uniq | awk '{ print $4 }'`
New line 386:
SA_DATE=`sar -b -f $SA_LOC/$FILE| grep -i $SC_OS | grep -i -v restart | uniq | head -n1 | awk '{ print $4 }'`
See attached files, and diff output below.
# diff sar2html sar2html.new
106a107,129
> # REDHAT 7 --------------------------------------------------------------------------------------
> SA_Redhat_7='b B d I_SUM n_DEV n_EDEV n_NFS n_NFSD n_SOCK P_ALL q r R S v w W y'
> SA_Redhat_7_b='tps rtps wtps,1 2 3 4 5, I/O TRANSACTION:bread/s bwrtn/s,1 2 6 7,I/O TRANSFER RATE'
> SA_Redhat_7_B='pgpgin/s pgpgout/s,1 2 3 4,PAGING STATISTICS:fault/s majflt/s,1 2 5 6,PAGE FAULTS:pgfree/s pgscank/s pgscand/s pgsteal/s,1 2 7 8 9 10,PAGE OPERATIONS:%vmeff,1 2 11,EFFICIENCY OF PAGE RECLAIM'
> SA_Redhat_7_d='tps,1 2 4,NUMBER OF TRANSFERS:rd_sec/s wr_sec/s,1 2 5 6,NUMBER OF SECTOR r/w:avgrq-sz avgqu-sz,1 2 7 8,I/O REQUESTS AND QUEUE LENGHT:await,1 2 9,AVEARGE WAIT TIME,svctm,1 2 10,AVERAGE SERVICE TIME:%util,1 2 11,CPU PERCENTAGE of I/O'
> SA_Redhat_7_I_SUM='intr/s,1 2 4,INTERRUPT ACTIVITY'
> SA_Redhat_7_n_DEV='rxkB/s txkB/s,1 2 6 7,NETWORK I/O:rxpck/s txpck/s rxcmp/s txcmp/s rxmcst/s,1 2 4 5 8 9 10,NETWORK STATISTICS'
> SA_Redhat_7_n_EDEV='rxerr/s txerr/s coll/s rxdrop/s txdrop/s txcarr/s rxfram/s rxfifo/s txfifo/s,1 2 4 5 6 7 8 9 10 11 12,NETWORK ERROR STATISTICS'
> SA_Redhat_7_n_NFS='read/s write/s,1 2 5 6,NUMBER OF RPC R/W:call/s retrans/s access/s getatt/s,1 2 3 4 7 8,NUMBER OF RPC REQUESTS AND ACCESSES'
> SA_Redhat_7_n_NFSD='sread/s swrite/s,1 2 10 11,NUMBER OF RPC R/W:scall/s badcall/s saccess/s sgetatt/s,1 2 3 4 12 13,NUMBER OF RPC REQUESTS AND ACCESSES: packet/s udp/s tcp/s,1 2 5 6 7,NUMBER OF NETWORK PACKETS:hit/s miss/s,1 2 8 9,NUMBER OF REPLY CACHE HITS AND MISSES'
> SA_Redhat_7_n_SOCK='totsck tcpsck udpsck rawsck ip-frag tcp-tw,1 2 3 4 5 6 7 8,NETWORK SOCKET STATISTICS'
> SA_Redhat_7_P_ALL='%user %nice %system %iowait %steal %idle,1 2 4 5 6 7 8 9,PROCESSOR ACTIVITY'
> SA_Redhat_7_q='runq-sz,1 2 3,QUEUE LENGTH:plist-sz,1 2 4,NUMBER OF PROCESSES:ldavg-1 ldavg-5 ldavg-15,1 2 5 6 7,LOAD AVERAGE'
> # For r attribute, need to add after %commit: kbactive, kbinact, kbdirty (active/inactive/dirty memory)
> SA_Redhat_7_r='kbmemfree kbmemused kbbuffers kbcached kbcommit,1 2 3 4 6 7 8,MEMORY UTILIZATION:%memused %commit,1 2 5 9,MEMORY UTILIZATION %'
> SA_Redhat_7_R='frmpg/s bufpg/s campg/s,1 2 3 4 5,MEMORY STATISTICS'
> SA_Redhat_7_S='kbswpfree kbswpused kbswpcad,1 2 3 4 6,SWAP UTILIZATION:%swpused %swpcad,1 2 5 7,SWAP UTILIZATION %'
> SA_Redhat_7_v='dentunusd,1 2 3,UNUSED CACHE ENTRIES:file-nr inode-nr,1 2 4 5,NUMBER OF FILE AND INODE HANDLERS:pty-nr,1 2 6,NUMBER OF PSEUDO-TERMINALS'
> SA_Redhat_7_w='proc/s,1 2 3,PROCESS CREATION ACTIVITY:cswch/s,1 2 4,SYSTEM SWITCHING ACTIVITY'
> SA_Redhat_7_W='pswpin/s pswpout/s,1 2 3 4,SWAPPING STATISTICS'
> SA_Redhat_7_y='rcvin/s xmtin/s framerr/s prtyerr/s brk/s ovrun/s,1 2 3 4 5 6 7 8,TTY DEVICE ACTIVITY'
> SA_Redhat_7_SPECIAL='d n_DEV n_EDEV P_ALL'
>
[root@centos6vm sar2html-2.4.2]#
[root@centos6vm sar2html-2.4.2]#
[root@centos6vm sar2html-2.4.2]# diff sar2ascii sar2ascii.new
106a107,129
> # REDHAT 7 --------------------------------------------------------------------------------------
> SA_Redhat_7='b B d I_SUM n_DEV n_EDEV n_NFS n_NFSD n_SOCK P_ALL q r R S v w W y'
> SA_Redhat_7_b='tps rtps wtps,1 2 3 4 5, I/O TRANSACTION:bread/s bwrtn/s,1 2 6 7,I/O TRANSFER RATE'
> SA_Redhat_7_B='pgpgin/s pgpgout/s,1 2 3 4,PAGING STATISTICS:fault/s majflt/s,1 2 5 6,PAGE FAULTS:pgfree/s pgscank/s pgscand/s pgsteal/s,1 2 7 8 9 10,PAGE OPERATIONS:%vmeff,1 2 11,EFFICIENCY OF PAGE RECLAIM'
> SA_Redhat_7_d='tps,1 2 4,NUMBER OF TRANSFERS:rd_sec/s wr_sec/s,1 2 5 6,NUMBER OF SECTOR r/w:avgrq-sz avgqu-sz,1 2 7 8,I/O REQUESTS AND QUEUE LENGHT:await,1 2 9,AVEARGE WAIT TIME,svctm,1 2 10,AVERAGE SERVICE TIME:%util,1 2 11,CPU PERCENTAGE of I/O'
> SA_Redhat_7_I_SUM='intr/s,1 2 4,INTERRUPT ACTIVITY'
> SA_Redhat_7_n_DEV='rxkB/s txkB/s,1 2 6 7,NETWORK I/O:rxpck/s txpck/s rxcmp/s txcmp/s rxmcst/s,1 2 4 5 8 9 10,NETWORK STATISTICS'
> SA_Redhat_7_n_EDEV='rxerr/s txerr/s coll/s rxdrop/s txdrop/s txcarr/s rxfram/s rxfifo/s txfifo/s,1 2 4 5 6 7 8 9 10 11 12,NETWORK ERROR STATISTICS'
> SA_Redhat_7_n_NFS='read/s write/s,1 2 5 6,NUMBER OF RPC R/W:call/s retrans/s access/s getatt/s,1 2 3 4 7 8,NUMBER OF RPC REQUESTS AND ACCESSES'
> SA_Redhat_7_n_NFSD='sread/s swrite/s,1 2 10 11,NUMBER OF RPC R/W:scall/s badcall/s saccess/s sgetatt/s,1 2 3 4 12 13,NUMBER OF RPC REQUESTS AND ACCESSES: packet/s udp/s tcp/s,1 2 5 6 7,NUMBER OF NETWORK PACKETS:hit/s miss/s,1 2 8 9,NUMBER OF REPLY CACHE HITS AND MISSES'
> SA_Redhat_7_n_SOCK='totsck tcpsck udpsck rawsck ip-frag tcp-tw,1 2 3 4 5 6 7 8,NETWORK SOCKET STATISTICS'
> SA_Redhat_7_P_ALL='%user %nice %system %iowait %steal %idle,1 2 4 5 6 7 8 9,PROCESSOR ACTIVITY'
> SA_Redhat_7_q='runq-sz,1 2 3,QUEUE LENGTH:plist-sz,1 2 4,NUMBER OF PROCESSES:ldavg-1 ldavg-5 ldavg-15,1 2 5 6 7,LOAD AVERAGE'
> # For r attribute, need to add after %commit: kbactive, kbinact, kbdirty (active/inactive/dirty memory)
> SA_Redhat_7_r='kbmemfree kbmemused kbbuffers kbcached kbcommit,1 2 3 4 6 7 8,MEMORY UTILIZATION:%memused %commit,1 2 5 9,MEMORY UTILIZATION %'
> SA_Redhat_7_R='frmpg/s bufpg/s campg/s,1 2 3 4 5,MEMORY STATISTICS'
> SA_Redhat_7_S='kbswpfree kbswpused kbswpcad,1 2 3 4 6,SWAP UTILIZATION:%swpused %swpcad,1 2 5 7,SWAP UTILIZATION %'
> SA_Redhat_7_v='dentunusd,1 2 3,UNUSED CACHE ENTRIES:file-nr inode-nr,1 2 4 5,NUMBER OF FILE AND INODE HANDLERS:pty-nr,1 2 6,NUMBER OF PSEUDO-TERMINALS'
> SA_Redhat_7_w='proc/s,1 2 3,PROCESS CREATION ACTIVITY:cswch/s,1 2 4,SYSTEM SWITCHING ACTIVITY'
> SA_Redhat_7_W='pswpin/s pswpout/s,1 2 3 4,SWAPPING STATISTICS'
> SA_Redhat_7_y='rcvin/s xmtin/s framerr/s prtyerr/s brk/s ovrun/s,1 2 3 4 5 6 7 8,TTY DEVICE ACTIVITY'
> SA_Redhat_7_SPECIAL='d n_DEV n_EDEV P_ALL'
>
320c343
< if [ $SC_REV != "3" ] && [ $SC_REV != "4" ] && [ $SC_REV != "5" ] && [ $SC_REV != "6" ]; then
---
> if [ $SC_REV != "3" ] && [ $SC_REV != "4" ] && [ $SC_REV != "5" ] && [ $SC_REV != "6" ] && [ $SC_REV != "7" ]; then
362,363c385,386
< if [ $SC_RELEASE = "Redhat_6" ] || [ $SC_RELEASE = "Suse_11" ]; then
< SA_DATE=`sar -b -f $SA_LOC/$FILE| grep -i $SC_OS | grep -i -v restart | uniq | awk '{ print $4 }'`
---
> if [ $SC_RELEASE = "Redhat_6" ] || [ $SC_RELEASE = "Redhat_7" ]|| [ $SC_RELEASE = "Suse_11" ]; then
> SA_DATE=`sar -b -f $SA_LOC/$FILE| grep -i $SC_OS | grep -i -v restart | uniq | head -n1 | awk '{ print $4 }'`
[root@centos6vm sar2html-2.4.2]# diff sar2html.php sar2html.php.new
102c102,122
<
---
>
> var $SA_Redhat_7 = 'b B d I_SUM n_DEV n_EDEV n_NFS n_NFSD n_SOCK P_ALL q r R S v w W y';
> var $SA_Redhat_7_b = 'I/O TRANSACTION & TRANSFER RATE';
> var $SA_Redhat_7_B = 'PAGING STATISTICS';
> var $SA_Redhat_7_d = 'DISK I/O & STATISTICS';
> var $SA_Redhat_7_I_SUM = 'INTERRUPT ACTIVITY';
> var $SA_Redhat_7_n_DEV = 'NETWORK I/O & NETWORK STATISTICS';
> var $SA_Redhat_7_n_EDEV = 'NETWORK ERROR STATISTICS';
> var $SA_Redhat_7_n_NFS = 'NFS STATISTICS';
> var $SA_Redhat_7_n_NFSD = 'NFSD STATISTICS';
> var $SA_Redhat_7_n_SOCK = 'NETWORK SOCKET STATISTICS';
> var $SA_Redhat_7_P_ALL = 'PROCESSOR ACTIVITY';
> var $SA_Redhat_7_q = 'PROCESS QUEUE';
> var $SA_Redhat_7_r = 'MEMORY & SWAP UTILIZATION';
> var $SA_Redhat_7_R = 'MEMORY STATISTICS';
> var $SA_Redhat_7_S = 'SWAP UTILIZATION';
> var $SA_Redhat_7_v = 'KERNEL TABLES';
> var $SA_Redhat_7_w = 'SYSTEM SWITCHING ACTIVITY';
> var $SA_Redhat_7_W = 'SWAPPING STATISTICS';
> var $SA_Redhat_7_y = 'TTY DEVICE ACTIVITY';
>
269a290
> var $SA_Redhat_7 = 'd n_DEV n_EDEV P_ALL';
Since I do not have rhel7 system I need to have "sar -A" output to interpret it.
Could you please post it to the patch queue?
Regards,
Attached is sar -A output. Let me know if you need anything else.
Could you please send printout of man page of sar?