SNMP
Availability of SNMP data within the OCS webconsole will require a SNMP Scanner to be installed and configured.
The SNMP scanner can operate as a standalone tool (offline mode) or communicate directly with an OCS server (online mode).
SNMP Scanner
The SNMP Scanner is a tool designed to scan networks and collect device information using the SNMP protocol. It always uses a hardcoded base inventory (matching generic OIDs) to retrieve information. If a template is available, the scanner performs an advanced scan using the template retrieved from the OCS server.
Available scan modes
The scanner can operate in two modes: online and offline.
In online mode, the scanner queries the OCS server to check whether a device has already been scanned, and if so, whether a template is defined for it. If a template is available, the scanner performs an advanced scan using that template, and then sends the inventory data back to the server.
In offline mode, the scanner only uses the base template and does not query the OCS server at all, inventory data will be stored in individual files in the local_inventory_dir directory and local configuration will be used.
Scanning process
Supported SNMP versions
The scanner supports SNMPv1, SNMPv2c, and SNMPv3.
The version used is determined by the configuration file configs.json or by the configuration retrieved from the OCS server.
Basic scan
The basic scan uses generic OIDs to populate the base inventory fields. The goal is to retrieve as much data as possible from devices, regardless of type. It is performed for all devices, whether or not a custom template exists.
Advanced scan
If a template exists for a device, an advanced scan is performed using OIDs defined in the template file retrieved from the OCS server. The template contains a list of OIDs required to enrich the scan. The scanner uses these OIDs to retrieve corresponding device values.
SNMP scanner installation
Requirements: Debian 12 (bookworm) or later, or an Ubuntu release shipping Python ≥ 3.9.
Add the repository (skip if already configured on the host):
Replace <distribution_codename> with your system's codename (Debian: bookworm, trixie; Ubuntu: jammy, noble, plucky).
Then install the package:
Uninstalling:
Requirements: Fedora, RHEL 9+, Rocky Linux 9+ or an equivalent, shipping Python ≥ 3.9.
Add the repository (skip if already configured on the host) — this installs the release package that configures the DNF/YUM repository and imports the signing key:
Replace [elX|fcXX] with your OS version (Enterprise Linux: el9, el10; Fedora: fc42, fc43, fc44).
Then install the package:
Uninstalling:
This stops and disables the service and timer, and removes the scanner's application files, logs, offline inventory data, and the ocssnmp system user.
What the package installs
Application code
/usr/share/ocsinventory-snmp-scanner/
Python virtual environment
/usr/lib/ocsinventory-snmp-scanner/venv/
Configuration (scanner.conf, configs.json)
/etc/ocsinventory-snmp-scanner/
Logs
/var/log/ocsinventory-snmp-scanner/snmp_scanner.log (also available through journalctl)
Offline inventory files (local_inventory_dir)
/var/lib/ocsinventory-snmp-scanner/files/
MIBs cache (mibs_dir)
/var/lib/ocsinventory-snmp-scanner/mibs/
systemd units
ocsinventory-snmp-scanner.service, ocsinventory-snmp-scanner.timer
SNMP configuration
Enabling SNMP scanning
Navigate to Configurations ➜ Networks ➜ SNMP.
On the default tab General, at the top, enabled the SNMP option using the on/off switch.
User
A dedicated user must be created on the OCS web console with appropriate permissions. The user must have the following permissions:
View :
Inventory - Asset,Templates,SNMP Scanner,Configuration - GeneralAdd :
Inventory - Asset,SNMP ScannerChange :
Inventory - Asset,SNMP ScannerDelete :
Inventory - Asset
Communities
To create a community:
Navigate to Configurations ➜ Networks ➜ SNMP.
On the General tab, locate the Communities section.
Click the Add an SNMP community button.
Fill the form.
Name: name of the community
Version: SNMP version to use (v1, v2c or v3)
User: SNMP user to use (only for SNMPv3)
Password: SNMP password to use (only for SNMPv3)
Level: Authentication level to use (only for SNMPv3)
Authentication protocol: Authentication protocol to use (only for SNMPv3)
Privacy protocol: Privacy protocol to use (only for SNMPv3)
Privacy password: Privacy password to use (only for SNMPv3)
Retries: number of retries to perform when scanning a device
Timeout: timeout in seconds to wait for a response from a device
Subnets: list of subnets to scan, in CIDR notation, comma separated. These will be matched against the Scanner's
subnetsfield to determine if the scanner should use this configuration to scan a device.
Click Add.
Scanner configuration
The scanner configuration will be read from the config/scanner.conf file:
Scanner registration
Scanner registration is automatic when running in online mode. The scanner creates its own instance in OCS during its first run.
The entry is created using:
name from the local
configs.jsonsubnets from the local
configs.json
The name is the scanner’s unique name. The subnets field lists the networks the scanner scans.
Once registered, assign a community to the scanner using the OCS web console:
Navigate to Configuration → Networks → SNMP.
Switch to the Scanner tab.
Locate the scanner entry you want to edit and click the pencil icon in the Actions column.
Edit the form:
Name
IP address
Networks: comma-separated list of subnets the scanner should scan, in CIDR notation.
Notes
Communities: assign communities to this scanner using the dropdown.
Click Add.
Template example
By default, a generic SNMP template is available. A default Rule automatically assigns it to every SNMP asset.
The template can be found under Configuration → Networks → SNMP → Templates.
Communities
In offline mode, SNMP communities are defined locally in the configs.json file. The scanner reads this file at startup and uses the configuration entries to determine how each subnet should be scanned.
Here is an example of the configs.json content:
Scanner configuration
The scanner configuration will be read from the config/scanner.conf file:
Scanner registration
Registering a scanner is optional in offline (standalone) mode but can be done manually from the OCS web console for easy of management, see registering an SNMP scanner.
Running the scanner
Run once, to test your configuration:
Check the outcome:
Schedule recurring scans:
The package ships a weekly timer, disabled by default:
This runs a scan once a week, with up to an hour of random delay (so a whole fleet installed from the same image doesn't scan at the exact same instant), and automatically catches up on a missed run if the machine was off at the scheduled time. Check the next scheduled run with:
To change the frequency, override the timer instead of editing the shipped unit file directly:
Results
In the online mode, the results will be displayed under the Inventory → General → Assets page, along non-SNMP devices.
In offline mode, the inventories generated during the SNMP scan will be stored under the path defined by the local configuration option local_inventory_dir.
Last updated

