From bf431fe7cd6b75adedf7b5eee6f720661b39371b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Peter=20=C5=A0tibran=C3=BD?= Date: Mon, 10 Jun 2024 11:58:44 +0200 Subject: [PATCH 1/5] Update procfs to v0.15.1 and fix compilation errors. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Peter Štibraný --- collector/fibrechannel_linux.go | 46 ++++++++++++++++++++------------- go.mod | 2 +- go.sum | 4 +-- 3 files changed, 31 insertions(+), 21 deletions(-) diff --git a/collector/fibrechannel_linux.go b/collector/fibrechannel_linux.go index 13a3b5dc16..6c8f465321 100644 --- a/collector/fibrechannel_linux.go +++ b/collector/fibrechannel_linux.go @@ -87,10 +87,10 @@ func (c *fibrechannelCollector) pushMetric(ch chan<- prometheus.Metric, name str ch <- prometheus.MustNewConstMetric(c.metricDescs[name], valueType, float64(value), host) } -func (c *fibrechannelCollector) pushCounter(ch chan<- prometheus.Metric, name string, value uint64, host string) { +func (c *fibrechannelCollector) pushCounter(ch chan<- prometheus.Metric, name string, value *uint64, host string) { // Don't push counters that aren't implemented (a counter equal to maxUint64 is unimplemented by the HBA firmware) - if value != maxUint64 { - c.pushMetric(ch, name, value, host, prometheus.CounterValue) + if value != nil && *value != maxUint64 { + c.pushMetric(ch, name, *value, host, prometheus.CounterValue) } } @@ -114,24 +114,34 @@ func (c *fibrechannelCollector) Update(ch chan<- prometheus.Metric) error { infoValue := 1.0 // First push the Host values - ch <- prometheus.MustNewConstMetric(infoDesc, prometheus.GaugeValue, infoValue, host.Name, host.Speed, host.PortState, host.PortType, host.PortID, host.PortName, host.FabricName, host.SymbolicName, host.SupportedClasses, host.SupportedSpeeds, host.DevLossTMO) + ch <- prometheus.MustNewConstMetric(infoDesc, prometheus.GaugeValue, infoValue, + nilToEmpty(host.Name), nilToEmpty(host.Speed), nilToEmpty(host.PortState), nilToEmpty(host.PortType), + nilToEmpty(host.PortID), nilToEmpty(host.PortName), nilToEmpty(host.FabricName), nilToEmpty(host.SymbolicName), + nilToEmpty(host.SupportedClasses), nilToEmpty(host.SupportedSpeeds), nilToEmpty(host.DevLossTMO)) // Then the counters - 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) - c.pushCounter(ch, "rx_frames_total", host.Counters.RXFrames, host.Name) - c.pushCounter(ch, "rx_words_total", host.Counters.RXWords, host.Name) - c.pushCounter(ch, "tx_frames_total", host.Counters.TXFrames, host.Name) - c.pushCounter(ch, "tx_words_total", host.Counters.TXWords, host.Name) - c.pushCounter(ch, "seconds_since_last_reset_total", host.Counters.SecondsSinceLastReset, host.Name) - c.pushCounter(ch, "invalid_tx_words_total", host.Counters.InvalidTXWordCount, host.Name) - c.pushCounter(ch, "link_failure_total", host.Counters.LinkFailureCount, host.Name) - c.pushCounter(ch, "loss_of_sync_total", host.Counters.LossOfSyncCount, host.Name) - c.pushCounter(ch, "loss_of_signal_total", host.Counters.LossOfSignalCount, host.Name) - c.pushCounter(ch, "nos_total", host.Counters.NosCount, host.Name) - c.pushCounter(ch, "fcp_packet_aborts_total", host.Counters.FCPPacketAborts, host.Name) + c.pushCounter(ch, "dumped_frames_total", host.Counters.DumpedFrames, nilToEmpty(host.Name)) + c.pushCounter(ch, "error_frames_total", host.Counters.ErrorFrames, nilToEmpty(host.Name)) + c.pushCounter(ch, "invalid_crc_total", host.Counters.InvalidCRCCount, nilToEmpty(host.Name)) + c.pushCounter(ch, "rx_frames_total", host.Counters.RXFrames, nilToEmpty(host.Name)) + c.pushCounter(ch, "rx_words_total", host.Counters.RXWords, nilToEmpty(host.Name)) + c.pushCounter(ch, "tx_frames_total", host.Counters.TXFrames, nilToEmpty(host.Name)) + c.pushCounter(ch, "tx_words_total", host.Counters.TXWords, nilToEmpty(host.Name)) + c.pushCounter(ch, "seconds_since_last_reset_total", host.Counters.SecondsSinceLastReset, nilToEmpty(host.Name)) + c.pushCounter(ch, "invalid_tx_words_total", host.Counters.InvalidTXWordCount, nilToEmpty(host.Name)) + c.pushCounter(ch, "link_failure_total", host.Counters.LinkFailureCount, nilToEmpty(host.Name)) + c.pushCounter(ch, "loss_of_sync_total", host.Counters.LossOfSyncCount, nilToEmpty(host.Name)) + c.pushCounter(ch, "loss_of_signal_total", host.Counters.LossOfSignalCount, nilToEmpty(host.Name)) + c.pushCounter(ch, "nos_total", host.Counters.NosCount, nilToEmpty(host.Name)) + c.pushCounter(ch, "fcp_packet_aborts_total", host.Counters.FCPPacketAborts, nilToEmpty(host.Name)) } return nil } + +func nilToEmpty(s *string) string { + if s == nil { + return "" + } + return *s +} diff --git a/go.mod b/go.mod index 0b9e8a0a38..55ca545e6c 100644 --- a/go.mod +++ b/go.mod @@ -26,7 +26,7 @@ require ( github.com/prometheus/client_model v0.6.1 github.com/prometheus/common v0.53.0 github.com/prometheus/exporter-toolkit v0.11.0 - github.com/prometheus/procfs v0.14.0 + github.com/prometheus/procfs v0.15.1 github.com/safchain/ethtool v0.3.0 golang.org/x/exp v0.0.0-20240416160154-fe59bbe5cc7f golang.org/x/sys v0.20.0 diff --git a/go.sum b/go.sum index 652f6056e3..2c378be7dd 100644 --- a/go.sum +++ b/go.sum @@ -82,8 +82,8 @@ github.com/prometheus/common v0.53.0 h1:U2pL9w9nmJwJDa4qqLQ3ZaePJ6ZTwt7cMD3AG3+a github.com/prometheus/common v0.53.0/go.mod h1:BrxBKv3FWBIGXw89Mg1AeBq7FSyRzXWI3l3e7W3RN5U= github.com/prometheus/exporter-toolkit v0.11.0 h1:yNTsuZ0aNCNFQ3aFTD2uhPOvr4iD7fdBvKPAEGkNf+g= github.com/prometheus/exporter-toolkit v0.11.0/go.mod h1:BVnENhnNecpwoTLiABx7mrPB/OLRIgN74qlQbV+FK1Q= -github.com/prometheus/procfs v0.14.0 h1:Lw4VdGGoKEZilJsayHf0B+9YgLGREba2C6xr+Fdfq6s= -github.com/prometheus/procfs v0.14.0/go.mod h1:XL+Iwz8k8ZabyZfMFHPiilCniixqQarAy5Mu67pHlNQ= +github.com/prometheus/procfs v0.15.1 h1:YagwOFzUgYfKKHX6Dr+sHT7km/hxC76UB0learggepc= +github.com/prometheus/procfs v0.15.1/go.mod h1:fB45yRUv8NstnjriLhBQLuOUt+WW4BsoGhij/e3PBqk= github.com/rogpeppe/go-internal v1.10.0 h1:TMyTOH3F/DB16zRVcYyreMH6GnZZrwQVAoYjRBZyWFQ= github.com/rogpeppe/go-internal v1.10.0/go.mod h1:UQnix2H7Ngw/k4C5ijL5+65zddjncjaFoBhdsK/akog= github.com/safchain/ethtool v0.3.0 h1:gimQJpsI6sc1yIqP/y8GYgiXn/NjgvpM0RNoWLVVmP0= From dd6d587b2c2dc27bd0ed592410c82e60800b9ad0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Peter=20=C5=A0tibran=C3=BD?= Date: Mon, 10 Jun 2024 12:13:09 +0200 Subject: [PATCH 2/5] Report last NFS Transport stats only. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Peter Štibraný --- collector/mountstats_linux.go | 34 ++++++++++++++++++++++------------ 1 file changed, 22 insertions(+), 12 deletions(-) diff --git a/collector/mountstats_linux.go b/collector/mountstats_linux.go index 9dea6fad71..52a3817413 100644 --- a/collector/mountstats_linux.go +++ b/collector/mountstats_linux.go @@ -538,7 +538,7 @@ func (c *mountStatsCollector) Update(ch chan<- prometheus.Metric) error { mountAddress = miStats.SuperOptions["addr"] } - deviceIdentifier := nfsDeviceIdentifier{m.Device, stats.Transport.Protocol, mountAddress} + deviceIdentifier := nfsDeviceIdentifier{m.Device, lastTransportOrEmpty(stats.Transport).Protocol, mountAddress} i := deviceList[deviceIdentifier] if i { level.Debug(c.logger).Log("msg", "Skipping duplicate device entry", "device", deviceIdentifier) @@ -546,12 +546,21 @@ func (c *mountStatsCollector) Update(ch chan<- prometheus.Metric) error { } deviceList[deviceIdentifier] = true - c.updateNFSStats(ch, stats, m.Device, stats.Transport.Protocol, mountAddress) + c.updateNFSStats(ch, stats, m.Device, lastTransportOrEmpty(stats.Transport).Protocol, mountAddress) } return nil } +// lastTransportOrEmpty returns last element from given slice. Before https://github.com/prometheus/procfs/issues/450, +// *procfs.MountStatsNFS only contained last transport, so this preserves previous behaviour. +func lastTransportOrEmpty(transport []procfs.NFSTransportStats) procfs.NFSTransportStats { + if len(transport) > 0 { + return transport[len(transport)-1] + } + return procfs.NFSTransportStats{} +} + func (c *mountStatsCollector) updateNFSStats(ch chan<- prometheus.Metric, s *procfs.MountStatsNFS, export, protocol, mountAddress string) { labelValues := []string{export, protocol, mountAddress} ch <- prometheus.MustNewConstMetric( @@ -617,73 +626,74 @@ func (c *mountStatsCollector) updateNFSStats(ch chan<- prometheus.Metric, s *pro labelValues..., ) + tr := lastTransportOrEmpty(s.Transport) ch <- prometheus.MustNewConstMetric( c.NFSTransportBindTotal, prometheus.CounterValue, - float64(s.Transport.Bind), + float64(tr.Bind), labelValues..., ) ch <- prometheus.MustNewConstMetric( c.NFSTransportConnectTotal, prometheus.CounterValue, - float64(s.Transport.Connect), + float64(tr.Connect), labelValues..., ) ch <- prometheus.MustNewConstMetric( c.NFSTransportIdleTimeSeconds, prometheus.GaugeValue, - float64(s.Transport.IdleTimeSeconds%float64Mantissa), + float64(tr.IdleTimeSeconds%float64Mantissa), labelValues..., ) ch <- prometheus.MustNewConstMetric( c.NFSTransportSendsTotal, prometheus.CounterValue, - float64(s.Transport.Sends), + float64(tr.Sends), labelValues..., ) ch <- prometheus.MustNewConstMetric( c.NFSTransportReceivesTotal, prometheus.CounterValue, - float64(s.Transport.Receives), + float64(tr.Receives), labelValues..., ) ch <- prometheus.MustNewConstMetric( c.NFSTransportBadTransactionIDsTotal, prometheus.CounterValue, - float64(s.Transport.BadTransactionIDs), + float64(tr.BadTransactionIDs), labelValues..., ) ch <- prometheus.MustNewConstMetric( c.NFSTransportBacklogQueueTotal, prometheus.CounterValue, - float64(s.Transport.CumulativeBacklog), + float64(tr.CumulativeBacklog), labelValues..., ) ch <- prometheus.MustNewConstMetric( c.NFSTransportMaximumRPCSlots, prometheus.GaugeValue, - float64(s.Transport.MaximumRPCSlotsUsed), + float64(tr.MaximumRPCSlotsUsed), labelValues..., ) ch <- prometheus.MustNewConstMetric( c.NFSTransportSendingQueueTotal, prometheus.CounterValue, - float64(s.Transport.CumulativeSendingQueue), + float64(tr.CumulativeSendingQueue), labelValues..., ) ch <- prometheus.MustNewConstMetric( c.NFSTransportPendingQueueTotal, prometheus.CounterValue, - float64(s.Transport.CumulativePendingQueue), + float64(tr.CumulativePendingQueue), labelValues..., ) From 5237827256b2a57a5dde6665c6d27c2fc30b098b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Peter=20=C5=A0tibran=C3=BD?= Date: Mon, 10 Jun 2024 12:46:24 +0200 Subject: [PATCH 3/5] Report NFS Transport per port. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Peter Štibraný --- collector/mountstats_linux.go | 147 ++++++++++++++++++---------------- 1 file changed, 76 insertions(+), 71 deletions(-) diff --git a/collector/mountstats_linux.go b/collector/mountstats_linux.go index 52a3817413..bd2d46fcee 100644 --- a/collector/mountstats_linux.go +++ b/collector/mountstats_linux.go @@ -18,6 +18,7 @@ package collector import ( "fmt" + "strconv" "github.com/go-kit/log" "github.com/go-kit/log/level" @@ -129,6 +130,7 @@ func NewMountStatsCollector(logger log.Logger) (Collector, error) { var ( labels = []string{"export", "protocol", "mountaddr"} + trLabels = []string{"export", "protocol", "mountaddr", "port"} opLabels = []string{"export", "protocol", "mountaddr", "operation"} ) @@ -199,70 +201,70 @@ func NewMountStatsCollector(logger log.Logger) (Collector, error) { NFSTransportBindTotal: prometheus.NewDesc( prometheus.BuildFQName(namespace, subsystem, "transport_bind_total"), "Number of times the client has had to establish a connection from scratch to the NFS server.", - labels, + trLabels, nil, ), NFSTransportConnectTotal: prometheus.NewDesc( prometheus.BuildFQName(namespace, subsystem, "transport_connect_total"), "Number of times the client has made a TCP connection to the NFS server.", - labels, + trLabels, nil, ), NFSTransportIdleTimeSeconds: prometheus.NewDesc( prometheus.BuildFQName(namespace, subsystem, "transport_idle_time_seconds"), "Duration since the NFS mount last saw any RPC traffic, in seconds.", - labels, + trLabels, nil, ), NFSTransportSendsTotal: prometheus.NewDesc( prometheus.BuildFQName(namespace, subsystem, "transport_sends_total"), "Number of RPC requests for this mount sent to the NFS server.", - labels, + trLabels, nil, ), NFSTransportReceivesTotal: prometheus.NewDesc( prometheus.BuildFQName(namespace, subsystem, "transport_receives_total"), "Number of RPC responses for this mount received from the NFS server.", - labels, + trLabels, nil, ), NFSTransportBadTransactionIDsTotal: prometheus.NewDesc( prometheus.BuildFQName(namespace, subsystem, "transport_bad_transaction_ids_total"), "Number of times the NFS server sent a response with a transaction ID unknown to this client.", - labels, + trLabels, nil, ), NFSTransportBacklogQueueTotal: prometheus.NewDesc( prometheus.BuildFQName(namespace, subsystem, "transport_backlog_queue_total"), "Total number of items added to the RPC backlog queue.", - labels, + trLabels, nil, ), NFSTransportMaximumRPCSlots: prometheus.NewDesc( prometheus.BuildFQName(namespace, subsystem, "transport_maximum_rpc_slots"), "Maximum number of simultaneously active RPC requests ever used.", - labels, + trLabels, nil, ), NFSTransportSendingQueueTotal: prometheus.NewDesc( prometheus.BuildFQName(namespace, subsystem, "transport_sending_queue_total"), "Total number of items added to the RPC transmission sending queue.", - labels, + trLabels, nil, ), NFSTransportPendingQueueTotal: prometheus.NewDesc( prometheus.BuildFQName(namespace, subsystem, "transport_pending_queue_total"), "Total number of items added to the RPC transmission pending queue.", - labels, + trLabels, nil, ), @@ -626,76 +628,79 @@ func (c *mountStatsCollector) updateNFSStats(ch chan<- prometheus.Metric, s *pro labelValues..., ) - tr := lastTransportOrEmpty(s.Transport) - ch <- prometheus.MustNewConstMetric( - c.NFSTransportBindTotal, - prometheus.CounterValue, - float64(tr.Bind), - labelValues..., - ) + for _, tr := range s.Transport { + trLabelValues := []string{export, protocol, mountAddress, strconv.FormatUint(tr.Port, 10)} - ch <- prometheus.MustNewConstMetric( - c.NFSTransportConnectTotal, - prometheus.CounterValue, - float64(tr.Connect), - labelValues..., - ) + ch <- prometheus.MustNewConstMetric( + c.NFSTransportBindTotal, + prometheus.CounterValue, + float64(tr.Bind), + trLabelValues..., + ) - ch <- prometheus.MustNewConstMetric( - c.NFSTransportIdleTimeSeconds, - prometheus.GaugeValue, - float64(tr.IdleTimeSeconds%float64Mantissa), - labelValues..., - ) + ch <- prometheus.MustNewConstMetric( + c.NFSTransportConnectTotal, + prometheus.CounterValue, + float64(tr.Connect), + trLabelValues..., + ) - ch <- prometheus.MustNewConstMetric( - c.NFSTransportSendsTotal, - prometheus.CounterValue, - float64(tr.Sends), - labelValues..., - ) + ch <- prometheus.MustNewConstMetric( + c.NFSTransportIdleTimeSeconds, + prometheus.GaugeValue, + float64(tr.IdleTimeSeconds%float64Mantissa), + trLabelValues..., + ) - ch <- prometheus.MustNewConstMetric( - c.NFSTransportReceivesTotal, - prometheus.CounterValue, - float64(tr.Receives), - labelValues..., - ) + ch <- prometheus.MustNewConstMetric( + c.NFSTransportSendsTotal, + prometheus.CounterValue, + float64(tr.Sends), + trLabelValues..., + ) - ch <- prometheus.MustNewConstMetric( - c.NFSTransportBadTransactionIDsTotal, - prometheus.CounterValue, - float64(tr.BadTransactionIDs), - labelValues..., - ) + ch <- prometheus.MustNewConstMetric( + c.NFSTransportReceivesTotal, + prometheus.CounterValue, + float64(tr.Receives), + trLabelValues..., + ) - ch <- prometheus.MustNewConstMetric( - c.NFSTransportBacklogQueueTotal, - prometheus.CounterValue, - float64(tr.CumulativeBacklog), - labelValues..., - ) + ch <- prometheus.MustNewConstMetric( + c.NFSTransportBadTransactionIDsTotal, + prometheus.CounterValue, + float64(tr.BadTransactionIDs), + trLabelValues..., + ) - ch <- prometheus.MustNewConstMetric( - c.NFSTransportMaximumRPCSlots, - prometheus.GaugeValue, - float64(tr.MaximumRPCSlotsUsed), - labelValues..., - ) + ch <- prometheus.MustNewConstMetric( + c.NFSTransportBacklogQueueTotal, + prometheus.CounterValue, + float64(tr.CumulativeBacklog), + trLabelValues..., + ) - ch <- prometheus.MustNewConstMetric( - c.NFSTransportSendingQueueTotal, - prometheus.CounterValue, - float64(tr.CumulativeSendingQueue), - labelValues..., - ) + ch <- prometheus.MustNewConstMetric( + c.NFSTransportMaximumRPCSlots, + prometheus.GaugeValue, + float64(tr.MaximumRPCSlotsUsed), + trLabelValues..., + ) - ch <- prometheus.MustNewConstMetric( - c.NFSTransportPendingQueueTotal, - prometheus.CounterValue, - float64(tr.CumulativePendingQueue), - labelValues..., - ) + ch <- prometheus.MustNewConstMetric( + c.NFSTransportSendingQueueTotal, + prometheus.CounterValue, + float64(tr.CumulativeSendingQueue), + trLabelValues..., + ) + + ch <- prometheus.MustNewConstMetric( + c.NFSTransportPendingQueueTotal, + prometheus.CounterValue, + float64(tr.CumulativePendingQueue), + trLabelValues..., + ) + } for _, op := range s.Operations { opLabelValues := []string{export, protocol, mountAddress, op.Operation} From 537bfbf1c5cf12cafdc4b4ab47cc25ab74f5958c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Peter=20=C5=A0tibran=C3=BD?= Date: Mon, 10 Jun 2024 12:50:46 +0200 Subject: [PATCH 4/5] Report per-transport protocol. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Peter Štibraný --- collector/mountstats_linux.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/collector/mountstats_linux.go b/collector/mountstats_linux.go index bd2d46fcee..bbcacb3ecb 100644 --- a/collector/mountstats_linux.go +++ b/collector/mountstats_linux.go @@ -629,7 +629,7 @@ func (c *mountStatsCollector) updateNFSStats(ch chan<- prometheus.Metric, s *pro ) for _, tr := range s.Transport { - trLabelValues := []string{export, protocol, mountAddress, strconv.FormatUint(tr.Port, 10)} + trLabelValues := []string{export, tr.Protocol, mountAddress, strconv.FormatUint(tr.Port, 10)} ch <- prometheus.MustNewConstMetric( c.NFSTransportBindTotal, From 0ce1f84d45f4919c9fe62c3167a92ae8bbc658ca Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Peter=20=C5=A0tibran=C3=BD?= Date: Mon, 10 Jun 2024 13:17:23 +0200 Subject: [PATCH 5/5] Update tests. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Peter Štibraný --- collector/fixtures/e2e-64k-page-output.txt | 50 +++++++++++++--------- collector/fixtures/e2e-output.txt | 50 +++++++++++++--------- collector/fixtures/proc/10/mountstats | 2 + 3 files changed, 62 insertions(+), 40 deletions(-) diff --git a/collector/fixtures/e2e-64k-page-output.txt b/collector/fixtures/e2e-64k-page-output.txt index 99c58abaf7..01abf4dd2e 100644 --- a/collector/fixtures/e2e-64k-page-output.txt +++ b/collector/fixtures/e2e-64k-page-output.txt @@ -2225,44 +2225,54 @@ node_mountstats_nfs_total_write_bytes_total{export="192.168.1.1:/srv/test",mount node_mountstats_nfs_total_write_bytes_total{export="192.168.1.1:/srv/test",mountaddr="192.168.1.1",protocol="udp"} 0 # HELP node_mountstats_nfs_transport_backlog_queue_total Total number of items added to the RPC backlog queue. # TYPE node_mountstats_nfs_transport_backlog_queue_total counter -node_mountstats_nfs_transport_backlog_queue_total{export="192.168.1.1:/srv/test",mountaddr="192.168.1.1",protocol="tcp"} 0 -node_mountstats_nfs_transport_backlog_queue_total{export="192.168.1.1:/srv/test",mountaddr="192.168.1.1",protocol="udp"} 0 +node_mountstats_nfs_transport_backlog_queue_total{export="192.168.1.1:/srv/test",mountaddr="192.168.1.1",port="689",protocol="tcp"} 0 +node_mountstats_nfs_transport_backlog_queue_total{export="192.168.1.1:/srv/test",mountaddr="192.168.1.1",port="832",protocol="tcp"} 0 +node_mountstats_nfs_transport_backlog_queue_total{export="192.168.1.1:/srv/test",mountaddr="192.168.1.1",port="832",protocol="udp"} 0 # HELP node_mountstats_nfs_transport_bad_transaction_ids_total Number of times the NFS server sent a response with a transaction ID unknown to this client. # TYPE node_mountstats_nfs_transport_bad_transaction_ids_total counter -node_mountstats_nfs_transport_bad_transaction_ids_total{export="192.168.1.1:/srv/test",mountaddr="192.168.1.1",protocol="tcp"} 0 -node_mountstats_nfs_transport_bad_transaction_ids_total{export="192.168.1.1:/srv/test",mountaddr="192.168.1.1",protocol="udp"} 0 +node_mountstats_nfs_transport_bad_transaction_ids_total{export="192.168.1.1:/srv/test",mountaddr="192.168.1.1",port="689",protocol="tcp"} 0 +node_mountstats_nfs_transport_bad_transaction_ids_total{export="192.168.1.1:/srv/test",mountaddr="192.168.1.1",port="832",protocol="tcp"} 0 +node_mountstats_nfs_transport_bad_transaction_ids_total{export="192.168.1.1:/srv/test",mountaddr="192.168.1.1",port="832",protocol="udp"} 0 # HELP node_mountstats_nfs_transport_bind_total Number of times the client has had to establish a connection from scratch to the NFS server. # TYPE node_mountstats_nfs_transport_bind_total counter -node_mountstats_nfs_transport_bind_total{export="192.168.1.1:/srv/test",mountaddr="192.168.1.1",protocol="tcp"} 0 -node_mountstats_nfs_transport_bind_total{export="192.168.1.1:/srv/test",mountaddr="192.168.1.1",protocol="udp"} 0 +node_mountstats_nfs_transport_bind_total{export="192.168.1.1:/srv/test",mountaddr="192.168.1.1",port="689",protocol="tcp"} 1 +node_mountstats_nfs_transport_bind_total{export="192.168.1.1:/srv/test",mountaddr="192.168.1.1",port="832",protocol="tcp"} 0 +node_mountstats_nfs_transport_bind_total{export="192.168.1.1:/srv/test",mountaddr="192.168.1.1",port="832",protocol="udp"} 0 # HELP node_mountstats_nfs_transport_connect_total Number of times the client has made a TCP connection to the NFS server. # TYPE node_mountstats_nfs_transport_connect_total counter -node_mountstats_nfs_transport_connect_total{export="192.168.1.1:/srv/test",mountaddr="192.168.1.1",protocol="tcp"} 1 -node_mountstats_nfs_transport_connect_total{export="192.168.1.1:/srv/test",mountaddr="192.168.1.1",protocol="udp"} 0 +node_mountstats_nfs_transport_connect_total{export="192.168.1.1:/srv/test",mountaddr="192.168.1.1",port="689",protocol="tcp"} 2 +node_mountstats_nfs_transport_connect_total{export="192.168.1.1:/srv/test",mountaddr="192.168.1.1",port="832",protocol="tcp"} 1 +node_mountstats_nfs_transport_connect_total{export="192.168.1.1:/srv/test",mountaddr="192.168.1.1",port="832",protocol="udp"} 0 # HELP node_mountstats_nfs_transport_idle_time_seconds Duration since the NFS mount last saw any RPC traffic, in seconds. # TYPE node_mountstats_nfs_transport_idle_time_seconds gauge -node_mountstats_nfs_transport_idle_time_seconds{export="192.168.1.1:/srv/test",mountaddr="192.168.1.1",protocol="tcp"} 11 -node_mountstats_nfs_transport_idle_time_seconds{export="192.168.1.1:/srv/test",mountaddr="192.168.1.1",protocol="udp"} 0 +node_mountstats_nfs_transport_idle_time_seconds{export="192.168.1.1:/srv/test",mountaddr="192.168.1.1",port="689",protocol="tcp"} 0 +node_mountstats_nfs_transport_idle_time_seconds{export="192.168.1.1:/srv/test",mountaddr="192.168.1.1",port="832",protocol="tcp"} 11 +node_mountstats_nfs_transport_idle_time_seconds{export="192.168.1.1:/srv/test",mountaddr="192.168.1.1",port="832",protocol="udp"} 0 # HELP node_mountstats_nfs_transport_maximum_rpc_slots Maximum number of simultaneously active RPC requests ever used. # TYPE node_mountstats_nfs_transport_maximum_rpc_slots gauge -node_mountstats_nfs_transport_maximum_rpc_slots{export="192.168.1.1:/srv/test",mountaddr="192.168.1.1",protocol="tcp"} 24 -node_mountstats_nfs_transport_maximum_rpc_slots{export="192.168.1.1:/srv/test",mountaddr="192.168.1.1",protocol="udp"} 24 +node_mountstats_nfs_transport_maximum_rpc_slots{export="192.168.1.1:/srv/test",mountaddr="192.168.1.1",port="689",protocol="tcp"} 10 +node_mountstats_nfs_transport_maximum_rpc_slots{export="192.168.1.1:/srv/test",mountaddr="192.168.1.1",port="832",protocol="tcp"} 24 +node_mountstats_nfs_transport_maximum_rpc_slots{export="192.168.1.1:/srv/test",mountaddr="192.168.1.1",port="832",protocol="udp"} 24 # HELP node_mountstats_nfs_transport_pending_queue_total Total number of items added to the RPC transmission pending queue. # TYPE node_mountstats_nfs_transport_pending_queue_total counter -node_mountstats_nfs_transport_pending_queue_total{export="192.168.1.1:/srv/test",mountaddr="192.168.1.1",protocol="tcp"} 5726 -node_mountstats_nfs_transport_pending_queue_total{export="192.168.1.1:/srv/test",mountaddr="192.168.1.1",protocol="udp"} 5726 +node_mountstats_nfs_transport_pending_queue_total{export="192.168.1.1:/srv/test",mountaddr="192.168.1.1",port="689",protocol="tcp"} 22129 +node_mountstats_nfs_transport_pending_queue_total{export="192.168.1.1:/srv/test",mountaddr="192.168.1.1",port="832",protocol="tcp"} 5726 +node_mountstats_nfs_transport_pending_queue_total{export="192.168.1.1:/srv/test",mountaddr="192.168.1.1",port="832",protocol="udp"} 5726 # HELP node_mountstats_nfs_transport_receives_total Number of RPC responses for this mount received from the NFS server. # TYPE node_mountstats_nfs_transport_receives_total counter -node_mountstats_nfs_transport_receives_total{export="192.168.1.1:/srv/test",mountaddr="192.168.1.1",protocol="tcp"} 6428 -node_mountstats_nfs_transport_receives_total{export="192.168.1.1:/srv/test",mountaddr="192.168.1.1",protocol="udp"} 6428 +node_mountstats_nfs_transport_receives_total{export="192.168.1.1:/srv/test",mountaddr="192.168.1.1",port="689",protocol="tcp"} 2818 +node_mountstats_nfs_transport_receives_total{export="192.168.1.1:/srv/test",mountaddr="192.168.1.1",port="832",protocol="tcp"} 6428 +node_mountstats_nfs_transport_receives_total{export="192.168.1.1:/srv/test",mountaddr="192.168.1.1",port="832",protocol="udp"} 6428 # HELP node_mountstats_nfs_transport_sending_queue_total Total number of items added to the RPC transmission sending queue. # TYPE node_mountstats_nfs_transport_sending_queue_total counter -node_mountstats_nfs_transport_sending_queue_total{export="192.168.1.1:/srv/test",mountaddr="192.168.1.1",protocol="tcp"} 26 -node_mountstats_nfs_transport_sending_queue_total{export="192.168.1.1:/srv/test",mountaddr="192.168.1.1",protocol="udp"} 26 +node_mountstats_nfs_transport_sending_queue_total{export="192.168.1.1:/srv/test",mountaddr="192.168.1.1",port="689",protocol="tcp"} 0 +node_mountstats_nfs_transport_sending_queue_total{export="192.168.1.1:/srv/test",mountaddr="192.168.1.1",port="832",protocol="tcp"} 26 +node_mountstats_nfs_transport_sending_queue_total{export="192.168.1.1:/srv/test",mountaddr="192.168.1.1",port="832",protocol="udp"} 26 # HELP node_mountstats_nfs_transport_sends_total Number of RPC requests for this mount sent to the NFS server. # TYPE node_mountstats_nfs_transport_sends_total counter -node_mountstats_nfs_transport_sends_total{export="192.168.1.1:/srv/test",mountaddr="192.168.1.1",protocol="tcp"} 6428 -node_mountstats_nfs_transport_sends_total{export="192.168.1.1:/srv/test",mountaddr="192.168.1.1",protocol="udp"} 6428 +node_mountstats_nfs_transport_sends_total{export="192.168.1.1:/srv/test",mountaddr="192.168.1.1",port="689",protocol="tcp"} 2826 +node_mountstats_nfs_transport_sends_total{export="192.168.1.1:/srv/test",mountaddr="192.168.1.1",port="832",protocol="tcp"} 6428 +node_mountstats_nfs_transport_sends_total{export="192.168.1.1:/srv/test",mountaddr="192.168.1.1",port="832",protocol="udp"} 6428 # HELP node_mountstats_nfs_write_bytes_total Number of bytes written using the write() syscall. # TYPE node_mountstats_nfs_write_bytes_total counter node_mountstats_nfs_write_bytes_total{export="192.168.1.1:/srv/test",mountaddr="192.168.1.1",protocol="tcp"} 0 diff --git a/collector/fixtures/e2e-output.txt b/collector/fixtures/e2e-output.txt index d52cb99d04..9e43231b70 100644 --- a/collector/fixtures/e2e-output.txt +++ b/collector/fixtures/e2e-output.txt @@ -2247,44 +2247,54 @@ node_mountstats_nfs_total_write_bytes_total{export="192.168.1.1:/srv/test",mount node_mountstats_nfs_total_write_bytes_total{export="192.168.1.1:/srv/test",mountaddr="192.168.1.1",protocol="udp"} 0 # HELP node_mountstats_nfs_transport_backlog_queue_total Total number of items added to the RPC backlog queue. # TYPE node_mountstats_nfs_transport_backlog_queue_total counter -node_mountstats_nfs_transport_backlog_queue_total{export="192.168.1.1:/srv/test",mountaddr="192.168.1.1",protocol="tcp"} 0 -node_mountstats_nfs_transport_backlog_queue_total{export="192.168.1.1:/srv/test",mountaddr="192.168.1.1",protocol="udp"} 0 +node_mountstats_nfs_transport_backlog_queue_total{export="192.168.1.1:/srv/test",mountaddr="192.168.1.1",port="689",protocol="tcp"} 0 +node_mountstats_nfs_transport_backlog_queue_total{export="192.168.1.1:/srv/test",mountaddr="192.168.1.1",port="832",protocol="tcp"} 0 +node_mountstats_nfs_transport_backlog_queue_total{export="192.168.1.1:/srv/test",mountaddr="192.168.1.1",port="832",protocol="udp"} 0 # HELP node_mountstats_nfs_transport_bad_transaction_ids_total Number of times the NFS server sent a response with a transaction ID unknown to this client. # TYPE node_mountstats_nfs_transport_bad_transaction_ids_total counter -node_mountstats_nfs_transport_bad_transaction_ids_total{export="192.168.1.1:/srv/test",mountaddr="192.168.1.1",protocol="tcp"} 0 -node_mountstats_nfs_transport_bad_transaction_ids_total{export="192.168.1.1:/srv/test",mountaddr="192.168.1.1",protocol="udp"} 0 +node_mountstats_nfs_transport_bad_transaction_ids_total{export="192.168.1.1:/srv/test",mountaddr="192.168.1.1",port="689",protocol="tcp"} 0 +node_mountstats_nfs_transport_bad_transaction_ids_total{export="192.168.1.1:/srv/test",mountaddr="192.168.1.1",port="832",protocol="tcp"} 0 +node_mountstats_nfs_transport_bad_transaction_ids_total{export="192.168.1.1:/srv/test",mountaddr="192.168.1.1",port="832",protocol="udp"} 0 # HELP node_mountstats_nfs_transport_bind_total Number of times the client has had to establish a connection from scratch to the NFS server. # TYPE node_mountstats_nfs_transport_bind_total counter -node_mountstats_nfs_transport_bind_total{export="192.168.1.1:/srv/test",mountaddr="192.168.1.1",protocol="tcp"} 0 -node_mountstats_nfs_transport_bind_total{export="192.168.1.1:/srv/test",mountaddr="192.168.1.1",protocol="udp"} 0 +node_mountstats_nfs_transport_bind_total{export="192.168.1.1:/srv/test",mountaddr="192.168.1.1",port="689",protocol="tcp"} 1 +node_mountstats_nfs_transport_bind_total{export="192.168.1.1:/srv/test",mountaddr="192.168.1.1",port="832",protocol="tcp"} 0 +node_mountstats_nfs_transport_bind_total{export="192.168.1.1:/srv/test",mountaddr="192.168.1.1",port="832",protocol="udp"} 0 # HELP node_mountstats_nfs_transport_connect_total Number of times the client has made a TCP connection to the NFS server. # TYPE node_mountstats_nfs_transport_connect_total counter -node_mountstats_nfs_transport_connect_total{export="192.168.1.1:/srv/test",mountaddr="192.168.1.1",protocol="tcp"} 1 -node_mountstats_nfs_transport_connect_total{export="192.168.1.1:/srv/test",mountaddr="192.168.1.1",protocol="udp"} 0 +node_mountstats_nfs_transport_connect_total{export="192.168.1.1:/srv/test",mountaddr="192.168.1.1",port="689",protocol="tcp"} 2 +node_mountstats_nfs_transport_connect_total{export="192.168.1.1:/srv/test",mountaddr="192.168.1.1",port="832",protocol="tcp"} 1 +node_mountstats_nfs_transport_connect_total{export="192.168.1.1:/srv/test",mountaddr="192.168.1.1",port="832",protocol="udp"} 0 # HELP node_mountstats_nfs_transport_idle_time_seconds Duration since the NFS mount last saw any RPC traffic, in seconds. # TYPE node_mountstats_nfs_transport_idle_time_seconds gauge -node_mountstats_nfs_transport_idle_time_seconds{export="192.168.1.1:/srv/test",mountaddr="192.168.1.1",protocol="tcp"} 11 -node_mountstats_nfs_transport_idle_time_seconds{export="192.168.1.1:/srv/test",mountaddr="192.168.1.1",protocol="udp"} 0 +node_mountstats_nfs_transport_idle_time_seconds{export="192.168.1.1:/srv/test",mountaddr="192.168.1.1",port="689",protocol="tcp"} 0 +node_mountstats_nfs_transport_idle_time_seconds{export="192.168.1.1:/srv/test",mountaddr="192.168.1.1",port="832",protocol="tcp"} 11 +node_mountstats_nfs_transport_idle_time_seconds{export="192.168.1.1:/srv/test",mountaddr="192.168.1.1",port="832",protocol="udp"} 0 # HELP node_mountstats_nfs_transport_maximum_rpc_slots Maximum number of simultaneously active RPC requests ever used. # TYPE node_mountstats_nfs_transport_maximum_rpc_slots gauge -node_mountstats_nfs_transport_maximum_rpc_slots{export="192.168.1.1:/srv/test",mountaddr="192.168.1.1",protocol="tcp"} 24 -node_mountstats_nfs_transport_maximum_rpc_slots{export="192.168.1.1:/srv/test",mountaddr="192.168.1.1",protocol="udp"} 24 +node_mountstats_nfs_transport_maximum_rpc_slots{export="192.168.1.1:/srv/test",mountaddr="192.168.1.1",port="689",protocol="tcp"} 10 +node_mountstats_nfs_transport_maximum_rpc_slots{export="192.168.1.1:/srv/test",mountaddr="192.168.1.1",port="832",protocol="tcp"} 24 +node_mountstats_nfs_transport_maximum_rpc_slots{export="192.168.1.1:/srv/test",mountaddr="192.168.1.1",port="832",protocol="udp"} 24 # HELP node_mountstats_nfs_transport_pending_queue_total Total number of items added to the RPC transmission pending queue. # TYPE node_mountstats_nfs_transport_pending_queue_total counter -node_mountstats_nfs_transport_pending_queue_total{export="192.168.1.1:/srv/test",mountaddr="192.168.1.1",protocol="tcp"} 5726 -node_mountstats_nfs_transport_pending_queue_total{export="192.168.1.1:/srv/test",mountaddr="192.168.1.1",protocol="udp"} 5726 +node_mountstats_nfs_transport_pending_queue_total{export="192.168.1.1:/srv/test",mountaddr="192.168.1.1",port="689",protocol="tcp"} 22129 +node_mountstats_nfs_transport_pending_queue_total{export="192.168.1.1:/srv/test",mountaddr="192.168.1.1",port="832",protocol="tcp"} 5726 +node_mountstats_nfs_transport_pending_queue_total{export="192.168.1.1:/srv/test",mountaddr="192.168.1.1",port="832",protocol="udp"} 5726 # HELP node_mountstats_nfs_transport_receives_total Number of RPC responses for this mount received from the NFS server. # TYPE node_mountstats_nfs_transport_receives_total counter -node_mountstats_nfs_transport_receives_total{export="192.168.1.1:/srv/test",mountaddr="192.168.1.1",protocol="tcp"} 6428 -node_mountstats_nfs_transport_receives_total{export="192.168.1.1:/srv/test",mountaddr="192.168.1.1",protocol="udp"} 6428 +node_mountstats_nfs_transport_receives_total{export="192.168.1.1:/srv/test",mountaddr="192.168.1.1",port="689",protocol="tcp"} 2818 +node_mountstats_nfs_transport_receives_total{export="192.168.1.1:/srv/test",mountaddr="192.168.1.1",port="832",protocol="tcp"} 6428 +node_mountstats_nfs_transport_receives_total{export="192.168.1.1:/srv/test",mountaddr="192.168.1.1",port="832",protocol="udp"} 6428 # HELP node_mountstats_nfs_transport_sending_queue_total Total number of items added to the RPC transmission sending queue. # TYPE node_mountstats_nfs_transport_sending_queue_total counter -node_mountstats_nfs_transport_sending_queue_total{export="192.168.1.1:/srv/test",mountaddr="192.168.1.1",protocol="tcp"} 26 -node_mountstats_nfs_transport_sending_queue_total{export="192.168.1.1:/srv/test",mountaddr="192.168.1.1",protocol="udp"} 26 +node_mountstats_nfs_transport_sending_queue_total{export="192.168.1.1:/srv/test",mountaddr="192.168.1.1",port="689",protocol="tcp"} 0 +node_mountstats_nfs_transport_sending_queue_total{export="192.168.1.1:/srv/test",mountaddr="192.168.1.1",port="832",protocol="tcp"} 26 +node_mountstats_nfs_transport_sending_queue_total{export="192.168.1.1:/srv/test",mountaddr="192.168.1.1",port="832",protocol="udp"} 26 # HELP node_mountstats_nfs_transport_sends_total Number of RPC requests for this mount sent to the NFS server. # TYPE node_mountstats_nfs_transport_sends_total counter -node_mountstats_nfs_transport_sends_total{export="192.168.1.1:/srv/test",mountaddr="192.168.1.1",protocol="tcp"} 6428 -node_mountstats_nfs_transport_sends_total{export="192.168.1.1:/srv/test",mountaddr="192.168.1.1",protocol="udp"} 6428 +node_mountstats_nfs_transport_sends_total{export="192.168.1.1:/srv/test",mountaddr="192.168.1.1",port="689",protocol="tcp"} 2826 +node_mountstats_nfs_transport_sends_total{export="192.168.1.1:/srv/test",mountaddr="192.168.1.1",port="832",protocol="tcp"} 6428 +node_mountstats_nfs_transport_sends_total{export="192.168.1.1:/srv/test",mountaddr="192.168.1.1",port="832",protocol="udp"} 6428 # HELP node_mountstats_nfs_write_bytes_total Number of bytes written using the write() syscall. # TYPE node_mountstats_nfs_write_bytes_total counter node_mountstats_nfs_write_bytes_total{export="192.168.1.1:/srv/test",mountaddr="192.168.1.1",protocol="tcp"} 0 diff --git a/collector/fixtures/proc/10/mountstats b/collector/fixtures/proc/10/mountstats index f90f237c1c..5b872c1b59 100644 --- a/collector/fixtures/proc/10/mountstats +++ b/collector/fixtures/proc/10/mountstats @@ -12,6 +12,7 @@ device 192.168.1.1:/srv/test mounted on /mnt/nfs/test with fstype nfs4 statvers= bytes: 1207640230 0 0 0 1210214218 0 295483 0 RPC iostats version: 1.0 p/v: 100003/4 (nfs) xprt: tcp 832 0 1 0 11 6428 6428 0 12154 0 24 26 5726 + xprt: tcp 689 1 2 0 0 2826 2818 0 24955 0 10 0 22129 per-op statistics NULL: 0 0 0 0 0 0 0 0 READ: 1298 1298 0 207680 1210292152 6 79386 79407 @@ -27,6 +28,7 @@ device 192.168.1.1:/srv/test mounted on /mnt/nfs/test-dupe with fstype nfs4 stat bytes: 1207640230 0 0 0 1210214218 0 295483 0 RPC iostats version: 1.0 p/v: 100003/4 (nfs) xprt: tcp 832 0 1 0 11 6428 6428 0 12154 0 24 26 5726 + xprt: tcp 689 1 2 0 0 2826 2818 0 24955 0 10 0 22129 per-op statistics NULL: 0 0 0 0 0 0 0 0 READ: 1298 1298 0 207680 1210292152 6 79386 79407