JDBC Source
The JDBC source provides the ability to run an SQL Query against an external system and map the result to an OpenNMS requisition.
Parameter | Required | Description |
---|---|---|
|
* |
Set |
|
* |
JDBC driver, e.g. |
|
JDBC URL, e.g. |
|
|
SQL statement |
|
|
user name for database connection |
|
|
password for database connection |
|
|
* |
Mapper script for changing the requisition. For no operation use |
|
If set |
The following column-headers will be mapped from the result set to the OpenNMS requisition:
Column Header | Required | Description |
---|---|---|
|
* |
will be interpreted as |
|
defines the |
|
|
defines the |
|
|
defines the |
|
|
will be interpreted as an IP address for a new IP interface on the node |
|
|
is interpreted as |
|
|
will be interpreted as Interface Status. Value has to be an integer. Use |
|
|
will be interpreted as node label for the node identified by the |
|
|
The monitoring location for the node. When not set, the node is monitored from the OpenNMS server, otherwise from the Minion associated with the |
|
|
will be interpreted as a surveillance category for the node identified by the |
|
|
will be interpreted as a service on the interface of the node identified by the |
|
|
will be interpreted as node-level meta-data with the given key and the default context |
Please note, that this datasource only allows to specify node-level meta-data. |
This source also supports all asset fields by using Asset_
as a prefix followed by the asset-field-name
.
The city field of the assets can be addressed like this: yourvalue AS Asset_City
and is not case-sensitive.
Every row of the result set will be checked for the listed column headers.
The provided data will be added to the corresponding node.
Multiple result rows with matching Foreign_Id
will be added to the same node.
To use additional JDBC drivers, just drop the JAR files into the opennms-pris/lib directory and set the source.driver and source.url accordingly.
|
### File: phpipam/requisition.properties
# This example connects to an phpIPAM MySQL database and imports the
# data and maps the result an OpenNMS requisition.
# Hint: the MySQL driver has to be manually installed to the opennms-pris/lib
# directory
source = jdbc
## jdbc source parameter to connect against phpIPAM on MySQL
source.driver = com.mysql.jdbc.Driver
source.url = jdbc:mysql://phpipam.foo.org/phpipam
source.user = user
source.password = secret
source.selectStatement = SELECT \
id AS Foreign_Id, \
dns_name AS Node_Label, \
'P' AS MgmtType, \
description AS Asset_Description, \
INET_NTOA(ip_addr) AS Ip_Address, \
owner AS Cat \
FROM ipaddresses;
### default no-operation mapper
mapper = echo
### File: opennms/requisition.properties
# This example connects to an OpenNMS PostgreSQL database and imports the
# data and maps the result a new OpenNMS requisition
source = jdbc
## jdbc source parameter to connect against PostgreSQL
source.driver = org.postgresql.Driver
source.url = jdbc:postgresql://localhost:5432/opennms
source.user = opennms
source.password = opennms
source.selectStatement = SELECT \
node.foreignId AS Foreign_Id, \
node.nodelabel AS Node_Label, \
node.location AS Location, \
ipinterface.ipaddr AS IP_Address, \
ipinterface.issnmpprimary AS MgmtType, \
ipinterface.ipstatus AS InterfaceStatus, \
assets.description AS Asset_Description, \
assets.city AS Asset_City, \
assets.state AS Asset_State, \
service.servicename AS Svc, \
categories.categoryname AS Cat \
FROM \
node LEFT OUTER JOIN ipInterface ON node.nodeId=ipInterface.nodeId \
LEFT OUTER JOIN ifServices ON ipInterface.id=ifServices.ipinterfaceid \
LEFT OUTER JOIN service ON ifServices.serviceId=service.serviceId \
LEFT OUTER JOIN category_node ON node.nodeId=category_node.nodeId \
LEFT OUTER JOIN categories ON category_node.categoryId=categories.categoryId \
LEFT OUTER JOIN assets ON node.nodeId=assets.nodeId;
### default no-operation mapper
mapper = echo