I'm quite new to Orion and am trying to figure out how to run PowerShell scripts (as in ps1 files) on my monitored systems. It looks like the SAM component needs several manual steps (create a template, configure its credentials, copy a script into a text field, and a bunch of other manual UI stuff based on the 18-step process at Windows PowerShell Monitor ).
But I don't want to do any of that - I want to have the agent run scripts that exist as files and can therefore have their contents centrally controlled via git or perforce, and track the metrics they report. Just manually copying code excerpts into a field is far too manual for 2020.
I could have the "script" in the powershell monitor just call another script by name, but I would sure like to know if there's a less-kludgy way to do what I want.
I've definitely done what you describe of just having my SAM monitors call local files. As you said its kludgy but does the job. The usual problem I run into here is that server admins write scripts for the purposes of things they need done, and almost never care to think about the format requirements I have in order for SW to interpret the results of their scripts or to collect monitoring-centric metrics in their scripts.
For me, when working in places with good script source control like a Git I have built automations where the latest version of the scripts is just inserted directly into the SAM DB. Not sure how into the weeds you want to go with it, but all the necessary verbs do exist where you could automate the whole process of creating scripts in the repository, have that kick off a script that goes into SAM and creates a corresponding powershell component monitor with the script body being set from what's in your repo, or updating the existing component to reflect any script changes. Within 1-2 polling cycles all the new version of the script will be in effect.
Getting it all to work requires a pretty strong understanding of the Orion API verbs and the SQL table relationships unfortunately, but it can be done.
Hmm. Can I use the Orion SDK to update metrics directly? Or is it more for manipulating node data and metadata?
e.g. something conceptually like send-orionmetric -node X -metric Y -value Z
There's no good option for piping metric data directly into orion. The api *could* be used to do it, but the application as a whole would probably not be happy with you because it was designed with that kind of flow in mind. Orion assumes that they will be the ones collecting metrics, its not just a time series database receptacle like a prometheus or influxdb. They wrote the code for collecting data with the assumption that you would not need to do it yourself.
SolarWinds solutions are rooted in our deep connection to our user base in the THWACK® online community. More than 150,000 members are here to solve problems, share technology and best practices, and directly contribute to our product development process.