I'm currently working on adding ~200 ICMP only nodes to our Orion Platform and using python to do so. However, I am having an issue once they have been added to Orion which is that they will not poll status or response time. Below is my code for adding the node. The Node is successfully added but it remains unknown status.
def add_to_orion(ip, caption, address, office, swis):
try:
# Add Node
props = {
'IPAddress': ip,
'Caption': caption,
'EngineID': 1,
'ObjectSubType': 'ICMP'
}
print(f"Adding node {caption} ({ip})... ", end="")
results = swis.create('Orion.Nodes', **props)
print("Success!")
nodeid = search(r'(\d+)$', results).group(0)
pollers_enabled = {
'N.Status.ICMP.Native': True,
'N.ResponseTime.ICMP.Native': True,
}
pollers = []
for k in pollers_enabled:
pollers.append(
{
'PollerType': k,
'NetObject': 'N:' + nodeid,
'NetObjectType': 'N',
'NetObjectID': nodeid,
'Enabled': pollers_enabled[k]
}
)
for poller in pollers:
print(
f" Adding poller type: {poller['PollerType']} with"
f" status {poller['Enabled']}... ",
end=""
)
swis.create('Orion.Pollers', **poller)
print("Success!")
# Update Custom Properties
print(
"Updating Custom Properties:"
f"\n Address : '{address}''"
f"\n Office : '{office}'"
f"\n Device Type : 'TEMP'"
f"\n Team : 'TEMP'"
f"\n Owner : 'TEMP'"
)
node_cp = swis.query(
"SELECT URI FROM Orion.NodesCustomProperties "
f"WHERE NodeID = {nodeid}"
)['results'][0]
swis.update(
node_cp['URI'],
address=address,
_office=office,
_devicetype='TEMP',
team='TEMP',
owner='TEMP'
)
except Exception as e:
print(f"ERROR:\n\t{e}")