'test failed with "unknown" status' - Windows PowerShell Monitor

Getting 'test failed with "unknown" status' on a Windows PowerShell Monitor such as the one below. This happens on multiple nodes, local or remote host, etc. Orion does get the stats back as evident from the screenshots - so why doesn't it get the exit code? Or is something else at play?

Write-Host 'Message: test' 
Write-Host 'Statistic: 0'

Screen Shot 2017-07-26 at 2.23.37 PM.png

Screen Shot 2017-07-26 at 2.24.23 PM.png

Did review the following, checked out Configuring and Integrating PowerShell.pdf - didn't help.

(Running Orion Platform 2017.1.3 SP3, NPM 12.1, SAM 6.4.0.)

  • Submitted a support request to Solarwinds Support. Their response:

    Re: Update for Case #1209887 - "failed with "unknown" status' - Windows PowerShell Monitor."

    Hi,

    Since the powershell monitor is a custom script we do not support the writing of the custom script. We do have some pointers on how the system must be configured for your script to run here:

    Problems using the Orion APM Windows PowerShell Monitor

    Regards, ***** ***** | DPA Support Technician SolarWinds – Unexpected Simplicity

    Find it curious that a tech support specialist would take this issue of failure to run any PS script as asking for a custom script support.

    Questions:

    • Does Solarwinds support PowerShell based monitoring and alerting in their products (SAM)?
      • If so, what is the extent of that support?
    • Just curious: why is a "DPA Support Technician" involved in SAM support?

    Note: Problems using the Orion APM Windows PowerShell Monitor does not help: does not cover the issue I am having.

  • Solarwinds is able to reproduce the behavior every time yet is refusing to start a bug tracker - they're asking for my diagnostics and logs.

    In order to make it work: "edit script", choose random credentials, save, then back to "inherit from node" - and it may start working. If not, rinse and repeat.

    Solarwinds: just in case you're listening. This is a bug you're able to reproduce and it's directing affecting a feature you're advertising as part of SAM: scripted monitoring. As it is, Powershell scripts with "inherit from node" credentials do not work OOTB w/o jumping through the hoops.

    The policy of refusing the start a bug tracker without my logs and diagnostics on a bug you can reproduce is beyond unreasonable. I hope you get the hint.

  • For this SAM Component, do you have a "Script Output" section? This would normally be right below the Execution Mode configuration fields, where your screenshot cuts off.

    There can be up to 10 "Script Output" sections but there must be at least one.

    To generate the required section you do have to EDIT SCRIPT > GET SCRIPT OUTPUT. And yes, inherit credentials is NOT an option in this portion, so yes you will have to select credentials that will work for the test node selected.

    This is actually one of my pet peeves about script-based monitors with SAM. It makes having dynamic, multiple Script Outputs a little tricky to work out.

  • Just to be clear, in replicating your exact issue.  The only way I could get this to replicate is by bypassing the 'Get Script Output' on the initial edit script setup.  If I clicked on 'Get Script Ouput' regardless of whether or not I set credentials to something or 'none'.  I would get a successful output and then tests would complete going forward.  The only time I would get your error is if I did not click on 'Get Script Output' when initially configuring things. Then I could consistently get the 'Unknown error'.  Is that consistent with your experience?   Is that a bug or a process issue?

  • Can you post an actual script that's having this problem? The snipped that you posted at the beginning does not explicitly specify an exit code.

  • Have you tested WINRM config manually by running a test-wsman against the target server from the poller? Also have you tried running the script using local host as the execution mode to make sure it's not just a localised powershell issue?

  • Hi - just went through the same exercise, what fixed it for me was the following combination:

    Write-host "Statistic: 0"

    Exit 0;

    Seems like SolarWinds wants both. I had just the Exit 0 and it kept failing. Soon as I added the write-host, it worked. However there are other statistics I want the script to report, still working on that.