Add tapestats to collect tape devices statistics#2044
Add tapestats to collect tape devices statistics#2044SuperQ merged 1 commit intoprometheus:masterfrom
Conversation
|
Thanks for the new collector. We typically implement access to proc/sys files via the Prometheus procfs library rather than directly in the node_exporter. If you wouldn't mind implementing the file parser in the library first, it would be great to add this. (Yes, there are some legacy collectors that still use proc/sys directly) |
No problem. The collector is quite simple. It might not be a big deal.
As a suggestion, it would be nice to have a comment on top of every "legacy" usage with a "// TODO: migrate to procfs library". As programming is mostly a bunch of ctrl+c,ctrl+v, without a warning those codes tend to replicate. |
2f82f3e to
34763d3
Compare
|
Done. It requires prometheus/procfs#382 |
34763d3 to
3b2396f
Compare
3b2396f to
49ccfb3
Compare
49ccfb3 to
ee05667
Compare
|
Rebased and solved CHANGELOG.md conflicts. |
|
CC @bluecmd |
6e65aae to
74a2835
Compare
|
All changes applied. Rebased on master to use procfs v0.7.0 |
|
Actually, should we name this |
|
I though collectors abstracts the underlying OS. If someone implements tapestats for windows, FreeBSD, it would not make sense to mention a Linux specific name. Anyway, I can rename it if needed. |
|
Most of the naming has been based on the Linux names for things, since we typically start with Linux implementations.
@bluecmd Any opinions? |
collector/tapestats_linux.go
Outdated
There was a problem hiding this comment.
Should this really be multiplied?
There was a problem hiding this comment.
Seems like a copy-n-paste bug.
Yes, it is... I fixed that. Thanks!
|
I think this looks fine (save for the one comment above), I have been using the following script for a few days to test these metrics out, and it has worked fine. #!/bin/bash
for stp in /sys/class/scsi_tape/st[0-999]
do
drv="$(basename "${stp}")"
echo "node_tape_io_now{device=\""${drv}"\"} $(<"/sys/class/scsi_tape/${drv}/stats/in_flight")"
echo "node_tape_io_time_nanoseconds_total{device=\""${drv}"\"} $(<"/sys/class/scsi_tape/${drv}/stats/io_ns")"
echo "node_tape_io_others_total{device=\""${drv}"\"} $(<"/sys/class/scsi_tape/${drv}/stats/other_cnt")"
echo "node_tape_read_bytes_total{device=\""${drv}"\"} $(<"/sys/class/scsi_tape/${drv}/stats/read_byte_cnt")"
echo "node_tape_reads_completed_total{device=\""${drv}"\"} $(<"/sys/class/scsi_tape/${drv}/stats/read_cnt")"
echo "node_tape_read_time_nanoseconds_total{device=\""${drv}"\"} $(<"/sys/class/scsi_tape/${drv}/stats/read_ns")"
echo "node_tape_residual_total{device=\""${drv}"\"} $(<"/sys/class/scsi_tape/${drv}/stats/resid_cnt")"
echo "node_tape_written_bytes_total{device=\""${drv}"\"} $(<"/sys/class/scsi_tape/${drv}/stats/write_byte_cnt")"
echo "node_tape_writes_completed_total{device=\""${drv}"\"} $(<"/sys/class/scsi_tape/${drv}/stats/write_cnt")"
echo "node_tape_write_time_nanoseconds_total{device=\""${drv}"\"} $(<"/sys/class/scsi_tape/${drv}/stats/write_ns")"
doneLooking forward to having these metrics straight in node_exporter! |
It is based on diskstats to allow metrics reuse by simply s/disk/tape/ the query. Signed-off-by: Luiz Angelo Daros de Luca <luizluca@gmail.com>
74a2835 to
00aa2f3
Compare
|
@SuperQ can this be merged? |
|
Done, thanks! |
NOTE: Ignoring invalid network speed will be the default in 2.x NOTE: Filesystem collector flags have been renamed. `--collector.filesystem.ignored-mount-points` is now `--collector.filesystem.mount-points-exclude` and `--collector.filesystem.ignored-fs-types` is now `--collector.filesystem.fs-types-exclude`. The old flags will be removed in 2.x. * [CHANGE] Rename filesystem collector flags to match other collectors #2012 * [CHANGE] Make node_exporter print usage to STDOUT #2039 * [FEATURE] Add conntrack statistics metrics #1155 * [FEATURE] Add ethtool stats collector #1832 * [FEATURE] Add flag to ignore network speed if it is unknown #1989 * [FEATURE] Add tapestats collector for Linux #2044 * [ENHANCEMENT] Add ErrorLog plumbing to promhttp #1887 * [ENHANCEMENT] Add time zone offset metric #2060 * [BUGFIX] Add ErrorLog plumbing to promhttp #1887 * [BUGFIX] Handle errors from disabled PSI subsystem #1983 * [BUGFIX] Fix panic when using backwards compatible flags #2000 * [BUGFIX] Only initiate collectors once #2048 * [BUGFIX] Handle small backwards jumps in CPU idle #2067 Signed-off-by: Ben Kochie <superq@gmail.com>
NOTE: Ignoring invalid network speed will be the default in 2.x NOTE: Filesystem collector flags have been renamed. `--collector.filesystem.ignored-mount-points` is now `--collector.filesystem.mount-points-exclude` and `--collector.filesystem.ignored-fs-types` is now `--collector.filesystem.fs-types-exclude`. The old flags will be removed in 2.x. * [CHANGE] Rename filesystem collector flags to match other collectors #2012 * [CHANGE] Make node_exporter print usage to STDOUT #2039 * [FEATURE] Add conntrack statistics metrics #1155 * [FEATURE] Add ethtool stats collector #1832 * [FEATURE] Add flag to ignore network speed if it is unknown #1989 * [FEATURE] Add tapestats collector for Linux #2044 * [FEATURE] Add nvme collector #2062 * [ENHANCEMENT] Add ErrorLog plumbing to promhttp #1887 * [ENHANCEMENT] Add more Infiniband counters #2019 * [ENHANCEMENT] netclass: retrieve interface names and filter before parsing #2033 * [ENHANCEMENT] Add time zone offset metric #2060 * [BUGFIX] Handle errors from disabled PSI subsystem #1983 * [BUGFIX] Fix panic when using backwards compatible flags #2000 * [BUGFIX] Fix wrong value for OpenBSD memory buffer cache #2015 * [BUGFIX] Only initiate collectors once #2048 * [BUGFIX] Handle small backwards jumps in CPU idle #2067 Signed-off-by: Ben Kochie <superq@gmail.com>
NOTE: Ignoring invalid network speed will be the default in 2.x NOTE: Filesystem collector flags have been renamed. `--collector.filesystem.ignored-mount-points` is now `--collector.filesystem.mount-points-exclude` and `--collector.filesystem.ignored-fs-types` is now `--collector.filesystem.fs-types-exclude`. The old flags will be removed in 2.x. * [CHANGE] Rename filesystem collector flags to match other collectors prometheus#2012 * [CHANGE] Make node_exporter print usage to STDOUT prometheus#2039 * [FEATURE] Add conntrack statistics metrics prometheus#1155 * [FEATURE] Add ethtool stats collector prometheus#1832 * [FEATURE] Add flag to ignore network speed if it is unknown prometheus#1989 * [FEATURE] Add tapestats collector for Linux prometheus#2044 * [FEATURE] Add nvme collector prometheus#2062 * [ENHANCEMENT] Add ErrorLog plumbing to promhttp prometheus#1887 * [ENHANCEMENT] Add more Infiniband counters prometheus#2019 * [ENHANCEMENT] netclass: retrieve interface names and filter before parsing prometheus#2033 * [ENHANCEMENT] Add time zone offset metric prometheus#2060 * [BUGFIX] Handle errors from disabled PSI subsystem prometheus#1983 * [BUGFIX] Fix panic when using backwards compatible flags prometheus#2000 * [BUGFIX] Fix wrong value for OpenBSD memory buffer cache prometheus#2015 * [BUGFIX] Only initiate collectors once prometheus#2048 * [BUGFIX] Handle small backwards jumps in CPU idle prometheus#2067 Signed-off-by: Ben Kochie <superq@gmail.com>
NOTE: Ignoring invalid network speed will be the default in 2.x NOTE: Filesystem collector flags have been renamed. `--collector.filesystem.ignored-mount-points` is now `--collector.filesystem.mount-points-exclude` and `--collector.filesystem.ignored-fs-types` is now `--collector.filesystem.fs-types-exclude`. The old flags will be removed in 2.x. * [CHANGE] Rename filesystem collector flags to match other collectors prometheus#2012 * [CHANGE] Make node_exporter print usage to STDOUT prometheus#2039 * [FEATURE] Add conntrack statistics metrics prometheus#1155 * [FEATURE] Add ethtool stats collector prometheus#1832 * [FEATURE] Add flag to ignore network speed if it is unknown prometheus#1989 * [FEATURE] Add tapestats collector for Linux prometheus#2044 * [FEATURE] Add nvme collector prometheus#2062 * [ENHANCEMENT] Add ErrorLog plumbing to promhttp prometheus#1887 * [ENHANCEMENT] Add more Infiniband counters prometheus#2019 * [ENHANCEMENT] netclass: retrieve interface names and filter before parsing prometheus#2033 * [ENHANCEMENT] Add time zone offset metric prometheus#2060 * [BUGFIX] Handle errors from disabled PSI subsystem prometheus#1983 * [BUGFIX] Fix panic when using backwards compatible flags prometheus#2000 * [BUGFIX] Fix wrong value for OpenBSD memory buffer cache prometheus#2015 * [BUGFIX] Only initiate collectors once prometheus#2048 * [BUGFIX] Handle small backwards jumps in CPU idle prometheus#2067 Signed-off-by: Ben Kochie <superq@gmail.com>
It is heavily based on diskstats to allow metrics reuse by simply
s/disk/tape/ the query.
Signed-off-by: Luiz Angelo Daros de Luca luizluca@gmail.com