We're building custom alert actions that will send properties and values to our ServiceNow Event Management instance to create/close Events automatically for us. I have a PowerShell script that we will run as Trigger/Reset Actions for each alert. The script accepts a bunch of properties and values and sends them on. To do this though we have to build a list of Alert Variables (Macros) for each Object Type alerted on in SolarWinds. So we need a list of alert variables for Node alerts, SAM Component Alerts, SAM Application Alerts, Interface Alerts, etc...
One unfortunate feature of the new Alert Macro syntax is that based on the object type being alerted on, the alert macro syntax is different. For example, if the alert is for SAM Components and we want to include a few Node properties , we have to format the Node property macros like this: ${N=SwisEntity;M=Application.Node.Caption}. One nice thing about the old Macros is that we could just do ${Node.Caption} and that Macro would work for any object type that had some kind of relationship with Nodes. We could use that same variable in Volume, Interface, SAM, and VIM alerts. Heck, I think you could even use that variable in a Node alert... There really needs to be a more universal way to format alert variables. The new syntax is just wayyyy too specific.
MAIN QUESTION:
It is rather tedious to have to go into an alert for each object type, go to the Trigger Action section, choose Insert Variable in the Message box, and tediously go through the Object picker to find all of the variables we want. Then we have to copy/paste those into our Notepad++ file and format the variables for our arguments. I was hoping to build some kind of variable builder script using the Metadata.Entity and Metadata.Relationship "tables". Unfortunately they don't seem to have all Relationships matched for each Entity type. For example, the Orion.APM.Component entity has 19 different relationships when you expand it in the SWQL Studio Entity tree. However, in the Metadata.Relationship table it only has 14 relationships. One of the 5 it is missing is its most important one which is the Orion.APM.Application relationship which allows me to navigate through to the Orion.Nodes entity.
Am I missing something or can someone let me know if there is a better way to go about this? I'd just like to be able to create a script where we can put in the object type we are building an alert for and the properties we want to have alert macros built of. So we could put in something like Orion.APM.Application.Name, Orion.Nodes.Caption, Orion.Nodes.CustomProperties.SiteCode, etc... Then, it would go lookup the relationships that Orion.APM.Component has with the entity tables those properties live in and, if they are found, spit out the properly formatted Alert Macros ready to go.