|
4 | 4 | "bufio" |
5 | 5 | "bytes" |
6 | 6 | "encoding/binary" |
| 7 | + "errors" |
7 | 8 | "fmt" |
8 | 9 | "log" |
9 | 10 | "math" |
@@ -434,7 +435,17 @@ func (t Table) Build(gs snmpConnection, walk bool) (*RTable, error) { |
434 | 435 | // empty string. This results in all the non-table fields sharing the same |
435 | 436 | // index, and being added on the same row. |
436 | 437 | if pkt, err := gs.Get([]string{oid}); err != nil { |
437 | | - return nil, fmt.Errorf("performing get on field %s: %w", f.Name, err) |
| 438 | + if errors.Is(err, gosnmp.ErrUnknownSecurityLevel) { |
| 439 | + return nil, fmt.Errorf("unknown security level (sec_level)") |
| 440 | + } else if errors.Is(err, gosnmp.ErrUnknownUsername) { |
| 441 | + return nil, fmt.Errorf("unknown username (sec_name)") |
| 442 | + } else if errors.Is(err, gosnmp.ErrWrongDigest) { |
| 443 | + return nil, fmt.Errorf("wrong digest (auth_protocol, auth_password)") |
| 444 | + } else if errors.Is(err, gosnmp.ErrDecryption) { |
| 445 | + return nil, fmt.Errorf("decryption error (priv_protocol, priv_password)") |
| 446 | + } else { |
| 447 | + return nil, fmt.Errorf("performing get on field %s: %w", f.Name, err) |
| 448 | + } |
438 | 449 | } else if pkt != nil && len(pkt.Variables) > 0 && pkt.Variables[0].Type != gosnmp.NoSuchObject && pkt.Variables[0].Type != gosnmp.NoSuchInstance { |
439 | 450 | ent := pkt.Variables[0] |
440 | 451 | fv, err := fieldConvert(f.Conversion, ent.Value) |
|
0 commit comments