Skip to content

Commit

Permalink
fibre_channel: update procfs to take into account optional attributes (
Browse files Browse the repository at this point in the history
…prometheus#2933)

Signed-off-by: machine424 <ayoubmrini424@gmail.com>
  • Loading branch information
machine424 authored and gitperr committed Apr 30, 2024
1 parent 6f379cf commit 6024f4e
Show file tree
Hide file tree
Showing 4 changed files with 113 additions and 12 deletions.
12 changes: 0 additions & 12 deletions collector/fibrechannel_linux.go
Original file line number Diff line number Diff line change
Expand Up @@ -66,18 +66,6 @@ func NewFibreChannelCollector(logger log.Logger) (Collector, error) {
"rx_words_total": "Number of words received by host port",
"tx_frames_total": "Number of frames transmitted by host port",
"link_failure_total": "Number of times the host port link has failed",
"name": "Name of Fibre Channel HBA",
"speed": "Current operating speed",
"port_state": "Current port state",
"port_type": "Port type, what the port is connected to",
"symbolic_name": "Symbolic Name",
"node_name": "Node Name as hexadecimal string",
"port_id": "Port ID as string",
"port_name": "Port Name as hexadecimal string",
"fabric_name": "Fabric Name; 0 if PTP",
"dev_loss_tmo": "Device Loss Timeout in seconds",
"supported_classes": "The FC classes supported",
"supported_speeds": "The FC speeds supported",
}

i.metricDescs = make(map[string]*prometheus.Desc)
Expand Down
16 changes: 16 additions & 0 deletions collector/fixtures/e2e-64k-page-output.txt
Original file line number Diff line number Diff line change
Expand Up @@ -742,48 +742,64 @@ node_entropy_available_bits 1337
node_entropy_pool_size_bits 4096
# HELP node_exporter_build_info A metric with a constant '1' value labeled by version, revision, branch, goversion from which node_exporter was built, and the goos and goarch for the build.
# TYPE node_exporter_build_info gauge
# HELP node_fibrechannel_dumped_frames_total Number of dumped frames
# TYPE node_fibrechannel_dumped_frames_total counter
node_fibrechannel_dumped_frames_total{fc_host="host1"} 0
# HELP node_fibrechannel_error_frames_total Number of errors in frames
# TYPE node_fibrechannel_error_frames_total counter
node_fibrechannel_error_frames_total{fc_host="host0"} 0
node_fibrechannel_error_frames_total{fc_host="host1"} 19
# HELP node_fibrechannel_fcp_packet_aborts_total Number of aborted packets
# TYPE node_fibrechannel_fcp_packet_aborts_total counter
node_fibrechannel_fcp_packet_aborts_total{fc_host="host0"} 19
# HELP node_fibrechannel_info Non-numeric data from /sys/class/fc_host/<host>, value is always 1.
# TYPE node_fibrechannel_info gauge
node_fibrechannel_info{dev_loss_tmo="",fabric_name="",fc_host="host1",port_id="",port_name="",port_state="",port_type="",speed="8 Gbit",supported_classes="",supported_speeds="",symbolic_name=""} 1
node_fibrechannel_info{dev_loss_tmo="30",fabric_name="0",fc_host="host0",port_id="000002",port_name="1000e0071bce95f2",port_state="Online",port_type="Point-To-Point (direct nport connection)",speed="16 Gbit",supported_classes="Class 3",supported_speeds="4 Gbit, 8 Gbit, 16 Gbit",symbolic_name="Emulex SN1100E2P FV12.4.270.3 DV12.4.0.0. HN:gotest. OS:Linux"} 1
# HELP node_fibrechannel_invalid_crc_total Invalid Cyclic Redundancy Check count
# TYPE node_fibrechannel_invalid_crc_total counter
node_fibrechannel_invalid_crc_total{fc_host="host0"} 2
node_fibrechannel_invalid_crc_total{fc_host="host1"} 32
# HELP node_fibrechannel_invalid_tx_words_total Number of invalid words transmitted by host port
# TYPE node_fibrechannel_invalid_tx_words_total counter
node_fibrechannel_invalid_tx_words_total{fc_host="host0"} 8
node_fibrechannel_invalid_tx_words_total{fc_host="host1"} 128
# HELP node_fibrechannel_link_failure_total Number of times the host port link has failed
# TYPE node_fibrechannel_link_failure_total counter
node_fibrechannel_link_failure_total{fc_host="host0"} 9
node_fibrechannel_link_failure_total{fc_host="host1"} 144
# HELP node_fibrechannel_loss_of_signal_total Number of times signal has been lost
# TYPE node_fibrechannel_loss_of_signal_total counter
node_fibrechannel_loss_of_signal_total{fc_host="host0"} 17
node_fibrechannel_loss_of_signal_total{fc_host="host1"} 272
# HELP node_fibrechannel_loss_of_sync_total Number of failures on either bit or transmission word boundaries
# TYPE node_fibrechannel_loss_of_sync_total counter
node_fibrechannel_loss_of_sync_total{fc_host="host0"} 16
node_fibrechannel_loss_of_sync_total{fc_host="host1"} 256
# HELP node_fibrechannel_nos_total Number Not_Operational Primitive Sequence received by host port
# TYPE node_fibrechannel_nos_total counter
node_fibrechannel_nos_total{fc_host="host0"} 18
node_fibrechannel_nos_total{fc_host="host1"} 288
# HELP node_fibrechannel_rx_frames_total Number of frames received
# TYPE node_fibrechannel_rx_frames_total counter
node_fibrechannel_rx_frames_total{fc_host="host0"} 3
node_fibrechannel_rx_frames_total{fc_host="host1"} 48
# HELP node_fibrechannel_rx_words_total Number of words received by host port
# TYPE node_fibrechannel_rx_words_total counter
node_fibrechannel_rx_words_total{fc_host="host0"} 4
node_fibrechannel_rx_words_total{fc_host="host1"} 64
# HELP node_fibrechannel_seconds_since_last_reset_total Number of seconds since last host port reset
# TYPE node_fibrechannel_seconds_since_last_reset_total counter
node_fibrechannel_seconds_since_last_reset_total{fc_host="host0"} 7
node_fibrechannel_seconds_since_last_reset_total{fc_host="host1"} 112
# HELP node_fibrechannel_tx_frames_total Number of frames transmitted by host port
# TYPE node_fibrechannel_tx_frames_total counter
node_fibrechannel_tx_frames_total{fc_host="host0"} 5
node_fibrechannel_tx_frames_total{fc_host="host1"} 80
# HELP node_fibrechannel_tx_words_total Number of words transmitted by host port
# TYPE node_fibrechannel_tx_words_total counter
node_fibrechannel_tx_words_total{fc_host="host0"} 6
node_fibrechannel_tx_words_total{fc_host="host1"} 96
# HELP node_filefd_allocated File descriptor statistics: allocated.
# TYPE node_filefd_allocated gauge
node_filefd_allocated 1024
Expand Down
16 changes: 16 additions & 0 deletions collector/fixtures/e2e-output.txt
Original file line number Diff line number Diff line change
Expand Up @@ -764,48 +764,64 @@ node_entropy_available_bits 1337
node_entropy_pool_size_bits 4096
# HELP node_exporter_build_info A metric with a constant '1' value labeled by version, revision, branch, goversion from which node_exporter was built, and the goos and goarch for the build.
# TYPE node_exporter_build_info gauge
# HELP node_fibrechannel_dumped_frames_total Number of dumped frames
# TYPE node_fibrechannel_dumped_frames_total counter
node_fibrechannel_dumped_frames_total{fc_host="host1"} 0
# HELP node_fibrechannel_error_frames_total Number of errors in frames
# TYPE node_fibrechannel_error_frames_total counter
node_fibrechannel_error_frames_total{fc_host="host0"} 0
node_fibrechannel_error_frames_total{fc_host="host1"} 19
# HELP node_fibrechannel_fcp_packet_aborts_total Number of aborted packets
# TYPE node_fibrechannel_fcp_packet_aborts_total counter
node_fibrechannel_fcp_packet_aborts_total{fc_host="host0"} 19
# HELP node_fibrechannel_info Non-numeric data from /sys/class/fc_host/<host>, value is always 1.
# TYPE node_fibrechannel_info gauge
node_fibrechannel_info{dev_loss_tmo="",fabric_name="",fc_host="host1",port_id="",port_name="",port_state="",port_type="",speed="8 Gbit",supported_classes="",supported_speeds="",symbolic_name=""} 1
node_fibrechannel_info{dev_loss_tmo="30",fabric_name="0",fc_host="host0",port_id="000002",port_name="1000e0071bce95f2",port_state="Online",port_type="Point-To-Point (direct nport connection)",speed="16 Gbit",supported_classes="Class 3",supported_speeds="4 Gbit, 8 Gbit, 16 Gbit",symbolic_name="Emulex SN1100E2P FV12.4.270.3 DV12.4.0.0. HN:gotest. OS:Linux"} 1
# HELP node_fibrechannel_invalid_crc_total Invalid Cyclic Redundancy Check count
# TYPE node_fibrechannel_invalid_crc_total counter
node_fibrechannel_invalid_crc_total{fc_host="host0"} 2
node_fibrechannel_invalid_crc_total{fc_host="host1"} 32
# HELP node_fibrechannel_invalid_tx_words_total Number of invalid words transmitted by host port
# TYPE node_fibrechannel_invalid_tx_words_total counter
node_fibrechannel_invalid_tx_words_total{fc_host="host0"} 8
node_fibrechannel_invalid_tx_words_total{fc_host="host1"} 128
# HELP node_fibrechannel_link_failure_total Number of times the host port link has failed
# TYPE node_fibrechannel_link_failure_total counter
node_fibrechannel_link_failure_total{fc_host="host0"} 9
node_fibrechannel_link_failure_total{fc_host="host1"} 144
# HELP node_fibrechannel_loss_of_signal_total Number of times signal has been lost
# TYPE node_fibrechannel_loss_of_signal_total counter
node_fibrechannel_loss_of_signal_total{fc_host="host0"} 17
node_fibrechannel_loss_of_signal_total{fc_host="host1"} 272
# HELP node_fibrechannel_loss_of_sync_total Number of failures on either bit or transmission word boundaries
# TYPE node_fibrechannel_loss_of_sync_total counter
node_fibrechannel_loss_of_sync_total{fc_host="host0"} 16
node_fibrechannel_loss_of_sync_total{fc_host="host1"} 256
# HELP node_fibrechannel_nos_total Number Not_Operational Primitive Sequence received by host port
# TYPE node_fibrechannel_nos_total counter
node_fibrechannel_nos_total{fc_host="host0"} 18
node_fibrechannel_nos_total{fc_host="host1"} 288
# HELP node_fibrechannel_rx_frames_total Number of frames received
# TYPE node_fibrechannel_rx_frames_total counter
node_fibrechannel_rx_frames_total{fc_host="host0"} 3
node_fibrechannel_rx_frames_total{fc_host="host1"} 48
# HELP node_fibrechannel_rx_words_total Number of words received by host port
# TYPE node_fibrechannel_rx_words_total counter
node_fibrechannel_rx_words_total{fc_host="host0"} 4
node_fibrechannel_rx_words_total{fc_host="host1"} 64
# HELP node_fibrechannel_seconds_since_last_reset_total Number of seconds since last host port reset
# TYPE node_fibrechannel_seconds_since_last_reset_total counter
node_fibrechannel_seconds_since_last_reset_total{fc_host="host0"} 7
node_fibrechannel_seconds_since_last_reset_total{fc_host="host1"} 112
# HELP node_fibrechannel_tx_frames_total Number of frames transmitted by host port
# TYPE node_fibrechannel_tx_frames_total counter
node_fibrechannel_tx_frames_total{fc_host="host0"} 5
node_fibrechannel_tx_frames_total{fc_host="host1"} 80
# HELP node_fibrechannel_tx_words_total Number of words transmitted by host port
# TYPE node_fibrechannel_tx_words_total counter
node_fibrechannel_tx_words_total{fc_host="host0"} 6
node_fibrechannel_tx_words_total{fc_host="host1"} 96
# HELP node_filefd_allocated File descriptor statistics: allocated.
# TYPE node_filefd_allocated gauge
node_filefd_allocated 1024
Expand Down
81 changes: 81 additions & 0 deletions collector/fixtures/sys.ttar
Original file line number Diff line number Diff line change
Expand Up @@ -288,6 +288,87 @@ Lines: 1
Emulex SN1100E2P FV12.4.270.3 DV12.4.0.0. HN:gotest. OS:Linux
Mode: 644
# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Directory: sys/class/fc_host/host1
Mode: 755
# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Path: sys/class/fc_host/host1/speed
Lines: 1
8 Gbit
Mode: 644
# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Directory: sys/class/fc_host/host1/statistics
Mode: 755
# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Path: sys/class/fc_host/host1/statistics/dumped_frames
Lines: 1
0x0
Mode: 644
# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Path: sys/class/fc_host/host1/statistics/error_frames
Lines: 1
0x13
Mode: 644
# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Path: sys/class/fc_host/host1/statistics/fcp_packet_aborts
Lines: 1
0xffffffffffffffff
Mode: 644
# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Path: sys/class/fc_host/host1/statistics/invalid_crc_count
Lines: 1
0x20
Mode: 644
# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Path: sys/class/fc_host/host1/statistics/invalid_tx_word_count
Lines: 1
0x80
Mode: 644
# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Path: sys/class/fc_host/host1/statistics/link_failure_count
Lines: 1
0x90
Mode: 644
# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Path: sys/class/fc_host/host1/statistics/loss_of_signal_count
Lines: 1
0x110
Mode: 644
# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Path: sys/class/fc_host/host1/statistics/loss_of_sync_count
Lines: 1
0x100
Mode: 644
# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Path: sys/class/fc_host/host1/statistics/nos_count
Lines: 1
0x120
Mode: 644
# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Path: sys/class/fc_host/host1/statistics/rx_frames
Lines: 1
0x30
Mode: 644
# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Path: sys/class/fc_host/host1/statistics/rx_words
Lines: 1
0x40
Mode: 644
# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Path: sys/class/fc_host/host1/statistics/seconds_since_last_reset
Lines: 1
0x70
Mode: 644
# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Path: sys/class/fc_host/host1/statistics/tx_frames
Lines: 1
0x50
Mode: 644
# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Path: sys/class/fc_host/host1/statistics/tx_words
Lines: 1
0x60
Mode: 644
# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Directory: sys/class/hwmon
Mode: 755
# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Expand Down

0 comments on commit 6024f4e

Please sign in to comment.