Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Make by tools (01.00.01) - action=merge_page
Scroll Ignore
scroll-viewporttrue
scroll-pdftrue
scroll-officetrue
scroll-chmtrue
scroll-docbooktrue
scroll-eclipsehelptrue
scroll-epubtrue
scroll-htmlfalse
Panel
titleSommaire

Table of Contents
stylenone

Description

Ce module source vous permet de détecter automatiquement des équipements réseau et des serveurs physiques dans votre l'infrastructure pour faciliter et accélérer leur import dans la configuration.

  • Cette source utilise la commande nmap pour la découverte des équipements.
  • pour cela la commande nmap:
    • Scanne les machines présentes sur le réseau et détecte les ports ouverts ;
    • Essaye de déterminer le constructeur de l'équipement en fonction de son adresse MAC ;.
    • Si possible, détermine son FQDN (  Fully Qualified Domain Name  ).

La source Discovery permet de définir des règles qui,

  • suivant les valeurs remontées par la commande nmap,
  • apportent un complément d'information sur les équipements découverts
  • Ce complément d'information peut être :
    • Des modèles d'hôtes suivant le type d'équipement.
    • L'ajout d'un préfixe au nom de l'équipement.


Cette page vous explique comment de définir ce type de collecteur et la page Collecteur de type ( discovery-import ) - Import depuis un scan réseau vous décrit comment l'utiliser.

Activation du collecteur

Vous pouvez Il est possible d'avoir uniquement une source de type discovery-import.

Par défaut, l’installation de Shinken Entreprise va mettre à disposition cette source sous le nom "discovery".

  • Le fichier est disponible sous /etc/shinken/sources/discovery.cfg
  • Pour avoir cette source disponible
    • Le nom "discovery" doit être présent dans le paramètre sources   du fichier  /etc/shinken/synchronizers/synchronizer-master.cfg .



Exemple :

Code Block
languagejs
themeConfluence
define synchronizer { 
	...
    sources                   Source 1, Source 2, Source 3, discovery
     ...
}


Pour prendre en compte le changement de configuration, redémarrer le Synchronizer:

Code Block
languagetext
themeEmacs
service shinken-synchronizer restart

Configuration

La configuration du module se trouve par défaut dans le fichier    fichier /etc/shinken/sources/discovery.cfg.

Fichier de configuration

Code Block
languagejs
themeConfluence
title/etc/shinken/sources/discovery.cfg
# CFG_FORMAT_VERSION 1 ( SHINKEN : DON'T TOUCH THIS LINE )

#================================================================================
# discovery
#================================================================================
# Daemons that can load this source:
#  - synchronizer
# This source module allows you to automatically detect network devices and physical servers in your infrastructure and import them in the configuration.
# MANDATORY SOURCE
#================================================================================

define source {

    # ┌─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐ #
    # │ ────────────────────────────────────────────────    SOURCE IDENTITY    ──────────────────────────────────────────────── │ #
    # └─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘ #

    # ─── Source name [ Must be unique ]                                                      [ MANDATORY ]                     ───
    # ───                                                                                                                       ───
    source_name                                         discovery

    # ─── Source module type [ Do not edit ]                                                  [ MANDATORY ]                     ───
    # ───                                                                                                                       ───
    module_type                                         discovery-import

    # ─── Interval between each automatic import                                                                                ───
    # ─── Interval in minutes between each automatic import of the source                                                       ───
    # ───       -> Setting it to 0 will deactivate the automatic import and can only be done manually                           ───
    #           Default : 5                                                                                                     ───
    #                                                                                                                           ───
    import_interval                                     5

    # ─── Order of priority when merging data                                                                                   ───
    # ─── The final element will take the value of the element from the source with the highest priority                        ───
    # ───       -> Priority at source with the order closest to 1                                                               ───
    #           Default : 10                                                                                                    ───
    #                                                                                                                           ───
    order                                               10

    # ┌─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐ #
    # │ ───────────────────────────────────────────────    DATABASE OPTIONS    ──────────────────────────────────────────────── │ #
    # └─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘ #

    # ──────────────────────  General  ────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────── #

    # ─── Database backend                                                                                                      ───
    #                                                                                                                           ───
    #           Default : mongodb => Use Mongo as database backend                                                              ───
    # ───                                                                                                                          ───
    data_backend                                        mongodb

    # ─────────────────  MongoDB parameters  ────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────── #

    # ─── USE ONLY IF "data_backend" IS SET TO "mongodb"                                                                        ───

    # ─── MongoDB uri definition . You can find the mongodb uri syntax at                                                       ───
    # ─── https://docs.mongodb.com/manual/reference/connection-string/                                                          ───
    #                                                                                                                           ───
    #           Default : mongodb://localhost/?w=1&fsync=false                                                                  ───
    # ───                                                                                                                          ───
    mongodb_uri                                         mongodb://localhost/?w=1&fsync=false

    # ─── Database to use                                                                                                       ───
    #                                                                                                                           ───
    #           Default : synchronizer                                                                                          ───
    #    ───                                                                                                                       ───
    mongodb_database                                    synchronizer

    # ─── SSH tunnel activationusername/password/database to authenticate to secure your mongodb connectionMongoDB.                                                                ───
    # ─── ThatThe willthree allowparameters all mongodbneed to be encrypteduncommented &for authenticatedthe withauthentication SSH      to work                                            ───
    #    ───                                                                                                                       ───
    #    synchronizer__source_discovery-import__database__username shinken

    # ───  Default : 0 => Disable ( disable ssh tunnel )                                                                   ───
    #           ...     : 1 => Enable  ( enable ssh tunnel )            ───
    # synchronizer__source_discovery-import__database__password shinken

    # ───                                             ───
    #                                                                      ───
    # synchronizer__source_discovery-import__database__authentication_database admin

    # ─── SSH tunnel activation to secure your mongodb connection                                  ───
    mongodb_use_ssh_tunnel                              0
───
    # ─── IfThat thewill SSHallow connectionall goesmongodb wrong,to thenbe retry use_ssh_retry_failure time before_shinken_inactive encrypted & authenticated with SSH                      ───
    #                        ───
    #                                                                                               ───
    #           Default : 1 ( number of retry )      ───
    #           Default : 0 => Disable ( disable ssh tunnel )                                                   ───
    #            ───
    #           ...     : 1 => Enable  ( enable ssh tunnel )                                                                    ───
    # ───         ───
    mongodb_use_ssh_retry_failure                       1

    # ─── SSH user to connect to the mongodb server.                                                                      ───
    mongodb_use_ssh_tunnel  ───
    #                        0

    # ─── If the SSH connection goes wrong, then retry use_ssh_retry_failure time before_shinken_inactive                       ───
    #                                                                                        ───
             #           Default : shinken         ───
    #           Default : 1 ( number of retry )                                                                ───
    #             ───
    # ───                                                                                                         ───
    mongodb_ssh_user          ───
    mongodb_use_ssh_retry_failure                       shinken1

    # ─── SSH keyfileuser to connect to the mongodb server.                                                                            ───
    #                                                                                                                           ───
    #           Default : ~shinken/.ssh/id_rsashinken                                                                                               ───
    #  ───                                                                                                                         ───
    mongodb_ssh_keyfileuser                                    ~shinken/.ssh/id_rsashinken

    # ─── SSH Timeoutkeyfile to usedconnect to test if the SSH tunnel is viable or not, in seconds. the mongodb server.                                                                ───
    #     ───
    #                                                                                                                  ───
    #     ───
    #  Default : 10 ( seconds )    Default : ~shinken/.ssh/id_rsa                                                                                  ───
    #    ───                                                                                                                       ───
    mongodb_retryssh_timeoutkeyfile                                 10~shinken/.ssh/id_rsa

    # ─── SSH Timeout Numberused ofto connectiontest triesif tothe doSSH beforetunnel consideringis aviable requestor asnot, anin errorseconds.                                              ───
    #                                                                                                                           ───
    #           Default : 1510 ( triesseconds )                                                                                          ───
    # ───                                                                                                                          ───
    discovery-import__database_mongodb_retry_connection_X_times_before_considering_an_error 15

timeout       # ─── Time interval between each attempt.                  10

    # ─── Number of connection tries to do before considering a request as an  error.                                              ───
    #                                                                                                                           ───
    #           Default : 515 ( secondstries )                                                                                          ───
    #   ───                                                                                                                        ───
    discovery-import__database__waitretry_connection_X_secondstimes_before_reconnect 5considering_an_error 15

    # ┌─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐ #
─── Time interval between each attempt.        #  ───────────────────────────────────────────────    INTERNAL OPTIONS    ────────────────────────────────────────────────  #
    # └─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘ #

    # ─── Path to your discovery rules file.                                             ───
    #                                   ───
    #                                                                                    ───
    #           Default : 5 ( seconds )                   ───
    #           Default : /etc/shinken-user/configuration/daemons/synchronizers/sources/discovery/discovery_rules.json                       ───
    #                           ───
    # ───                                                                                           ───
    rules_path                        ───
    discovery-import__database__wait_X_seconds_before_reconnect 5

    # ┌─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐ #
    #   /etc/shinken-user/configuration/daemons/synchronizers/sources/discovery/discovery_rules.json───────────────────────────────────────────────    INTERNAL OPTIONS    ──────────────────────────────────────────────── │ #
    # └─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘ #

    # ─── Path to your nmap-mac-prefixes discovery rules file.                                                                                    ───
    #                                                                                                                           ───
    #           Default : /etc/shinken-user/configuration/daemons/synchronizers/sources/discovery/nmap/nmap-mac-prefixesdiscovery_rules.json          ───
    # ───                                                                                                                          ───
    nmap_mac_prefixesrules_path                                          /etc/shinken-user/configuration/daemons/synchronizers/sources/discovery/nmap/discovery_rules.json

    # ─── Path to your nmap-mac-prefixes

}
    

Détails des sections composant le fichier de configuration

Identification du module

NomTypeUnitésDéfautCommentaire
Code Block
source_name 
Texte--- discovery

Valeur obligatoire et non modifiable

Code Block
module_type 
Texte--- discovery-import

Valeur obligatoire et non modifiable ( permet au Synchronizer de charger le code logiciel correspondant ).

Fonctionnement de la source

Code Block
languagejs
define source { 
	...     
	# ─── Interval between each automatic import file.                                                                                  ───
    #                                ───
    # ─── Interval in minutes between each automatic import of the source                                                       ───
    # ───       -> Setting it to 0 will deactivate the automatic import───
 and can only be# done manually         Default : /etc/shinken-user/configuration/daemons/synchronizers/sources/discovery/nmap/nmap-mac-prefixes        ───
    #   ─── ───
    #           Default : 5                                                                                                     ───
    #nmap_mac_prefixes_path                              /etc/shinken-user/configuration/daemons/synchronizers/sources/discovery/nmap/nmap-mac-prefixes

}

Détails des sections composant le fichier de configuration

Identification du module

NomTypeUnitésDéfautCommentaire
No Format
source_name 
Texte--- discovery

Valeur obligatoire et non modifiable.

No Format
module_type 
Texte--- discovery-import

Valeur obligatoire et non modifiable ( permet au Synchronizer de charger le code logiciel correspondant ).

Fonctionnement de la source

Code Block
languagejs
themeConfluence
define source { 
	...     
	# ─── Interval between each automatic import                                                                                ───
    import_interval# ─── Interval in minutes between each automatic import of the source                          5

    # ─── Order of priority when merging data                  ───
    # ───       -> Setting it to 0 will deactivate the automatic import and can only be done manually                           ───
    #       ───
    #Default ───: The5 final element will take the value of the element from the source with the highest priority                        ───
    # ───       -> Priority at source with the order closest to 1                                        ───
    #                   ───
    #           Default : 10                                                                                       ───
    import_interval         ───
    #                        5

    # ─── Order of priority when merging data                                                                                   ───
    # ───
 The final element will take the value of the element from the source with the highest priority                        ───
    # ───       -> Priority at source with the order closest to 1                                               10     ...
}
NomTypeUnitésDéfautCommentaire
Code Block
order
Entier--- 10

L'ordre de la source dans l'interface de configuration (  A  un impact dans la fusion des données lors des imports de sources  ).

Remarque :  Si vous changez l'ordre depuis l'interface ( page d’accueil ), le fichier .cfg sera mis à jour.

Code Block
import_interval
Entierminutes 5

Délai écoulé entre les imports automatiques de la source. 

  • Un nombre ( en minutes )
  • Si 0, la source ne sera jamais exécutée automatiquement.

Options d'accès à la base de données

                ───
    #           Default : 10                                                                                                    ───
    #                                                                                                                           ───
    order                                               10     ...
}



NomTypeUnitésDéfautCommentaire
No Format
order
Entier--- 10

L'ordre de la source dans l'interface de configuration (  A  un impact dans la fusion des données lors des imports de sources  ).

Remarque :  Si l'ordre est changé depuis l'interface ( page d’accueil ), le fichier .cfg sera mis à jour.

No Format
import_interval
Entierminutes 5

Délai écoulé entre les imports automatiques de la source. 

  • Un nombre ( en minutes ).
  • Si 0, la source ne sera jamais exécutée automatiquement.


Options d'accès à la base de données

Code Block
languagejs
themeConfluence
title/etc/shinken/sources/discovery.cfg
    # ┌─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐ #
    # │ ───────────────────────────────────────────────    DATABASE OPTIONS    ──────────────────────────────────────────────── │ #
    # └─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘ #

    # ──────────────────────  General  ────────────────────────────────────────────────────────────────────────────────────────── #

    # ─── Database backend                                                                                                      ───
    #                                                                                                                           ───
    #           Default : mongodb => Use Mongo as database backend                                                              ───
    # ───                                                                                                                       ───
    data_backend                                        mongodb

    # ─────────────────  MongoDB parameters  ──────────────────────────────────────────────────────────────────────────────────── #

    # ─── USE ONLY IF "data_backend" IS SET TO "mongodb"                       
Code Block
languagebash
title/etc/shinken/sources/discovery.cfg
    # ┌─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐ #
    # │ ───────────────────────────────────────────────    DATABASE OPTIONS    ──────────────────────────────────────────────── │ #
    # └─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘ #

    # ──────────────────────  General  ──────────────────────────────────────────────────────────────────────────────────────────── 

    # ─── Database backend                                                 ───

    # ─── MongoDB uri definition . You can find the mongodb uri syntax at                                    ───
    #               ───
    # ─── https://docs.mongodb.com/manual/reference/connection-string/                                                          ───
    #                                        ───
    #           Default : mongodb => Use Mongo as database backend                                                              ───
    #           Default : mongodb://localhost/?w=1&fsync=false                                                                  ───
    # ───                                       ───
    data_backend                                         mongodb

    # ─────────────────  MongoDB parameters  ────────────────────────────────────────────────────────────────────────────────────── 

    # ─── USE ONLY IF "data_backend" IS SET TO "mongodb"           ───
    mongodb_uri                                         mongodb://localhost/?w=1&fsync=false

    # ─── Database to use        ───

    # ─── MongoDB uri definition . You can find the mongodb uri syntax at                                                       ───
    # ─── https://docs.mongodb.com/manual/reference/connection-string/                 ───
    #                                     ───
    #                                                                                  ───
    #           Default : synchronizer                        ───
    #           Default : mongodb://localhost/?w=1&fsync=false                                                 ───
    # ───            ───
    #                                                                                                       ───
    mongodb_database                ───
    mongodb_uri                synchronizer

    # ─── username/password/database to authenticate to MongoDB.               mongodb://localhost/?w=1&fsync=false

    # ─── Database to use                                          ───
    # ─── The three parameters need to be uncommented for the authentication to work                                            ───
    # ───                                                                                                                          ───
    # synchronizer__source_discovery-import__database__username shinken

    # ───    Default : synchronizer                                                                                          ───
    #                   ───
    # synchronizer__source_discovery-import__database__password shinken

    # ───                                                                                             ───
    mongodb_database                      ───
              synchronizer# synchronizer__source_discovery-import__database__authentication_database admin

    # ─── SSH tunnel activation to secure your mongodb connection                                                               ───
    # ─── That will allow all mongodb to be encrypted & authenticated with SSH                                                  ───
    #                                                                                                                           ───
    #           Default : 0 => Disable ( disable ssh tunnel )                                                                   ───
    #           ...     : 1 => Enable  ( enable ssh tunnel )                                                                    ───
    #    ───                                                                                                                       ───
    mongodb_use_ssh_tunnel                              0

    # ─── If the SSH connection goes wrong, then retry use_ssh_retry_failure time before_shinken_inactive                       ───
    #                                                                                                                           ───
    #           Default : 1 ( number of retry )                                                                                 ───
    #    ───                                                                                                                       ───
    mongodb_use_ssh_retry_failure                       1

    # ─── SSH user to connect to the mongodb server.                                                                            ───
    #                                                                                                                           ───
    #           Default : shinken                                                                                               ───
    # ───                                                                                                                          ───
    mongodb_ssh_user                                    shinken

    # ─── SSH keyfile to connect to the mongodb server.                                                                         ───
    #                                                                                                                           ───
    #           Default : ~shinken/.ssh/id_rsa                                                                                  ───
    # ───                                                                                                                          ───
    mongodb_ssh_keyfile                                 ~shinken/.ssh/id_rsa

    # ─── SSH Timeout used to test if the SSH tunnel is viable or not, in seconds.                                              ───
    #                                                                                                                           ───
    #           Default : 10 ( seconds )                                                                                        ───
    # ───                                                                                                                          ───
    mongodb_retry_timeout                               10

    # ─── Number of connection tries to do before considering a request as an error.                                            ───
    #                                                                                                                           ───
    #           Default : 15 ( tries )                                                                                          ───
    #    ───                                                                                                                       ───
    discovery-import__database__retry_connection_X_times_before_considering_an_error 15

    # ─── Time interval between each attempt.                                                                                   ───
    #                                                                                                                           ───
    #           Default : 5 ( seconds )                                                                                         ───
    #  ───                                                                                                                         ───
    discovery-import__database__wait_X_seconds_before_reconnect 5
codemongodbcodecodecodecodecodecodecode
NomTypeUnitésDéfautCommentaire





No Format
data_backend
Texte---mongodb

Base de données où les informations de la source vont être stockées

Code Block
mongodb_uri
url---mongodb://localhost/?safe=false

URL d'accès à MongoDB

.

No Format
mongodb_uri
url---mongodb://localhost/?safe=false

URL d'accès à MongoDB.

No Format
mongodb_database
Texte---synchronizer

Base MongoDB où sont stockées les données de la source.

No Format
synchronizer__source_discovery-import__database__username
Texte---

Utilisateur pour l'authentification avec mot de passe à la base MongoDB.

No Format
synchronizer__source_discovery-import__database__password
Texte---

Mot de passe de l'utilisateur utilisé pour l'authentification avec mot de passe à la base MongoDB.

No Format
synchronizer__source_discovery-import__database__authentication
Code Block
_database
Texte---synchronizer

Base Mongo où sont stockées les données de la source


Nom de la base MongoDB où l'utilisateur utilisé pour l'authentification avec mot de passe a été créé.

No Format
mongodb_use_ssh_tunnel



0 ou 1---0

Défini si la connexion à la base de données est directe ou doit être encapsulée dans un tunnel SSH.

No Format
mongodb_use_ssh_retry_failure
Entier positif---1Défini le nombre d'essais à réaliser si la connexion à la base de données est perdue.
No Format
mongodb_ssh_user
Texte---shinkenL'utilisateur qui sera utilisé si la connexion à la base de données est encapsulée dans un tunnel SSH.
No Format
mongodb_ssh_keyfile
Texte---~shinken/.ssh/id_rsaLa clé SSH qui sera utilisée si la connexion à la base de données est encapsulée dans un tunnel SSH.
No Format
mongodb_retry_timeout
Entier positifSeconde10Temps de connexion maximum avant que la connexion ne soit considérée comme trop longue et cause un échec de connexion.
No Format
discovery-import__database__retry_connection_X_times_before_considering_an_error
Entier positif---

15

Nombre de tentatives à effectuer avant de considérer une requête mongo comme étant en erreur.
No Format
discovery-import__database__wait_X_seconds_before_reconnect
Entier positifSeconde5Temps d'attente entre chaque tentative de requête mongo.



Options du module

Code Block
languagejs
themeConfluencebash
title/etc/shinken/sources/discovery.cfg
    # ┌─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐ #
    # │ ───────────────────────────────────────────────    INTERNAL OPTIONS    ──────────────────────────────────────────────── │ #
    # └─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘ #

    # ─── Path to your discovery rules file.                                                                                    ───
    #                                                                                                                           ───
    #           Default : /etc/shinken-user/configuration/daemons/synchronizers/sources/discovery/discovery_rules.json          ───
    #                                                                                                                           ───
    rules_path                                          /etc/shinken-user/configuration/daemons/synchronizers/sources/discovery/discovery_rules.json

    # ─── Path to your nmap-mac-prefixes file.                                                                                  ───
    #                                                                                                                           ───
    #           Default : /etc/shinken-user/configuration/daemons/synchronizers/sources/discovery/nmap/nmap-mac-prefixes        ───
    #                                                                                                                           ───
    nmap_mac_prefixes_path                              /etc/shinken-user/configuration/daemons/synchronizers/sources/discovery/nmap/nmap-mac-prefixes    
NomTypeUnitésDéfautCommentaire





Code Blocknoformat
rules_path
Path---

/etc/shinken-user/configuration/daemons/ synchronizers/sources/discovery/discovery_rules.json

Fichier .json comportant vos les règles de découvertes ( voir la page   Les règles de découvertes du scan réseau ( discovery-import )  ).
Code Blocknoformat
nmap_mac_prefixes_path
Path---/etc/shinken-user/configuration/daemons/synchronizers/sources/discovery/nmap/nmap-mac-prefixesFichier comportant vos les propres nmap-mac-prefixes (  Correspondance entre l'adresse MAC et le constructeur  ).