---
name: "snmpa_conf"
section: "3erl"
platform: "linux"
package: "erlang-manpages"
version: "1:25.2.3+dfsg-1+deb12u4"
release: "Debian 12 (Bookworm)"
platforms: ["linux"]
url: "https://new.carta.tech/snmpa_conf"
---

# snmpa\_conf(3erl)

Utility functions for handling the agent config files.

## NAME

snmpa\_conf - Utility functions for handling the agent config files.

## DESCRIPTION

The module *snmpa\_conf* contains various utility functions to used for manipulating (write/append/read) the config files of the SNMP agent.

## DATA TYPES

```
transportDomain() = transportDomainUdpIpv4 | transportDomainUdpIpv6
transportAddress() =
    transportAddressIPv4() | transportAddressIPv6()
transportAddressWithPort() =
    transportAddressIPv4WithPort() | transportAddressIPv6WithPort()
transportAddressWithoutPort() =
    transportAddressIPv4WithoutPort() | transportAddressIPv6WithoutPort()
transportAddressIPv4() =
    transportAddressIPv4WithPort() | transportAddressIPv4WithoutPort()
transportAddressIPv4WithPort =
    {transportAddressIPv4WithoutPort(), inet:port_number()} |
    [byte() x 4, byte() x 2]
transportAddressIPv4WithoutPort =
    inet:ip4_address() | [byte() x 4]
transportAddressIPv6() =
    transportAddressIPv6WithPort() | transportAddressIPv6WithoutPort()
transportAddressIPv6WithPort =
    {transportAddressIPv6WithoutPort(), inet:port_number()} |
    [word() x 8, inet:port_number()] |
    [word() x 8, byte() x 2] |
    {byte() x 16, byte() x 2]
transportAddressIPv6WithoutPort =
    inet:ip6_address() | [word() x 8] | [byte() x 16]
transportAddressMask() =
    [] | transportAddressWithPort()
byte() = 0..255
word() = 0..65535
```

For *inet:ip4\_address()*, *inet:ip6\_address()* and *inet:port\_number()*, see also *inet:ip\_address()*

## EXPORTS

**agent\_entry(Tag, Val) -\> agent\_entry()**\

Types:

Tag = intAgentTransports \| intAgentUDPPort \| intAgentMaxPacketSize \| snmpEngineMaxMessageSize \| snmpEngineID\
 Val = term()\
 agent\_entry() = term()\

Create an entry for the agent config file, *agent.conf*.

The type of *Val* depends on the value of *Tag*, see Agent Information for more info.

**write\_agent\_config(Dir, Conf) -\> ok**\
 **write\_agent\_config(Dir, Hdr, Conf) -\> ok**\

Types:

Dir = string()\
 Hdr = string()\
 Conf = \[agent\_entry()\]\

Write the agent config to the agent config file.

*Dir* is the path to the directory where to store the config file.

*Hdr* is an optional file header (note that this text is written to the file as is).

See Agent Information for more info.

**append\_agent\_config(Dir, Conf) -\> ok**\

Types:

Dir = string()\
 Conf = \[agent\_entry()\]\

Append the config to the current agent config file.

*Dir* is the path to the directory where to store the config file.

See Agent Information for more info.

**read\_agent\_config(Dir) -\> Conf**\

Types:

Dir = string()\
 Conf = \[agent\_entry()\]\

Read the current agent config file.

*Dir* is the path to the directory where to store the config file.

See Agent Information for more info.

**standard\_entry(Tag, Val) -\> standard\_entry()**\

Types:

Tag = sysDescr \| sysObjectID \| sysContact \| sysName \| sysLocation \| sysServices \| snmpEnableAuthenTraps\
 Val = term()\
 standard\_entry() = term()\

Create an entry for the agent standard config file, *standard.conf*.

The type of *Val* depends on the value of *Tag*, see System Information for more info.

**write\_standard\_config(Dir, Conf) -\> ok**\
 **write\_standard\_config(Dir, Hdr, Conf) -\> ok**\

Types:

Dir = string()\
 Hdr = string()\
 Conf = \[standard\_entry()\]\

Write the agent standard config to the agent standard config file.

*Dir* is the path to the directory where to store the config file.

*Hdr* is an optional file header (note that this text is written to the file as is).

See System Information for more info.

**append\_standard\_config(Dir, Conf) -\> ok**\

Types:

Dir = string()\
 Conf = \[standard\_entry()\]\

Append the standard config to the current agent standard config file.

*Dir* is the path to the directory where to store the config file.

See System Information for more info.

**read\_standard\_config(Dir) -\> Conf**\

Types:

Dir = string()\
 Conf = \[standard\_entry()\]\

Read the current agent standard config file.

*Dir* is the path to the directory where to store the config file.

See System Information for more info.

**context\_entry(Context) -\> context\_entry()**\

Types:

Context = string()\
 context\_entry() = term()\

Create an entry for the agent context config file, *context.conf*.

See Contexts for more info.

**write\_context\_config(Dir, Conf) -\> ok**\
 **write\_context\_config(Dir, Hdr, Conf) -\> ok**\

Types:

Dir = string()\
 Hdr = string()\
 Conf = \[context\_entry()\]\

Write the agent context config to the agent context config file.

*Dir* is the path to the directory where to store the config file.

*Hdr* is an optional file header (note that this text is written to the file as is).

See Contexts for more info.

**append\_context\_config(Dir, Conf) -\> ok**\

Types:

Dir = string()\
 Conf = \[context\_entry()\]\

Append the context config to the current agent context config file.

*Dir* is the path to the directory where to store the config file.

See Contexts for more info.

**read\_context\_config(Dir) -\> Conf**\

Types:

Dir = string()\
 Conf = \[context\_entry()\]\

Read the current agent context config file.

*Dir* is the path to the directory where to store the config file.

See Contexts for more info.

**community\_entry(CommunityIndex) -\> community\_entry()**\
 **community\_entry(CommunityIndex, CommunityName, SecName, ContextName, TransportTag) -\> community\_entry()**\

Types:

CommunityIndex = string()\
 CommunityName = string()\
 SecName = string()\
 CtxName = string()\
 TransportTag = string()\
 community\_entry() = term()\

Create an entry for the agent community config file, *community.conf*.

*CommunityIndex* must be a *non-empty* string.

*community\_entry("public")* translates to the following call: *community\_entry(CommunityIndex, CommunityIndex, "initial", "", "")*.

*community\_entry("all-rights")* translates to the following call: *community\_entry(CommunityIndex, CommunityIndex, CommunityIndex, "", "")*.

See Community for more info.

**write\_community\_config(Dir, Conf) -\> ok**\
 **write\_community\_config(Dir, Hdr, Conf) -\> ok**\

Types:

Dir = string()\
 Hdr = string()\
 Conf = \[community\_entry()\]\

Write the agent community config to the agent community config file.

*Dir* is the path to the directory where to store the config file.

*Hdr* is an optional file header (note that this text is written to the file as is).

See Community for more info.

**append\_community\_config(Dir, Conf) -\> ok**\

Types:

Dir = string()\
 Conf = \[community\_entry()\]\

Append the community config to the current agent community config file.

*Dir* is the path to the directory where to store the config file.

See Community for more info.

**read\_community\_config(Dir) -\> Conf**\

Types:

Dir = string()\
 Conf = \[community\_entry()\]\

Read the current agent community config file.

*Dir* is the path to the directory where to store the config file.

See Communities for more info.

**target\_addr\_entry(Name, Domain, Addr, TagList, ParamsName, EngineId) -\> target\_addr\_entry()**\
 **target\_addr\_entry(Name, Domain, Addr, TagList, ParamsName, EngineId, TMask) -\> target\_addr\_entry()**\
 **target\_addr\_entry(Name, Domain, Addr, TagList, ParamsName, EngineId, TMask, MaxMessageSize) -\> target\_addr\_entry()**\
 **target\_addr\_entry(Name, Domain, Addr, Timeout, RetryCount, TagList, ParamsName, EngineId, TMask, MaxMessageSize) -\> target\_addr\_entry()**\

Types:

Name = string()\
 Domain = transportDomain()\
 Ip = transportAddress() (depends on Domain)\
 Timeout = integer()\
 RetryCount = integer()\
 TagList = string()\
 ParamsName = string()\
 EngineId = string()\
 TMask = transportAddressMask() (depends on Domain)\
 MaxMessageSize = integer()\
 target\_addr\_entry() = term()\

Create an entry for the agent target\_addr config file, *target\_addr.conf*.

*Name* must be a *non-empty* string.

*target\_addr\_entry/6* translates to the following call: *target\_addr\_entry(Name, Domain, Addr, TagList, ParamsName, EngineId, \[\])*.

*target\_addr\_entry/7* translates to the following call: *target\_addr\_entry(Name, Domain, Addr, TagList, ParamsName, EngineId, TMask, 2048)*.

*target\_addr\_entry/8* translates to the following call: *target\_addr\_entry(Name, Domain, Addr, 1500, 3, TagList, ParamsName, EngineId, TMask, MaxMessageSize)*.

See Target Address Definitions for more info.

**write\_target\_addr\_config(Dir, Conf) -\> ok**\
 **write\_target\_addr\_config(Dir, Hdr, Conf) -\> ok**\

Types:

Dir = string()\
 Hdr = string()\
 Conf = \[target\_addr\_entry()\]\

Write the agent target\_addr config to the agent target\_addr config file.

*Dir* is the path to the directory where to store the config file.

*Hdr* is an optional file header (note that this text is written to the file as is).

See Target Address Definitions for more info.

**append\_target\_addr\_config(Dir, Conf) -\> ok**\

Types:

Dir = string()\
 Conf = \[target\_addr\_entry()\]\

Append the target\_addr config to the current agent target\_addr config file.

*Dir* is the path to the directory where to store the config file.

See Target Address Definitions for more info.

**read\_target\_addr\_config(Dir) -\> Conf**\

Types:

Dir = string()\
 Conf = \[target\_addr\_entry()\]\

Read the current agent target\_addr config file.

*Dir* is the path to the directory where to store the config file.

See Target Address Definitions for more info.

**target\_params\_entry(Name, Vsn) -\> target\_params\_entry()**\
 **target\_params\_entry(Name, Vsn, SecName, SecLevel) -\> target\_params\_entry()**\
 **target\_params\_entry(Name, MPModel, SecModel, SecName, SecLevel) -\> target\_params\_entry()**\

Types:

Name = string()\
 Vsn = v1 \| v2 \| v3\
 MPModel = v1 \| v2c \| v3\
 SecModel = v1 \| v2c \| usm\
 SecName = string()\
 SecLevel = noAuthNoPriv \| authNoPriv \| authPriv\
 target\_params\_entry() = term()\

Create an entry for the agent target\_params config file, *target\_params.conf*.

*Name* must be a *non-empty* string.

*Vsn* translates into *MPModel* and *SecModel* as follows:

```
\011  Vsn = v1 => MPModel = v1,  SecModel = v1
\011  Vsn = v2 => MPModel = v2c, SecModel = v2c
\011  Vsn = v3 => MPModel = v3,  SecModel = usm
```

*target\_params\_entry/2* translates to the following call: *target\_params\_entry(Name, Vsn, "initial", noAuthNoPriv)*.

*target\_params\_entry/4* translates to the following call: *target\_params\_entry(Name, MPModel, SecModel, SecName, SecLevel)* where *MPModel* and *SecModel* is mapped from *Vsn*, see above.

See Target Parameters Definitions for more info.

**write\_target\_params\_config(Dir, Conf) -\> ok**\
 **write\_target\_params\_config(Dir, Hdr, Conf) -\> ok**\

Types:

Dir = string()\
 Hdr = string()\
 Conf = \[target\_params\_entry()\]\

Write the agent target\_params config to the agent target\_params config file.

*Dir* is the path to the directory where to store the config file.

*Hdr* is an optional file header (note that this text is written to the file as is).

See Target Parameters Definitions for more info.

**append\_target\_params\_config(Dir, Conf) -\> ok**\

Types:

Dir = string()\
 Conf = \[target\_params\_entry()\]\

Append the target\_params config to the current agent target\_params config file.

*Dir* is the path to the directory where to store the config file.

See Target Parameters Definitions for more info.

**read\_target\_params\_config(Dir) -\> Conf**\

Types:

Dir = string()\
 Conf = \[target\_params\_entry()\]\

Read the current agent target\_params config file.

*Dir* is the path to the directory where to store the config file.

See Target Parameters Definitions for more info.

**vacm\_s2g\_entry(SecModel, SecName, GroupName) -\> vacm\_s2g\_entry()**\
 **vacm\_acc\_entry(GroupName, Prefix, SecModel, SecLevel, Match, ReadView, WriteView, NotifyView) -\> vacm\_acc\_entry()**\
 **vacm\_vtf\_entry(ViewIndex, ViewSubtree) -\> vacm\_vtf\_entry()**\
 **vacm\_vtf\_entry(ViewIndex, ViewSubtree, ViewStatus, ViewMask) -\> vacm\_vtf\_entry()**\

Types:

SecModel = v1 \| v2c \| usm\
 SecName = string()\
 GroupName = string()\
 Prefix = string()\
 SecLevel = noAuthNoPriv \| authNoPriv \| authPriv\
 Match = prefix \| exact\
 ReadView = string()\
 WriteView = string()\
 NotifyView = string()\
 ViewIndex = integer()\
 ViewSubtree = \[integer()\]\
 ViewStatus = included \| excluded\
 ViewMask = null \| \[zero\_or\_one()\]\
 zero\_or\_one() = 0 \| 1\
 vacm\_s2g\_entry() = term()\
 vacm\_acc\_entry() = term()\
 vacm\_vtf\_entry() = term()\

Create an entry for the agent vacm config file, *vacm.conf*.

*vacm\_vtf\_entry/2* translates to the following call: *vacm\_vtf\_entry(ViewIndex, ViewSubtree, included, null)*.

See MIB Views for VACM for more info.

**write\_vacm\_config(Dir, Conf) -\> ok**\
 **write\_vacm\_config(Dir, Hdr, Conf) -\> ok**\

Types:

Dir = string()\
 Hdr = string()\
 Conf = \[vacm\_entry()\]\
 vacm\_entry() = vacm\_sg2\_entry() \| vacm\_acc\_entry() \| vacm\_vtf\_entry()\

Write the agent vacm config to the agent vacm config file.

*Dir* is the path to the directory where to store the config file.

*Hdr* is an optional file header (note that this text is written to the file as is).

See MIB Views for VACM for more info.

**append\_vacm\_config(Dir, Conf) -\> ok**\

Types:

Dir = string()\
 Conf = \[vacm\_entry()\]\

Append the vacm config to the current agent vacm config file.

*Dir* is the path to the directory where to store the config file.

See MIB Views for VACM for more info.

**read\_vacm\_config(Dir) -\> Conf**\

Types:

Dir = string()\
 Conf = \[vacm\_entry()\]\

Read the current agent vacm config file.

*Dir* is the path to the directory where to store the config file.

See MIB Views for VACM for more info.

**usm\_entry(EngineId) -\> usm\_entry()**\
 **usm\_entry(EngineID, UserName, SecName, Clone, AuthP, AuthKeyC, OwnAuthKeyC, PrivP, PrivKeyC, OwnPrivKeyC, Public, AuthKey, PrivKey) -\> usm\_entry()**\

Types:

EngineId = string()\
 UserName = string()\
 SecName = string()\
 Clone = zeroDotZero \| \[integer()\]\
 AuthP = usmNoAuthProtocol \| usmHMACMD5AuthProtocol \| usmHMACSHAAuthProtocol \| usmHMAC128SHA224AuthProtocol \| usmHMAC192SH256AuthProtocol \| usmHMAC256SHA384AuthProtocol \| usmHMAC384SHA512AuthProtocol\
 AuthKeyC = string()\
 OwnAuthKeyC = string()\
 PrivP = usmNoPrivProtocol \| usmDESPrivProtocol \| usmAesCfb128Protocol\
 PrivKeyC = string()\
 OwnPrivKeyC = string()\
 Public = string()\
 AuthKey = \[integer()\]\
 PrivKey = \[integer()\]\
 usm\_entry() = term()\

Create an entry for the agent vacm config file, *vacm.conf*.

*usm\_entry/1* translates to the following call: *usm\_entry("initial", "initial", zeroDotZero, usmNoAuthProtocol, "", "", usmNoPrivProtocol, "", "", "", "", "")*.

See Security data for USM for more info.

**write\_usm\_config(Dir, Conf) -\> ok**\
 **write\_usm\_config(Dir, Hdr, Conf) -\> ok**\

Types:

Dir = string()\
 Hdr = string()\
 Conf = \[usm\_entry()\]\

Write the agent usm config to the agent usm config file.

*Dir* is the path to the directory where to store the config file.

*Hdr* is an optional file header (note that this text is written to the file as is).

See Security data for USM for more info.

**append\_usm\_config(Dir, Conf) -\> ok**\

Types:

Dir = string()\
 Conf = \[usm\_entry()\]\

Append the usm config to the current agent vacm config file.

*Dir* is the path to the directory where to store the config file.

See Security data for USM for more info.

**read\_usm\_config(Dir) -\> Conf**\

Types:

Dir = string()\
 Conf = \[usm\_entry()\]\

Read the current agent usm config file.

*Dir* is the path to the directory where to store the config file.

See Security data for USM for more info.

**notify\_entry(Name, Tag, Type) -\> notify\_entry()**\

Types:

Name = string()\
 Tag = string()\
 Type = trap \| inform\
 community\_entry() = term()\

Create an entry for the agent notify config file, *notify.conf*.

*Name* must be a *non-empty* string.

See Notify Definitions for more info.

**write\_notify\_config(Dir, Conf) -\> ok**\
 **write\_notify\_config(Dir, Hdr, Conf) -\> ok**\

Types:

Dir = string()\
 Hdr = string()\
 Conf = \[notify\_entry()\]\

Write the agent notify config to the agent notify config file.

*Dir* is the path to the directory where to store the config file.

*Hdr* is an optional file header (note that this text is written to the file as is).

See Notify Definitions for more info.

**append\_notify\_config(Dir, Conf) -\> ok**\

Types:

Dir = string()\
 Conf = \[notify\_entry()\]\

Append the notify config to the current agent notify config file.

*Dir* is the path to the directory where to store the config file.

See Notify Definitions for more info.

**read\_notify\_config(Dir) -\> Conf**\

Types:

Dir = string()\
 Conf = \[community\_entry()\]\

Read the current agent notify config file.

*Dir* is the path to the directory where to store the config file.

See Notify Definitions for more info.
