diff --git a/README b/README deleted file mode 100644 index 6ae8e56..0000000 --- a/README +++ /dev/null @@ -1,26 +0,0 @@ -Installation : --------------- - -Use install.sh - -Usage : -------- - -Usage after release 2.0 - - ./dsmclient.pl [-a action] [-h] -H hostname -i id -t timerequest [-s status] -o output ... - -h|--help Help - -H|--Host The hostname linked to trap services - -i|--id Id (a built string to match a specific alarm) - -t|--time The time epoch for the trap request - -s|--status The id status nagios 0 Ok; 1 Warning ; 2 Critical ; 3 Unknown - -o|--output The output to display in service comment - -Usage before revision 34 : deprecated. - - ./dsmclient.pl hostname timerequest output - hostname The hostname with trap services - timerequest The time epoch for the trap request - output The output to display in service comment - -In this version, the status if always CRITICAL. \ No newline at end of file diff --git a/README.md b/README.md new file mode 100644 index 0000000..9b4d7b3 --- /dev/null +++ b/README.md @@ -0,0 +1,35 @@ +# Centreon DSM + +Centreon Dynamic Services Management (DSM) is an extension to manage alarms in +a similar fashion to an event logs system. + + +## Installation + + yum install centreon-dsm-client centreon-dsm-server + + +## DSM Client Usage + + - Usage after release 2.0. + + /usr/share/centreon/bin/dsmclient.pl {--help|{--Host |--host-id } [--pool-prefix ] [--id ] [--time ] --status [--output ]} + --help Help + -H|--Host The hostname or IP address of the host linked to trap services + --host-id The ID that represents a certain host in the database + --pool-prefix The pool-prefix of a slot pool linked to a host + -i|--id ID (a string built to match a specific alarm) + -o|--output The output message to display in Service Comment + -s|--status The statuses recognized by the engine are 0 = OK; 1 = WARNING; 2 = CRITICAL; 3 = UNKNOWN + -t|--time The time epoch for the trap request + -m|--macro List of macros and their values that need to be updated + + + - Usage before revision 34: deprecated. + + ./dsmclient.pl hostname timerequest output + hostname The hostname with trap services + timerequest The time epoch for the trap request + output The output to display in service comment + +In this version, the status was always CRITICAL. diff --git a/bin/dsmclient.pl b/bin/dsmclient.pl index 8381789..b4dcda5 100755 --- a/bin/dsmclient.pl +++ b/bin/dsmclient.pl @@ -219,7 +219,7 @@ =head1 OPTIONS =item B<--pool-prefix> -Slots to used for the host. If not set, we used the first pool of slots. +Slot pool prefix linked to the host. If not set, the first pool of slots will be used. =back @@ -228,5 +228,3 @@ =head1 DESCRIPTION B. =cut - - diff --git a/doc/en/_static/use/conf-restart.png b/doc/en/_static/use/conf-restart.png index ac99d0e..e0e9b14 100644 Binary files a/doc/en/_static/use/conf-restart.png and b/doc/en/_static/use/conf-restart.png differ diff --git a/doc/en/_static/use/conf-test.png b/doc/en/_static/use/conf-test.png index c5c9422..fdefdea 100644 Binary files a/doc/en/_static/use/conf-test.png and b/doc/en/_static/use/conf-test.png differ diff --git a/doc/en/_static/use/form-passive-service.png b/doc/en/_static/use/form-passive-service.png index 21bd001..d2ecd77 100644 Binary files a/doc/en/_static/use/form-passive-service.png and b/doc/en/_static/use/form-passive-service.png differ diff --git a/doc/en/_static/use/form-slot.png b/doc/en/_static/use/form-slot.png index d1abfc6..f2f7bca 100644 Binary files a/doc/en/_static/use/form-slot.png and b/doc/en/_static/use/form-slot.png differ diff --git a/doc/en/_static/use/trap-form-2.png b/doc/en/_static/use/trap-form-2.png index 263869f..ffac275 100644 Binary files a/doc/en/_static/use/trap-form-2.png and b/doc/en/_static/use/trap-form-2.png differ diff --git a/doc/en/_static/use/trap-form.png b/doc/en/_static/use/trap-form.png index e879db1..8b53688 100644 Binary files a/doc/en/_static/use/trap-form.png and b/doc/en/_static/use/trap-form.png differ diff --git a/doc/en/administration.rst b/doc/en/administration.rst index 706af1a..04a4736 100644 --- a/doc/en/administration.rst +++ b/doc/en/administration.rst @@ -6,8 +6,8 @@ Administration Advanced configuration ********************** -It is possible to overwrite default configuration of the module by creating/editing the -**/etc/centreon/centreon_dsmd.pm** file: :: +It is possible to overwrite the default configuration of the module by +creating/editing the **/etc/centreon/centreon_dsmd.pm** file: :: %centreon_dsmd_config = ( # which user will send action to Centcore @@ -23,24 +23,25 @@ It is possible to overwrite default configuration of the module by creating/edit # duration in seconds to keep locks clean_locks_keep_stored => 3600, ); - + 1; ************* Purging cache ************* -All actions performed by the DSMD engine are logged in the database -**centreon_storage**. A cron is provided to delete the data based on retention. +All actions performed by the DSM daemon are logged in the database +**centreon_storage**. A cron job is provided to delete the data based on +retention. -To modify the retention period, by default **180 days**, you can create/edit the -**/etc/centreon/centreon_dsm_purge.pm** file: :: +To modify the retention period - by default **180 days** - you can create/edit +the **/etc/centreon/centreon_dsm_purge.pm** file: :: %centreon_dsm_purge_config = ( # period in days history_time => 180, ); - + 1; To modify the hour of the cron job, you can edit the **/etc/cron.d/centreon-dsm** @@ -49,6 +50,5 @@ file: :: ##################################### # Centreon DSM # - - 30 22 * * * root /usr/share/centreon/www/modules/centreon-dsm//cron/centreon_dsm_purge.pl --config='/etc/centreon/conf.pm' --severity=error >> /var/log/centreon/centreon_dsm_purge.log 2>&1 + 30 22 * * * root /usr/share/centreon/www/modules/centreon-dsm//cron/centreon_dsm_purge.pl --config='/etc/centreon/conf.pm' --severity=error >> /var/log/centreon/centreon_dsm_purge.log 2>&1 diff --git a/doc/en/installation.rst b/doc/en/installation.rst index 99cd073..0242907 100644 --- a/doc/en/installation.rst +++ b/doc/en/installation.rst @@ -6,21 +6,22 @@ Installation On a central server =================== -This part is to install **Centreon DSM** on a central server. Centreon DSM server -and client will be installed on the main server. +These instructions apply when installing the **Centreon DSM** extension on a +central server. The Centreon DSM server and client packages must be installed on +the main server. -Run the command:: +Install the packages running the command:: - # yum install centreon-dsm-server centreon-dsm-client + # yum install centreon-dsm -After installing the rpm, you have to finish the module installation through the -web frontend. Go to **dministration > Extensions > Manager** menu and search -**dsm**: +After installing the packages, you have to finish the installation of the module +through the web-based GUI. Go to **Administration > Extensions > Manager** menu +and search **dsm**: .. image:: /_static/installation/module-setup.png :align: center -Your Centreon DSM Module is now installed. +Your Centreon DSM module is now installed. .. image:: /_static/installation/module-setup-finished.png :align: center @@ -29,12 +30,28 @@ Your Centreon DSM Module is now installed. On a poller =========== -This part is to install **Centreon DSM** on a poller. Only client will be -installed. +These instructions apply when installing the **Centreon DSM** extension on a +poller. Only the Centreon DSM client package must be installed on the poller. -Run the command:: +Install the package running the command: + +:: # yum install centreon-dsm-client -You now have to create an access from the poller to the DBMS server on the -**centreon_storage** database. +You now have to configure MariaDB in order to enable the poller to connect to +the central server databases **centreon** and **centreon_storage** using the +user **centreon**. + +In order to do that, you have to connect to your MariaDB instance with the +**root** user and issue the following commands: + +:: + + $ GRANT SELECT ON `centreon`.`*` TO 'centreon'@'POLLER_IP'; + $ GRANT SELECT, INSERT, UPDATE ON `centreon_storage`.`*` TO 'centreon'@'POLLER_IP'; + +Now, from your poller, try to connect to the central server with the MySQL +client using the **centreon** user. If you have problems to configure the +connection to MariaDB, please refer to the database documentation: +https://mariadb.com/kb/en/grant/ diff --git a/doc/en/upgrade/from_1.x.rst b/doc/en/upgrade/from_1.x.rst index f69ba2f..c7eb856 100644 --- a/doc/en/upgrade/from_1.x.rst +++ b/doc/en/upgrade/from_1.x.rst @@ -1,14 +1,18 @@ .. _install_from_packages: -=============== -From 1.x to 2.x -=============== +========================== +From 1.x to 2.x (or newer) +========================== ***************** From RPM packages ***************** -Merethis provides RPM for its products through CES. Open source products are freely available from our repository. +Centreon provides RPM packages for its products through the Centreon open source +version available free of charge in our repository. + +These packages have been successfully tested in version 7.x CentOS and Red Hat +environments. **************** Centreon upgrade @@ -17,26 +21,27 @@ Centreon upgrade Upgrade a central server ------------------------ -This part is a how to upgrade a **Centreon DSM** for a central server. +These instructions apply when upgrading the Centreon DSM extension on a +central server. The Centreon DSM server and client packages must be installed on +the main server. -Centreon DSM server and client will be installed on the main server. +The version 1.x of Centreon DSM doesn't contain a server and a client: the +client embeds the intelligence and the server is just a cron task. -The version 1.x of Centreon DSM doesn't contain a server and a client: the client embed the intelligence and the server is just a cron task. +This organization was a problem due to a number of reasons. That's why this +module completely changed with this new major version. -This organization was a problem due of load problems. That's why we completely change this module. That's why this version is a major version. +To upgrade, run the following command: -To upgrade run the following command:: +:: $ yum upgrade centreon-dsm-server centreon-dsm-client -After installing the rpm, you have to finish the module installation via the web frontend. Go on: - -:: - - Administration > Modules +After installing the RPM packages, you have to finish the module installation +via the web-based GUI. Go to **Administration > Modules**. -Install the Centreon-DSM module. +Install the Centreon DSM module. .. image:: /_static/installation/module-setup.png :align: center @@ -46,52 +51,61 @@ Your Centreon DSM Module is now installed. .. image:: /_static/installation/module-setup-finished.png :align: center -In order to migrate the trap configuration, you have to change all specific commands configured on your specific traps. -On each specific commands rename the following path: +In order to migrate the trap configuration, you have to change all the commands +configured in each trap. +For each command, replace the following path: :: - /usr/share/centreon/bin/snmpTrapDyn.pl + /usr/share/centreon/bin/snmpTrapDyn.pl -by +by :: /usr/share/centreon/bin/dsmclient.pl -All parameters are the same. +The other parameters remain the same. -Install a poller +Upgrade a poller ---------------- -This part is a howto install Centreon DSM on a poller. Only client will be installed on a poller. +These instructions apply when upgrading the **Centreon DSM** extension on a +poller. Only the Centreon DSM client package must be installed on the poller. -To install centreon DSM, run the following commands: +To upgrade Centreon DSM, run the following commands: :: $ yum erase centreon-dsm $ yum install centreon-dsm-client -You have now to configure MySQL access in order that your poller is enable to connect to central server with the centreon user to the centreon and centreon_storage database. +You now have to configure MariaDB in order to enable the poller to connect to +the central server databases **centreon** and **centreon_storage** using the +user **centreon**. -In order to do that, connect you on MySQL with root user and launch the following request: +In order to do that, you have to connect to your MariaDB instance with the +**root** user and issue the following commands: :: $ GRANT SELECT ON `centreon`.`*` TO 'centreon'@'POLLER_IP'; $ GRANT SELECT, INSERT, UPDATE ON `centreon_storage`.`*` TO 'centreon'@'POLLER_IP'; -Now, from your poller, try to connect with MySQL client. If you have problem to configure MySQL connection, -please refer to the database documentation: http://dev.mysql.com/doc/refman/5.5/en/grant.html +Now, from your poller, try to connect to the central server with the MySQL +client using the **centreon** user. If you have problems to configure the +connection to MariaDB, please refer to the database documentation: +https://mariadb.com/kb/en/grant/ Base configuration of pollers ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -The communication between a poller and a central server is by MySQL. DSM Client need to have access to MySQL server in order to store new alarms. +The communication between a poller and the central server uses the MySQL +client/server protocol. The DSM client needs to have access to the central MySQL +server in order to store new alarms. .. note:: - The new trap system **centreontrapd** doesn't need an access to the database but Centreon-DSM does. - + The new trap system **centreontrapd** doesn't need access to the database but + Centreon DSM does. diff --git a/doc/en/user.rst b/doc/en/user.rst index e25905f..cc5da58 100644 --- a/doc/en/user.rst +++ b/doc/en/user.rst @@ -7,209 +7,333 @@ User guide Overview -------- -Centreon module, Dynamic Service Management (Centreon-DSM) is an extension to manage alarms with an eventlogs system. With DSM, Centreon can receive events such as SNMP traps resulting from the detection of a problem and assign events dynamically to a slot defined in Centreon, like a tray events. +Centreon module Dynamic Services Management (DSM) is an extension to manage +alarms with an event logs system. With DSM, Centreon can receive events such as +SNMP traps resulting from the detection of a problem and assign events +dynamically to a slot defined in Centreon, like a tray of events. -A resource has a set number of "slots" (containers) on which alerts will be assigned (stored). While this event has not been taken into account by a human action, it will remain visible in the interface Centreon. When event is acknowledged, the slot becomes available for new events. +A resource has a predefined number of slots (services) on which alerts will +be assigned to (stored). While a certain event has not been actively +acknowledged by a human action or cleared by another trap with an **OK** status, +it will remain visible in the Centreon web-based GUI. Once the event is +acknowledged or cleared, the slot becomes available for new events. -The goal of this module is to overhead the basic trap management system of Centreon. The basic function run with a single service and alarm crashed by successive alarms. +The goal of this module is to replace the basic trap management system of +Centreon. The basic trap management system runs with a single service and alarms +overwritten by successive alarms. Architecture ------------ -The event must be transmitted to the server via an SNMP trap. The SNMP trap is thus collected by the **snmptrapd daemon**. If reception parameters are valid (authorized community), then it sends snmptrapd trap SNMP binary SNMPTT. Otherwise, the event is deleted. +The event must be transmitted to the server via an SNMP trap. The SNMP trap is +thus collected by the **snmptrapd** daemon. If the received parameters are valid +(authorized community), then it sends snmptrapd trap SNMP binary SNMPTT. +Otherwise, the event is deleted. + +Once the SNMP trap has been received, it is sent to the **centreontrapdforward** +script which writes the information received in a buffer folder +(by default: /var/spool/centreontrapd/). + +The **centreontrapd** service reads the information received in the buffer +folder and interprets the traps received checking, in the centreon database, the +actions necessary to process these events. In Centreon DSM, we execute a +**Special Command**. + +This special command is executing the script **dsmclient.pl** with a few +arguments. This client will store the new trap in a slot queue that the daemon +reads every 5 seconds. + +The daemon **dsmd.pl** will search in the database **centreon** for slots (slot +pools) associated with the host. If no slot pool is found, the event is deleted. +Otherwise, the script will search for a free slot in the pool. If at least one +slot is free, then it will transmit external commands to the monitoring engine +to change the status of the slot. Otherwise the data will be kept in the +database and an alarm will be raised only after the release of a slot. A slot +can be released either by auto-acknowledgement or by a manual acknowledgement +from an operator. + + +Host configuration +------------------ + +Centreon DSM is different from the basic trap management system in the sense +that you can't link the passive service of the slot to the trap that you want +to monitor. +With Centreon DSM, you'll have to link the SNMP trap with any active service +that is currently **ENABLED** on a host. If the monitored host has at least one +active service, you can proceed to the next step_. Otherwise, you should create +a new host and select the host **Template** called +**generic-active-host-custom**. This template provides the bare minimum required +(the **Ping** active service) for the deployment of Centreon DSM. Make sure you +configure the **IP Address** and **SNMP Community and Version** parameters +correctly for your host. +Later_ in this document, we'll go through the steps required to link the host +active service with the SNMP trap. + +.. _step: + +Creating a passive service template +----------------------------------- + +Centreon DSM slots are actually created out of "regular" passive services. In +order to facilitate the configuration of these passive services, it is more +convenient to create a passive service template. This passive service template +will be used by the Centreon DSM to create the multiple services (slots) for the +SNMP traps that you want to monitor. +In order to create the passive service template, you have to: + +#. Go to the menu **Configuration > Services > Templates** +#. Click on **Add** + +The table below summarizes all the required attributes of a passive service +template for Centreon DSM: + ++--------------------------+---------------------------------------------------+ +| Attribute | Description | ++==========================+===================================================+ +| **Service Configuration** Tab | ++--------------------------+---------------------------------------------------+ +| Alias | Passive service template used with Centreon | +| | DSM and SNMP traps | ++--------------------------+---------------------------------------------------+ +| Service | generic-passive-service-dsm-custom | +| Template | | +| Name | | ++--------------------------+---------------------------------------------------+ +| Template | generic-passive-service | ++--------------------------+---------------------------------------------------+ +| Custom Macros | * **DUMMYSTATUS**: OK | +| | * **DUMMYOUTPUT**: Service is OK | +| | * **ALARM_ID**: empty | ++--------------------------+---------------------------------------------------+ -Once the SNMP trap has been received, it is sent to the **centreontrapdforward** script which writes the information received in a buffer folder (by default: /var/spool/centreontrapd/). - -The **centreontrapd** service reads the information received in the buffer folder and interprets the traps received checking, in the centreon database, the actions necessary to process these events. In Centreon DSM we execute a **special command**. - -This special command is executing binary **dsmclient.pl** with arguments. This client will store the new trap in a slot queue that the daemon read every 5 seconds. - -The daemon **dsmd.pl** will search in database "centreon" name slots (pool service liabilities) associated with the host. If no slot is created, the event is deleted. Otherwise, the binary will look if there is at least one free slot. If at least one slot is free, then it will transmit to monitoring engine external commands to change the state of the slot. Otherwise the data will be made no secret pending the release of a slot. A slot is releasable served by paying the liabilities. - - -Configure Slots ---------------- - -In Centreon WebUI, go on: - -:: - - Administration > Modules > Dynamic Services - - -and click on the **add** link. In order to create or modify a slot group, please follow the table below in order to understand the role of all parameters. - -+------------------------------+--------------------------------+ -| Parameters | Descriptions | -+==============================+================================+ -| Name | This is the name of the slot | -| | group. | -+------------------------------+--------------------------------+ -| Description | This is the description of the | -| | group. | -+------------------------------+--------------------------------+ -| Host Name | The name which host the slots. | -+------------------------------+--------------------------------+ -| Service template bas | The base service template use | -| | to create service slots on the | -| | host. This template must have | -| | been a passive template. This | -| | template must be 100 % passive | -| | and a custom macro have to be | -| | created on it. The macro is | -| | named "ALARM_ID" and the | -| | default value must be "empty". | -+------------------------------+--------------------------------+ -| Number of slots | The number of slot that | -| | Centreon will create on the | -| | selected host when the form | -| | will be validated. | -+------------------------------+--------------------------------+ -| Slot name prefix | The prefix is used to give the | -| | name of slots. The name will | -| | be follow by a number | -| | incremented from 0 to the | -| | number of slots. | -+------------------------------+--------------------------------+ -| Check command | This check command is used | -| | when the service has to be | -| | forced in order to free a | -| | slot. The check command must | -| | have to send a ok return code. | -+------------------------------+--------------------------------+ -| Status | The status of the slot. | -+------------------------------+--------------------------------+ - -You can find in the following picture, an example of form. - -.. image:: /_static/use/form-slot.png - :align: center +.. warning:: + The custom macro **ALARM_ID** and its associated value **empty** are + mandatory with Centreon DSM. They must be created together with the new + service template. An example of passive service template is available below: - + .. image:: /_static/use/form-passive-service.png :align: center -.. warning:: - The macro ALARM_ID is mandatory. The default empty is also necessary. +Configuring the slot pool +------------------------- + +In the Centreon web-based GUI, go to +**Administration > Extensions > (Dynamic Services) Configure** and click on the +**Add** button. In order to create or modify a slot pool, read the table below +for better comprehension of the role of each parameter. + ++--------------------+---------------------------------------------------------+ +| Parameter | Description | ++====================+=========================================================+ +| Name | This is the name of the slot pool. | ++--------------------+---------------------------------------------------------+ +| Description | This is a description for the slot pool. | ++--------------------+---------------------------------------------------------+ +| Host Name | The name of the host linked to the slot | +| | pool. | ++--------------------+---------------------------------------------------------+ +| Service | The base service template used to create the | +| template | service slots on the host. This template must | +| based | be a passive service template **only** and a | +| | custom macro needs to be created on it. The | +| | custom macro **must** be named **ALARM_ID** | +| | and its default value must be set to | +| | **empty**. | ++--------------------+---------------------------------------------------------+ +| Number of slots | The number of slots (services) that Centreon | +| | will create on the selected host upon | +| | validation of this configuration form. | ++--------------------+---------------------------------------------------------+ +| Slot name prefix | This prefix is used to name the services that | +| | represent each slot. The name of the service | +| | will be the **Slot name prefix** followed | +| | by a four-digit number, starting from 0001 and | +| | and all the way up to the total | +| | **Number of slots**. | ++--------------------+---------------------------------------------------------+ +| Check command | This **Check command** is used when the | +| | the service has to be forced into a free slot. | +| | The check command must return an **OK** code. | ++--------------------+---------------------------------------------------------+ +| Status | The status of the slot pool. | ++--------------------+---------------------------------------------------------+ + +In the following picture, you have an example of configuration. +.. image:: /_static/use/form-slot.png + :align: center -When you validate the form, Centreon will create or update all slot. If you don't have changed any value, you don't have to do other action. Else you have to go to: -:: - - Configuration > Monitoring Engine - -In order to generate configuration of the poller who have been impacted by the changes. If you don't do that, you will not see your changes appears into Centreon Monitoring UI. +When you save the configuration, Centreon will create or update all slots. If +you haven't changed anything else, you are all set. Otherwise, you +have to go to **Configuration > Pollers > Pollers** in order to generate the +configuration of the poller impacted by the changes. If you don't do that, you +will not see the results of your changes in the Centreon web-based GUI. .. image:: /_static/use/conf-test.png :align: center -Now the configuration has been generated and validated by Centreon Engine. You can now push the configuration files and restart. +Once the configuration has been generated and validated on the web-based GUI, +you can then push the configuration files and restart the Centreon Engine. .. image:: /_static/use/conf-restart.png :align: center -Configure traps ---------------- - -The last step is to configure traps that you want to redirect to you slots. This configuration is a little complexe for the moment but we will try to simplify it for the next versions of Centreon DSM. - -Edit a SNMP trap that you want to redirect to slots systems. Go on: +Configuring the traps +--------------------- -:: - - Configuration > SNMP traps. +The last step is to configure the traps that you want to redirect to the +Centreon DSM slots. +Nowadays, this configuration is slightly complex. Our intention is to simplify +it in future releases of the Centreon DSM. -You find the following form: +To edit an SNMP trap that you want to redirect to the slot systems, go to +**Configuration > SNMP traps > SNMP traps** and you will find the following +configuration form: .. image:: /_static/use/trap-form.png :align: center -In order to redirect alarms to slots, you have to enable **Execute special command** in the form and add the following command into the "special command" field +In order to redirect alarms to slots, you have to tick the checkbox +**Execute special command** and call the **dsmclient.pl** using the +**Special Command** field in a similar way to the example below: :: - /usr/share/centreon/bin/dsmclient.pl -H @HOSTADDRESS@ -o 'Example output : $*' -i 'linkdown' -s 1 -t @TIME@ - -This command launch for each trap received this command in order to redirect alarms to dsmd daemon. - -This command take some parameters. You can find in the following table the list and the description of each parameter: - -+------------------------------+------------------------------------------+ -| Parameters | Description | -+------------------------------+------------------------------------------+ -| -H | Host address (ip or name) in which you | -| | want to redirect the alarm. You can pass | -| | the value @HOSTADDRESS@ in order to keep | -| | the same host or you can use whatever you| -| | want in order to centralized all alarms | -| | on the same virtual host for example who | -| | host all alarms. | -+------------------------------+------------------------------------------+ -| -o | This is the output that dsm will put when| -| | the command will submit the result in the| -| | good slot. This output can be built will | -| | all $* value and with a specific string | -| | that you pass in parameter. | -+------------------------------+------------------------------------------+ -| -i | This is the id of the | -| | alarm. The alarm id can be built with the| -| | concatenation of some variables like | -| | "$1-$4". The id enable the possibility to| -| | use the option of auto-acknowledgement of| -| | alarm when you have the possibility to | -| | create the same id during the opening and| -| | the closing treatment of the alarm. | -+------------------------------+------------------------------------------+ -| -s | This is the status that you want to pass | -| | in parameter to the alarm. You can use | -| | @STATUS@ in order to use the inherited | -| | status build from matching rule system. | -+------------------------------+------------------------------------------+ -| -t | This is the time that you want to pass to| -| | dsm in order to keep the real trap | -| | reception time. | -+------------------------------+------------------------------------------+ -| -m | This is the list of macros and its values| -| | that you want to update during the | -| | treatment of the alarm. Please follow the| -| | syntax below: | -| | macro1=value1|macro2=value2|macro3=value3| -| | This function is used to update some | -| | parameters in live on the nagios or | -| | Centreon-Engine core memory without a | -| | restart. | -+------------------------------+------------------------------------------+ - -Your form should now be like that: + /usr/share/centreon/bin/dsmclient.pl --Host @HOSTADDRESS@ --output 'Example output: $*' --id 'linkdown' --status 2 --time @TIME@ + +This command accepts a number of different parameters. In the following table, +you can find a description for each of them: + ++---------------------+--------------------------------------------------------+ +| Parameter | Description | ++=====================+========================================================+ +| **-H \| --Host** | Host address (IP address or Name) to which you | +| | want to redirect the alarm. You can use the | +| | variable **@HOSTADDRESS@** in order to keep | +| | the same IP address received in the trap or | +| | the can change it to any other IP address if | +| | you intend to centralize all alarms on a | +| | single virtual host, for example. | ++---------------------+--------------------------------------------------------+ +| **--host-id** | This is the Centreon internally-defined Host | +| | ID of the managed device. | +| | The Host ID is used to assign a trap to a | +| | certain host-slot pool pair whenever the same | +| | trap can be generated by different hosts that | +| | share the same IP address. It doesn't matter | +| | if you're treating the same trap OID through | +| | both DSM and the basic SNMP trap management | +| | system at the same time. If you have more than | +| | one host using the same IP address, use the | +| | parameter **Host ID** instead of the parameter | +| | **Host** to identify the host. | +| | In order to discover the Host ID, you can go | +| | to **Configuration > Hosts > Hosts** and click | +| | on the name of the host. The Host ID can be | +| | obtained from the URL shown on the web browser | +| | (the Host ID is the number that comes right | +| | after **host_id=**). | ++---------------------+--------------------------------------------------------+ +| **--pool-prefix** | This option should be set exactly like the | +| | **Slot name prefix** that was previously set | +| | up in the step `Configuring the slot pool`_. | +| | The **--pool-prefix** option is mandatory | +| | whenever you have at the same time: | +| | | +| | * Multiple DSM slot pools linked to any one | +| | single host and; | +| | * Distinct traps assigned to different (but | +| | specific) DSM slot pools. | +| | | +| | If not set, all traps the will be directed to | +| | the first slot pool created on Centreon (that | +| | is linked to the host). | ++---------------------+--------------------------------------------------------+ +| **-i \| --id** | This is the ID of the alarm. The alarm ID can | +| | be built with the concatenation of strings and | +| | variables like "$1-$4". If you want Centreon | +| | to perform auto-acknowledgement (a certain | +| | trap 'resetting' the status of a slot to | +| | **OK**), make sure the alarm ID is exactly the | +| | same on the configuration of both traps. | +| | Example: if the trap linkUp should reset an | +| | alarm for the trap linkDown, you have to set | +| | the same ID for these two traps. You could use | +| | something like **--id 'Link Status'** for | +| | both. If the ID is not the same, then Centreon | +| | DSM will assign new alarms to different slots | +| | (instead of resetting an alarm previously in | +| | **WARNING** or **CRITICAL** status). | ++---------------------+--------------------------------------------------------+ +| **-o \| --output** | This is the output message that DSM will | +| | provide to the correct slot when the command | +| | is called. This output can be built with the | +| | concatenation of strings and all $* values. | ++---------------------+--------------------------------------------------------+ +| **-s \| --status** | This is the status (0 = **OK**, | +| | 1 = **WARNING**, 2 = **CRITICAL** or | +| | 3 = **UNKNOWN**) that you want the | +| | **dsmclient.pl** script to pass as parameter | +| | to the alarm. You can use **@STATUS@** in | +| | order to inherit the status resulting from the | +| | advanced matching rules system. | ++---------------------+--------------------------------------------------------+ +| **-t \| --time** | This is the time that you want to pass to | +| | DSM. In order to keep the actual trap | +| | reception time, you can use **@TIME@**. | ++---------------------+--------------------------------------------------------+ +| **-m \| --macro** | This is a list of macros and the values that | +| | you want to update them to during the | +| | treatment of the alarm. The following syntax | +| | must be used: | +| | macro1=value1\|macro2=value2\|macro3=value3 | +| | This option is used when you need to update | +| | macros at runtime on the Centreon Engine | +| | without requiring a restart. | ++---------------------+--------------------------------------------------------+ + + +Your configuration should look like this: .. image:: /_static/use/trap-form-2.png :align: center -After saving the form, please generate the SNMP traps configuration file. Go on: - -:: - - Configuration > SNMP Traps > Generate - -Select your poller, select generate and validate the form. +After saving the configuration, you'll have to generate the SNMP traps +configuration file. Go to **Configuration > SNMP Traps > Generate**, select the +poller, and tick the checkboxes **Generate trap database** and +**Apply configurations**. Finally, opt for **Restart** in the **Send signal** +drop-down list and click the button **Generate**. You can now start the daemon on your server: :: - /etc/init.d/dsmd start + systemctl start dsmd You should now have DSM activated for all traps you have configured. +.. _Later: -Configure Traps links ---------------------- +Configuring the link between the trap and the host active service +----------------------------------------------------------------- -One thing is different compared to Centreon Trap system is that you cannot link directly the service template of the slot to the trap in order to not received x time the trap (x represent here the number of slots). +Earlier on `Host configuration`_, we mentioned that Centreon DSM differs from +the basic trap management system in the sense that you can't link the passive +service of the slot to the trap that you want to monitor. You have to link the +the SNMP trap with any active service that is currently **ENABLED** on a host. +Here is how you do this. -You have to link traps to an active service of the resource, for example the Ping service. +#. Go to the menu **Configuration > SNMP traps > SNMP traps** +#. Search and click the trap that you want to edit +#. Click the tab **Relations** +#. Use the **Linked services** textbox to search for any active service + (e.g. **Ping**) on the host that generates that specific trap. Once you've + found it, click to select it. +#. Click **Save**