Search documentation of snmp

# View Source snmpm_conf (snmp v5.16)

Utility functions for handling the manager config files.

The module `snmpm_conf` contains various utility functions to used for manipulating (write/append/read) the config files of the SNMP manager.

# Summary

## Types

agent_entry()

An opaque data structure containg all configuration for one agent for the manager.

manager_entry()

An opaque data structure that represents one configuration entry for the manager.

user_entry()

An opaque data structure containg all configuration for one user for the manager.

usm_entry()

An opaque data structure containg information about security data for usm for the manager.

## Functions

agents_entry/12

Create an entry for the manager agents config file, `agents.conf`.

append_agents_config(Dir, Conf)

Append the agents config to the current manager agents config file.

append_manager_config(Dir, Conf)

Append the config to the current manager config file.

append_users_config(Dir, Conf)

Append the users config to the current manager users config file.

append_usm_config(Dir, Conf)

Append the usm config to the current manager usm config file.

manager_entry(Tag, Val)

Create an entry for the manager config file, `manager.conf`.

read_agents_config(Dir)

Read the current manager agents config file.

read_manager_config(Dir)

Read the current manager config file.

read_users_config(Dir)

Read the current manager users config file.

read_usm_config(Dir)

Read the current manager usm config file.

users_entry(UserId)

Equivalent to `users_entry(UserId, snmpm_user_default)`.

users_entry(UserId, UserMod)

Equivalent to `users_entry(UserId, UserMod, undefined)`.

users_entry(UserId, UserMod, UserData)

Equivalent to `users_entry(UserId, UserMod, UserData, [])`.

users_entry(UserId, UserMod, UserData, DefaultAgentConfig)

Create an entry for the manager users config file, `users.conf`.

usm_entry(EngineID, UserName, AuthP, AuthKey, PrivP, PrivKey)

Equivalent to `usm_entry/7`.

usm_entry(EngineID, UserName, SecName, AuthP, AuthKey, PrivP, PrivKey)

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

write_agents_config(Dir, Conf)

Equivalent to `write_agents_config/3`.

write_agents_config(Dir, Hdr, Conf)

Write the manager agents config to the manager agents config file.

write_manager_config(Dir, Conf)

Equivalent to `write_manager_config/3`.

write_manager_config(Dir, Hdr, Conf)

Write the manager config to the manager config file.

write_users_config(Dir, Conf)

Equivalent to `write_users_config/3`.

write_users_config(Dir, Hdr, Conf)

Write the manager users config to the manager users config file.

write_usm_config(Dir, Conf)

Equivalent to `write_usm_config/3`.

write_usm_config(Dir, Hdr, Conf)

Write the manager usm config to the manager usm config file.

# Types

Link to this opaque

# agent_entry()

View Source

    -opaque agent_entry()

An opaque data structure containg all configuration for one agent for the manager.

Link to this opaque

# manager_entry()

View Source

    -opaque manager_entry()

An opaque data structure that represents one configuration entry for the manager.

Link to this opaque

# user_entry()

View Source

    -opaque user_entry()

An opaque data structure containg all configuration for one user for the manager.

Link to this opaque

# usm_entry()

View Source

    -opaque usm_entry()

An opaque data structure containg information about security data for usm for the manager.

# Functions

Link to this function

# agents_entry/12

View Source

    -spec agents_entry(UserId, TargetName, Comm, TDomain, TAddr, EngineID, Timeout, MaxMessageSize, Version,
                       SecModel, SecName, SecLevel) ->
                          Entry
                          when
                              UserId :: snmpm:user_id(),
                              TargetName :: snmpm:target_name(),
                              Comm :: snmp:community(),
                              TDomain :: snmp:tdomain(),
                              TAddr :: snmp:taddress(),
                              EngineID :: snmp:engine_id(),
                              Timeout :: snmpm:register_timeout(),
                              MaxMessageSize :: snmp:mms(),
                              Version :: snmp:version(),
                              SecModel :: snmp:sec_model(),
                              SecName :: snmp:sec_name(),
                              SecLevel :: snmp:sec_level(),
                              Entry :: agent_entry();
                      (UserId, TargetName, Comm, Ip, Port, EngineID, Timeout, MaxMessageSize, Version,
                       SecModel, SecName, SecLevel) ->
                          Entry
                          when
                              UserId :: snmpm:user_id(),
                              TargetName :: snmpm:target_name(),
                              Comm :: snmp:community(),
                              Ip :: inet:ip_address(),
                              Port :: inet:port_number(),
                              EngineID :: snmp:engine_id(),
                              Timeout :: snmpm:register_timeout(),
                              MaxMessageSize :: snmp:mms(),
                              Version :: snmp:version(),
                              SecModel :: snmp:sec_model(),
                              SecName :: snmp:sec_name(),
                              SecLevel :: snmp:sec_level(),
                              Entry :: agent_entry().

Create an entry for the manager agents config file, `agents.conf`.

See Agents for more info.

Link to this function

# append_agents_config(Dir, Conf)

View Source

    -spec append_agents_config(Dir, Conf) -> ok when Dir :: snmp:dir(), Conf :: [agent_entry()].

Append the agents config to the current manager agents config file.

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

See Agents for more info.

Link to this function

# append_manager_config(Dir, Conf)

View Source

    -spec append_manager_config(Dir, Conf) -> ok when Dir :: snmp:dir(), Conf :: [manager_entry()].

Append the config to the current manager config file.

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

See Manager Information for more info.

Link to this function

# append_users_config(Dir, Conf)

View Source

    -spec append_users_config(Dir, Conf) -> ok when Dir :: snmp:dir(), Conf :: [user_entry()].

Append the users config to the current manager users config file.

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

See Users for more info.

Link to this function

# append_usm_config(Dir, Conf)

View Source

    -spec append_usm_config(Dir, Conf) -> ok when Dir :: snmp:dir(), Conf :: [usm_entry()].

Append the usm config to the current manager usm config file.

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

See Security data for USM for more info.

Link to this function

# manager_entry(Tag, Val)

View Source

    -spec manager_entry(Tag, Val) -> ManagerEntry
                           when
                               Tag :: transports | port | engine_id | max_message_size,
                               Val :: term(),
                               ManagerEntry :: manager_entry();
                       (Tag, Val) -> ManagerEntry
                           when Tag :: address, Val :: term(), ManagerEntry :: manager_entry().

Create an entry for the manager config file, `manager.conf`.

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

Link to this function

# read_agents_config(Dir)

View Source

    -spec read_agents_config(Dir) -> {ok, Conf} | {error, Reason}
                                when Dir :: snmp:dir(), Conf :: [agent_entry()], Reason :: term().

Read the current manager agents config file.

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

See Agents for more info.

Link to this function

# read_manager_config(Dir)

View Source

    -spec read_manager_config(Dir) -> {ok, Conf} | {error, Reason}
                                 when Dir :: snmp:dir(), Conf :: [manager_entry()], Reason :: term().

Read the current manager config file.

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

See Manager Information for more info.

Link to this function

# read_users_config(Dir)

View Source

    -spec read_users_config(Dir) -> {ok, Conf} | {error, Reason}
                               when Dir :: snmp:dir(), Conf :: [user_entry()], Reason :: term().

Read the current manager users config file.

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

See Users for more info.

Link to this function

# read_usm_config(Dir)

View Source

    -spec read_usm_config(Dir) -> {ok, Conf} | {error, Reason}
                             when Dir :: snmp:dir(), Conf :: [usm_entry()], Reason :: term().

Read the current manager usm config file.

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

See Security data for USM for more info.

Link to this function

# users_entry(UserId)

View Source

    -spec users_entry(UserId) -> UserEntry when UserId :: snmpm:user_id(), UserEntry :: user_entry().

Equivalent to `users_entry(UserId, snmpm_user_default)`.

Link to this function

# users_entry(UserId, UserMod)

View Source

    -spec users_entry(UserId, UserMod) -> UserEntry
                         when
                             UserId :: snmpm:user_id(),
                             UserMod :: snmpm:snmpm_user(),
                             UserEntry :: user_entry().

Equivalent to `users_entry(UserId, UserMod, undefined)`.

Link to this function

# users_entry(UserId, UserMod, UserData)

View Source

    -spec users_entry(UserId, UserMod, UserData) -> UserEntry
                         when
                             UserId :: snmpm:user_id(),
                             UserMod :: snmpm:snmpm_user(),
                             UserData :: term(),
                             UserEntry :: user_entry().

Equivalent to `users_entry(UserId, UserMod, UserData, [])`.

Link to this function

# users_entry(UserId, UserMod, UserData, DefaultAgentConfig)

View Source (since OTP 27.0)

    -spec users_entry(UserId, UserMod, UserData, DefaultAgentConfig) -> UserEntry
                         when
                             UserId :: snmpm:user_id(),
                             UserMod :: snmpm:snmpm_user(),
                             UserData :: term(),
                             DefaultAgentConfig :: [snmpm:agent_config()],
                             UserEntry :: user_entry().

Create an entry for the manager users config file, `users.conf`.

See the `Users` chapter of the (SNMP) `Manager Configuration` User Guide for more info.

Link to this function

# usm_entry(EngineID, UserName, AuthP, AuthKey, PrivP, PrivKey)

View Source

    -spec usm_entry(EngineID, UserName, AuthP, AuthKey, PrivP, PrivKey) -> UsmEntry
                       when
                           EngineID :: snmp:engine_id(),
                           UserName :: snmp:usm_name(),
                           AuthP :: snmp:usm_auth_protocol(),
                           AuthKey :: snmp:usm_auth_key(),
                           PrivP :: snmp:usm_priv_protocol(),
                           PrivKey :: snmp:usm_priv_key(),
                           UsmEntry :: usm_entry().

Equivalent to `usm_entry/7`.

Link to this function

# usm_entry(EngineID, UserName, SecName, AuthP, AuthKey, PrivP, PrivKey)

View Source

    -spec usm_entry(EngineID, UserName, SecName, AuthP, AuthKey, PrivP, PrivKey) -> UsmEntry
                       when
                           EngineID :: snmp:engine_id(),
                           UserName :: snmp:usm_name(),
                           SecName :: snmp:sec_name(),
                           AuthP :: snmp:usm_auth_protocol(),
                           AuthKey :: snmp:usm_auth_key(),
                           PrivP :: snmp:usm_priv_protocol(),
                           PrivKey :: snmp:usm_priv_key(),
                           UsmEntry :: usm_entry().

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

See `Security data for USM` for more info.

Link to this function

# write_agents_config(Dir, Conf)

View Source

    -spec write_agents_config(Dir, Conf) -> ok when Dir :: snmp:dir(), Conf :: [agent_entry()].

Equivalent to `write_agents_config/3`.

Link to this function

# write_agents_config(Dir, Hdr, Conf)

View Source

    -spec write_agents_config(Dir, Hdr, Conf) -> ok
                                 when Dir :: snmp:dir(), Hdr :: string(), Conf :: [agent_entry()].

Write the manager agents config to the manager agents 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 Agents for more info.

Link to this function

# write_manager_config(Dir, Conf)

View Source

    -spec write_manager_config(Dir, Conf) -> ok when Dir :: snmp:dir(), Conf :: [manager_entry()].

Equivalent to `write_manager_config/3`.

Link to this function

# write_manager_config(Dir, Hdr, Conf)

View Source

    -spec write_manager_config(Dir, Hdr, Conf) -> ok
                                  when Dir :: snmp:dir(), Hdr :: string(), Conf :: [manager_entry()].

Write the manager config to the manager 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 Manager Information for more info.

Link to this function

# write_users_config(Dir, Conf)

View Source

    -spec write_users_config(Dir, Conf) -> ok when Dir :: snmp:dir(), Conf :: [user_entry()].

Equivalent to `write_users_config/3`.

Link to this function

# write_users_config(Dir, Hdr, Conf)

View Source

    -spec write_users_config(Dir, Hdr, Conf) -> ok
                                when Dir :: snmp:dir(), Hdr :: string(), Conf :: [user_entry()].

Write the manager users config to the manager users 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 Users for more info.

Link to this function

# write_usm_config(Dir, Conf)

View Source

    -spec write_usm_config(Dir, Conf) -> ok when Dir :: snmp:dir(), Conf :: [user_entry()].

Equivalent to `write_usm_config/3`.

Link to this function

# write_usm_config(Dir, Hdr, Conf)

View Source

    -spec write_usm_config(Dir, Hdr, Conf) -> ok
                              when Dir :: snmp:dir(), Hdr :: string(), Conf :: [user_entry()].

Write the manager usm config to the manager 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.