| Scroll Ignore | ||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| ||||||||||||||||
|
Concept
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 .
La page "Collecteur de type ( discovery-import ) - Import depuis un scan réseau vous " décrit comment l'utiliser ( voir la page Collecteur de type ( discovery-import ) - Import depuis un scan réseau ).
Activation du collecteur
Vous pouvez avoir uniquement une La source de type "discovery-import" est une source qui doit être activée sur le démon Synchronizer.
- L'activation de la source s'effectue en ajoutant le nom de la source dans la configuration du
Synchronizer.- Par défaut, l’installation de Shinken Entreprise va mettre à disposition cette source sous le nom "
discovery".- Le fichier de configuration de la source est disponible sous /etc/shinken/sources/discovery.cfg
- Par défaut, l’installation de Shinken Entreprise va mettre à disposition cette source sous le nom "
- 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 .
| Code Block | ||
|---|---|---|
| ||
define synchronizer {
...
sources Source 1, Source 2, Source 3, discovery
...
} |
| Code Block |
|---|
service shinken-synchronizer restart |
Configuration
La configuration du module se trouve par défaut dans le fichier /etc/shinken/sources/discovery .cfg
Fichier de configuration
- .
- Pour cela, il faut ouvrir le fichier de configuration du
Synchronizeret ajouter dans le paramètre sources, le nom de la source de type"discovery-import".
- Contraintes :
- Activable uniquement sur le
Synchronizer( voir la page Définition du démon ( synchronizer-master.cfg ) ). Il ne peut y avoir qu'une seule source de type
"discovery-import".
- Activable uniquement sur le
Pour prendre en compte le changement de configuration, il faut redémarrer le Synchronizer :
| Excerpt Include | ||||||||
|---|---|---|---|---|---|---|---|---|
|
Exemple d'activation de la source nommée "discovery" sur le Synchronizer ( configuration livrée par défaut par Shinken )
L'exemple suivant :
- active la source
"discovery", - sur le Synchronizer
,dont la configuration est dans le fichier /etc/shinken/synchronizers/synchronizer-master.cfg
Modification dans le fichier du module /etc/shinken/synchronizers/synchronizer-master.cfg :
| Code Block | ||||
|---|---|---|---|---|
| ||||
define synchronizer{
[...] | ||||
| Code Block | ||||
| ||||
#=========================================================== Sources ===================== # 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 ] # syncui Automatically added # discovery Automatically added # listener-shinken Automatically added # server-analyzer Automatically added # cfg-file-shinken Mandatory Standard Shinken Enterprise packs [ MANDATORY ] # listener-rest SAMPLE for REST ───listener # ─── active-dir-example SAMPLE for active directory # sync-vmware SAMPLE for VMWare (deprecated) # cfg-file-nagios SAMPLE for nagios import # openldap-example SAMPLE for OpenLDAP import # cfg-file-sample ─── source_name SAMPLE for Shinken framework import # synchronizer-collector-vmware SAMPLE for VMWare sources discovery, Source 2, discovery Source 3 [...] } |
Puis redémarrage du Synchronizer:
| Excerpt Include | ||||||||
|---|---|---|---|---|---|---|---|---|
|
Configuration
La configuration du module se trouve par défaut dans le fichier /etc/shinken/sources/discovery.cfg.
Fichier de configuration
| Code Block | ||||||
|---|---|---|---|---|---|---|
| ||||||
# 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 ] # ─── Source module type [ Do not edit ] [ MANDATORY ] ─── # ─── ─── module_type [ MANDATORY ] discovery-import # ─── Interval between each automatic import ─── # ─── ─── # ─── Interval in minutes between each automatic import of the source ─── source_name ─── # ─── -> Setting it to 0 will deactivate the automatic import and can only be done manually discovery # ─── Source module type [ Do not edit ] ─── # Default : 5 [ MANDATORY ] ─── # ─── ─── # ─── module_type discovery-import # ─── Interval between each automatic import ─── import_interval 5 # ─── Order of priority when merging data ─── # ─── Interval in minutes between each automatic import of the source ─── # ─── The final element will take-> theSetting valueit ofto the0 elementwill fromdeactivate the sourceautomatic import withand thecan highestonly prioritybe done manually ─── # ─── # -> Priority at source with the order closest toDefault 1: 5 ─── # Default : 10 ─── # ─── # ─── import_interval 5 # ─── Order of priority when merging data ─── order 10 # ┌─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐ #─── # │─── ───────────────────────────────────────────────The final element will DATABASEtake OPTIONSthe value of the ────────────────────────────────────────────────element │from # the source with the #highest └─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘priority # # ────────────────────── General ──────────────────────────────────────────────────────────────────────────────────────────── # ─── Database backend ─── # ─── -> Priority at source with the order closest to 1 ─── # ─── Default #: 10 ─── # ─── # Default : mongodb => Use Mongo as database backend ─── # ─── order 10 # ┌─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐ # # │ ─────────────────────────────────────────────── DATABASE OPTIONS ──────────────────────────────────────────────── │ # # └─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘ # # ────────────────────── General ────────────────────────────────────────────────────────────────────────────────────────── # # ─── 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 => 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 definition . You can find the mongodb uri syntax at ─── mongodb_uri ─── # ─── https://docs.mongodb.com/manual/reference/connection-string/ mongodb://localhost/?w=1&fsync=false # ─── Database to use ─── # ─── # ─── # Default : mongodb://localhost/?w=1&fsync=false ─── # Default :─── synchronizer # ─── ─── # ─── mongodb_uri mongodb://localhost/?w=1&fsync=false # ─── Database to use ─── mongodb_database synchronizer # ─── SSH tunnel activation to secure your mongodb connection ─── # ─── # ─── That will allow all mongodb to be encrypted & authenticated with SSH ─── # Default : synchronizer ─── # ─── ─── # Default : 0 => Disable ( disable ssh tunnel ) ─── # ─── ... mongodb_database : 1 => Enable ( enable ssh tunnel ) synchronizer # ─── username/password to authenticate to MongoDB. ─── # ─── # ─── Both parameters must be provided for authentication to function correctly. ─── # ─── ─── mongodb_use_ssh_tunnel 0 # ─── If the SSH connection goes wrong, then retry use_ssh_retry_failure time before_shinken_inactive ─── # ─── # synchronizer__source_discovery-import__database__username # ─── ─── # Default : 1 ( number of retry ) ─── # synchronizer__source_discovery-import__database__password # ─── SSH tunnel activation to secure your mongodb connection ─── # ─── That will allow all mongodb to be encrypted & authenticated with SSH ─── # ─── mongodb_use_ssh_retry_failure 1 # ─── SSH user to connect to the mongodb server. ─── # Default : 0 => Disable ( disable ssh tunnel ) ─── # ─── # ... : 1 => Enable ( enable ssh tunnel ) ─── # ─── Default :# shinken─── ─── # ─── mongodb_use_ssh_tunnel 0 # ─── If the SSH connection goes wrong, then retry use_ssh_retry_failure time before_shinken_inactive ─── # ─── mongodb_ssh_user shinken # ─── SSH keyfile to connect to the mongodb server. ─── # Default : 1 ( number of retry ) ─── # ─── # ─── ─── # Default : ~shinken/.ssh/id_rsa ─── mongodb_use_ssh_retry_failure ───1 # ─── SSH user to connect to the mongodb server. ─── # ─── mongodb_ssh_keyfile ~shinken/.ssh/id_rsa # ─── SSH Timeout used to test if the SSH tunnel is viable or not, in seconds. ─── # ─── Default : shinken # ─── # ─── ─── # Default : 10 ( seconds ) ─── mongodb_ssh_user ─── # shinken # ─── SSH keyfile to connect to the mongodb server. ─── # ─── mongodb_retry_timeout 10 # ─── Number of connection tries to do before considering a request as an error. ─── # ─── # Default : ~shinken/.ssh/id_rsa ─── # ─── ─── # Default : 15 ( tries ) ─── #mongodb_ssh_keyfile ~shinken/.ssh/id_rsa # ─── SSH Timeout used to test if the SSH tunnel is viable or not, in seconds. ─── # ─── discovery-import__database__retry_connection_X_times_before_considering_an_error 15 # ─── Time interval between each attempt. ─── #─── # Default : 10 ( seconds ) ─── # ─── ─── # Default : 5 ( seconds ) ─── #mongodb_retry_timeout 10 # ─── Number of connection tries to do before considering a request as an error. ─── # ─── discovery-import__database__wait_X_seconds_before_reconnect 5 # ┌─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐ # # │ ─────────────────────────────────────────────── INTERNAL OPTIONS ──────────────────────────────────────────────── │ # # └─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘ # # ─── Path to your discovery rules file. ─── # Default : 15 ( tries ) ─── # ─── # ─── ─── # Default : /etc/shinken-user/configuration/daemons/synchronizers/sources/discovery/discovery_rules.json ─── # ─── discovery-import__database__retry_connection_X_times_before_considering_an_error 15 # ─── Time interval between each attempt. ─── rules_path ─── # /etc/shinken-user/configuration/daemons/synchronizers/sources/discovery/discovery_rules.json # ─── Path to your nmap-mac-prefixes file. ─── # ─── # Default : 5 ( seconds ) ─── # ─── ─── # Default : /etc/shinken-user/configuration/daemons/synchronizers/sources/discovery/nmap/nmap-mac-prefixes ─── # ─── discovery-import__database__wait_X_seconds_before_reconnect 5 # ┌─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐ # # │ ─────────────────────────────────────────────── INTERNAL OPTIONS ──────────────────────────────────────────────── │ # # └─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘ # # ─── Path to your nmap_mac_prefixes_path discovery rules file. /etc/shinken-user/configuration/daemons/synchronizers/sources/discovery/nmap/nmap-mac-prefixes } |
Détails des sections composant le fichier de configuration
Identification du module
|
Valeur obligatoire et non modifiable
| Code Block |
|---|
module_type |
Valeur obligatoire et non modifiable ( permet au Synchronizer de charger le code logiciel correspondant ).
Fonctionnement de la source
| Code Block | ||
|---|---|---|
| ||
define source { ... # ─── 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 : /etc/shinken-user/configuration/daemons/synchronizers/sources/discovery/discovery_rules.json ─── # ─── ─── # Default : 5 ─── ─── rules_path # /etc/shinken-user/configuration/daemons/synchronizers/sources/discovery/discovery_rules.json # ─── Path to your nmap-mac-prefixes file. ─── import_interval ─── # 5 # ─── Order of priority when merging data ─── # ─── The final element will take the value of the elementDefault from the source with the highest priority : /etc/shinken-user/configuration/daemons/synchronizers/sources/discovery/nmap/nmap-mac-prefixes ─── # ─── -> Priority at source with the order closest to 1 ─── # Default : 10 ─── 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
| Scroll Title | |||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| |||||||||||||||||||
|
Fonctionnement de la source
| Code Block | ||||
|---|---|---|---|---|
| ||||
define source { ... # ─── Interval between each automatic import ─── # ─── # ─── Interval in minutes between each automatic import of the source ─── order# ─── -> Setting it to 0 will deactivate the automatic import and can only be done manually 10 ... } |
| Code Block |
|---|
order |
L'ordre de la source dans l'interface de configuration ( A un impact dans la fusion des données lors des imports de sources ).
- Un nombre
- Voir la page Le mélange des sources & les clés de synchronisation (sync-key) pour plus d'information au sujet des fusions.
Remarque : Si vous changez l'ordre depuis l'interface ( page d’accueil ), le fichier .cfg sera mis à jour.
| Code Block |
|---|
import_interval |
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 : 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 ...
} |
| Scroll Title | |||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| |||||||||||||||||||
|
Options d'accès à la base de données
| Code Block | ||||||
|---|---|---|---|---|---|---|
| ||||||
# ┌─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐ #
# │ ─────────────────────────────────────────────── DATABASE OPTIONS ──────────────────────────────────────────────── │ #
# └─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘ #
# ────────────────────── General ────────────────────────────────────────────────────────────────────────────────────────── #
# ─── Database backend ───
# ───
# Default : mongodb => Use Mongo as database backend ───
# ─── | ||||||
| Code Block | ||||||
| ||||||
# ┌─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐ # # │ ─────────────────────────────────────────────── DATABASE OPTIONS ──────────────────────────────────────────────── │ # # └─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘ # # ────────────────────── General ──────────────────────────────────────────────────────────────────────────────────────────── # ─── 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 ─── # Default : mongodb => Use Mongo as database backend ─── # ─── https://docs.mongodb.com/manual/reference/connection-string/ ─── # ─── # ─── data_backend ─── # Default : mongodb://localhost/?w=1&fsync=false 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/ ─── mongodb_uri mongodb://localhost/?w=1&fsync=false # ─── Database to use # ─── # ─── # Default : mongodb://localhost/?w=1&fsync=false ─── # ─── # Default : synchronizer ─── mongodb_uri# ─── mongodb://localhost/?w=1&fsync=false # ─── Database to use ─── mongodb_database ─── synchronizer # ─── username/password to authenticate to MongoDB. ─── # ─── Both parameters must be provided for authentication to function correctly. ─── # Default─── : synchronizer # ─── ─── # ─── # synchronizer__source_discovery-import__database__username # ─── ─── mongodb_database ─── # synchronizer __source_discovery-import__database__password # ─── 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 |
| Scroll Title | ||||
|---|---|---|---|---|
| ||||
|
|
|
|
|
|
Base Mongo où sont stockées les données de la source
|
|
|
|
|
|
|
|
Options du module
| Code Block | ||||||
|---|---|---|---|---|---|---|
| ||||||
# ┌─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐ #
# │ ─────────────────────────────────────────────── 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 |
| Scroll Title | ||||
|---|---|---|---|---|
| ||||
|
|
|
|
|
|
|
|