SNMP Synchonization

It is now possible to synchronize SNMP inventories in between servers using the same process as basic "inventories". The first step will be to synchronize the configured types between the servers.

Prerequisites

  • PHP synchronization script sync_snmp_types.php (found in the tools/ directory of ocsreports)
  • SNMP types configuration file (see the Configuration section for details about retrieving the file)
  • Configuration option GENERATE_OCS_FILES_SNMP enabled on the server
  • Perl injector script ocsinventory-injector.pl (found in the utils/ directory of the release archive)

Configuration

SNMP file generation :

Head to the General Configuration, then "Inventory Files" and enable the GENERATE_OCS_FILES_SNMP option.

Once done, every SNMP inventory sent to this server will generate a file at the path specified under OCS_FILES_PATH. These files can be used with the ocsinventory-injector.pl to inject them to a higher level server.

SNMP types synchronization :

The sync_snmp_types.php script can be used to synchronize the SNMP types between two servers. We recommend you to backup your database / SNMP tables before running the script. To avoid loosing data, the script will only add or update the types configuration, no deletion will be performed.

First, you will need to retrieve the SNMP types configuration file from the server you want to synchronize from. Go to Configuration > SNMP Configuration > Configuration export and click the "Download SNMP Types Configuration" button.

Executing the synchronization script

cd /usr/share/ocsinventory-reports/ocsreports/tools/ && php sync_snmp_types.php --file=/path/to/localsnmp_types_conf.xml

Output

The script will ouput information about types added from the xml. If all goes well, you should be able to see the new types and/or updated configurations in the SNMP configuration page. Again, since the synchronization script is not allowed to delete types, you will need to delete the types manually if you want to remove them.

Troubleshooting

Output of the script can be redirected to a file for further analysis. It will log any action done by the script, from adding a type to updating the table structure.

Injecting the SNMP inventories

Once the SNMP types have been synchronized, you can inject the SNMP inventories generated by the server to a higher lever server using the ocsinventory-injector.pl script just like you would with basic inventories.

Command-line example : perl ocsinventory-injector.pl -v -f /path/to/snmpxml/<DEVICEID>-SNMP.ocs -u http://<server>/ocsinventory