github.com/influxdata/telegraf@v1.30.3/internal/snmp/config.go (about)

     1  package snmp
     2  
     3  import (
     4  	"time"
     5  
     6  	"github.com/influxdata/telegraf/config"
     7  )
     8  
     9  type ClientConfig struct {
    10  	// Timeout to wait for a response.
    11  	Timeout config.Duration `toml:"timeout"`
    12  	Retries int             `toml:"retries"`
    13  	// Values: 1, 2, 3
    14  	Version              uint8 `toml:"version"`
    15  	UnconnectedUDPSocket bool  `toml:"unconnected_udp_socket"`
    16  	// Path to mib files
    17  	Path []string `toml:"path"`
    18  	// Translator implementation
    19  	Translator string `toml:"-"`
    20  
    21  	// Parameters for Version 1 & 2
    22  	Community string `toml:"community"`
    23  
    24  	// Parameters for Version 2 & 3
    25  	MaxRepetitions uint32 `toml:"max_repetitions"`
    26  
    27  	// Parameters for Version 3
    28  	ContextName string `toml:"context_name"`
    29  	// Values: "noAuthNoPriv", "authNoPriv", "authPriv"
    30  	SecLevel string `toml:"sec_level"`
    31  	SecName  string `toml:"sec_name"`
    32  	// Values: "MD5", "SHA", "". Default: ""
    33  	AuthProtocol string `toml:"auth_protocol"`
    34  	AuthPassword string `toml:"auth_password"`
    35  	// Values: "DES", "AES", "". Default: ""
    36  	PrivProtocol string `toml:"priv_protocol"`
    37  	PrivPassword string `toml:"priv_password"`
    38  	EngineID     string `toml:"-"`
    39  	EngineBoots  uint32 `toml:"-"`
    40  	EngineTime   uint32 `toml:"-"`
    41  }
    42  
    43  func DefaultClientConfig() *ClientConfig {
    44  	return &ClientConfig{
    45  		Timeout:        config.Duration(5 * time.Second),
    46  		Retries:        3,
    47  		Version:        2,
    48  		Path:           []string{"/usr/share/snmp/mibs"},
    49  		Translator:     "gosmi",
    50  		Community:      "public",
    51  		MaxRepetitions: 10,
    52  		SecLevel:       "authNoPriv",
    53  		SecName:        "myuser",
    54  		AuthProtocol:   "MD5",
    55  		AuthPassword:   "pass",
    56  	}
    57  }