Installer sous Linux

Cette page installe les composants Mugnsoft comme services Linux (systemd, Upstart ou SysV sont detectes automatiquement). Un seul script fait tout pour un composant : telechargement, verification de signature, configuration, installation du service, enregistrement aupres du Webserver et demarrage. Les etapes manuelles qu’il automatise sont decrites ensuite.

Avant de commencer

  • Un hote Linux 64 bits (Debian, Ubuntu, RHEL et derives, voir les prerequis) et un shell root (sudo -i).
  • curl (ou wget) et gpg :

# Debian / Ubuntu
apt-get install -y curl gnupg
# RHEL / Rocky / Alma / CentOS / Fedora
dnf install -y curl gnupg2
  • Les flux reseau ci-dessous ouverts dans vos pare-feu. 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).

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)

Telechargez mugnsoft-install.sh sur chaque hote, puis lancez, en root, la ligne du composant que recoit cet hote :


curl -fsSLO https://doc.mugnsoft.com/materials/mugnsoft-install.sh

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


bash mugnsoft-install.sh webserver --license ./license_MNS.dat

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


Webserver installed in /opt/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 --shared-internal):
    3f9c...e1

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


# sonde monitor
bash mugnsoft-install.sh monitor    --webserver 10.0.0.5:8050 --shared-internal 3f9c...e1 --location Paris

# Integrator (il a son propre fichier de licence)
bash mugnsoft-install.sh integrator --webserver 10.0.0.5:8050 --shared-internal 3f9c...e1 --license ./license_MNS.dat

# Sentinel Agent
bash mugnsoft-install.sh sentinel   --webserver 10.0.0.5:8050 --shared-internal 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 --install-dir le dossier ou le composant est installe (par defaut /opt/mugnsoft/<dossier du composant>). Les options peuvent etre donnees dans n’importe quel ordre :


bash mugnsoft-install.sh sentinel --version 4.2.0 --install-dir /srv/mugnsoft/sentinel \
     --webserver 10.0.0.5:8050 --shared-internal 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 en root et l’absence du dossier d’installation (il n’ecrase jamais une installation).
  2. Telecharge mugnsoft-<composant>-<version>.linux-amd64.tar.gz 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 /opt/mugnsoft/<dossier du composant> (ou le dossier --install-dir) et rend les programmes executables.
  4. Ecrit les valeurs dans le fichier .json du composant (et copie le fichier de licence).
  5. Lance <composant> 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.
  6. Demarre le service. Le service est active au demarrage du systeme.
Option Defaut Usage
--version <x.y.z> 4.3.0 Version a installer, par exemple 4.2.0
--install-dir <chemin> /opt/mugnsoft/<dossier du composant> Dossier ou le composant est installe, par exemple /srv/mugnsoft/monitor. Il ne doit pas encore exister ; ses dossiers parents sont crees
--dir <chemin> /opt/mugnsoft Dossier parent a la place : le composant va dans <chemin>/<dossier du composant>. Ignore avec --install-dir
--package <fichier> telechargement Installer un paquet deja present, .tar.gz ou .zip (son .sig doit etre a cote)
--no-verify desactive Sauter la verification de signature (deconseille)
--name <nom> <composant>-<nom court de l'hote> 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)
--run-as <utilisateur> root Executer le service sous ce compte, cree au besoin. Voir Executer en non root. Version 4.3.0 ou superieure
--webserver-url <url> https://<hote webserver>:9090 Integrator uniquement : lien vers l’interface web utilise dans les notifications
--api-port, --web-port 8050, 9090 Webserver uniquement
--front-pki <dossier> — Webserver-Front uniquement, voir Installer le Webserver-Front

bash mugnsoft-install.sh --help affiche la meme liste.

#!/usr/bin/env bash
# mugnsoft-install.sh - download, verify, configure, install and start one Mugnsoft
# component as a Linux service (systemd, Upstart or SysV), in one command.
#
# Usage (as root):
#   bash mugnsoft-install.sh <component> [options]    (options in any order)
#
# Components:
#   webserver        the Webserver (needs --license)
#   monitor          a monitor probe
#   integrator       an Integrator (needs --license)
#   sentinel         a Sentinel Agent (discovery_agent)
#   webserver-front  a Webserver-Front (needs --front-pki)
#
# Options:
#   --version <x.y.z>          release to install (default 4.3.0)
#   --install-dir <path>       folder the component is installed in (default
#                              /opt/mugnsoft/<package folder>, e.g. /opt/mugnsoft/monitor)
#   --dir <path>               parent folder instead (default /opt/mugnsoft); the
#                              component goes in <path>/<package folder>
#   --package <file>           install this package (.tar.gz or .zip) instead of downloading it
#   --no-verify                skip the GPG signature check (not recommended)
#   --run-as <user>            run the service under this account instead of root,
#                              creating it if needed (needs version 4.3.0 or later)
#   webserver, integrator:
#   --license <file>           the license_MNS.dat received from Mugnsoft
#   webserver:
#   --api-port <port>          API port (default 8050)
#   --web-port <port>          web UI port (default 9090)
#   monitor, integrator, sentinel:
#   --webserver <host:port>    the Webserver API address (host:API port, e.g. 10.0.0.5:8050)
#   --shared-internal <value>  the "_sharedInternal" value of the Webserver's webserver.json
#   --name <name>              component name (default <component>-<short hostname>)
#   --port <port>              component API port (default: the package's)
#   --location <text>          location shown on the Webserver (monitor, sentinel)
#   --advertise <ip>           monitor only: IP address the Webserver must use to
#                              reach this probe (default: auto-detected)
#   --webserver-url <url>      integrator only: Webserver web UI URL used in
#                              notifications (default https://<webserver host>:9090)
#   webserver-front:
#   --front-pki <dir>          the front/ folder produced by mugnsoft-front-pki.sh
#
# Examples (replace the values with yours):
#   bash mugnsoft-install.sh webserver --license ./license_MNS.dat
#   bash mugnsoft-install.sh monitor --webserver 10.0.0.5:8050 --shared-internal 3f9c...e1 --location Paris
#   bash mugnsoft-install.sh sentinel --version 4.3.0 --install-dir /srv/mugnsoft/sentinel \
#        --webserver 10.0.0.5:8050 --shared-internal 3f9c...e1

set -euo pipefail

VERSION=4.3.0 DIR=/opt/mugnsoft INSTALL_DIR="" PACKAGE="" VERIFY=1
LICENSE="" API_PORT="" WEB_PORT="" WEBSERVER="" SHARED="" NAME="" PORT="" LOCATION=""
ADVERTISE="" WEBSERVER_URL="" FRONT_PKI="" RUN_AS=""
BASE_URL="https://mugnsoft.com/bin"

die()  { echo "ERROR: $*" >&2; exit 1; }
info() { echo "==> $*"; }
usage() { sed -n '2,/^$/p' "$0" | sed 's/^# \{0,1\}//'; exit "${1:-0}"; }
fetch() { if command -v curl >/dev/null; then curl -fsSL -o "$2" "$1"; else wget -q -O "$2" "$1"; fi; }

[ $# -ge 1 ] || usage 1
COMPONENT=""
while [ $# -gt 0 ]; do
  case "$1" in
    -h|--help) usage 0 ;;
    --no-verify) VERIFY=0; shift; continue ;;
    -*) ;;
    *) [ -z "$COMPONENT" ] || die "unexpected argument '$1' (one component per run)"
       COMPONENT="$1"; shift; continue ;;
  esac
  [ $# -ge 2 ] && [ "${2#--}" = "$2" ] || die "option $1 needs a value"
  case "$1" in
    --version) VERSION="$2" ;;          --dir) DIR="$2" ;;
    --install-dir) INSTALL_DIR="$2" ;;
    --package) PACKAGE="$2" ;;
    --license) LICENSE="$2" ;;          --api-port) API_PORT="$2" ;;
    --web-port) WEB_PORT="$2" ;;        --webserver) WEBSERVER="$2" ;;
    --shared-internal) SHARED="$2" ;;   --name) NAME="$2" ;;
    --port) PORT="$2" ;;                --location) LOCATION="$2" ;;
    --advertise) ADVERTISE="$2" ;;      --webserver-url) WEBSERVER_URL="$2" ;;
    --front-pki) FRONT_PKI="$2" ;;      --run-as) RUN_AS="$2" ;;
    *) die "unknown option: $1 (see --help)" ;;
  esac
  shift 2
done

# component -> package name, folder, binary, config file
[ -n "$COMPONENT" ] || die "no component given (webserver, monitor, integrator, sentinel, webserver-front; see --help)"
case "$COMPONENT" in
  webserver)       PKG=webserver;        BIN=webserver ;;
  webserver-front) PKG=webserver-front;  BIN=webserver-front ;;
  monitor)         PKG=monitor;          BIN=monitor ;;
  integrator)      PKG=integrator;       BIN=integrator ;;
  sentinel|discovery_agent) COMPONENT=sentinel; PKG=discovery_agent; BIN=discovery_agent ;;
  *) die "unknown component '$COMPONENT' (webserver, monitor, integrator, sentinel, webserver-front)" ;;
esac
CONF="$BIN.json"
[[ "$VERSION" =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]] || die "--version must look like 4.3.0, got '$VERSION'"
# --install-dir names the component's own folder; --dir only its parent
if [ -n "$INSTALL_DIR" ]; then
  [[ "$INSTALL_DIR" = /* ]] || INSTALL_DIR="$PWD/$INSTALL_DIR"
  TARGET="${INSTALL_DIR%/}"
else
  TARGET="${DIR%/}/$PKG"
fi
[[ "$TARGET" =~ ^/[A-Za-z0-9._/+@-]+$ ]] || die "install folder may hold letters, digits and . _ - + @ / only: '$TARGET'"
case "$TARGET" in /|/bin|/boot|/dev|/etc|/home|/lib*|/opt|/proc|/root|/run|/sbin|/srv|/sys|/tmp|/usr|/usr/*bin|/var) die "refusing to install directly in $TARGET: name a folder of its own" ;; esac

# ---- checks, before anything is written -------------------------------------
[ "$(id -u)" -eq 0 ] || die "run as root (sudo bash $0 ...)"
for c in tar gzip sed grep; do command -v "$c" >/dev/null || die "'$c' is required: install it first"; done
num() { [[ "$2" =~ ^[0-9]+$ ]] && [ "$2" -ge 1 ] && [ "$2" -le 65535 ] || die "$1 must be a port number, got '$2'"; }
safe() { [[ "$2" =~ ^[A-Za-z0-9._:/@+=,\ -]*$ ]] || die "$1 contains characters that are not allowed: '$2'"; }
[ -n "$API_PORT" ] && num --api-port "$API_PORT"
[ -n "$WEB_PORT" ] && num --web-port "$WEB_PORT"
[ -n "$PORT" ] && num --port "$PORT"
if [ -n "$RUN_AS" ]; then
  [[ "$RUN_AS" =~ ^[a-z_][a-z0-9_-]{0,30}$ ]] || die "--run-as must be a valid user name, got '$RUN_AS'"
  [ "$(printf '%s\n' 4.3.0 "$VERSION" | sort -V | head -n 1)" = 4.3.0 ] || die "--run-as needs version 4.3.0 or later (--version)"
  # only systemd applies the account: SysV and Upstart scripts would start the program as root
  [ -d /run/systemd/system ] || die "--run-as needs systemd as the init system"
  [ "$RUN_AS" = root ] || id -u "$RUN_AS" >/dev/null 2>&1 || command -v useradd >/dev/null \
    || die "'useradd' is required to create $RUN_AS: install shadow-utils (RHEL) or passwd (Debian)"
fi
case "$COMPONENT" in
  webserver|integrator)
    [ -n "$LICENSE" ] || die "--license <license_MNS.dat> is required for the $COMPONENT"
    [ -f "$LICENSE" ] || die "license file not found: $LICENSE" ;;
esac
case "$COMPONENT" in
  monitor|integrator|sentinel)
    [ -n "$WEBSERVER" ] || die "--webserver <host:port> is required (the Webserver API address)"
    [[ "$WEBSERVER" =~ ^[A-Za-z0-9.-]+:[0-9]+$ ]] || die "--webserver must look like host:port, e.g. 10.0.0.5:8050"
    [ -n "$SHARED" ] || die "--shared-internal is required: copy \"_sharedInternal\" from the Webserver's webserver.json"
    [[ "$SHARED" =~ ^[A-Za-z0-9._~!#%^*+=-]+$ ]] || die "--shared-internal holds unexpected characters"
    NAME="${NAME:-$COMPONENT-$(hostname -s)}"
    [[ "$NAME" =~ ^[A-Za-z0-9-]+$ ]] || die "--name may hold letters, digits and hyphens only: '$NAME'"
    safe --location "$LOCATION"; safe --advertise "$ADVERTISE"; safe --webserver-url "$WEBSERVER_URL" ;;
  webserver-front)
    [ -n "$FRONT_PKI" ] || die "--front-pki <dir> is required: the front/ folder made by mugnsoft-front-pki.sh"
    [ -f "$FRONT_PKI/config/ssl/certificates/webserver.pem" ] && [ -f "$FRONT_PKI/webserver-front.json" ] \
      || die "$FRONT_PKI does not look like the front/ folder of mugnsoft-front-pki.sh" ;;
esac
[ -e "$TARGET" ] && die "$TARGET already exists: this script installs, it does not upgrade (see the Upgrade section of the docs)"

WORK=$(mktemp -d); trap 'rm -rf "$WORK"' EXIT

# ---- 1. get the package -----------------------------------------------------
FILE="mugnsoft-$PKG-$VERSION.linux-amd64.tar.gz"
if [ -z "$PACKAGE" ]; then
  info "Downloading $FILE"
  fetch "$BASE_URL/$VERSION/$FILE" "$WORK/$FILE" || die "download failed: $BASE_URL/$VERSION/$FILE"
  [ "$VERIFY" -eq 1 ] && { fetch "$BASE_URL/$VERSION/$FILE.sig" "$WORK/$FILE.sig" || die "signature download failed"; }
  PACKAGE="$WORK/$FILE"
else
  [ -f "$PACKAGE" ] || die "package not found: $PACKAGE"
  [ "$VERIFY" -eq 1 ] && { [ -f "$PACKAGE.sig" ] || die "no $PACKAGE.sig next to the package: download it too, or pass --no-verify"; cp "$PACKAGE.sig" "$WORK/pkg.sig"; }
fi

# ---- 2. verify its signature -------------------------------------------------
if [ "$VERIFY" -eq 1 ]; then
  command -v gpg >/dev/null || die "'gpg' is required to verify the package (or pass --no-verify)"
  info "Verifying the GPG signature"
  SIG="$PACKAGE.sig"; [ -f "$WORK/pkg.sig" ] && SIG="$WORK/pkg.sig"
  export GNUPGHOME="$WORK/gnupg"; mkdir -m 700 "$GNUPGHOME"
  fetch "$BASE_URL/Mugnsoft_public.key" "$WORK/key" || die "could not download Mugnsoft_public.key"
  gpg --batch --quiet --import "$WORK/key" 2>/dev/null
  gpg --batch --verify "$SIG" "$PACKAGE" 2>/dev/null || die "SIGNATURE CHECK FAILED for $PACKAGE: do not install it"
  info "Signature OK"
else
  echo "WARNING: signature not verified (--no-verify)" >&2
fi

# ---- 3. extract ---------------------------------------------------------------
info "Extracting to $TARGET"
mkdir -p "$(dirname "$TARGET")"
mkdir "$WORK/x"
case "$PACKAGE" in
  *.zip) command -v unzip >/dev/null || die "'unzip' is required for a .zip package"; unzip -q "$PACKAGE" -d "$WORK/x" ;;
  *)     tar -xzf "$PACKAGE" -C "$WORK/x" ;;
esac
[ -d "$WORK/x/$PKG" ] || die "unexpected package layout: no $PKG/ folder inside"
mv "$WORK/x/$PKG" "$TARGET"
cd "$TARGET"
chmod +x "./$BIN"
[ -d exec ] && find exec -maxdepth 1 -type f \( -name ffmpeg -o -name harx \) -exec chmod +x {} +
[ -d exec/jdk/bin ] && chmod +x exec/jdk/bin/*
[ -f "$CONF" ] || die "$CONF missing from the package"

# set "key": "value" in a flat JSON file, adding the key when it is absent
setkey() {
  local key="$1" val="$2"
  if grep -q "\"$key\"[[:space:]]*:" "$CONF"; then
    sed -i -E "s|(\"$key\"[[:space:]]*:[[:space:]]*)\"[^\"]*\"|\1\"$val\"|" "$CONF"
  else
    sed -i -E "0,/\{/s|\{|{\n    \"$key\": \"$val\",|" "$CONF"
  fi
}

# ---- 4. configure ---------------------------------------------------------------
info "Configuring $CONF"
case "$COMPONENT" in
  webserver)
    cp "$LICENSE" ./license_MNS.dat
    [ -n "$API_PORT" ] && setkey PortAPI "$API_PORT"
    [ -n "$WEB_PORT" ] && setkey PortWEB "$WEB_PORT" ;;
  webserver-front)
    cp -r "$FRONT_PKI"/. . ;;
  *)
    setkey _sharedInternal "$SHARED"
    setkey webserver "$WEBSERVER"
    setkey name "$NAME"
    setkey description "Mugnsoft $COMPONENT on $(hostname -s)"
    [ -n "$PORT" ] && setkey port "$PORT"
    [ "$COMPONENT" != integrator ] && setkey location "$LOCATION"
    [ "$COMPONENT" = monitor ] && [ -n "$ADVERTISE" ] && setkey ip "$ADVERTISE"
    [ "$COMPONENT" = sentinel ] && setkey discoFSGMonitored "/"
    if [ "$COMPONENT" = integrator ]; then
      cp "$LICENSE" ./license_MNS.dat
      setkey webserverUrl "${WEBSERVER_URL:-https://${WEBSERVER%%:*}:9090}"
    fi ;;
esac
chmod 600 "$CONF"   # holds _sharedInternal
if [ -n "$RUN_AS" ] && [ "$RUN_AS" != root ]; then
  if ! id -u "$RUN_AS" >/dev/null 2>&1; then
    NOLOGIN=/usr/sbin/nologin; [ -x "$NOLOGIN" ] || NOLOGIN=/sbin/nologin; [ -x "$NOLOGIN" ] || NOLOGIN=/bin/false
    # a group of that name left by an earlier account is reused
    if getent group "$RUN_AS" >/dev/null; then GRPOPT=(--gid "$RUN_AS"); else GRPOPT=(--user-group); fi
    useradd --system "${GRPOPT[@]}" --home-dir "/home/$RUN_AS" --create-home --shell "$NOLOGIN" "$RUN_AS"
    info "Created system account $RUN_AS (home /home/$RUN_AS)"
  fi
  # the browser profiles and caches of EUM journeys and PDF reports go under the home folder
  RUN_HOME=$(getent passwd "$RUN_AS" | cut -d: -f6)
  if [ -n "$RUN_HOME" ] && [ "$RUN_HOME" != / ] && [ ! -d "$RUN_HOME" ]; then
    install -d -m 700 -o "$RUN_AS" -g "$(id -gn "$RUN_AS")" "$RUN_HOME"
    command -v restorecon >/dev/null 2>&1 && restorecon "$RUN_HOME" || true
  elif [ "$RUN_HOME" = "/home/$RUN_AS" ]; then
    chown "$RUN_AS:$(id -gn "$RUN_AS")" "$RUN_HOME"; chmod 700 "$RUN_HOME"
  fi
  setkey RunUser "$RUN_AS"
fi

# ---- 5. install the service (components register with the Webserver here) ------
info "Installing the service"
OUT=$("./$BIN" install 2>&1) || true
echo "$OUT" | grep -v '^time=' || true
# "Service '<name>' installed." - not "Service '<name>' not installed."
echo "$OUT" | grep -q "Service '[^']*' installed\." || die "the service was not installed - read the messages above, fix, then run: cd $TARGET && ./$BIN install"

# ---- 6. start it ----------------------------------------------------------------
info "Starting the service"
"./$BIN" start 2>&1 | grep -v '^time=' || true

echo
getkey() { sed -n -E "s/.*\"$1\"[[:space:]]*:[[:space:]]*\"([^\"]*)\".*/\1/p" "$CONF" | head -n 1; }
# the script leaves the firewall alone: say which ports must be reachable
firewall_hint() {
  local p; for p in "$@"; do
    if command -v firewall-cmd >/dev/null && firewall-cmd --state >/dev/null 2>&1; then
      echo "    firewall-cmd --permanent --add-port=$p/tcp && firewall-cmd --reload"
    elif command -v ufw >/dev/null && ufw status 2>/dev/null | grep -q "Status: active"; then
      echo "    ufw allow $p/tcp"
    fi
  done
}
case "$COMPONENT" in
  webserver)
    echo "Webserver installed in $TARGET"
    echo "  Web UI:   https://<this host>:$(getkey PortWEB)/   (admin / admin, change it at first login)"
    echo "  API:      <this host>:$(getkey PortAPI)   -> the --webserver value for the components"
    echo "  _sharedInternal (pass it to every component as --shared-internal):"
    echo "    $(getkey _sharedInternal)"
    echo "  Ports $(getkey PortAPI) (API) and $(getkey PortWEB) (web UI) must be reachable from the other hosts and the browsers:"
    firewall_hint "$(getkey PortAPI)" "$(getkey PortWEB)" ;;
  webserver-front)
    echo "Webserver-Front installed in $TARGET - now configure ADMIN (see the Webserver-Front install page)."
    echo "  Ports $(getkey PortAPI) (replication, reached by ADMIN) and $(getkey PortWEB) (web UI) must be reachable:"
    firewall_hint "$(getkey PortAPI)" "$(getkey PortWEB)" ;;
  *)
    echo "$COMPONENT '$NAME' installed in $TARGET and registered with $WEBSERVER."
    echo "  Port $(getkey port): the Webserver connects to it, it must be reachable from the Webserver host:"
    firewall_hint "$(getkey port)"
    echo "Last step: on the Webserver, open Settings (gear) > Components, right-click '$NAME' and choose enable server." ;;
esac

Option B — Pas a pas

Les memes etapes a la main. Fixez d’abord les deux variables, puis lancez les blocs dans l’ordre.

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


VERSION=4.3.0; COMPONENT=monitor          # <- changer COMPONENT pour chaque hote
F=mugnsoft-$COMPONENT-$VERSION.linux-amd64.tar.gz
curl -fsSLO https://mugnsoft.com/bin/$VERSION/$F
curl -fsSLO https://mugnsoft.com/bin/$VERSION/$F.sig
curl -fsSLO https://mugnsoft.com/bin/Mugnsoft_public.key
gpg --import Mugnsoft_public.key
gpg --verify $F.sig $F                    # doit afficher : Good signature from "Mugnsoft ..."
mkdir -p /opt/mugnsoft && tar -xzf $F -C /opt/mugnsoft && cd /opt/mugnsoft/$COMPONENT
chmod +x ./$COMPONENT

gpg ajoute WARNING: This key is not certified with a trusted signature! : c’est attendu, ce qui compte est Good signature. Un BAD signature signifie que le fichier est corrompu ou altere : supprimez-le.

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


cp /chemin/vers/license_MNS.dat /opt/mugnsoft/webserver/
cd /opt/mugnsoft/webserver
./webserver install && ./webserver start
grep _sharedInternal webserver.json

3. Hote Monitor / Integrator / Sentinel Agent : editez le fichier .json du composant (monitor.json, integrator.json ou discovery_agent.json) 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 Optionnels : vide, location affiche le nom de l’hote
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
RunUser un compte Linux Optionnel : executer le service sous ce compte plutot qu’en root. Voir Executer en non root

Pour l’Integrator, copiez aussi son license_MNS.dat dans /opt/mugnsoft/integrator/. Puis installez (ce qui enregistre le composant) et demarrez :


./monitor install && ./monitor start            # ou ./integrator, ./discovery_agent

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 : --api-port et --web-port 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. Le script affiche a la fin le ou les ports a ouvrir.

Les ouvrir. Le script ne modifie pas le pare-feu. Avec firewalld (famille RHEL), sur chaque hote, pour son ou ses propres ports :


firewall-cmd --permanent --add-port=8072/tcp && firewall-cmd --reload   # ici : un monitor

Avec ufw (Ubuntu) : ufw allow 8072/tcp.

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 restart.
  2. Ouvrez le nouveau port dans le pare-feu.
  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 restart), ouvrez les nouveaux ports, 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 systemd
Etat — systemctl status MugnsoftMonitor
Arreter / demarrer / redemarrer ./monitor stop, ./monitor start, ./monitor restart systemctl restart MugnsoftMonitor (ou stop, start)
Executer au premier plan (debogage) ./monitor stop && ./monitor run —
S’enregistrer a nouveau aupres du Webserver ./monitor register —
Supprimer le service ./monitor uninstall (puis supprimer le dossier) —
Journaux log/monitor.log dans le dossier du composant journalctl -u MugnsoftMonitor

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 : installez-y 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 /opt/mugnsoft/monitor/drivers/ :

Navigateur Driver Telechargement
Chrome chromedriver Chrome for Testing
Firefox geckodriver geckodriver releases
Edge msedgedriver 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 curl -k https://10.0.0.5:8050/ping (repond {"message":"pong"})
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
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 (machine-id sous Linux)
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
<dossier> already exists (script) Le script n’ecrase jamais une installation : choisissez un autre --install-dir, 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