I'm running the query below to return the number of times an eventlog has appeared in the last 5 minutes. This will return an accurate number. I've tested this from the Orion server's powershell terminal against all my servers and it works. However when I run it via the integrated powershell monitor in APM (4.0.1) I get the error below. The issue is that I've done all the steps necessary. I got that error locally in the terminal until I enabled PSRemoting and added the computer to the trustedhosts. Anyone have any idea:
Get-EventLog Application -ComputerName <remote-server-ip-address> -message *someString* -entrytype Error | where {$_.eventID -eq ####} | where {$_.TimeGenerated -gt (get-date).AddMinutes(-5)} | Group-Object EntryType | Format-Table Count -HideTableHeaders
I put my server's IP address in the monitor
I put my real string I'm searching for after "-message"
I put the real eventid I'm searching on
Below is the error I'm getting when I test the Application Monitor via the web console:
---------------------------------------------
Testing on node N1G6DB2 WAN (0.117): failed with 'NotAvailable' status
Connecting to remote server failed with the following error message : The WinRM client cannot process the request. If the authentication scheme is different from Kerberos, or if the client computer is not joined to a domain, then HTTPS transport must be used or the destination machine must be added to the TrustedHosts configuration setting. Use winrm.cmd to configure TrustedHosts. Note that computers in the TrustedHosts list might not be authenticated. You can get more information about that by running the following command: winrm help config. For more information, see the about_Remote_Troubleshooting Help topic.
---------------------------------------------
I've tried checking the https box and not checking it. I'm using V2. I confirmed my servers use that version ($host.version). the Orion server and the others are both Windows Server 2008 R2 x64. If I run either of the following queries I can see that TrustedHosts is set to "local" which means all servers in the same workgroup will work (this is our case as there's no domain). And it does work now if I run locally on the Orion server's powershell terminal.
(A) Set-Item WSMan:\localhost\Client\TrustedHosts
or
(B) winrm get winrm/config
If you haven't noticed, yes this is my attempt to find a script that can query for the exact number of times an event has occured since the last polling cycle. So far it works great if I run it directly on the server, just not via the web.