Skip to content

Commit

Permalink
fixed collectServerShares func
Browse files Browse the repository at this point in the history
Signed-off-by: Andrey Burtasov <[email protected]>
  • Loading branch information
Andrey Burtasov authored and Andrey Burtasov committed Nov 16, 2023
1 parent 9922f12 commit 268a47f
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions pkg/collector/smb/smb.go
Original file line number Diff line number Diff line change
Expand Up @@ -102,8 +102,8 @@ func (c *collector) Build() error {
)
}

c.CurrentOpenFileCount = desc("smb_server_shares_current_open_file_count", "Current count open files")
c.TreeConnectCount = desc("smb_server_session_tree_connect_count", "Current tree connect count")
c.CurrentOpenFileCount = desc("server_shares_current_open_file_count", "Current total count open files")
c.TreeConnectCount = desc("server_session_tree_connect_count", "Current tree connect count")

c.enabledCollectors = make([]string, 0, len(smbAllCollectorNames))

Expand Down Expand Up @@ -167,14 +167,14 @@ func (c *collector) collectServerShares(ctx *types.ScrapeContext, ch chan<- prom
}
for _, instance := range data {
labelName := c.toLabelName(instance.Name)
if strings.HasSuffix(labelName, "_total") {
if !strings.HasSuffix(labelName, "_total") {
continue
}

ch <- prometheus.MustNewConstMetric(
c.CurrentOpenFileCount,
prometheus.CounterValue,
instance.CurrentOpenFileCount,
labelName,
)

}
Expand All @@ -193,6 +193,7 @@ func (c *collector) collectServerSessions(ctx *types.ScrapeContext, ch chan<- pr
}

for _, instance := range data {

ch <- prometheus.MustNewConstMetric(
c.TreeConnectCount,
prometheus.CounterValue,
Expand Down

0 comments on commit 268a47f

Please sign in to comment.