After the first two studies, we know how to monitor the running status of the host and database through the DEM tool and DMAgent. However, it is impossible for DBAs to watch various indicators in front of the screen at all times. So, when we are not in front of the system, how do we know the real-time operating status of the database? At this time, we will use another powerful function of DEM-alert. Through the alarm, we can be notified by email or SMS when the database is running abnormally, so as to carry out emergency treatment.
This article demonstrates the environment:
Operating system: Windows Server 2012 R2 Standard
Database: DM Database Server x64 V7.1.6.48-Build(2018.03.01-89507)ENT
01
Deploy DMAgent and add database instance
Before enabling alarms, we need to deploy DEM and DMAgent in advance and add database instances that need to be monitored. For specific methods, please refer to " Remote Web Management DM7 Database-DMAgent Monitoring ".
02
Configure alarm notification mode
DEM supports two ways to push alarm information by email and SMS, which needs to be configured before use.
2.1 Send warning via email
If you want to send a warning via email, you first need to enable email push and configure the relevant information of the SMTP server, as shown in the figure.
Here I use the SMTP server of Tencent Enterprise Mailbox, you can also set it according to the actual situation during work. After the configuration is complete, you can click "Email Push Test" above to check whether the test is successful.
If the configuration is successful, you can receive the corresponding mail through the recipient.
2.2 Send a warning via SMS
If you need to enable SMS notifications
You need to use WEB-INF/lib/demsdk.jar in the DEM directory,
Implement the com.dameng.dem.server.util.IPhoneNotify interface, package the dependent packages and implementation classes into WEB-INF/lib, restart the web container, and then complete the SMS notification configuration in the system configuration. Due to the length, we won’t demonstrate it in detail here, and interested students can test it themselves.
03
Configure alerts
The configuration of alarms is divided into three steps, configuring application resources, configuring alarm rules, and configuring notifications. Let's demonstrate one by one below.
3.1 Application resource allocation
First add a new alarm and set the alarm name
Select the database instance to be monitored
3.2 Alarm rule configuration
The configuration of alarm rules is also divided into two steps. First, determine the alarm metrics
Then set the alarm algorithm
Here for the convenience of demonstration, we set the rule as the total number of sessions>=5, and then the alarm will start. In actual work, you can select the alarm according to your needs.
3.3 Notify user configuration
The third step is to choose which method to notify. Here we only have one dmin user, and we use email to notify.
At this point, the alarm configuration is complete.
04
Trigger an alarm
The alarm condition we set is that the total number of sessions>=5. At this time, as long as we open a few more sessions on the corresponding instance, it is easy to achieve the alarm requirement. The process is omitted here.
When we open a certain number of sessions, we will receive an alert email from the system
The message body will tell us that the database has violated some rules at this time, and the current state of the database. At the same time, we can also view the corresponding alarm information in the alarm notification through DEM.
At this point, we have finished sharing knowledge about DEM tools. If you are interested in using DEM in your work, you can also refer to the "DEM Online Help Manual", which can be found in the help under the DEM installation directory.