How calculation of IOSTAT metrics is done using the cdm probe?
Below commands are used in different platforms for calculation of IOSTAT metrics
aix "/usr/bin/iostat -D"
linux "iostat -d -x"
solaris"/usr/bin/iostat -x"
For example on Linux, the cdm probe gathers the data by creating the iostat command as below:
linux.c:553: sprintf(cmd,"%s %d %d",IO_STAT_CMD, pIOStats->lSampleInterval, samples);
which would result in something like the command below:
# iostat -d -x -k <Sample_interval> 2
Sample_interval is whatever is configured in the probe.
Eg: In case customer interval is 1 minute , samples (sample_interval) is 10 and samples will is always 2. (Hardcoded in code)
This command is run after each iostat interval configured in the probe (1 min for customer) and QOS/alarms are trigged based on the value at that moment i.e not according to average of samples
The sample_interval field signifies that the when above command is run 2 samples are collected for each iostat device and after parsing output of 2 samples of iostat device metrics value is calculated(which means after each 10 second one sample is collected and hence a total of 20 seconds would be taken to collect data from this command).
Example result:
[root@ServerName cdm_5.72GA]# iostat -d -x -k 10 2
Linux 2.6.32-431.el6.x86_64 (ServerName) 12/20/2016 _x86_64_ (2 CPU)
Device: rrqm/s wrqm/s r/s w/s rkB/s wkB/s avgrq-sz avgqu-sz await svctm %util
sda 0.21 1.10 0.33 0.71 10.00 7.25 33.15 0.01 5.08 3.69 0.38
dm-0 0.00 0.00 0.53 1.81 9.83 7.24 14.59 0.02 8.02 1.63 0.38
dm-1 0.00 0.00 0.01 0.00 0.03 0.00 8.00 0.00 3.16 2.02 0.00
Device: rrqm/s wrqm/s r/s w/s rkB/s wkB/s avgrq-sz avgqu-sz await svctm %util
sda 0.00 1.20 0.00 0.30 0.00 6.00 40.00 0.00 0.33 0.33 0.01
dm-0 0.00 0.00 0.00 1.50 0.00 6.00 8.00 0.00 0.07 0.07 0.01
dm-1 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00
As you can see in the output, 2 samples for metrics are fetched for each iostat device after a interval of 10 seconds. You can run this command on the console and check,
It will return after 20 seconds to fetch 2 samples.
Regarding the samples hardcoded as 2. The reason is that we take values of only the second sample as per the iostat command and ignore the first sample.
i.e if interval is configured as 1 min for iostat, we take only the second sample of this command(highlighted part below) for iostat metrics calculations and return QOS/alarms based on that at each iostat interval.
Linux 2.6.32-431.el6.x86_64 (BuildServer-CTeam) 12/20/2016 _x86_64_ (2 CPU)
Device: rrqm/s wrqm/s r/s w/s rkB/s wkB/s avgrq-sz avgqu-sz await svctm %util
sda 0.21 1.10 0.33 0.71 10.00 7.25 33.15 0.01 5.08 3.69 0.38
dm-0 0.00 0.00 0.53 1.81 9.83 7.24 14.59 0.02 8.02 1.63 0.38
dm-1 0.00 0.00 0.01 0.00 0.03 0.00 8.00 0.00 3.16 2.02 0.00
Device: rrqm/s wrqm/s r/s w/s rkB/s wkB/s avgrq-sz avgqu-sz await svctm %util
sda 0.00 1.20 0.00 0.30 0.00 6.00 40.00 0.00 0.33 0.33 0.01
dm-0 0.00 0.00 0.00 1.50 0.00 6.00 8.00 0.00 0.07 0.07 0.01
dm-1 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00
Note:“samples” field is actually sample interval
Note that on Linux the option is -d while on AIX is it -D (uppercase).
https://www.ibm.com/docs/en/aix/7.2?topic=i-iostat-command
IMPORTANT:
The cdm probe also requires the following package for iostat monitoring. For more information, refer to the official sysstat documentation.
The sysstat package (Linux and Unix platforms)
(From version 6.00) On Linux platforms, the probe requires sysstat 9.1.2 for disk latency metrics.
To collect network traffic information, install the SYSSTAT package and test the command sar -n DEV