5 Replies Latest reply on Nov 8, 2017 3:34 AM by yaquaholic

    Help Troubleshooting a Powershell Monitor


      I have a powershell monitor running on a few application servers, that is supposed to return a Warning state if there are more or less than 1 instance of a particular process running (we've had issues with multiple versions being spawned). The powershell script that I'm using for the monitor works fine in isolation, and returns the correct process count - The monitor in Solarwinds takes that returned value as a Statistic and is supposed to issue a warning if the Statistic value is not 1.


      Unfortunately, the monitor goes down multiple times a day, I see that the monitor status is "3" (meaning Critical). But I can't get any info on why / how this is happening. Is this a failure to connect to the monitored server (or a timeout)? Is the script returning a bad value? Are there good suggestions for how to troubleshoot this problem? I've created an Alert email with all of the variables that I can seem to find for this monitor, but it doesn't seem to be giving me any info of use except the Status "3" value.

        • Re: Help Troubleshooting a Powershell Monitor

          Hi claidheamh, can you upload the PowerShell monitor, so that we can have a look it a for you?

          • Re: Help Troubleshooting a Powershell Monitor

            Here's the Script portion of the monitor:


            Script Arguments: ${IP}

            Script Body: $remoteserver = '${IP}'

                 $processname = 'zequal'

                 $statistic = @(Get-Process $processname -ComputerName $remoteserver -ErrorAction 0).Count

                 Write-Host "Statistic: $statistic"


              • Re: Help Troubleshooting a Powershell Monitor

                A few things you could try, in:


                1. Logs - have you enabled the debug options and had a trawl through the logs?


                From the application view, at the end of the URL and you will see something like: NetObject=AA:xxxx  The number is the application ID. 

                On the poller the the node is polled, navigate to C:\ProgramData\SolarWinds\Logs\APM\ApplicationLogs directory (ProgramDAta is hidden by default) and look for the AppID folder that matches your ApplicationID (sort by date and newest files  it'll be near/at the top).  


                2. Local or remote execution of the monitor.

                    Have you tried removing the $remoteserver = '${IP}' and the "-ComputerName $remoteserver" from the script and then running the PowerShell in Execution Mode: Remote Host?

                This invokes the command on the server, rather than running it locally. It might help.


                3. Keep it simple and just use the 'Process Monitor - Windows' component type?

                  • Re: Help Troubleshooting a Powershell Monitor

                    Yaquaholic -


                    -Process Monitor for Windows doesn't seem to have an option to monitor for a specific number of instances, just the existence of instances on the node, which doesn't solve my problem (need to see when duplicates are spawned).


                    -I don't seem to have the Advanced / Debug Logging option available, was that recently introduced? I'm a couple of revisions behind on SAM.


                    I'm trying the Remote Host method to see if this works better for us.


                    Thanks for the help!

                      • Re: Help Troubleshooting a Powershell Monitor

                        Morning claidheamh ,


                        The Process monitoring picks up on all running instances of the desired process.

                        I threw up a quick template, using csrss.exe (as there be more than one instance running on my test box):


                        And it knows how many processes are running and their PIDs, so it will be alertable on.

                        You can quickly over complicate things with PowerShell, and even after years of practice, I often end up with the debugging on and going through log files troubleshooting.


                        If you still want to debug, the debugging is available in the template configuration, but it is hidden by default and it has been around for as long as I can remember (strokes his grey beard for dramatic effect).

                        Hit the advanced button and it will appear.


                        Hope it helps