Discovery commands

A discovery commands is a command line to execute a discovery plugin.

For each discovery plugins you need to define two commands:

  • The first one to get the list of available XML attributes
  • The second one to discover items on a host
../_images/commands_list.png

Command to list available XML attributes

Go to Configuration > Commands > Discovery menu and click on Add button to create the first command.

Fill the fileds:

  • Command Name: Name of your command
  • Command type: check Discovery option
  • Command Line: Define the command to get the list of XML attributes

Note

All commands using Centreon Plugin project need to set the hostname option so add –hostname=127.0.0.1 in your command line

../_images/command_attributes.png

This is an example of the command line executed in a shell:

# /usr/lib/nagios/plugins/centreon_plugins.pl --plugin=os::linux::snmp::plugin --mode=list-interfaces --hostname=127.0.0.1 --disco-format
<?xml version="1.0" encoding="utf-8"?>
<data>
    <element>name</element>
    <element>total</element>
    <element>status</element>
    <element>interfaceid</element>
 </data>

Save the command.

Command to get the list of items on a host

Go to Configuration > Commands > Discovery menu and click on Add button to create the first command.

Fill the fileds:

  • Command Name: Name of your command
  • Command type: check Discovery option
  • Command Line: Define the command to get the list of items.
../_images/command_disco.png

This is an example of the command line executed in a shell:

# /usr/lib/nagios/plugins/centreon_plugins.pl --plugin=os::linux::snmp::plugin --mode=list-interfaces --hostname=192.168.220.129 --snmp-version=2 --snmp-community=public --disco-show
<?xml version="1.0" encoding="utf-8"?>
<data>
    <label status="1" name="lo" total="10" interfaceid="1"/>
    <label status="1" name="eth0" total="1000" interfaceid="2"/>
</data>

Save the command.