1.0 Introduction
The purpose of this article is to describe the procedure for adding an email handler to a Sensu server to send email notifications or alerts when a check is executed or reaches a warning or critical status for a Fortanix Data Security Manager (DSM) instance.
2.0 Terminology References
SMTP - Simple Mail Transfer Protocol
VM - Virtual Machine
3.0 Prerequisites
Before configuring the email handler, ensure the following:
The Sensu server is set up and monitoring the Fortanix DSM targets.
4.0 Configure Email Handler on Sense VM
This section explains how to configure the email handler on the Sensu VM.
Perform the following steps:
Run the following command to navigate to the
Monitoring-Server-Artifacts
folder on the Sensu VM created in “Section 5.1: Setting Up Sensu Server” in the Fortanix DSM with Sensu Monitoring and Alerting guide:cd Monitoring-Server-Artifacts
Run the following command to execute the
add_handlers.sh
script to add an email handler:./add_handlers.sh
When prompted, select Y for email handler:
Do you want to create email handler ? (Y/N): Y Creating email handler Specify From email address : Specify To email address : Specify SMTP server address : Does SMTP server allow insecure connection (unauthenticated on port 25)? (Y/N) : Specify SMPT username : Specify SMTP user password : Specify SMTP port (default 587) : Created Attaching email handler to all checks
Verify the email handler configuration from Sensu Web user interface (UI):
Figure 1: Select the Email handler
Figure 2: Email handler specification
5.0 Configure Keepalive Handler
This section explains how the keepalive handler monitors the status of the sensu-agent
service on each node.
5.1 Configure Keepalive Handler on Sense VM
Perform the following steps on the Sensu VM:
Run the following command to navigate to the
Monitoring-Server-Artifacts
folder in Sensu VM created in “Section 5.1: Setting Up Sensu Server” in the Fortanix DSM with Sensu Monitoring and Alerting guide:cd Monitoring-Server-Artifacts
Run the following command to create the
email-keepalive-handler.yml
file:vi email-keepalive-handler.yml
Add the following configuration to the
email-keepalive-handler.yml
file:type: Handler api_version: core/v2 metadata: name: keepalive namespace: default spec handlers: - email type: set filters: - is_incident - not_silenced
Run the following command to create the keepalive handler for email handler:
sensuctl create -f email-keepalive-handler.yml
Run the following commands to reload the
systemd
manager configuration:sudo systemctl daemon-reload
Run the following commands to restart the
sensu-agent
service:sudo systemctl restart sensu-agent
Run the following command to verify the status of the
sensu-agent
service:sudo systemctl status sensu-agent
5.2 Apply Configuration Changes on Fortanix DSM Node
Perform the following steps on each Fortanix DSM node where the sensu-agent
service is configured:
Add the following values in the
/etc/sensu/agent.yml
file:keepalive-warning-timeout: 60 keepalive-critical-timeout: 90
Run the following command to reload the
systemd
manager configuration:sudo systemctl daemon-reload
Run the following command to restart the
sensu-agent
service:sudo systemctl restart sensu-agent
Run the following command to verify the status of the
sensu-agent
service:sudo systemctl status sensu-agent