Discovery Operation
discovery.php
discovery.php
is Observium's discovery process. It scans devices and populates the database with ports and other entities that require polling. The discovery process should be run automatical periodically via cron, but can also be run manually for debugging and development purposes.
Usage
discovery.php [-dquV] [-i instances] [-n number] [-m module] [-h device]
Option | Description |
---|---|
-h <device_id> |
Discover a single device by device_id |
-h <hostname wildcard> |
Discover devices matching the hostname wildcard |
-h odd |
Discover all odd numbered devices |
-h even |
Discover all even numbered devices |
-h all |
Discover all devices |
-h new |
Discover all new devices which have never been discovered |
-i <instances> -n <id/number> |
Discover as instance <id/number> of <instances> . Useful on very large installs. |
-q |
Quiet output |
-u |
Upgrade DB Schema, used during update procedure |
-M |
Show globally enabled/disabled modules and exit |
-V |
Show version and exit |
-d |
Enable debugging output |
-dd |
More verbose debugging output |
-m |
Specify discovery module(s) (separated by commas) to be run |
observium-wrapper
observium-wrapper
is Observium's multi-threaded discovery control process. It launches and monitors individual discovery.php
processes for each monitored device.
Cron
The discovery process should be run once or twice per day on usual installations. It usually takes longer to run than the poller since it queries devices using a more prospective method than the poller.
As documented in our install guides, the correct way to run the Observium discovery is by executing observium-wrapper
automatically via cron once every 6 hours. It is now no longer required to specify the number of threads as a commandline option, as this can now be configured in the web UI or in config.php
.
33 */6 * * * root /opt/observium/observium-wrapper discovery >> /dev/null 2>&1
By default the observium-wrapper will execute twice as many threads as your system has CPUs. This is a good default for many systems, but can easily be fine-tuned by changing the corresponding setting.
For newly added devices additionaly run initial discovery cron every 5 min.
*/5 * * * * root /opt/observium/observium-wrapper discovery --host new >> /dev/null 2>&1
Examples
Most manual usage of the discovery script will be for debugging or development purposes. For example, to check if a device is returning any useful data to a particular discovery module.
For example, to debug the storage
module on the device storage-server.company.com
you could use this :
./discovery.php -h storage-server.company.com -m storage -dd
You can run multiple modules using the -m
option, this is useful when debugging unix-agent and application modules, which require both to be run :
./discovery.php -h srv01.company.com -m unix-agent,applications -dd
Example debugging output
Debugging output will usually include the full command line of any SNMP commands run, along with the data returned by the device and some output indicating how we process the data and whatever SQL changes we make based on the data returned.
This example output from the mempools module shows part of this process
The example below illustrates what happens when a module doesn't find any entries in a specific MIB. In this instance the device repoorts that there are no entries in the dskEntry table in UCD-SNMP-MIB.