We have an internally developed application which is built as an “appliance” which consists of a number of virtual servers. The problem I’m currently having is that under certain redeployment circumstances, the virtual servers are re-created with different IP addresses.
This is screwing up our OpenNMS as sometimes a re-deployed VM has an IP address that was originally assigned to one of the other VM’s in the “appliance” prior to the re-deployment. This is causing OpenNMS to have the wrong IP address associated with a node so that the node being monitored on an IP address is not the same node as defined by the node label, so events are being raised in our ticketing system against the wrong node.
On initial discovery, the node label is automatically set to the snmp SysName, but after an application re-deploymement that causes the IP addresses to change, the node label is not updated to the new “sysName” and you can see in the node screen, the SNMP attribute “Name” is different to the node label.
I initially thought that the node label should be updated to match the snmp attributes found on the ‘original’ ip address, but I don’t think this is the correct solution as then the surveillance categories would be incorrect, as they would be based on the categories of the previous node that owned that IP address.
Ideally, when the IP address of a VM changes, I want to update the IP address on the node in OpenNMS so that the node maintains the correct surveillance category membership, and also to maintain historic performance data. So I thought of writing a script to use the ReST API to change the IP address of the node to match the current reality.
Using this document: https://wiki.opennms.org/wiki/ReST#PUTs_.28Modifying_Data.29 I’ve tried setting up a shell script that uses curl, however, the documentation does not contain any usage examples for changing node data, so I came up with the following command:
curl -v --data "ipAddress=10.2.0.44" -H "Content-Type: application/x-www-form-urlencoded" -X PUT http://admin:admin@localhost:8980/opennms/rest/nodes/6/ipinterfaces/10.2.0.16
however, this command is giving this error:
* About to connect() to localhost port 8980 (#0)
* Trying ::1...
* Connected to localhost (::1) port 8980 (#0)
* Server auth using Basic with user 'admin'
> PUT /opennms/rest/nodes/6/ipinterfaces/10.2.0.16 HTTP/1.1
> Authorization: Basic YWRtaW46YWRtaW4=
> User-Agent: curl/7.29.0
> Host: localhost:8980
> Accept: */*
> Content-Type: application/x-www-form-urlencoded
> Content-Length: 19
* upload completely sent off: 19 out of 19 bytes
< HTTP/1.1 500 Server Error
< Date: Thu, 20 Jul 2017 01:04:06 GMT
< X-Frame-Options: SAMEORIGIN
< Content-Type: application/octet-stream
< Content-Length: 282
< Server: Jetty(9.4.0.v20161208)
* Connection #0 to host localhost left intact
Failed to convert value of type 'java.lang.String' to required type 'java.net.InetAddress'; nested exception is java.lang.IllegalStateException: Cannot convert value of type [java.lang.String] to required type [java.net.InetAddress]: no matching editors or conversion strategy found0
How do I need to change my curl commandline to get this to work correctly, and/or is there a better method for programmatically updating a node with a new IP address?
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
Please read the OpenNMS Mailing List FAQ:
opennms-discuss mailing list
To *unsubscribe* or change your subscription options, see the bottom of this page:
|Free forum by Nabble||Edit this page|