> 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/fr/plateforme/monitoring.md).

# Surveillance

Surveillez PowerShell Universal avec Azure Application Insights et les compteurs de performance Windows, et consultez les processus actifs et les sessions utilisateur dans la console.

PowerShell Universal s'intègre automatiquement à Microsoft Application Insights pour assurer la surveillance et les alertes de votre système. Il fournit également des compteurs de performance pour diverses fonctionnalités de l'environnement.

## Application Insights

### Configurer Application Insights

Dans le portail Azure, vous devrez créer une nouvelle ressource Application Insights. Une fois créée, vous devrez copier la chaîne de connexion.

Ensuite, collez votre chaîne de connexion dans le [fichier de paramètres ](/powershell-universal/fr/config/settings.md)de PowerShell Universal. Enfin, redémarrez le serveur PowerShell Universal. La surveillance de l'application sera maintenant activée.

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

Si vous exécutez PowerShell Universal dans Azure, vous pouvez également créer un nouveau paramètre d'application. Dans votre application web, cliquez sur Configuration, puis sur Nouveau paramètre d'application.

Le nom devrait être :

```
APPLICATIONINSIGHTS__CONNECTIONSTRING
```

La valeur devrait être la chaîne de connexion. Redémarrez votre application web pour commencer à collecter des métriques.

### Consulter les données de surveillance

Dans le portail Azure, vous pouvez consulter la ressource Application Insights pour voir les informations sur votre serveur PowerShell Universal. Cela inclura des données telles que les réponses échouées, le temps de réponse du serveur, les requêtes du serveur et la disponibilité. Vous pourrez aussi configurer des alertes pour surveiller des conditions particulières du serveur PowerShell Universal.

## Compteurs de performance

{% hint style="info" %}
Les compteurs de performance sont uniquement pris en charge sous Windows.
{% endhint %}

Les compteurs de performance sont installés lors de l'exécution de l'installateur MSI. Une fois cela fait, les données de performance seront automatiquement générées par les compteurs suivants.

* 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

### Installation

Par défaut, le MSI installera les compteurs de performance. Si vous exécutez PowerShell Universal en dehors du MSI, vous devrez les installer vous-même. Vous pouvez le faire avec le script suivant. Vous devrez l'exécuter à partir d'une invite élevée.

```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
}
```

## Processus

Les processus démarrés directement depuis PowerShell Universal seront affichés dans la page des processus. Vous pouvez accéder à cette page en cliquant sur Accueil, puis sur la carte Processus.

Les informations incluent l'ID du processus, son objectif, le nom du fichier et l'utilisation de la mémoire. Vous pouvez également voir l'état des runspaces au sein du processus.

Notez que les processus démarrés par vos scripts ne seront pas listés ici.

## Sessions utilisateur

Vous pouvez consulter les sessions utilisateur des tableaux de bord et de la console d'administration en cliquant sur la carte Sessions utilisateur dans la page d'accueil. Les informations de session incluent l'heure de connexion, la source, le nom d'utilisateur, la chaîne user agent et l'adresse IP distante.


---

# 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/fr/plateforme/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.
