cancel
Showing results for 
Search instead for 
Did you mean: 
Create Post
Highlighted
Level 7

Change NCM Option in Node Properties via REST API

Currently, we use the command generated by Solarwinds in the 'Download agent software' section to install and add servers to Solarwinds.  It seems that when we use this, sometimes it automatically adds the node to NCM.  I'm trying to find a way to either disable automatically adding it to NCM, or using the REST API, turn the setting to 'Never'. This is the setting under node properties that I'm referring to:  pastedImage_0.png

So I know I can query this setting using this request (I'm testing via Postman):  https://solarwinds_server/SolarWinds/InformationService/v3/Json/swis://solarwinds_server/Orion/Orion...

I don't see anywhere in Orion.Nodes to send a request to change that value.  My next guess was it'd be somewhere in Cirrus.Nodes but I haven't found anything in there yet.  Any ideas?

0 Kudos
9 Replies
Highlighted

Re: Change NCM Option in Node Properties via REST API

Not sure about the Never option, but to switch any object to just be No you can use RemoveNode from Cirrus.Nodes

SolarWinds Information Service v3.0 Schema Documentation

- Marc Netterfield, Github
0 Kudos
Highlighted
Level 7

Re: Change NCM Option in Node Properties via REST API

Ah, so that verb requires the NCM NodeID, which is different than the Orion NodeID, correct? 

0 Kudos

Re: Change NCM Option in Node Properties via REST API

yeah, NCM was a completely stand alone product years ago, so it already used a GUID based node id scheme.  The cirrus.nodes view will have both the cirrus nodeid and the corenodeid so you can correlate them.

- Marc Netterfield, Github
0 Kudos
Highlighted
Level 7

Re: Change NCM Option in Node Properties via REST API

Ok, I was trying that previously and wasn't getting anything from the REST API.  If I run the following query in SWQL Studio I can get the correct results:

SELECT TOP 1000 NodeID, CoreNodeID

FROM Cirrus.Nodes

WHERE CoreNodeID = 1752

I'm trying to translate that into a query in REST using Postman to test.  This seems like it should work and is returning a status 200 but the result is blank:

https://solarwinds_server/SolarWinds/InformationService/v3/Json/Query?query=SELECT NodeID,CoreNodeID FROM Cirrus.Nodes WHERE CoreNodeID = 1752

I get this as a result:

{

    "results": []

}

Any ideas?

0 Kudos
Highlighted

Re: Change NCM Option in Node Properties via REST API

It looks like the formatting is incorrect, see below the first couple of items in there show you how to build out the request correctly

REST · solarwinds/OrionSDK Wiki · GitHub

0 Kudos
Highlighted

Re: Change NCM Option in Node Properties via REST API

I usually prefer to do queries in a message body since converting the strings for http can get messy at times

https://loop1.com/swblog/using-the-rest-api-to-get-the-most-out-of-solarwinds-part-1/

- Marc Netterfield, Github
0 Kudos
Highlighted
Level 7

Re: Change NCM Option in Node Properties via REST API

Ok, I've tried it a couple different way and I still can't get a response.  I'm using a broader query just to see if I can get some type of response.  Here's what I've tried:

POST to https://solarwinds_server/SolarWinds/InformationService/v3/Json/Query

With a body of: {"query":"SELECT NodeID,CoreNodeID FROM Cirrus.Nodes"}

I've also tried formatting it with the + signs: https://solarwinds_server/SolarWinds/InformationService/v3/Json/Query?query=SELECT+NodeID,CoreNodeID...

Both return empty results.  Anything glaring that you can see I'm missing?

0 Kudos
Highlighted

Re: Change NCM Option in Node Properties via REST API

You do have nodes in NCM already right?

I usually write my queries in swql studio and then copy them into my post body's and things *should* match up.

To be fair, I rarely use postman so maybe there is an environment setting thats jamming you up, i mostly use curl requests or the powershell module.  May just be faster to spit something into that?

- Marc Netterfield, Github
0 Kudos
Highlighted
Level 7

Re: Change NCM Option in Node Properties via REST API

Well, turns out it had nothing to do with my queries.  The account I was using to access the Solarwinds API didn't have proper access to query NCM.  Once that access was granted, my queries worked.  Would be nice if it threw a permissions error, but I guess I should've checked that account's access earlier.  I gave it admin access to NCM to make sure there's no more issues while I figure the rest of this out.

So here's what I'm sending to use RemoveNode: https://solarwinds_server/SolarWinds/InformationService/v3/Json/Invoke/Cirrus/Cirrus.Nodes/RemoveNod...

Body: {"NodeID":"rh43k3j3-21j1-1245-b2jr8d9sd0a1"}

Getting:

{

    "Message": "Invalid SWIS uri at character 37: Incomplete uri. Parser did not finish in End state, but instead was left in Scheme state\r\nParameter name: uri",

    "ExceptionType": "System.ArgumentException",

    "FullException": "System.ArgumentException: Invalid SWIS uri at character 37: Incomplete uri. Parser did not finish in End state, but instead was left in Scheme state\r\nParameter name: uri\r\n   at SolarWinds.Data.Utility.SwisUriParser.ParsingError(String message)\r\n   at SolarWinds.Data.Utility.SwisUriParser.ParseInternal()\r\n   at SolarWinds.InformationService.Core.InformationService.Update(String uri, IDictionary`2 propertiesToUpdate)"

}

0 Kudos