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 1874a14 + dac0d11 commit c4a4f43
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 c4a4f43

Please sign in to comment.