| 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 explique comment définir ce type de collecteur.
La page "Collecteur de type discovery-import ( Scan NMAP )" décrit comment l'utiliser ( voir la page Collecteur de type discovery-import ( Scan NMAP ) ).
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 | ||||
|---|---|---|---|---|
| ||||
define synchronizer {
...
sources Source 1, Source 2, Source 3, discovery
...
} |
Pour prendre en compte le changement de configuration, redémarrer le Synchronizer:
| Code Block | ||||
|---|---|---|---|---|
| ||||
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 | ||||||
|---|---|---|---|---|---|---|
| ||||||
# 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 # ─── SSHusername/password tunnelto activationauthenticate to secureMongoDB. your mongodb connection ─── # ─── That will─── allow all mongodb to# be─── encryptedBoth ¶meters authenticatedmust withbe SSHprovided for authentication to function correctly. ─── # ─── ─── # synchronizer__source_discovery-import__database__username # ─── Default : 0 => Disable ( disable ssh tunnel ) ─── # ... : 1 => Enable ( enable ssh tunnel ) ─── # 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_tunnel 0 # ─── If the SSH connection goes wrong, then retry use_ssh_retry_failure time before_shinken_inactive ─── # ─── # Default : 0 => Disable ( disable ssh tunnel ) ─── # Default... : 1 ( number of: retry1 )=> Enable ( enable ssh tunnel ) ─── # ─── ─── mongodb_use_ssh_retry_failuretunnel 1 # ─── SSH user0 to connect to the# mongodb─── server.If the SSH connection goes wrong, then retry use_ssh_retry_failure time before_shinken_inactive ─── # ─── # Default : shinken1 ( number of retry ) ─── # ─── ─── mongodb_use_ssh_userretry_failure shinken1 # ─── SSH keyfileuser to connect to the mongodb server. ─── # ─── # Default : ~shinken/.ssh/id_rsashinken ─── # ─── ─── mongodb_ssh_keyfileuser ~shinken/.ssh/id_rsashinken # ─── SSH keyfile Timeoutto 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 # ─── NumberSSH ofTimeout connection triesused to dotest beforeif consideringthe aSSH requesttunnel asis an error.viable or not, in seconds. ─── # ─── # Default : 1510 ( triesseconds ) ─── # ─── ─── discovery-import__database__retry_connection_X_times_before_considering_an_error 15 mongodb_retry_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__retry_waitconnection_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 ─── /etc/shinken-user/configuration/daemons/synchronizers/sources/discovery/discovery_rules.jsondiscovery-import__database__wait_X_seconds_before_reconnect 5 # ───┌─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐ Path# to your nmap-mac-prefixes file. # │ ─────────────────────────────────────────────── INTERNAL OPTIONS ──────────────────────────────────────────────── │ # # └─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘ # # ─── Path to your discovery rules file. ─── # ─── # ─── # Default : /etc/shinken-user/configuration/daemons/synchronizers/sources/discovery/nmap/nmap-mac-prefixesdiscovery_rules.json ─── # ─── ─── nmaprules_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
| No Format |
|---|
source_name |
Valeur obligatoire et non modifiable
| No Format |
|---|
module_type |
Valeur obligatoire et non modifiable ( permet au Synchronizer de charger le code logiciel correspondant ).
Fonctionnement de la source
| Code Block | ||||
|---|---|---|---|---|
| ||||
# ─── Interval between each automatic importdiscovery_rules.json # ─── Path to your nmap-mac-prefixes 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 ─── # ─── ─── import_intervalnmap_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 5 # ─── Order of priority when merging data ─── # ─── TheInterval finalin elementminutes willbetween takeeach theautomatic valueimport of the element from the source with the highest priority source ─── # ─── -> Setting Priorityit to at0 sourcewill withdeactivate the order closest to 1 automatic import and can only be done manually ─── # Default : 5 ─── # Default : 10 ─── # ─── # ─── import_interval ─── 5 # order─── Order of priority when merging data 10 |
| No Format |
|---|
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 Synchronizer 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.
| No Format |
|---|
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
───
# ─── 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 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 | ||||
|---|---|---|---|---|
| ||||
|
|
|
|
|
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 | ||||
|---|---|---|---|---|
| ||||
|
|
|
|
|
|
|