Im trying to create a raise ServiceNow alert action that will work with both Nodes and Interfaces.
The one stickler i have is trying to set the ServiceNow Configuration Item with the Node Name.
Now for Interface the variable would be ${N=SwisEntity;M=Node.Caption} and for Node the variable is ${N=SwisEntity;M=Caption} but wont work for either or.
So after some fiddling i thought this SWQL variable would work for both to take the NodeID wherther was the Node or Interface alerting and use that to find matching NodeID on the Nodes Table and pull Caption
${N=SWQL;M=SELECT Caption from Orion.Nodes WHERE ${N=SwisEntity;M=Node.NodeID} = ${N=SwisEntity;M=NodeID} }
However in testing im finding the script is not matching the Node IDs and so is pulling the wrong Node Caption.
When i use this in the alert message and test:
Interface Node ID: ${N=SwisEntity;M=NodeID}
Matched Node ID: ${N=SWQL;M=SELECT NodeID from Orion.Nodes WHERE ${N=SwisEntity;M=Node.NodeID} = ${N=SwisEntity;M=NodeID} }
The result shows it is not finding the correct match:
Interface Node ID: 29
Matched Node ID: 28
Can anyone advise if ive made a mistake in the SWQL script or if there is a more elegant solution for a variable for Node Name that will work with both Nodes and Interfaces.
Cheers