DISCLAIMER: This is alpha code. Expect bugs, issues, and the likelihood of major behavioral changes.
Auto-generates BIND9-compatible forward and reverse DNS zone / config files for all L3 interfaces in SolarWinds Orion NPM.
- Queries the SolarWinds Information Service (SWIS) for a list of all managed layer 3 interfaces, using SolarWinds Query Language (similar syntax to native SQL)
- Generates forward lookup records (A and CNAME)
- Generates reverse lookup records (PTR)
- Creates the appropriate BIND9 zone and configuration files
At this time, npm_bind does not automatically copy or enable the generated BIND9 config. This must be done manually for DNS changes to take effect.
Required modules:
- orionsdk
- jinja2
- yaml
- requests
- urllib3
npm_bind depends on two custom fields added to NPM:
IPAddress
interface custom field. This allows for manually-defined interface addresses in cases when the SNMP-queried address is incorrect or nonexistent.DeviceClass
node custom field. Helpful in differentiating types of nodes (e.g. network devices vs. servers)
All npm_bind config resides in config/config.yaml
. Refer to inline comments for details.
All BIND9 files are generated from jinja2 templates located in config/templates
. They will need little or no modification.
npm_bind has two data sources:
- SolarWinds NPM, as received by the SolarWinds API (SWIS)
- Manual input, as defined in
config.yaml
.
The objective of this project is to rely as heavily as possible on NPM as the source of truth, using manual input as sparingly as possible. Ideally, npm_bind will need little or no post-deployment adjustment; all relevant changes occur directly in NPM.
Data begins as a list of dicts (iface_list
) with the following schema:
node_id
- Node unique ID as assigned by NPMnode_uri
- Node SWIS URI (beginning with swis://)node_name
- Node hostname (SWIScaption
property)node_addr
- Node polling IP addressnode_fqdn
- Node fully-qualified domain namenode_class
-DeviceClass
NPM custom property. I use this to differentiate between network nodes and servers.iface_id
- Interface unique ID as assigned by NPMiface_uri
- Interface SWIS URI (beginning with swis://)iface_name
- Interface description, which includes both the device's interface name (e.g. Gi0/1) and any administratively assigned description stringiface_speed
- Interface's negotiated speed in bits per second (bps). Note: a) that NPM does not accurately query this value in all cases, and b) that the interface's negotiated speed may differ from its line speed.
npm_bind ships with an example query in config/query.swql
. This is tailored to our use-case, but will likely need minimal or no adjustment, as long as the custom fields described above are created and populated.
Orion NPM can query an interface's IP address via SNMP for many devices, but certain vendors do not support that (notably: Palo Alto). For such devices, their managed interfaces in Orion will show as "Unknown" IP address.
To further complicate things, best I can tell, Orion does not allow us to administratively set an interface's IP address, either via the web GUI or SWIS.
The workaround here is to create an interface custom property called IPAddress and manually set that in NPM. We then have two fields from which we may obtain an interface's IP address.
If the interface's custom property IPAddress is set, that takes precedence over an interface's SNMP address.
If an interface has neither an administratively-defined nor an SNMP-queried IP address, it is not included in the result set at all.
Returns a list of all managed interfaces known by Orion NPM that have the DeviceClass custom property set to "Network" and have either an SNMP-queried L3 address, or an administratively-set IP address via an interface custom property called IPAddress.