pcp updates - add scsi tape statistics to pmdalinux

"Mark Goodwin" <[email protected]> Mon, 13 Feb 2017 14:53:29 +1100
Newsgroups gmane.comp.sysutils.pcp
Message-ID <[email protected]>
Discussed with Nathan and we tentatively agreed to take this for 3.11.8,
subject to review. QA for this is coming later today (new tests using fake
sysfs root, as well as some existing test updates).

Changes committed to git://git.pcp.io/mgoodwin/pcp master

commit b3660e3be239cc77516f8bbf7cc31242b406adff
Author: Mark Goodwin <[email protected]>
Date:   Mon Feb 13 14:22:35 2017 +1100

    pmdalinux: add support for scsi tape statistics

    Linux tape stats are now fairly widely available. The new Liux PMDA
metrics
    are named after the statistics exported below
/sys/class/scsi_tape/*/stats/*
    as follows :

    tape.dev.in_flight [number of I/Os currently outstanding to this tape
device]
    tape.dev.io_ns [cummulative amount of time spent waiting for all I/O to
complete to tape device]
    tape.dev.other_cnt [number of I/Os issued to the tape drive other than
read or write commands]
    tape.dev.read_byte_cnt [number of bytes read from the tape drive]
    tape.dev.read_cnt [number of read requests issued to the tape drive]
    tape.dev.read_ns [cummulative amount of time spent waiting for read
requests to complete]
    tape.dev.resid_cnt [count of read or write residual data, per tape
device]
    tape.dev.write_byte_cnt [number of bytes written to the tape drive]
    tape.dev.write_cnt [number of write requests issued to the tape drive]
    tape.dev.write_ns [cummulative amount of time spent waiting for write
requests to complete]

    All of the above span the new TAPEDEV instance domain. We support tape
devices being
    dynamically added or removed. This can be tested with scsi_debug on
supported kernels,
    e.g. to create 4 virtual scsi tape devices :

            # modprobe scsi_debug ptype=1 add_host=4 dev_size_mb=100

    To remove one of them (e.g. st2) :
            # echo 1 > /sys/class/scsi_tape/st2/device/delete

    To remove all of them :
            # rmmod scsi_debug

    The above scsi_debug interface will be used to create fake sysfs files
for QA purposes,
    which will be in a followup commit. There are also a couple of QA
updates for existing
    tests.

    We also support the singular metric 'hinv.ntape' as the current number
of scsi tape devices.
    Note also that the various derivative devices, such as /dev/nst1 (and
so forth) actually
    share the same statistics exports as the regular devices and so the
tape device indom is
    not populated with these devices.

    modified:   src/pmdas/linux/GNUmakefile
    modified:   src/pmdas/linux/help
    modified:   src/pmdas/linux/linux.h
    modified:   src/pmdas/linux/pmda.c
    modified:   src/pmdas/linux/root_linux
    new file:   src/pmdas/linux/sysfs_tapestats.c
    new file:   src/pmdas/linux/sysfs_tapestats.h