Installer sous Windows

Cette page installe les composants Mugnsoft comme services Windows. Un seul script PowerShell fait tout pour un composant : telechargement, verification de signature, configuration, regle de pare-feu, installation du service, enregistrement aupres du Webserver et demarrage. Les etapes manuelles qu’il automatise sont decrites ensuite.

Avant de commencer

  • Windows 10 / 11 ou Windows Server 2016 et suivants, 64 bits, et un PowerShell eleve (clic droit → Executer en tant qu’administrateur).
  • Pour verifier les paquets : gpg, fourni avec Git for Windows ou Gpg4win. Le script trouve l’un ou l’autre.
  • Les flux reseau ci-dessous ouverts dans vos pare-feu (le script ajoute la regle du Pare-feu Windows de l’hote ou il s’execute). Chaque composant ecoute sur son propre port d’API, et le Webserver se connecte a lui :
De Vers Port (defaut) Pourquoi
Navigateurs des utilisateurs Webserver TCP 9090 (PortWEB) Interface web
Monitors, Integrators, Sentinel Agents Webserver TCP 8050 (PortAPI) Enregistrement et envoi des donnees
Webserver chaque Monitor / Integrator / Sentinel Agent son port (paquets : monitor 8072, integrator 8060, sentinel 8078) Le Webserver pilote le composant
Monitors, Sentinel Agents Integrator TCP 8060 (son port) Donnees de supervision et de decouverte

D’autres ports peuvent etre choisis a l’installation ou changes ensuite : voir Ports.

  • Installez d’abord le Webserver : tous les autres composants ont besoin de deux valeurs qu’il produit.
  • Un composant de chaque type par hote : les noms de service sont fixes (MugnsoftWebserver, MugnsoftMonitor, MugnsoftIntegrator, MugnsoftDiscoveryAgent, MugnsoftWebserverFront).
  • Les services s’executent en LocalSystem. Executer un composant sous un compte dedie est reserve a Linux (Executer en non-root) : un RunUser dans le .json d’un composant est ignore sous Windows.
  • Sentinel Agent : le runtime Npcap est optionnel. Sans lui, la bande passante reseau est mesuree a partir des statistiques TCP de Windows, avec des restrictions (pas de detection du protocole a partir du contenu, connexions courtes non vues) ; voir les prerequis.

Vos valeurs

Les commandes de cette page utilisent ces valeurs d’exemple. Remplacez-les par les votres ; tout le reste se copie tel quel.

Valeur Origine Exemple (a remplacer !)
Adresse du Webserver IP ou nom DNS de l’hote Webserver, tel que les autres hotes le joignent 10.0.0.5
Port d’API du Webserver PortAPI de webserver.json (defaut) 8050
_sharedInternal Affiche a la fin de l’installation du Webserver (etape 1), aussi dans webserver.json 3f9c...e1 (64 caracteres hexa)
Fichier de licence license_MNS.dat envoye par Mugnsoft, un par Webserver et par Integrator, lie a son hote .\license_MNS.dat
Localisation Texte libre affiche sur le Webserver (monitor, sentinel) Paris

Option A — Script (recommande)

Dans un PowerShell eleve, telechargez mugnsoft-install.ps1 sur chaque hote :


Invoke-WebRequest "https://doc.mugnsoft.com/materials/mugnsoft-install.ps1" `
  -OutFile mugnsoft-install.ps1 -UseBasicParsing

1. Webserver (en premier). Placez votre license_MNS.dat a cote du script, puis :


powershell -ExecutionPolicy Bypass -File .\mugnsoft-install.ps1 webserver `
  -License .\license_MNS.dat

La fin de sa sortie donne ce dont les autres hotes ont besoin, par exemple :


Webserver installed in C:\Mugnsoft\webserver
  Web UI:   https://<this host>:9090/   (admin / admin, change it at first login)
  API:      <this host>:8050   -> the -Webserver value for the components
  _sharedInternal (pass it to every component as -SharedInternal):
    3f9c...e1

2. Sonde monitor, Integrator, Sentinel Agent, chacun sur son hote, avec votre adresse de Webserver et votre _sharedInternal :


# sonde monitor
powershell -ExecutionPolicy Bypass -File .\mugnsoft-install.ps1 monitor `
  -Webserver "10.0.0.5:8050" -SharedInternal 3f9c...e1 -Location Paris

# Integrator (il a son propre fichier de licence)
powershell -ExecutionPolicy Bypass -File .\mugnsoft-install.ps1 integrator `
  -Webserver "10.0.0.5:8050" -SharedInternal 3f9c...e1 -License .\license_MNS.dat

# Sentinel Agent
powershell -ExecutionPolicy Bypass -File .\mugnsoft-install.ps1 sentinel `
  -Webserver "10.0.0.5:8050" -SharedInternal 3f9c...e1 -Location Paris

Chaque execution se termine par ... installed ... and registered with 10.0.0.5:8050. Activez ensuite le composant.

Une autre version ou un autre dossier. -Version choisit la version (par defaut la plus recente, 4.3.0) et -InstallDir le dossier ou le composant est installe (par defaut C:\Mugnsoft\<dossier du composant>) :


powershell -ExecutionPolicy Bypass -File .\mugnsoft-install.ps1 sentinel -Version 4.2.0 `
  -InstallDir D:\Mugnsoft\sentinel -Webserver "10.0.0.5:8050" -SharedInternal 3f9c...e1

Ce que fait le script, dans l’ordre, en s’arretant au premier probleme avec un message indiquant quoi corriger :

  1. Controle les arguments, l’execution elevee et l’absence du dossier d’installation (il n’ecrase jamais une installation).
  2. Telecharge mugnsoft-<composant>-<version>.windows-amd64.zip et son .sig depuis https://mugnsoft.com/bin/<version>/, et verifie la signature avec la cle GPG publique de Mugnsoft (dans un trousseau jetable).
  3. L’extrait dans C:\Mugnsoft\<dossier du composant> (ou le dossier -InstallDir).
  4. Ecrit les valeurs dans le fichier .json du composant (et copie le fichier de licence).
  5. Ajoute une regle entrante du Pare-feu Windows Mugnsoft <composant> pour le ou les ports du composant.
  6. Lance <composant>.exe install : un monitor, un Integrator ou un Sentinel Agent s’enregistre a ce moment aupres du Webserver, et le service n’est cree que si cela reussit.
  7. Demarre le service.
Parametre Defaut Usage
-Version <x.y.z> 4.3.0 Version a installer, par exemple 4.2.0
-InstallDir <chemin> C:\Mugnsoft\<dossier du composant> Dossier ou le composant est installe, par exemple D:\Mugnsoft\monitor. Il ne doit pas encore exister ; ses dossiers parents sont crees
-Dir <chemin> C:\Mugnsoft Dossier parent a la place : le composant va dans <chemin>\<dossier du composant>. Ignore avec -InstallDir
-Package <fichier.zip> telechargement Installer un paquet deja present (son .sig doit etre a cote)
-NoVerify desactive Sauter la verification de signature (deconseille)
-Name <nom> <composant>-<nom de l'ordinateur> Nom du composant sur le Webserver : lettres, chiffres, tirets
-Port <port> celui du paquet Port d’API du composant
-Advertise <ip> detectee Monitor uniquement : l’IP que le Webserver doit composer pour joindre la sonde (voir Verifier l’adresse)
-WebserverUrl <url> https://<hote webserver>:9090 Integrator uniquement : lien vers l’interface web utilise dans les notifications
-ApiPort, -WebPort 8050, 9090 Webserver uniquement
-FrontPki <dossier> — Webserver-Front uniquement, voir Installer le Webserver-Front
-NoFirewall desactive Ne pas ajouter la regle du Pare-feu Windows

Get-Help .\mugnsoft-install.ps1 -Detailed affiche la meme liste.

<#
.SYNOPSIS
  Download, verify, configure, install and start one Mugnsoft component as a
  Windows service, in one command. Run it from an elevated PowerShell.

.EXAMPLE
  .\mugnsoft-install.ps1 webserver -License .\license_MNS.dat
.EXAMPLE
  .\mugnsoft-install.ps1 monitor -Webserver 10.0.0.5:8050 -SharedInternal 3f9c...e1 -Location Paris
.EXAMPLE
  .\mugnsoft-install.ps1 sentinel -Version 4.2.0 -InstallDir D:\Mugnsoft\sentinel -Webserver 10.0.0.5:8050 -SharedInternal 3f9c...e1

.PARAMETER Component
  webserver, monitor, integrator, sentinel or webserver-front.
.PARAMETER Version
  Release to install (default 4.3.0), e.g. 4.2.0.
.PARAMETER InstallDir
  Folder the component is installed in (default C:\Mugnsoft\<package folder>,
  e.g. C:\Mugnsoft\monitor). It must not exist yet; its parent folders are created.
.PARAMETER Dir
  Parent folder instead (default C:\Mugnsoft); the component goes in <Dir>\<package folder>.
  Ignored with -InstallDir.
.PARAMETER Package
  Install this package (.zip) instead of downloading it.
.PARAMETER NoVerify
  Skip the GPG signature check (not recommended).
.PARAMETER License
  webserver and integrator: the license_MNS.dat received from Mugnsoft.
.PARAMETER ApiPort
  webserver: API port (default 8050).
.PARAMETER WebPort
  webserver: web UI port (default 9090).
.PARAMETER Webserver
  monitor, integrator, sentinel: the Webserver API address, host:port (e.g. 10.0.0.5:8050).
.PARAMETER SharedInternal
  monitor, integrator, sentinel: the "_sharedInternal" value of the Webserver's webserver.json.
.PARAMETER Name
  Component name (default <component>-<computer name>).
.PARAMETER Port
  Component API port (default: the package's).
.PARAMETER Location
  Location shown on the Webserver (monitor, sentinel).
.PARAMETER Advertise
  monitor: IP address the Webserver must use to reach this probe (default: auto-detected).
.PARAMETER WebserverUrl
  integrator: Webserver web UI URL used in notifications (default https://<webserver host>:9090).
.PARAMETER FrontPki
  webserver-front: the front\ folder produced by mugnsoft-front-pki.sh.
.PARAMETER NoFirewall
  Do not add the Windows Firewall rule opening the component's port(s).
#>
[CmdletBinding()]
param(
  [Parameter(Mandatory = $true, Position = 0)]
  [ValidateSet("webserver", "monitor", "integrator", "sentinel", "webserver-front")]
  [string]$Component,
  [string]$Version = "4.3.0",
  [string]$InstallDir = "",
  [string]$Dir = "C:\Mugnsoft",
  [string]$Package = "",
  [switch]$NoVerify,
  [string]$License = "",
  [string]$ApiPort = "",
  [string]$WebPort = "",
  [string]$Webserver = "",
  [string]$SharedInternal = "",
  [string]$Name = "",
  [string]$Port = "",
  [string]$Location = "",
  [string]$Advertise = "",
  [string]$WebserverUrl = "",
  [string]$FrontPki = "",
  [switch]$NoFirewall
)
$ErrorActionPreference = "Stop"
$ProgressPreference = "SilentlyContinue"   # Invoke-WebRequest is 10x faster without the progress bar
[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12
$BaseUrl = "https://mugnsoft.com/bin"

function Fail($msg) { Write-Host "ERROR: $msg" -ForegroundColor Red; exit 1 }
function Info($msg) { Write-Host "==> $msg" -ForegroundColor Cyan }
# Run a native program and capture stdout+stderr. Windows PowerShell turns every
# stderr line into a terminating error under ErrorActionPreference=Stop, so relax
# it for the call only.
function Native([string]$exe, [string[]]$a) {
  $prev = $ErrorActionPreference; $ErrorActionPreference = "Continue"
  try { $o = & $exe @a 2>&1 | ForEach-Object { "$_" }; $code = $LASTEXITCODE } finally { $ErrorActionPreference = $prev }
  return @{ Out = ($o -join "`n"); Code = $code }
}

# component -> package folder and binary
$pkg = @{ "webserver" = "webserver"; "webserver-front" = "webserver-front"; "monitor" = "monitor";
          "integrator" = "integrator"; "sentinel" = "discovery_agent" }[$Component]
$bin = "$pkg.exe"; $conf = "$pkg.json"
if ($Version -notmatch '^\d+\.\d+\.\d+$') { Fail "-Version must look like 4.3.0, got '$Version'" }
# -InstallDir names the component's own folder; -Dir only its parent. A relative
# path is taken from the current PowerShell location (not .NET's working folder).
$target = if ($InstallDir) { $InstallDir } else { Join-Path $Dir $pkg }
$target = $ExecutionContext.SessionState.Path.GetUnresolvedProviderPathFromPSPath($target).TrimEnd('\')
if ($target -notmatch '^[A-Za-z]:\\[A-Za-z0-9 ._\\()+@-]+$') { Fail "install folder must be a local path (letters, digits, spaces and . _ - ( ) + @): '$target'" }
$deny = @($env:SystemRoot, $env:ProgramFiles, ${env:ProgramFiles(x86)}, $env:ProgramData, $env:USERPROFILE, "$env:SystemDrive\Users") | Where-Object { $_ } | ForEach-Object { $_.TrimEnd('\') }
if ($deny -contains $target) { Fail "refusing to install directly in $target : name a folder of its own" }

# ---- checks, before anything is written -------------------------------------
$admin = ([Security.Principal.WindowsPrincipal][Security.Principal.WindowsIdentity]::GetCurrent()).IsInRole([Security.Principal.WindowsBuiltInRole]::Administrator)
if (-not $admin) { Fail "run this script from an elevated PowerShell (Run as administrator)" }
foreach ($p in @(@("-ApiPort", $ApiPort), @("-WebPort", $WebPort), @("-Port", $Port))) {
  if ($p[1] -and -not ($p[1] -match '^\d+$' -and [int]$p[1] -ge 1 -and [int]$p[1] -le 65535)) { Fail "$($p[0]) must be a port number, got '$($p[1])'" }
}
foreach ($p in @(@("-Location", $Location), @("-Advertise", $Advertise), @("-WebserverUrl", $WebserverUrl))) {
  if ($p[1] -notmatch '^[A-Za-z0-9._:/@+=, -]*$') { Fail "$($p[0]) contains characters that are not allowed: '$($p[1])'" }
}
if ($Component -in @("webserver", "integrator")) {
  if (-not $License) { Fail "-License <license_MNS.dat> is required for the $Component" }
  if (-not (Test-Path $License -PathType Leaf)) { Fail "license file not found: $License" }
}
if ($Component -in @("monitor", "integrator", "sentinel")) {
  if (-not $Webserver) { Fail "-Webserver <host:port> is required (the Webserver API address)" }
  if ($Webserver -notmatch '^[A-Za-z0-9.-]+:\d+$') { Fail "-Webserver must look like host:port, e.g. 10.0.0.5:8050" }
  if (-not $SharedInternal) { Fail "-SharedInternal is required: copy `"_sharedInternal`" from the Webserver's webserver.json" }
  if ($SharedInternal -notmatch '^[A-Za-z0-9._~!#%^*+=-]+$') { Fail "-SharedInternal holds unexpected characters" }
  if (-not $Name) { $Name = "$Component-$($env:COMPUTERNAME.ToLower())" }
  if ($Name -notmatch '^[A-Za-z0-9-]+$') { Fail "-Name may hold letters, digits and hyphens only: '$Name'" }
}
if ($Component -eq "webserver-front") {
  if (-not $FrontPki) { Fail "-FrontPki <dir> is required: the front\ folder made by mugnsoft-front-pki.sh" }
  if (-not ((Test-Path "$FrontPki\config\ssl\certificates\webserver.pem") -and (Test-Path "$FrontPki\webserver-front.json"))) {
    Fail "$FrontPki does not look like the front\ folder of mugnsoft-front-pki.sh" }
}
if (Test-Path $target) { Fail "$target already exists: this script installs, it does not upgrade (see the Upgrade section of the docs)" }

$work = Join-Path $env:TEMP ("mugnsoft-install-" + [guid]::NewGuid().ToString("N"))
New-Item -ItemType Directory $work | Out-Null
try {
  # ---- 1. get the package -----------------------------------------------------
  $file = "mugnsoft-$pkg-$Version.windows-amd64.zip"
  if (-not $Package) {
    Info "Downloading $file"
    try { Invoke-WebRequest "$BaseUrl/$Version/$file" -OutFile "$work\$file" -UseBasicParsing } catch { Fail "download failed: $BaseUrl/$Version/$file" }
    if (-not $NoVerify) { try { Invoke-WebRequest "$BaseUrl/$Version/$file.sig" -OutFile "$work\$file.sig" -UseBasicParsing } catch { Fail "signature download failed" } }
    $Package = "$work\$file"
  } else {
    if (-not (Test-Path $Package -PathType Leaf)) { Fail "package not found: $Package" }
    $Package = (Resolve-Path $Package).Path
    if (-not $NoVerify -and -not (Test-Path "$Package.sig")) { Fail "no $Package.sig next to the package: download it too, or pass -NoVerify" }
  }

  # ---- 2. verify its signature (gpg from PATH, Git for Windows or Gpg4win) ------
  if (-not $NoVerify) {
    $gpg = (Get-Command gpg -ErrorAction SilentlyContinue).Source
    $git = (Get-Command git -ErrorAction SilentlyContinue).Source   # Git for Windows ships gpg in usr\bin
    $fromGit = if ($git) { Join-Path (Split-Path (Split-Path $git)) "usr\bin\gpg.exe" } else { "" }
    foreach ($c in @($fromGit, "$env:ProgramFiles\Git\usr\bin\gpg.exe", "${env:ProgramFiles(x86)}\GnuPG\bin\gpg.exe", "$env:ProgramFiles\GnuPG\bin\gpg.exe")) {
      if (-not $gpg -and $c -and (Test-Path $c)) { $gpg = $c }
    }
    if (-not $gpg) { Fail "gpg not found: install Git for Windows or Gpg4win to verify the package (or pass -NoVerify)" }
    Info "Verifying the GPG signature"
    try { Invoke-WebRequest "$BaseUrl/Mugnsoft_public.key" -OutFile "$work\Mugnsoft_public.key" -UseBasicParsing } catch { Fail "could not download Mugnsoft_public.key" }
    # a throw-away keyring, given as a RELATIVE --homedir: Git's (MSYS) gpg misreads
    # an absolute Windows path there, Gpg4win accepts both
    Push-Location $work
    New-Item -ItemType Directory gnupg | Out-Null
    Native $gpg @("--homedir", "gnupg", "--batch", "--quiet", "--import", "$work\Mugnsoft_public.key") | Out-Null
    $sig = if (Test-Path "$Package.sig") { "$Package.sig" } else { "$work\$file.sig" }
    $ok = (Native $gpg @("--homedir", "gnupg", "--batch", "--verify", $sig, $Package)).Code -eq 0
    Pop-Location
    if (-not $ok) { Fail "SIGNATURE CHECK FAILED for $Package : do not install it" }
    Info "Signature OK"
  } else {
    Write-Host "WARNING: signature not verified (-NoVerify)" -ForegroundColor Yellow
  }

  # ---- 3. extract ---------------------------------------------------------------
  Info "Extracting to $target"
  New-Item -ItemType Directory -Force (Split-Path $target) | Out-Null
  Expand-Archive $Package -DestinationPath "$work\x"
  if (-not (Test-Path "$work\x\$pkg")) { Fail "unexpected package layout: no $pkg\ folder inside" }
  Move-Item "$work\x\$pkg" $target
  Set-Location $target
  if (-not (Test-Path $conf)) { Fail "$conf missing from the package" }

  # set "key": "value" in a flat JSON file, adding the key when it is absent;
  # written back as UTF-8 WITHOUT BOM (a BOM makes the JSON unreadable to the component)
  $script:text = [IO.File]::ReadAllText("$target\$conf")
  function SetKey($key, $val) {
    $re = '("' + [regex]::Escape($key) + '"\s*:\s*)"[^"]*"'
    if ($script:text -match $re) { $script:text = [regex]::Replace($script:text, $re, { param($m) $m.Groups[1].Value + '"' + $val + '"' }) }
    else { $script:text = ([regex]'\{').Replace($script:text, "{`r`n    `"$key`": `"$val`",", 1) }
  }

  # ---- 4. configure ---------------------------------------------------------------
  Info "Configuring $conf"
  $ports = @()
  switch ($Component) {
    "webserver" {
      Copy-Item $License "$target\license_MNS.dat"
      if ($ApiPort) { SetKey "PortAPI" $ApiPort }
      if ($WebPort) { SetKey "PortWEB" $WebPort }
    }
    "webserver-front" { Copy-Item -Recurse -Force "$FrontPki\*" $target; $script:text = [IO.File]::ReadAllText("$target\$conf") }
    default {
      SetKey "_sharedInternal" $SharedInternal
      SetKey "webserver" $Webserver
      SetKey "name" $Name
      SetKey "description" "Mugnsoft $Component on $env:COMPUTERNAME"
      if ($Port) { SetKey "port" $Port }
      if ($Component -ne "integrator") { SetKey "location" $Location }
      if ($Component -eq "monitor" -and $Advertise) { SetKey "ip" $Advertise }
      if ($Component -eq "integrator") {
        Copy-Item $License "$target\license_MNS.dat"
        SetKey "os" "windows"
        if (-not $WebserverUrl) { $WebserverUrl = "https://" + $Webserver.Split(":")[0] + ":9090" }
        SetKey "webserverUrl" $WebserverUrl
      }
    }
  }
  [IO.File]::WriteAllText("$target\$conf", $script:text, (New-Object Text.UTF8Encoding $false))
  $cfg = $script:text | ConvertFrom-Json
  if ($Component -in @("webserver", "webserver-front")) { $ports = @($cfg.PortAPI, $cfg.PortWEB) } else { $ports = @($cfg.port) }

  # ---- 5. open the port(s) in Windows Firewall --------------------------------------
  if (-not $NoFirewall) {
    $rule = "Mugnsoft $Component"
    if (-not (Get-NetFirewallRule -DisplayName $rule -ErrorAction SilentlyContinue)) {
      New-NetFirewallRule -DisplayName $rule -Direction Inbound -Protocol TCP -LocalPort $ports -Action Allow | Out-Null
      Info "Firewall: inbound TCP $($ports -join ', ') allowed (rule '$rule')"
    }
  }

  # ---- 6. install the service (components register with the Webserver here) ------
  Info "Installing the service"
  $out = (Native "$target\$bin" @("install")).Out
  $out -split "`r?`n" | Where-Object { $_ -and $_ -notmatch '^time=' } | ForEach-Object { Write-Host "   $_" }
  # "Service '<name>' installed." - not "Service '<name>' not installed."
  if ($out -notmatch "Service '[^']+' installed\.") { Fail "the service was not installed - read the messages above, fix, then run: cd $target; .\$bin install" }

  # ---- 7. start it ----------------------------------------------------------------
  Info "Starting the service"
  (Native "$target\$bin" @("start")).Out -split "`r?`n" | Where-Object { $_ -and $_ -notmatch '^time=' } | ForEach-Object { Write-Host "   $_" }

  # install generates the webserver's _sharedInternal: read the config again
  $cfg = [IO.File]::ReadAllText("$target\$conf") | ConvertFrom-Json
  Write-Host ""
  switch ($Component) {
    "webserver" {
      Write-Host "Webserver installed in $target"
      Write-Host "  Web UI:   https://<this host>:$($cfg.PortWEB)/   (admin / admin, change it at first login)"
      Write-Host "  API:      <this host>:$($cfg.PortAPI)   -> the -Webserver value for the components"
      Write-Host "  _sharedInternal (pass it to every component as -SharedInternal):"
      Write-Host "    $($cfg._sharedInternal)"
      Write-Host "  Ports $($cfg.PortAPI) (API) and $($cfg.PortWEB) (web UI): $(if ($NoFirewall) { 'open them in the firewall' } else { 'opened in Windows Firewall' })."
    }
    "webserver-front" {
      Write-Host "Webserver-Front installed in $target - now configure ADMIN (see the Webserver-Front install page)."
      Write-Host "  Ports $($cfg.PortAPI) (replication, reached by ADMIN) and $($cfg.PortWEB) (web UI)."
    }
    default {
      Write-Host "$Component '$Name' installed in $target and registered with $Webserver."
      Write-Host "  Port $($cfg.port): the Webserver connects to it - $(if ($NoFirewall) { 'open it in the firewall' } else { 'opened in Windows Firewall' })."
      Write-Host "Last step: on the Webserver, open Settings (gear) > Components, right-click '$Name' and choose enable server."
    }
  }
} finally {
  Set-Location $env:TEMP
  Remove-Item -Recurse -Force $work -ErrorAction SilentlyContinue
}

Option B — Pas a pas

Les memes etapes a la main, dans un PowerShell eleve.

1. Telecharger et verifier (sur chaque hote ; $c vaut webserver, monitor, integrator ou discovery_agent) :


$v = "4.3.0"; $c = "monitor"              # <- changer $c pour chaque hote
$f = "mugnsoft-$c-$v.windows-amd64.zip"
Invoke-WebRequest "https://mugnsoft.com/bin/$v/$f" -OutFile $f -UseBasicParsing
Invoke-WebRequest "https://mugnsoft.com/bin/$v/$f.sig" -OutFile "$f.sig" -UseBasicParsing
Invoke-WebRequest "https://mugnsoft.com/bin/Mugnsoft_public.key" `
  -OutFile Mugnsoft_public.key -UseBasicParsing

Verifiez dans Git Bash (ou une invite Gpg4win) depuis le meme dossier. La commande doit afficher Good signature from "Mugnsoft ..." ; l’avertissement This key is not certified est attendu. Un BAD signature signifie que le fichier est corrompu ou altere : supprimez-le.


gpg --import Mugnsoft_public.key
gpg --verify mugnsoft-monitor-4.3.0.windows-amd64.zip.sig \
             mugnsoft-monitor-4.3.0.windows-amd64.zip

Puis extrayez (de retour dans PowerShell) :


Expand-Archive $f -DestinationPath C:\Mugnsoft
cd C:\Mugnsoft\$c

2. Hote Webserver : copiez la licence, installez et demarrez, puis lisez _sharedInternal (le Webserver en ecrit un aleatoire dans webserver.json lors de install) :


Copy-Item C:\chemin\vers\license_MNS.dat C:\Mugnsoft\webserver\
cd C:\Mugnsoft\webserver
.\webserver.exe install; .\webserver.exe start
Select-String _sharedInternal webserver.json
New-NetFirewallRule -DisplayName "Mugnsoft webserver" -Direction Inbound `
  -Protocol TCP -LocalPort 8050,9090 -Action Allow

3. Hote Monitor / Integrator / Sentinel Agent : editez le fichier .json du composant (monitor.json, integrator.json ou discovery_agent.json) avec le Bloc-notes et renseignez :

Cle Valeur Note
_sharedInternal la valeur du Webserver Doit etre identique a celle du Webserver
webserver 10.0.0.5:8050 Adresse et port d’API du Webserver
name un nom unique, ex. monitor-paris-1 Lettres, chiffres, tirets. La valeur du paquet est un exemple
location, description votre texte Les valeurs du paquet sont des exemples
port garder, ou un autre port libre Le Webserver doit pouvoir le joindre
ip monitor uniquement, optionnel L’IP que le Webserver doit composer, si l’hote en a plusieurs
webserverUrl https://10.0.0.5:9090 Integrator uniquement

Pour l’Integrator, copiez aussi son license_MNS.dat dans C:\Mugnsoft\integrator\. Puis ouvrez le port, installez (ce qui enregistre le composant) et demarrez, en remplacant monitor et 8072 par votre composant et son port :


New-NetFirewallRule -DisplayName "Mugnsoft monitor" -Direction Inbound `
  -Protocol TCP -LocalPort 8072 -Action Allow
.\monitor.exe install; .\monitor.exe start

install doit afficher deux fois status: Success (enregistrement, puis certificat) et Service '...' installed.

Activer les composants

Un composant enregistre reste en attente tant que vous ne l’activez pas :

  1. Connectez-vous a https://10.0.0.5:9090/ (admin / admin ; un nouveau mot de passe est exige a la premiere connexion).
  2. Ouvrez le menu engrenage → components, clic droit sur le nouveau composant → enable server. Un message de succes confirme que le Webserver l’a joint.

Verifier l’adresse. Le Webserver se connecte a l’adresse IP enregistree par le composant. Un hote avec plusieurs interfaces reseau peut enregistrer la mauvaise : enable server echoue alors avec getting access token: Failed. Make sure the component is running. Clic droit sur le composant → edit server, saisissez l’IP que le Webserver peut joindre, enregistrez, puis activez-le a nouveau. Pour un monitor, vous pouvez aussi passer -Advertise <ip> (ou renseigner ip dans monitor.json) avant l’installation.

Ports

Chaque composant ecoute sur son ou ses propres ports TCP, definis dans son fichier .json :

Composant Port par defaut Cle dans son .json Joint par
Webserver 8050 (API) PortAPI Monitors, Integrators, Sentinel Agents, clients de l’API
Webserver 9090 (interface web) PortWEB Navigateurs des utilisateurs
Sonde monitor 8072 port Webserver
Integrator 8060 port Webserver, Monitors, Sentinel Agents
Sentinel Agent 8078 port Webserver
Webserver-Front 8040 (replication), 9080 (interface web) PortAPI, PortWEB Webserver ADMIN, navigateurs des utilisateurs

D’autres ports a l’installation. Avec le script : -ApiPort et -WebPort pour le Webserver, -Port pour un monitor, un Integrator ou un Sentinel Agent. Les composants ont alors besoin du port d’API du Webserver dans -Webserver "<hote>:<port API>". A la main : changez la cle dans le fichier .json avant de lancer install.

Les ouvrir. Le script ajoute une regle entrante du Pare-feu Windows Mugnsoft <composant> pour le ou les ports installes (sauf avec -NoFirewall) et les affiche a la fin. A la main, ou pour un autre pare-feu sur le chemin, la meme regle est :


New-NetFirewallRule -DisplayName "Mugnsoft monitor" -Direction Inbound -Protocol TCP -LocalPort 8072 -Action Allow

Changer ensuite le port d’un Monitor, d’un Integrator ou d’un Sentinel Agent, dans cet ordre (le Webserver verifie qu’il joint le composant sur le nouveau port avant de l’enregistrer) :

  1. Mettez le nouveau port dans le fichier .json du composant, puis redemarrez-le : .\monitor.exe restart.
  2. Ouvrez le nouveau port : Set-NetFirewallRule -DisplayName "Mugnsoft monitor" -LocalPort <nouveau port>.
  3. Sur le Webserver, menu engrenage → components, clic droit sur le composant → edit server, saisissez le nouveau port, enregistrez. Pour un Integrator, le Webserver pousse ensuite sa nouvelle adresse aux monitors et aux Sentinel Agents.

Changer ensuite les ports du Webserver : mettez PortAPI / PortWEB dans webserver.json et redemarrez-le (.\webserver.exe restart), mettez a jour sa regle (Set-NetFirewallRule -DisplayName "Mugnsoft webserver" -LocalPort <port API>,<port web>), puis dans le .json de chaque composant mettez webserver a <hote>:<nouveau port API> et redemarrez le composant. Apres un changement du port web, mettez aussi a jour webserverUrl dans integrator.json (liens des notifications).

Gerer les services

Tache Commande (depuis le dossier du composant) Equivalent Windows
Etat — Get-Service MugnsoftMonitor
Arreter / demarrer / redemarrer .\monitor.exe stop, .\monitor.exe start, .\monitor.exe restart Restart-Service MugnsoftMonitor
Executer au premier plan (debogage) .\monitor.exe stop; .\monitor.exe run —
S’enregistrer a nouveau aupres du Webserver .\monitor.exe register —
Supprimer le service .\monitor.exe uninstall (puis supprimer le dossier) —
Journaux log\monitor.log dans le dossier du composant —

Remplacez monitor / MugnsoftMonitor par webserver / MugnsoftWebserver, integrator / MugnsoftIntegrator, discovery_agent / MugnsoftDiscoveryAgent. Un composant se retire du Webserver depuis sa page Components (clic droit → delete server).

Pour une mise a jour, suivez l’ordre et les controles des notes de version de la version cible ; cette page couvre les nouvelles installations.

Sondes monitor : navigateurs pour les parcours EUM

URL, API, TCP, ping et les autres types de moniteurs n’ont besoin de rien de plus. Les parcours EUM (Web UI) ont besoin d’un navigateur sur l’hote de la sonde : Chrome, Edge ou Firefox. Au demarrage, le monitor telecharge le webdriver correspondant s’il peut joindre Internet. Sinon, telechargez vous-meme le driver correspondant a la version du navigateur et placez-le dans C:\Mugnsoft\monitor\drivers\ :

Navigateur Driver Telechargement
Chrome chromedriver.exe Chrome for Testing
Firefox geckodriver.exe geckodriver releases
Edge msedgedriver.exe Edge WebDriver

Pour enregistrer des parcours, utilisez Mugnsoft Pulse ou le Mugnsoft IDE.

Depannage

Message Cause et correction
self pre-registering ... status: Failed / Make sure that component can reach the Webserver API endpoint. L’hote ne joint pas webserver sur le port d’API : verifiez la valeur, le service Webserver, les pare-feu. Testez avec Test-NetConnection 10.0.0.5 -Port 8050
a server is already defined with this name Un composant de ce nom existe sur le Webserver (une tentative precedente). Supprimez-le sur la page Components, ou choisissez un autre -Name, puis relancez install
a server is already defined with this IP and port Un composant a deja enregistre cette adresse IP et ce port (une installation precedente de cet hote). Supprimez-le sur la page Components, ou utilisez un autre -Port, puis relancez install
Failed to install service '...': service ... already exists Ce type de composant est deja installe sur cet hote : un par hote. Utilisez-le, ou faites d’abord uninstall
No license ...\license_MNS.dat file found Integrator : copiez son fichier de licence dans son dossier (-License avec le script)
license not valid for this machine Le fichier de licence appartient a un autre hote : les licences sont liees a l’hote
enable server : getting access token: Failed Le Webserver ne joint pas le composant : mauvaise IP enregistree (voir Verifier l’adresse), ou port du composant bloque
enable server / Push Settings : rejected the internal login (HTTP 401) _sharedInternal differe de celui du Webserver : corrigez-le dans le .json du composant et redemarrez le composant
running scripts is disabled on this system Lancez le script avec powershell -ExecutionPolicy Bypass -File ... comme ci-dessus
<dossier> already exists (script) Le script n’ecrase jamais une installation : choisissez un autre -InstallDir, ou supprimez d’abord l’ancienne (uninstall)
SIGNATURE CHECK FAILED (script) / BAD signature Le paquet est corrompu ou altere : telechargez-le a nouveau ; ne l’installez jamais

Voir aussi

Traductions