6. Alerts

Alerts are managed from workstation, however alerts feature must be enabled and configured before any alert rule can be added. Whenever some alert rule is defined in workstation it is persisted in the corresponding manager instance. If there are any databases connected to that instance, they get notified about the alert change instantly. They update their set of rules and start to evaluate them. How the notifications are performed is determined by the corresponding notification plugin. The notification feature is implemented as a plugin and is disabled by default. In order to enable it you must add a valid notification plugin name to the plugins option in the manager configuration file. You can either provide your own implementation of the notification plugin or use the one shipped with Flopsar.

Tip

You can always check what alert rules are currently deployed on a database by executing the following command:

$ fs2db get --target alerts <database_home>

The instructions given below are only valid for the Flopsar notification plugin.

6.1. Notification Plugin

The notification plugin is an SMTP client, which sends emails when some conditions are fulfilled. The plugin makes use of CURL library.

If you plan to use this feature, you must enable this plugin as well. Follow the instructions below to enable the notification plugin:

  1. update the plugins option to include the libflopsar-smtp.so value.

  2. copy /usr/share/flopsar/templates/plugins/flopsar-smtp directory to <manager_home>/conf/.

  3. edit smtp.conf file and set your SMTP server options:

    smtp.host:Address of your SMTP server.
    smtp.port:Port of your SMTP server.
    smtp.username:If your SMTP server requires authentication, put a valid user name here. Corresponds to the CURLOPT_USERNAME.
    smtp.password:If your SMTP server requires authentication, put a valid password here. Corresponds to the CURLOPT_PASSWORD option.
    smtp.subject:Subject of each notification email.
    smtp.from:SMTP sender address. Corresponds to the CURLOPT_MAIL_FROM option.
    smtp.verbose:Verbose mode used to display a lot of verbose information. Corresponds to the CURLOPT_VERBOSE option.
    smtp.ssl.enabled:
     Corresponds to the CURLOPT_USE_SSL option.
    smtp.ssl.verify_peer:
     Corresponds to the CURLOPT_SSL_VERIFYPEER option.
    smtp.ssl.verify_host:
     Corresponds to the CURLOPT_SSL_VERIFYHOST option.
  4. edit the smtp.recipients and add subscribers’ email addresses (one per line).

  5. edit the smtp.text and set your own message template.

When you set your own message template, you have some variables at your disposal:

$FS2_AID:Alert identifier.
$FS2_VAL:The monitored component value.
$FS2_DATE:Alert generation time.
$FS2_AGENT:agent identifier.
$FS2_COMPONENT:Component name.
$FS2_TWINDOW:Time window of the alert rule.

These variables will be replaced with their corresponding values. Below, you can see a sample message (smtp.text content):

<html>
<body>
This is my sample alert message template!<br/>
<b>Agent</b>: $FS2_AGENT<br/>
<b>Component</b>: $FS2_COMPONENT<br/>
</body>
</html>

If you want to check if the plugin configuration is valid, you can execute the following command (see Plugins for more details):

$ fs2mgr --plugins test <manager_home>

In this case, this command will make the plugin send an email to all the subscribers.

Note

You can change the plugin settings in runtime. All the changes will be automatically reloaded in runtime, after you save the configuration files.