# snmp() destination options

This driver sends SNMP traps using the SNMP v2c or v3 protocol.

The `snmp()` destination has the following options:

## auth-algorithm()

|   
---|---  
Type: | SHA  
Default: | SHA  
  
_Description:_ The authentication method to use. Lowercase values (for example, `sha`) can be used as well.

This option is used with the SNMPv3 protocol.

## auth-password()

|   
---|---  
Type: | string  
Default: | empty string  
  
_Description:_ The password used for authentication. If the `auth-username()` option is set but the `auth-password()` is empty, AxoSyslog will try to authenticate with an empty password.

This option is used with the SNMPv3 protocol.

## auth-username()

|   
---|---  
Type: | string  
Default: | empty string  
  
_Description:_ The username used to authenticate on the SNMP server. If this parameter is set, AxoSyslog will try to authenticate on the SNMP server.

This option is used with the SNMPv3 protocol.

## community()

|   
---|---  
Type: | string  
Default: | public  
  
_Description:_ The community string used for SNMPv2c authentication.

This option is used with the SNMPv2c protocol.

## enc-algorithm()

|   
---|---  
Type: | AES  
Default: | AES  
  
_Description:_ The encryption method used to encrypt the SNMP traffic. Lowercase values (for example, `aes`) can be used as well.

This option is used with the SNMPv3 protocol.

## enc-password()

|   
---|---  
Type: | string  
Default: |   
  
_Description:_ The password used for the encryption. Encryption is used only if the `enc-password()` is not empty.

This option is used with the SNMPv3 protocol.

## engine-id()

|   
---|---  
Type: | number (hexadecimal number)  
Default: |   
  
_Description:_ The engine ID is a hexadecimal number at least 10 digits long, starting with `0x`. for example, `0xABABABABAB`.

This option is a required parameter when using the SNMPv3 protocol.

## host()

|   
---|---  
Type: | hostname or IP address  
Default: | n/a  
  
_Description:_ Hostname of the SNMP server.

## log-fifo-size()

|   
---|---  
Type: | number  
Default: | Use global setting.  
  
_Description:_ The number of messages that the output queue can store.

## port()

|   
---|---  
Type: | number (port number)  
Default: | 162  
  
_Description:_ The port number to connect to.

## snmp-obj()

|   
---|---  
Type: | <oid_of_the_object> <type_of_the_object»<value_of_the_object> >  
Default: | n/a  
  
_Description:_ The `snmp-obj()` option can be used to create custom SNMP trap elements. To create a trap element, specify the OID, type, and value of the element in the `snmp-obj()` option. To send SNMP traps, at least one `snmp-obj()` option must be defined. The `snmp-obj()` option requires the following parameters. Note that AxoSyslog does not validate the values of these elements.

  * `<oid_of_the_object>: The object id of the SNMP object, for example, `.1.3.6.1.4.1.18372.3.1.1.1.1.1`.

  * `<type_of_the_object>: The type of the object specified as an ASN.1 primitive. One of: `Integer, Timeticks, Octetstring, Counter32, Ipaddress, Objectid`. The type names are not case sensitive.

  * `<value_of_the_object>: The value of the object as a string. The macros of AxoSyslog can be used to set these values, making it possible to transfer the content and other metadata from the the syslog message to the SNMP trap. Note that if the value of an `Integer, Counter32`or`Timeticks` object is not a number (for example, is an empty string or other not-number string), AxoSyslog will automatically replace the value with 0. The values of other types of objects are not validated.




## Example: Defining SNMP objects

The following are SNMP object definitions:
```
 
       snmp-obj('.1.3.6.1.4.1.18372.3.1.1.1.1.3', 'Ipaddress', '192.168.1.1')
    
```
```
       snmp-obj('.1.3.6.1.4.1.18372.3.1.1.1.1.2', 'Octetstring', '${MESSAGE}')
    
```

## time-zone()

|   
---|---  
Type: | name of the timezone, or the timezone offset  
Default: | unspecified  
  
_Description:_ Convert timestamps to the timezone specified by this option. If this option is not set, then the original timezone information in the message is used. Converting the timezone changes the values of all date-related macros derived from the timestamp, for example, `HOUR`. For the complete list of such macros, see [Date-related macros](../../../docs/axosyslog-core/chapter-manipulating-messages/customizing-message-format/date-macros/index.md).

The timezone can be specified by using the name, for example, `time-zone("Europe/Budapest")`), or as the timezone offset in +/-HH:MM format, for example, `+01:00`). On Linux and UNIX platforms, the valid timezone names are listed under the `/usr/share/zoneinfo` directory.

## trap-obj()

|   
---|---  
Type: | <oid_of_the_object> “Objectid”, <value_of_the_object»  
Default: | n/a  
  
_Description:_ The `trap-obj()` is a specialized version of the `snmp-obj()` option that is used to identify the SNMP trap object. The type of the trap object is always `Objectid`. The `<oid_of_the_object> and the `<value_of_the_object»parameters are identical to the respective parameters of the `snmp-obj()` option. For details on these parameters, see [snmp-obj()](../../../docs/axosyslog-core/chapter-destinations/destination-snmp/reference-destination-snmp/index.md#snmp-destination-option-snmp-obj).

Note Using the `trap-obj()` object is equivalent to using the `snmp-obj()` with the `Objectid` type. 

## version()

|   
---|---  
Type: | v2c  
Default: | v2c  
  
_Description:_ Specifies which version of the SNMP protocol to use.

Note The AxoSyslog application will accept any valid option for the `snmp()` destination, but will only use the ones relevant to the selected protocol version, any other option will be ignored. For example, if the `version("v2c") engine-id("0xABABABABAB") community("mycommunity")` options are set, AxoSyslog will accept every option, but process only the `community()` option, because `engine-id()` applies only to SNMPv3. 

Last modified July 2, 2023: [Change highlight mode of code examples (2f8a9593)](<https://github.com/axoflow/axosyslog-core-docs/commit/2f8a95937c6498193e7168ce8b0dc831e9f0f8ad>)