0
votes

I tried to config bosun scollector, I get snmpwalk works with integer format output, but when I try to get some output with cpu usage, it is string format when do the output.

example: .1.3.6.1.4.1.2620.1.48.23.1.4.1.0 = INTEGER: 23 --- working

.1.3.6.1.4.1.2620.1.48.29.1.2.2.0 = STRING: "1%" --- not working

this is config:

Host = "http://localhost:8070"
DisableSelf = true
Freq = 60
Filter = ["snmp-generic", "snmp-ifaces"]

[[SNMP]]
  Community = "test"
  Host = "name"
  MIBs = [ "fwname"]

[Tags]
  product = "fw"

[MIBs]

  [MIBs.fw]
    BaseOid = ".1.3.6.1.4.1.2620"

    [[MIBs.fw.Metrics]]
      Metric = "os.cpu"
      Oid = ".1.6.7.2.4.0"
      Unit = "percent"
      RateType = "gauge"
    [[MIBs.fw.Metrics]]
      Metric = "os.cpu.used"
      Oid = ".1.6.7.4.5.0"
      Unit = "percent"
      RateType = "gauge"

this is error message:

2016/12/01 21:37:08 error: interval.go:64: snmp-generic-fw strconv.ParseFloat: parsing "0%": invalid syntax

I know this is string format issue, but any idea how I can fix it support string

thank you all the helps

1
the string format output cannot work, but integer work without any issuejack

1 Answers

0
votes

Metrics have to be integer or float values. The error is likely from trying to convert a string like "60%" to a float, which is an invalid cast/conversion. Using the OID for the integer version works because that can be converted successfully.

You will have to find another OID that uses raw integers, or write a custom collector that converts the "60%" string to an integer.