Skip to content

Commit

Permalink
Merge branch 'czerwonk:main' into anx-prod
Browse files Browse the repository at this point in the history
  • Loading branch information
Gaste8 authored Feb 15, 2024
2 parents 6a12898 + dac0d11 commit 88f2fe9
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion pkg/features/system/collector.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,9 @@
package system

import (
"encoding/xml"
"fmt"
log "github.com/sirupsen/logrus"
"regexp"
"strconv"
"strings"
Expand Down Expand Up @@ -187,7 +189,16 @@ func (c *systemCollector) CollectSystem(client collector.Client, ch chan<- prome

func (c *systemCollector) collectBuffers(client collector.Client, ch chan<- prometheus.Metric, labelValues []string) error {
r := &buffers{}
err := client.RunCommandAndParse("show system buffers", r)

err := client.RunCommandAndParseWithParser("show system buffers", func(b []byte) error {
if string(b[:]) == "\nerror: syntax error, expecting <command>: buffers\n" {
log.Debugf("system doesn't support system buffers command")
return nil
}

return xml.Unmarshal(b, &r)
})

if err != nil {
return err
}
Expand Down

0 comments on commit 88f2fe9

Please sign in to comment.