Let unmanaged interfaces remain unmanaged when reprovisioned

Description

When an entire node is unmanaged through the webinterface it only stays that way until it is rescanned again (after 1d per default).

This essentially breaks the ability to unmanage nodes.

Please let me know if you need more information.

Working branch: https://github.com/OpenNMS/opennms/tree/features/NMS-4696

Acceptance / Success Criteria

None

Confluence content

mentioned on

Lucidchart Diagrams

Activity

Show:

Allan Eising January 28, 2013 at 12:07 PM

Ugh, sorry about the formatting.
See it here instead: http://sxi.dk/tmp/provision-code.txt

Allan Eising January 28, 2013 at 12:04 PM

The custom provisioner used here is really simple. It iterates over my CMDB, fetches hostnames and IP-addresses and provides the following XML output:

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<model-import non-ip-snmp-primary="N" non-ip-interfaces="false" last-import="2013-01-28T09:32:47.801+01:00" foreign-source="niacpe" date-stamp="2013-01-28T09:32:47.472+01:00" xmlns="http://xmlns.opennms.org/xsd/config/model-import">
<!-- per node: -->
<node node-label="a.fqdn.hostname" foreign-id="same.fqdn.hostname">
<interface snmp-primary="P" status="1" ip-addr="172.31.xx.yy" descr="Mgmt">
<monitored-service service-name="ICMP"/>
<monitored-service service-name="SNMP"/>
</interface>
<category name="CPE"/>
<category name="C-CUSTOMERNAME"/>
</node>
</model-import>

The relevant XML-building ruby code follows:

builder = Nokogiri::XML::Builder.new do |xml|
xml.send(:"model-import", 'foreign-source' => 'niacpe', 'date-stamp' => Time.now.xmlschema(fraction_digits=3), 'xmlns' => "http://xmlns.opennms.org/xsd/config/model-import") do
pnodes.each do |hostname, values|

  1. We try to guess customername
    if hostname =~ /^(cpe|ce)/i
    customername = hostname.split('.')[1]
    else
    customername = hostname.split('.')[0]
    end
    if hostname =~ /(N\w{2}-?\d{6})/
    crid = $1
    else
    crid = nil
    end

xml.node('foreign-id' => hostname, 'node-label' => hostname) do

values[:ips].each do |ip|
xml.interface('status' => '1', 'snmp-primary' => ip[:status], 'ip-addr' => ip[:ip], 'descr' => 'Mgmt') do
xml.send(:"monitored-service", "service-name" => "ICMP")
xml.send(:"monitored-service", "service-name" => "SNMP")
end
end
xml.category('name' => 'CPE')
xml.category('name' => "C-#{customername.upcase}") # Changeme!
if crid
xml.asset('name' => 'circuitId', 'value' => crid)
end

end
end
end
end

Allan Eising January 28, 2013 at 3:25 AM

Hi there,

I've started to roll out OpenNMS again and I have yet again run in to this issue.

The OpenNMS version is now 1.10.7 and I'm running provisiond with a custom adapter that produces a requisition XML file from my CMDB.

Two steps to reproduce this goes like this:

1) On a node with outages, forcibly unmanage the interface and services. This puts ismanaged = 'F' on the ipinterface table for the interface.
2) Sync the requisition.
3) ismanaged is now 'M' on that interface.

Further observations:
The availability of the node and interface is reset to 100%. No polling seems to happen to the interface, although the ip address is unreachable.

Provisiond reports the following upon scanning the node:
The Node with Id: 4134; ForeignSource: niacpe; ForeignId:<redacted> has aborted for the following reason: Aborting node scan : Agent timed out while scanning the system table.

No outage is reported for the interface or node, although it should report a uei.opennms.org/nodes/nodeDown event as no interfaces are reachable for the given node.

Further analysis:

As the requisition reports the interface as 'P', I could suspect that the re-management behaves as it does by design, however the 100% availability and no further polling issue observed does not strike me as working as designed. This is, perhaps, the fixable issue here.

One possible option for me would be to read the ipinterface table on reprovisioning and simply removing information about interfaces with ismanaged == 'F'. Would this be considered best practice by the OpenNMS designers?

Please do not hesitate to contact me about further information if required.

Best,

Allan

Allan Eising March 28, 2012 at 9:38 AM

Sorry for the lack of feedback, but I do not work for the company using this feature anymore, so I am unfortunately not able to test it.

Seth Leger March 28, 2012 at 9:28 AM

No feedback from the user, I'm going to assume that the fixes to https://opennms.atlassian.net/browse/NMS-3906#icft=NMS-3906 have fixed the issue sufficiently.

Won't Fix

Details

Assignee

Reporter

HB Grooming Date

Affects versions

Priority

PagerDuty

Created May 17, 2011 at 3:58 PM
Updated October 19, 2021 at 6:48 PM
Resolved October 19, 2021 at 6:46 PM