Skip to content

Quick Start Tutorial

Ronny Trommer edited this page Jun 5, 2020 · 6 revisions

Spreadsheets drive the world and you can use it as a requisition data source to import inventory into OpenNMS with our pris-plugin. Let's say we want to import nodes from an Excel file called inventory.xls which has two worksheets, one with Routers and a second one with Servers like this:

Worksheet name: myServer

Node_Label Location IP_Management MgmtType_ svc_Forced cat_Environment
dc01 172.16.23.10 P ICMP, SNMP Server
dc02 172.16.23.11 P ICMP, SNMP Server
filesrv01 172.16.23.12 P ICMP, SNMP Server
filesrv02 172.16.23.13 P ICMP, SNMP Server
mailrv02 172.16.23.13 P ICMP, SNMP, SMTP, IMAP Server

Worksheet name: myRouter

Node_Label Location IP_Management MgmtType_ svc_Forced cat_Environment
bbone-gw1 10.0.23.1 P ICMP, SNMP backbone
bbone-gw2 10.0.23.2. P ICMP, SNMP backbone
rt01 172.16.23.1 P ICMP, SNMP Central
rt02 172.16.23.2 P ICMP, SNMP Office
rt02 172.20.23.2 S ICMP, SNMP, StrafePing
rt02 172.21.23.2 N ICMP, StrafePing

ℹ️ Reminder: ${OPENNMS_HOME} is in RHEL/CentOS /opt/opennms and in Debian/Ubuntu /usr/share/opennms. We use /opt/opennms here in this example.

⚠️ Please use only Excel files compatible with Excel 1997-2004 format, the library we use cannot handle xlsx files.

Step 1: Download and install the pris-plugin in OpenNMS

cd /opt/opennms/deploy
wget https://github.com/OpenNMS/pris-plugin/releases/download/v1.0.0/opennms-pris-plugin-1.0.0.kar

The feature gets automatically installed, no restart required. You can check if it got installed correctly with:

ssh admin@localhost -p 8101 "feature:list" | grep opennms-plugins-pris-xls
Password authentication
Password:
opennms-plugins-pris-xls                    | 1.0.0            | x        | Started     | openmms-plugins-pris-features    | OpenNMS :: Plugins :: Pris :: XLS

Step 2: Create a configuration file per requisition (worksheet)

File: /opt/opennms/etc/org.opennms.plugins.feature.pris-myServer.cfg

name = myServer
source = xls
source.file = /opt/opennms/etc/inventory/inventory.xls
mapper = echo

File: /opt/opennms/etc/org.opennms.plugins.feature.pris-myRouter.cfg

name = myRouter
source = xls
source.file = /opt/opennms/etc/inventory/inventory.xls
mapper = echo

As soon as you create the configuration files, they will be loaded automatically.

Step 3: Import the requisitions via the Karaf Shell

ssh admin@localhost -p 8101
import-requisition pris name=myRouter
import-requisition pris name=myServer

If you want to see first the requisition as XML raw input before importing you can use the show-import command like this:

show-import pris name=myServer

Clone this wiki locally