From 61ec69253485534bade53f539e041ac18cf57d1c Mon Sep 17 00:00:00 2001 From: Andrey Burtasov Date: Fri, 24 Nov 2023 17:57:31 +0300 Subject: [PATCH] fix collectServerSession func Signed-off-by: Andrey Burtasov --- pkg/collector/smb/smb.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/pkg/collector/smb/smb.go b/pkg/collector/smb/smb.go index a902adfc..92fc1974 100644 --- a/pkg/collector/smb/smb.go +++ b/pkg/collector/smb/smb.go @@ -183,6 +183,7 @@ func (c *collector) collectServerShares(ctx *types.ScrapeContext, ch chan<- prom // Perflib: SMB Server Sessions type perflibServerSession struct { + Name string TreeConnectCount float64 `perflib:"Tree Connect Count"` } @@ -193,6 +194,10 @@ func (c *collector) collectServerSessions(ctx *types.ScrapeContext, ch chan<- pr } for _, instance := range data { + labelName := c.toLabelName(instance.Name) + if !strings.HasSuffix(labelName, "_total") { + continue + } ch <- prometheus.MustNewConstMetric( c.TreeConnectCount,