Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 18 additions & 1 deletion collector/fibrechannel_linux.go
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,24 @@ func (c *fibrechannelCollector) Update(ch chan<- prometheus.Metric) error {
)...)

// Then the counters
// Note: `procfs` guarantees these a safe dereference for these counters.
// Note: `procfs` does not guarantee a safe dereference for these counters.
// A disabled host returns no statistics counters.
if host.PortState == nil || *host.PortState == "Unknown" {
host.Counters.DumpedFrames = new(uint64)
host.Counters.ErrorFrames = new(uint64)
host.Counters.InvalidCRCCount = new(uint64)
host.Counters.RXFrames = new(uint64)
host.Counters.RXWords = new(uint64)
host.Counters.TXFrames = new(uint64)
host.Counters.TXWords = new(uint64)
host.Counters.SecondsSinceLastReset = new(uint64)
host.Counters.InvalidTXWordCount = new(uint64)
host.Counters.LinkFailureCount = new(uint64)
host.Counters.LossOfSyncCount = new(uint64)
host.Counters.LossOfSignalCount = new(uint64)
host.Counters.NosCount = new(uint64)
host.Counters.FCPPacketAborts = new(uint64)
}
c.pushCounter(ch, "dumped_frames_total", *host.Counters.DumpedFrames, *host.Name)
c.pushCounter(ch, "error_frames_total", *host.Counters.ErrorFrames, *host.Name)
c.pushCounter(ch, "invalid_crc_total", *host.Counters.InvalidCRCCount, *host.Name)
Expand Down
2 changes: 1 addition & 1 deletion collector/fixtures/e2e-output.txt
Original file line number Diff line number Diff line change
Expand Up @@ -1397,7 +1397,7 @@ node_fibrechannel_error_frames_total{fc_host="host1"} 19
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="",fabric_name="",fc_host="host1",port_id="",port_name="",port_state="Online",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
Expand Down
5 changes: 5 additions & 0 deletions collector/fixtures/sys.ttar
Original file line number Diff line number Diff line change
Expand Up @@ -1130,6 +1130,11 @@ Mode: 644
Directory: sys/class/fc_host/host1
Mode: 755
# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Path: sys/class/fc_host/host1/port_state
Lines: 1
Online
Mode: 644
# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Path: sys/class/fc_host/host1/speed
Lines: 1
8 Gbit
Expand Down