> For the complete documentation index, see [llms.txt](https://docs.devolutions.net/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.devolutions.net/powershell-universal/it/piattaforma/monitoring.md).

# Monitoraggio

PowerShell Universal si integra automaticamente con Microsoft Application Insights per fornire monitoraggio e avvisi per il suo sistema. Fornisce inoltre contatori delle prestazioni per varie funzionalità nell'ambiente.

## Application Insights

### Configurazione di Application Insights

Nel portale di Azure, dovrà creare una nuova risorsa Application Insights. Una volta creata, dovrà copiare la stringa di connessione.

![Application Insights Information](/files/lbIr2B5ofeLZhOEreZTE)

Successivamente, incolli la stringa di connessione nel [file Impostazioni ](/powershell-universal/it/config/settings.md)di PowerShell Universal. Infine, riavvii il server PowerShell Universal. Il monitoraggio dell'applicazione sarà ora abilitato.

```json
  "ApplicationInsights": {
    "ConnectionString": "InstrumentationKey=73b84b67-6fc9-4c37-9f54-000000000000"
  },
```

Se esegue PowerShell Universal in Azure, può anche creare una nuova impostazione dell'applicazione. All'interno della sua app web, clicchi su Configurazione e poi su Nuova impostazione dell'applicazione.

Il nome deve essere:

```
APPLICATIONINSIGHTS__CONNECTIONSTRING
```

Il valore deve essere la stringa di connessione. Riavvii la sua app web per iniziare a raccogliere le metriche.

### Visualizzazione dei dati di monitoraggio

Nel portale di Azure, può visualizzare la risorsa Application Insights per consultare le informazioni sul suo server PowerShell Universal. Sono inclusi dati come le risposte non riuscite, il tempo di risposta del server, le richieste al server e la disponibilità. Potrà inoltre configurare avvisi per monitorare condizioni particolari del server PowerShell Universal.

## Contatori delle prestazioni

{% hint style="info" %}
I contatori delle prestazioni sono supportati solo su Windows.
{% endhint %}

I contatori delle prestazioni vengono installati eseguendo l'installer MSI. Una volta fatto, i dati sulle prestazioni verranno generati automaticamente dai seguenti contatori.

* 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

### Installazione

Per impostazione predefinita, l'MSI installerà i contatori delle prestazioni. Se esegue PowerShell Universal al di fuori dell'MSI, dovrà installarli manualmente. Può farlo con lo script seguente. Dovrà eseguirlo da un prompt con privilegi elevati.

```powershell
$categoryName = "PowerShell Universal"
$categoryType = [System.Diagnostics.PerformanceCounterCategoryType]::MultiInstance
$categoryExists = [System.Diagnostics.PerformanceCounterCategory]::Exists($categoryName)

If (-Not $categoryExists)
{
$objCCDC = New-Object System.Diagnostics.CounterCreationDataCollection
$objCCD1 = New-Object System.Diagnostics.CounterCreationData
$objCCD1.CounterName = "Active Endpoints"
$objCCD1.CounterType = "NumberOfItems32"
$objCCD1.CounterHelp = "Active number of executing endpoints."
$objCCDC.Add($objCCD1) | Out-Null

$objCCD1 = New-Object System.Diagnostics.CounterCreationData
$objCCD1.CounterName = "Execution Time"
$objCCD1.CounterType = "averageTimer32"
$objCCD1.CounterHelp = "Average execution time."
$objCCDC.Add($objCCD1) | Out-Null

$objCCD1 = New-Object System.Diagnostics.CounterCreationData
$objCCD1.CounterName = "Execution Time Base"
$objCCD1.CounterType = "averageBase"
$objCCD1.CounterHelp = "Average execution time base."
$objCCDC.Add($objCCD1) | Out-Null

$objCCD1 = New-Object System.Diagnostics.CounterCreationData
$objCCD1.CounterName = "Calls per second"
$objCCD1.CounterType = "rateOfCountsPerSecond64"
$objCCD1.CounterHelp = "Number of executions per second."
$objCCDC.Add($objCCD1) | Out-Null

$objCCD1 = New-Object System.Diagnostics.CounterCreationData
$objCCD1.CounterName = "Active Connections"
$objCCD1.CounterType = "numberOfItems64"
$objCCD1.CounterHelp = "Number of active connections to dashboards"
$objCCDC.Add($objCCD1) | Out-Null

[System.Diagnostics.PerformanceCounterCategory]::Create($categoryName, $categoryHelp, $categoryType, $objCCDC)|Out-Null
}
```

## Processi

I processi avviati direttamente da PowerShell Universal verranno visualizzati nella pagina dei processi. Può accedere a questa pagina cliccando su Home e poi sulla scheda Processi.

Le informazioni includono l'ID del processo, lo scopo, il nome del file e l'utilizzo della memoria. Può anche visualizzare lo stato dei runspace all'interno del processo.

<figure><img src="/files/gr4C3CwRcunmxhtI4G9n" alt=""><figcaption></figcaption></figure>

Si noti che i processi avviati dai suoi script non verranno elencati qui.

## Sessioni utente

Può visualizzare le sessioni utente per le dashboard e la console di amministrazione cliccando sulla scheda Sessioni utente nella pagina Home. Le informazioni sulla sessione includono l'ora di connessione, l'origine, il nome utente, la stringa dello user agent e l'indirizzo IP remoto.

<figure><img src="/files/JnP1rbmIR9iJzFCDLCLo" alt=""><figcaption></figcaption></figure>


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.devolutions.net/powershell-universal/it/piattaforma/monitoring.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
