salt.modules.win_snmp

Module for managing SNMP service settings on Windows servers. The Windows feature 'SNMP-Service' must be installed.

salt.modules.win_snmp.get_agent_service_types()

Get the sysServices types that can be configured.

Returns:

A list of service types.

Return type:

list

CLI Example:

salt '*' win_snmp.get_agent_service_types
salt.modules.win_snmp.get_agent_settings()

Determine the value of the SNMP sysContact, sysLocation, and sysServices settings.

Returns:

A dictionary of the agent settings.

Return type:

dict

CLI Example:

salt '*' win_snmp.get_agent_settings
salt.modules.win_snmp.get_auth_traps_enabled()

Determine whether the host is configured to send authentication traps.

Returns:

True if traps are enabled, otherwise False

Return type:

bool

CLI Example:

salt '*' win_snmp.get_auth_traps_enabled
salt.modules.win_snmp.get_community_names()

Get the current accepted SNMP community names and their permissions.

If community names are being managed by Group Policy, those values will be returned instead like this:

TestCommunity:
    Managed by GPO

Community names managed normally will denote the permission instead:

TestCommunity:
    Read Only
Returns:

A dictionary of community names and permissions.

Return type:

dict

CLI Example:

salt '*' win_snmp.get_community_names
salt.modules.win_snmp.get_permission_types()

Get the permission types that can be configured for communities.

Returns:

A list of permission types.

Return type:

list

CLI Example:

salt '*' win_snmp.get_permission_types
salt.modules.win_snmp.set_agent_settings(contact=None, location=None, services=None)

Manage the SNMP sysContact, sysLocation, and sysServices settings.

Parameters:
  • contact (str, optional) -- The SNMP contact.

  • location (str, optional) -- The SNMP location.

  • services (list, optional) -- A list of selected services. The possible service names can be found via win_snmp.get_agent_service_types. To disable all services pass a list of None, ie: ['None']

Returns:

True if successful, otherwise False

Return type:

bool

CLI Example:

salt '*' win_snmp.set_agent_settings contact='Contact Name' location='Place' services="['Physical']"
salt.modules.win_snmp.set_auth_traps_enabled(status=True)

Manage the sending of authentication traps.

Parameters:

status (bool) -- True to enable traps. False to disable.

Returns:

True if successful, otherwise False

Return type:

bool

CLI Example:

salt '*' win_snmp.set_auth_traps_enabled status='True'
salt.modules.win_snmp.set_community_names(communities)

Manage the SNMP accepted community names and their permissions.

Note

Settings managed by Group Policy will always take precedence over those set using the SNMP interface. Therefore if this function finds Group Policy settings it will raise a CommandExecutionError

Parameters:

communities (dict) -- A dictionary of SNMP community names and permissions. The possible permissions can be found via win_snmp.get_permission_types.

Returns:

True if successful, otherwise False

Return type:

bool

Raises:

CommandExecutionError -- If SNMP settings are being managed by Group Policy

CLI Example:

salt '*' win_snmp.set_community_names communities="{'TestCommunity': 'Read Only'}'