snmp

3Modules6Plugins1Dependency

Overview

Description

The Ansible ansible.snmp collection includes a variety of plugins for using SNMP on the control node to make SNMP connections to a device.

Readme

CI

Ansible SNMP Collection

The Ansible ansible.snmp collection includes a variety of plugins for using SNMP on the control node to make SNMP connections to a device.

Ansible version compatibility

This collection has been tested against following Ansible versions: >=2.14.0.

For collections that support Ansible 2.9, please ensure you update your network_os to use the fully qualified collection name (for example, cisco.ios.ios). Plugins and modules within a collection may be tested with only specific Ansible versions. A collection may contain metadata that identifies these versions. PEP440 is the schema used to describe the versions of Ansible.

Included content

Connection plugins

NameDescription
ansible.snmp.v1Make SNMP v1 connections to a device
ansible.snmp.v2cMake SNMP v2c connections to a device
ansible.snmp.v3_usmMake SNMP v3 user-based security model (USM) connections to a device.

Modules

NameDescription
ansible.snmp.getPerform an SNMP get against a remote device for one or more OIDs
ansible.snmp.setPerform an SNMP set against a remote device for one or more OIDs
ansible.snmp.walkPerform an SNMP walk against a remote device for one or more OIDs

Installing this collection

You can install the ansible.snmp collection with the Ansible Galaxy CLI:

ansible-galaxy collection install ansible.snmp

You can also include it in a requirements.yml file and install it with ansible-galaxy collection install -r requirements.yml, using the format:

---
collections:
  - name: ansible.snmp

Using this collection

You can call modules by their Fully Qualified Collection Namespace (FQCN), such as ansible.snmp.get. The most common use case for this collection is to retrieve operation state information from a device using SNMP get or SNMP walk The following example task gets the existing configuration on an SNMP-enabled device, using the FQCN:

---
- name: Retrieve several individual OIDs
  ansible.snmp.get:
    oids:
      - oid: "SNMPv2-MIB::sysDescr.0"
      - oid: "SNMPv2-MIB::sysDescr"
        iid: "0"
    numeric: false
    long_names: True

NOTE: For Ansible 2.9, you may not see deprecation warnings when you run your playbooks with this collection. Use this documentation to track when a module is deprecated.

See Also:

Contributing to this collection

This collection is intended for plugins that are not platform or discipline-specific. Simple plugin examples should be generic in nature. More complex examples can include real-world platform modules to demonstrate the utility of the plugin in a playbook.

We welcome community contributions to this collection. If you find problems, please open an issue or create a PR against the ansible.utils collection repository. See Contributing to Ansible-maintained collections for complete details.

See the Ansible Community Guide for details on contributing to Ansible.

Code of Conduct

This collection follows the Ansible project's Code of Conduct. Please read and familiarize yourself with this document.

Release notes

Release notes are available here For automated release announcements refer here.

Roadmap

For information on releasing, versioning and deprecation see the strategy document.

In general, major versions can contain breaking changes, while minor versions only contain new features (like new plugin addition) and bug fixes. The releases will be done on an as-needed basis when new features and/or bug fixes are done.

More information

Licensing

GNU General Public License v3.0 or later.

See LICENSE to see the full text.

Installing the python binding for net-snmp

Using dnf

sudo dnf install net-snmp net-snmp-libs net-snmp-utils net-snmp-python

or

Using source (fedora)

  • download https://sourceforge.net/projects/net-snmp/files/net-snmp/5.9.1/net-snmp-5.9.1.tar.gz/download
  • extract tar -xvf net-snmp-5.9.1.tar.gz
  • as root sudo su -
  • cd cd net-snmp-5.9.1
  • set the path to system python
  • configure ./configure --with-python-modules --libdir=/usr/lib64 --enable-shared
  • make make
  • install sudo make install
  • add the install path to ld
more /etc/ld.so.conf.d/netsnmp.conf
/usr/local/lib
  • cd python
  • build python setup.py build
  • install python setup.py install or python setup.py install --user
  • confirm python -c 'import netsnmp'
  • It's installed in system python

Configuring netsnmp

  • sudo dnf install perl-Term-ReadLine-Gnu
  • snmpconf -p
  • 1: snmp.conf
  • 4: Textual mib parsing
  • 1: Specifies directory to be searched for mibs
  • Enter the list of directories to search through for mibs: +/home/ftp_site/cisco_mibs
  • finished
  • finished
  • quit
  • review ~/.snmp/snmp.conf

Using the net-snmp python bindings with a python virtual environment

  • python3 -m venv venv --system-site-packages

or install again after sourcing venv

  • python3 -m venv venv
  • source venv/bin/activate
  • pip install net-snmp-5.9.1/python

Additional information

Licensing

GNU General Public License v3.0 or later.

See LICENSE to see the full text.

Certification

Product
2.4
DocumentationDependencies

This collection requires the following collections for use:

NameSummary
No dependencies
This collection is not being used by other collections.
View in Automation Hub
Red Hat logoLinkedInYouTubeFacebookTwitter

Platforms

Products & services

Try, buy, sell

Help

About Red Hat Ecosystem Catalog

The Red Hat Ecosystem Catalog is the official source for discovering and learning more about the Red Hat Ecosystem of both Red Hat and certified third-party products and services.

We’re the world’s leading provider of enterprise open source solutions—including Linux, cloud, container, and Kubernetes. We deliver hardened solutions that make it easier for enterprises to work across platforms and environments, from the core datacenter to the network edge.

© 2025 Red Hat, LLC
Feedback