Journey of a host discovery job
Journey of a host discovery job: finding Linux servers with SNMP
This topic follows a host discovery job from the moment you create it in Centreon Web to the moment the discovered hosts are monitored. It uses an SNMP discovery of Linux servers on a subnet as an example.
The steps where the Monitoring Connector is involved are marked From the Monitoring Connector. The other steps are handled by Centreon's own components.
Example used in this topic
| Item | Value |
|---|---|
| Discovery provider | Generic SNMP agents |
| Subnet scanned | 192.168.1.0/24 |
| SNMP version and community | 2c / public |
| Poller running the discovery | poller-01 |
| Host found | srv-linux-01 (192.168.1.20) |
| Host template applied | OS-Linux-SNMP-custom |
Note: Provider names, plugin options and attribute names depend on your Monitoring Connector version. The commands and outputs below are simplified examples.
Overview
flowchart LR
A["Centreon Web<br/>Auto Discovery module"] -->|job| B["Gorgone<br/>central"]
B -->|forwards job| C["Gorgone<br/>poller-01"]
C -->|runs| D["Discovery plugin"]
D -->|SNMP requests| E["192.168.1.0/24"]
E -->|SNMP replies| D
D -->|JSON results| C
C --> B
B -->|stores results| F[("Database")]
F -->|mappers applied| A
A -->|hosts created, export| G["Centreon Engine"]Step 1: Create the discovery job
Go to Configuration > Hosts > Discovery and click +ADD. A wizard opens:
- Choose a provider: select Generic SNMP agents. Providers come with Monitoring Connectors, so the matching connector must be installed.
- Access parameters: enter the SNMP version (
2c) and community (public). - Additional parameters: enter the subnet to scan (
192.168.1.0/24) and select the poller that will run the discovery (poller-01). The poller must be able to reach the subnet. - Mappers: define how discovered items become hosts (see Step 7).
- Analysis: choose Manual analysis (you select the hosts to create) or Automatic analysis (hosts are created automatically).
- Execution: run the job immediately or schedule it.
Click FINISH. The job appears in the list with the status Scheduled or Running.
From the Monitoring Connector: the discovery provider. It defines the discovery command, the parameters the wizard asks for, and the attributes the discovery returns. The list of providers in the wizard only shows the providers of the Monitoring Connectors installed on your platform.
Step 2: Centreon Web hands the job to Gorgone
The Auto Discovery module sends the job to the Gorgone daemon on the central server. Gorgone builds the discovery command from the provider definition and the parameters you entered.
Step 3: Gorgone forwards the job to the poller
Because the job is assigned to poller-01, Gorgone on the central server forwards it to Gorgone on poller-01. The discovery runs on the poller, close to the network being scanned. The central server doesn't need to reach the subnet itself.
Step 4: The poller runs the discovery plugin
Gorgone on poller-01 runs the discovery plugin. The command looks like this (simplified):
/usr/lib/centreon/plugins/centreon_generic_snmp.pl --plugin=os::linux::snmp::plugin \
--mode=discovery --subnet='192.168.1.0/24' \
--snmp-community='public' --snmp-version='2c' --snmp-port='161'
From the Monitoring Connector: the discovery plugin. It must be installed on the poller that runs the discovery. If Automatic installation of plugins is set to ON on the Configuration > Connectors > Monitoring Connectors page, it is installed automatically when the job runs.
Step 5: The plugin scans the subnet
The plugin sends an SNMP request to every address of the subnet. Addresses where an SNMP agent answers are kept. For each one, the plugin reads basic system information, such as the system name and description, and deduces the type of device.
poller-01 → SNMP get sysDescr, sysName → 192.168.1.1 … 192.168.1.254
poller-01 ← reply from 192.168.1.20: "Linux srv-linux-01 5.14.0 x86_64"
poller-01 ← reply from 192.168.1.21: "Cisco IOS Software …"
(no reply from the other addresses)
Step 6: The results come back to the central server
The plugin returns its results as JSON. Gorgone on the poller sends them back to Gorgone on the central server, which stores them in the database. The job status changes to Finished.
{
"discovered_items": 2,
"results": [
{
"ip": "192.168.1.20",
"hostname": "srv-linux-01",
"type": "linux",
"description": "Linux srv-linux-01 5.14.0 x86_64",
"snmp_community": "public",
"snmp_version": "2c",
"snmp_port": 161
},
{
"ip": "192.168.1.21",
"hostname": "sw-core-01",
"type": "cisco",
"description": "Cisco IOS Software …",
"snmp_community": "public",
"snmp_version": "2c",
"snmp_port": 161
}
]
}
Step 7: Mappers turn results into hosts
The Auto Discovery module applies the job's mappers to each result. Mappers translate discovered attributes into Centreon host settings:
| Mapper | Rule in this example | Result for srv-linux-01 |
|---|---|---|
| Property | Name ← hostname, address ← ip | Name srv-linux-01, address 192.168.1.20 |
| Exclusion | Exclude if type is not linux | sw-core-01 is excluded |
| Template | Add OS-Linux-SNMP-custom | Template applied |
| Host group | os- + type | Linked to host group os-linux (created if it doesn't exist) |
| Monitoring | Monitored from poller-01 | Assigned to poller-01 |
If you change mappers before the hosts are created, the results are updated immediately.
From the Monitoring Connector: the host template applied by the Template mapper. In this example,
OS-Linux-SNMP-customis provided by the Linux SNMP Monitoring Connector. The attributes you can use in the mappers (hostname,ip,type, etc.) are defined by the discovery provider.
Step 8: You review the results
On Configuration > Hosts > Discovery, click the arrow next to the job's status to display the results. An icon tells you what will happen to each host:
- Plus icon: the host doesn't exist yet and will be created.
- Arrow icon: the host already exists and will be updated (only if Update existing hosts was selected).
With Manual analysis, select srv-linux-01 and click Save. With Automatic analysis, this step happens on its own. The job goes through the Saving status.
Step 9: The hosts are created
srv-linux-01 is created in Configuration > Hosts > Hosts. The services linked to its host template (CPU, memory, disks, traffic and so on) are created with it.
From the Monitoring Connector: the service templates linked to the host template, which determine which services are created and with which default thresholds. The host template is also linked to the connector's service discovery rules, so that interfaces, disks and other items of the host can then be discovered (see Journey of a service discovery rule).
Step 10: The configuration is exported
Export the configuration of poller-01 and reload it. If Export and reload pollers configuration was selected in the job wizard, this happens automatically. Centreon Engine on poller-01 now knows about srv-linux-01 and starts scheduling its checks.
From here, each check follows the journey described in Journey of a service check.
Discovery versus checks
A discovery job and a monitoring check both run plugins on a poller, but they follow different paths:
| Discovery job | Monitoring check | |
|---|---|---|
| Triggered by | You, or the job's schedule | Centreon Engine, at each check interval |
| Run by | Gorgone | Centreon Engine |
| Plugin output | JSON list of discovered items | Exit code, output and performance data |
| Results go to | Auto Discovery module, then host configuration | Centreon Broker, then real-time status and graphs |
| Provided by the Monitoring Connector | The discovery provider | The command and the host and service templates |
In both cases, the Monitoring Connector supplies what is needed: the discovery provider that defines the discovery command, and the templates and commands used by the checks on the hosts it creates.
Behavior to keep in mind
- Hosts that are no longer discovered are not disabled automatically. Only hosts that are discovered and excluded by an exclusion mapper can be disabled.
- When existing hosts are updated, their name, alias and IP address (set by Property mappers) are not changed.
- Changing mappers after hosts have been created has no effect on those hosts, unless Update existing hosts is selected.