I can add a node in SolarWinds using python script. I also want to enable the NCM and update some fields as below
How to do it in python script ?
Thanks for your reply
You would "set" the values after it's added. The samples for 'edits' are in: solarwinds/orionsdk-python: Python client for interacting with the SolarWinds Orion API (github.com)
Thanks for your reply
I have gone through the sample code a couple of times, but I can not find which script is doing this.
Can you help to point out the file name ? So I can look at more closely
I use the add-node.py and add the following line to
# Add to NCM
swis.invoke('Cirrus.Nodes', 'AddNodeToNCM', nodeid)
My guess is this will add the node to NCM.
This is the output
Add an SNMP v2c node:
Adding node 10.239.178.74... swis://nrmpincmw001.ad.seagate.com/Orion/Orion.Nodes/NodeID=3003
DONE!
Updating site and region 10.239.178.74...
{'NodeID': 3003, 'City': 'Fremont', 'Comments': None, 'CounteractRadius': None, 'Department': None, 'Region': 'US-EMEA', 'Site': 'FRE', 'DisplayName': None, 'Description': None, 'InstanceType': 'Orion.NodesCustomProperties', 'Uri': 'swis://nrmpincmw001.ad.seagate.com/Orion/Orion.Nodes/NodeID=3003/CustomProperties', 'InstanceSiteId': 0}
DONE!
Traceback (most recent call last):
File "add-node.py", line 129, in <module>
addNode(npm_server,username,password,hostname,ip,community,site,region,city)
File "add-node.py", line 58, in addNode
swis.invoke('Cirrus.Nodes', 'AddNodeToNCM', nodeid)
File "/home/xsun/py3_venv/lib64/python3.6/site-packages/orionsdk/swisclient.py", line 31, in invoke
"Invoke/{}/{}".format(entity, verb), args).json()
File "/home/xsun/py3_venv/lib64/python3.6/site-packages/orionsdk/swisclient.py", line 63, in _req
resp.raise_for_status()
File "/home/xsun/py3_venv/lib64/python3.6/site-packages/requests/models.py", line 940, in raise_for_status
raise HTTPError(http_error_msg, response=self)
requests.exceptions.HTTPError: 403 Client Error: Access denied. WebViewer permission required. for url: https://solarwinds.seagate.com:17778/SolarWinds/InformationService/v3/Json/Invoke/Cirrus.Nodes/AddNodeToNCM
What kind of access does the error refers to ?
Thanks
Your logic look sound. If you try to do this work "manually" via SWQL Studio (right-click on the verb and select "Invoke") does it work?
Fill in the "Core" Node ID in question, then click Invoke.
If it works then the results should be something like this:
<Return xmlns="http://schemas.datacontract.org/2004/07/SolarWinds.InformationService.Contract">7e6398e6-65b2-4042-9589-f6647730c3f6</Return>
Where the GUID inside the return tag is the NodeID
from the new entry in Cirrus.Nodes
.
Ok. I found this link
I use Windows AD account. It does not work even I have the "Network configuration manager settings" administrator privilege.
If I use a local account with "Network configuration manager settings" with Webviewer privilege, the invoke is working now.
Ok. I found this link
I use Windows AD account. It does not work even I have the "Network configuration manager settings" administrator privilege.
If I use a local account with "Network configuration manager settings" with Webviewer privilege, the invoke is working now.
SolarWinds solutions are rooted in our deep connection to our user base in the THWACK® online community. More than 195,000 members are here to solve problems, share technology and best practices, and directly contribute to our product development process.