Monitoring
Monitoring PowerShell Universal with Application Insights and Performance Counters
Last updated
Monitoring PowerShell Universal with Application Insights and Performance Counters
Last updated
PowerShell Universal automatically integrates with Microsoft Application Insights to provide monitoring and alerting for your system. It also provides performance counters for various features in the environment.
Within the Azure Portal, you will need to create a new Application Insights resource. Once it's been created, you will need to copy the instrumentation key.
Next, paste your instrumentation key into the Settings file for PowerShell Universal. Finally, restart the PowerShell Universal server. Application monitoring will now be enabled.
If you are running PowerShell Universal in Azure, you can also create a new Application Setting. Within your web app, click Configuration and the n Click New application setting.
The name should be:
The value should be the instrumentation key. Restart your web app to start collecting metrics.
Within the Azure Portal, you can view the Application Insights resource to view information about your PowerShell Universal server. This will include data such as failed responses, server response time, server requests and availability. You'll also be able to setup alerts to monitor for particular conditions of the PowerShell Universal server.
Performance counters are only supported on Windows.
Performance counters are installed when running the MSI installer. Once this occurs, performance data will automatically be generated by the following counters.
PowerShell Universal \ Active API Endpoints \ _Total
PowerShell Universal \ Active API Endpoints \ Endpoint
PowerShell Universal \ API Endpoint Calls per Second \ _Total
PowerShell Universal \ API Endpoint Calls per Second \ Endpoint
PowerShell Universal \ API Execution Time \ _Total
PowerShell Universal \ API Execution Time \ Endpoint
PowerShell Universal \ Active Dashboard Connections \ _Total
PowerShell Universal \ Active Dashboard Connections \ Dashboard
By default, the MSI will install the performance counters. If you are running PowerShell Universal outside of the MSI, you will need to install them yourself. You can do so with the following script. You will need to run it from an elevated prompt.
Processes started directly from PowerShell Universal will be displayed in the processes page. You can access this page by click Home and then the Processes card.
Information includes the process ID, purpose, file name, and memory usage. You can also view the state of runspaces within the process.
Note that processes started by your scripts will not be listed here.
You can view user sessions for dashboards and the admin console by click the User Sessions card on the Home page. Session information includes the connection time, source, user name, user agent string and remote IP Address.