Note: This bug is displayed in read-only format because the product is no longer active in Red Hat Bugzilla.
RHEL Engineering is moving the tracking of its product development work on RHEL 6 through RHEL 9 to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "RHEL project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs in the statuses "NEW", "ASSIGNED", and "POST" are being migrated throughout September 2023. Bugs of Red Hat partners with an assigned Engineering Partner Manager (EPM) are migrated in late September as per pre-agreed dates. Bugs against components "kernel", "kernel-rt", and "kpatch" are only migrated if still in "NEW" or "ASSIGNED". If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "RHEL project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/RHEL-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.

Bug 1671818

Summary: pcp ignores --finish=time option
Product: Red Hat Enterprise Linux 6 Reporter: Dwight (Bud) Brown <bubrown>
Component: pcpAssignee: Mark Goodwin <mgoodwin>
Status: CLOSED WONTFIX QA Contact: qe-baseos-tools-bugs
Severity: medium Docs Contact:
Priority: unspecified    
Version: 6.10CC: agerstmayr, mgoodwin, nathans, patrickm, toneata
Target Milestone: rc   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: pcp-4.3.3-1 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of:
: 1711085 (view as bug list) Environment:
Last Closed: 2019-05-16 23:55:22 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Dwight (Bud) Brown 2019-02-01 18:31:04 UTC
Description of problem:
-T / --finish seems to not work as expected.  
$ pmiostat -Z PKT-5 --start="01/29/2019 12:30:00" --finish="01/29/2019 14:30:00" -x t,h -u -a ./pmlogger/a0310psec1niimdbl0-1/20190129.00.10.2 | tail -4
Tue Jan 29 19:48:31 2019 vdc             0.00   13.20    0.00  30.30     0.00   159.60    5.267    0.081    2.66    0.00    2.66    6.86
Tue Jan 29 19:48:41 2019 vda             0.00    0.20    0.00   2.40     0.00    12.20    5.083    0.003    1.29    0.00    1.29    0.25
Tue Jan 29 19:48:41 2019 vdb             0.00  253.19    0.00 326.99     0.00  2507.94    7.670    0.938    2.87    0.00    2.87   93.86
Tue Jan 29 19:48:41 2019 vdc             0.00    6.50    0.10  12.80     0.40    70.00    5.457    0.033    2.59    3.00    2.59    3.19

While the output starts at 12:30 as specified by --start, --finish is ignored and the output continues until the end of the archive file at 19:48.

$ pmiostat -Z PKT-5 --start="01/29/2019 12:30:00" --finish="01/29/2019 14:30:00" -x t,h -u -a ./pmlogger/a0310psec1niimdbl0-1/20190129.00.10.2 | head -4
Tue Jan 29 12:30:11 2019 vda             0.00    0.00    0.00   0.00     0.00     0.00    0.000    0.000    0.00    0.00    0.00    0.00
Tue Jan 29 12:30:11 2019 vdb             0.00  382.66    0.00 338.97     0.00  3503.26   10.335    0.944    2.78    0.00    2.78   94.36
Tue Jan 29 12:30:11 2019 vdc             0.00   52.19    0.00  64.29     0.00   411.16    6.395    0.151    2.34    0.00    2.34   14.82
Tue Jan 29 12:30:21 2019 vda             0.00    0.00    0.00   0.30     0.00    24.00   80.000    0.000    0.67    0.00    0.67    0.02

well actually, --start time failes also, its off by 1.There is a sample at 12:30:01 but with a start time of 12:30:00 that sample is skipped.


$ pmiostat -Z PKT-5 --start="01/29/2019 12:29:40" --finish="01/29/2019 14:35:00" -x t,h -u -a ./pmlogger/a0310psec1niimdbl0-1/20190129.00.10.2 | head -4
Tue Jan 29 12:29:51 2019 vda             0.00    0.00    0.00   0.10     0.00     0.40    4.000    0.000    0.00    0.00    0.00    0.00
Tue Jan 29 12:29:51 2019 vdb             0.00  261.43    0.00 337.24     0.00  2574.31    7.633    0.923    2.74    0.00    2.74   92.27
Tue Jan 29 12:29:51 2019 vdc             0.00   18.80    0.00  25.50     0.00   158.42    6.212    0.060    2.35    0.00    2.35    5.57
Tue Jan 29 12:30:01 2019 vda             0.00    0.00    0.00   1.20     0.00     2.80    2.333    0.002    1.83    0.00    1.83    0.16 <<<

That last sample shown at 12:30:01 was what I expect if I specify the start time to be 12:30:00 not the later at 12:30:11.



Version-Release number of selected component (if applicable):
pcp-3.10.9-9.el6.x86_64
pcp-conf-3.10.9-9.el6.x86_64
python-pcp-3.10.9-9.el6.x86_64
pcp-doc-3.10.9-9.el6.noarch
pcp-system-tools-3.10.9-9.el6.x86_64
pcp-libs-3.10.9-9.el6.x86_64


How reproducible:


Steps to Reproduce:
1.
2.
3.

Actual results:


Expected results:


Additional info:
The @ character is used with the man PCPIntro page, but without any clear explanation or when to use it or not use it.  The syntax is shown simply as -S date time ... but then examples use -S @ date time without explanation of why the @ is used.... absolute maybe.  Anyway, its never explained well why the @ starts showing up in date stamp specifications.

also tried using --finish='+6h' and that also didn't work, it again just dumped until the end of the file at 19:48.

Comment 2 Nathan Scott 2019-02-05 04:17:26 UTC
As discussed, Mark; looks like it fails to stop at --finish time when run with -u option.
The --start off-by-one issue is possibly related to rate conversion of counters, but that's just a guess - worth taking a closer look.
Thanks!

Comment 3 Mark Goodwin 2019-04-24 02:10:45 UTC
The problem only occurs in non-interpolated mode (-u flag) and only for apps that use pmcc.py (the convenience classes). So pcp-iostat (aka pmiostat) is affected, but pmrep is not. The bug is in MetricGroupManager._computeSamples(), which is called by MetricGroupManager.run() to compute the number of loop iterations before terminating, i.e. the end of the time window.

The time window (and hence number of reporting loops) is computed from the start, finish and delta arguments, but in non-interpolated mode the delta is not defined (it's inherent to the underlying fetch intervals for log records in the archive). Therefore, run() doesn't know when to stop. To fix this,  run() would need to check if the current sample time is past the designated finish time rather than just checking if we have looped for the computed number of samples.

Work-arounds:
(a) don't use -u and --finish together. The -u and -t flags are incompatible, and so are -u and --finish.
(b) use --start and --samples instead of --start and --finish.
(c) use interpolated mode, i.e. -t interval (for desired interval)  instead of -u

Comment 4 Mark Goodwin 2019-05-16 07:17:46 UTC
Fixed upstream for pcp-4.3.3 (currently under development):

Mark Goodwin (2):
      qa: add qa/1588 to test python pmcc time window handling
      python: fix pmcc time window handling

 qa/1588                |   55 +++
 qa/1588.out            |  775 +++++++++++++++++++++++++++++++++++++++++++++++++
 qa/group               |    1
 src/python/pcp/pmcc.py |   57 ++-
 4 files changed, 869 insertions(+), 19 deletions(-)

Details :

commit 7aa23e63e5c63ea6dd561bf3cfbb45a92539fa02 (HEAD -> master)
Author: Mark Goodwin <mgoodwin>
Date:   Thu May 16 16:44:20 2019 +1000

    python: fix pmcc time window handling

    For reference, see BZ 1671818 - pcp ignores --finish=time option.
    PCP python apps that use pmcc and support -u (non-interpolation mode)
    ignore the --finish time window option because the calculation relies
    on sampling time delta being set (but it is not set in -u mode).

    With this fix to pmcc.py, the --samples and --finish options
    are both considered when deciding when to terminate the run()
    loop. If both --samples and --finish are specified, the run loop
    will terminate when either the current timestamp or sample count
    reaches the end of the time window. If neither are set, run()
    continues to the end of the archive, as normal.

    Using sample count OR finish time to terminate the run loop
    effectively avoids the problem in the BZ because --finish
    no longer relies on the time delta to figure out when to stop.

    qa/1588 exercises the fix.

    Also note, qa/829 might need a tweak for testing pcp-dmcache(1),
    which also uses pmcc.

commit 2484809b5096b70252f5a659833150951538cb6f
Author: Mark Goodwin <mgoodwin>
Date:   Thu May 16 16:42:09 2019 +1000

    qa: add qa/1588 to test python pmcc time window handling

    See BZ 1671818 - pcp ignores --finish=time option
    Next commit to src/python/pcp/pmcc.py fixes it.

Comment 5 Mark Goodwin 2019-05-16 23:55:22 UTC
Closing this WONTFIX for RHEL6 - multiple workarounds are available (see Comment #3) and secondly, PCP archives are both forward and backward compatible with any PCP release - so PCP archives captured on RHEL6 can be replayed and analysed on later versions of PCP.