Introduction
This document explains how to send notifications by mail regarding events occurring in Denodo Virtual DataPort.
In some situations we need to be alerted if a specific event takes place in Denodo. In order to achieve that, we can use different techniques detailed in this article: log4j appenders, JMX alerts and Denodo Scheduler Handlers.
JMX notifications
When to use
To register alerts regarding Memory/CPU usage information or any other information available in the MBeans exposed through JMX by the Denodo Platform.
Description
Java Mission Control (JMC) is an Oracle tool for managing, monitoring, profiling, and troubleshooting Java applications. We will see how to use this tool in order to monitor the Denodo Platform MBeans and to generate alerts based on their status.
Steps to configure
JMC is included as part of the Java distribution, if a JDK is already installed JMC can be executed (otherwise the Java Development Kit needs to be installed). Once the tool is running, perform the following steps:
- Execute jmc.exe located at <JDK_PATH>/bin.
- The “JVM Browser” shows the processes running locally. When the VDP Server is running in a remote machine you can connect with a remote JVM using the option “File” > “Connect” > “Create a new connection”.
- From the JVM Browser search for the VDP Server process. You can identify the process by the process ID (searching previously for this number) or identifying the element which command line starts as following:
com.denodo.util.launcher.Launcher com.denodo.vdb.vdbinterface.server.VDBManagerImpl...
- By clicking on the JVM Browser element and double clicking on “MBean Server” JMC will connect to the VDP Server.
- On the MBeanServer wizard a Triggers tab is available at the bottom. This will open a wizard where trigger rules can be configured (activated and deactivated) for several events like CPU usage or Deadlocked threads. New trigger rules can also be created based on the exposed MBeans.
As an example we are going to create a new Trigger that sends an email every time that the number of active requests exceeds a limit number. The steps will be the following:
- On the Triggers tab click on “Add…” button.
- Search for the MBean containing the information and click on “Finish”. In the KB article “Monitoring Denodo servers with JMX” more information about the available MBeans can be found.
- A new wizard called “Rule Details” will show up. In that wizard the values for triggering the condition can be setted. In this example the “current value” will be the limit that, when reached, the email will be sent.
- Once the condition has been defined, we need to make sure that JMC will evaluate the values properly so the condition can be checked. This means that we need to “cast” the attribute name indicating how it can be measured.
To do that, go to the MBeans tab and search for the appropriate bean and the attribute to be measured. In this case, the bean is “VDBServerManagementInfo” and the attribute “ActiveRequests”.
Once located, right click on “ActiveRequests” to indicate to JMC how it needs to manage the retrieved value. In this case, the value will be interpreted as a number, in units of 1.
- When the trigger is configured by clicking on the “Action” tab the “Send e-mail” action can be configured.
- In addition, the SMTP server has to be configured in order to be able to send the email. For that go to Window > Preferences > Java Mission Control > JMX Console > Communication and set up the SMTP Server configuration.
Log4j Alerts
When to use
To get an e-mail alert of an event logged in the Denodo Virtual DataPort logs.
Description
Virtual DataPort uses the logging library Apache Log4j to log the activity of the Virtual DataPort server and its Administration Tool. Log4j allows defining the log level (TRACE, DEBUG, INFO, WARN, ERROR or FATAL) for different categories. The configuration of Log4j for the Virtual DataPort server is controlled by the file:
<DENODO_HOME>/conf/vdp/log4j2.xml
For the administration tool by the file:
<DENODO_HOME>/conf/vdp-admin/log4j2.xml.
In these files you can find three main components: Appenders, PatternLayouts and Loggers.
A logger defines a log level for a category and they can be assigned to appenders previously configured. For instance:
<RollingFile name="VDBOUT" fileName=".../logs/vdp/vdp-cache.log">
<PatternLayout pattern="[%t] %d{yyyy-MM-dd'T'HH:mm:ss.SSS}/>
</RollingFile>
<Logger name="com.denodo.vdb" level="error">
<AppenderRef ref="VDBOUT" />
</Logger>
This configuration indicates that the category “com.denodo.vdb” on an error event will write the output of the log to the file configured in the VDBOUT appender following the defined pattern layout.
The SMTPAppender is an appender which sends an e-mail when a specific logging event occurs, typically on errors or fatal errors. Therefore, instead of writing the output to a file it is possible to configure a destination email address.
Steps to configure
- Configure the appender. The appender contains the information related to the SMTP server used for sending the email.
<SMTP name="EMAILALERT"
subject="VDP Log Alert"
to="toUser@mydomain.com"
from="fromUser@mydomain.com"
smtpHost="mail.mydomain.com"
smtpPort="25"
smtpProtocol="smtp"
smtpUsername="mysmtpusername"
smtpPassword="mysmtppassword"
smtpDebug="true"
bufferSize="512">
</SMTP>
- Configure the loggers. Once the appender is configured, any logger with a log level for a category can be configured indicating the email appender as output:
<Logger name="com.denodo.vdp" level="FATAL">
<AppenderRef ref="EMAILALERT" />
</Logger>
Denodo Scheduler Handlers
When to use
To send an email alert about the failure of a particular Job in Denodo Scheduler.
Description
When configuring Jobs in Scheduler it is possible to configure handlers. A handler is an action that is executed as the last step before completing the execution of a job (if the conditions are met). Denodo Scheduler includes as a built-in handler the “Mail” handler. This handler allows to send an email with the result report on the job execution. It requires a list of destination email addresses to be specified and allows several conditions to be set (determining in which cases the mail has to be sent).
Steps to configure
In order to be able to send the email Scheduler requires a SMTP server to be configured. This configuration has to be set in “Administration” > “Server” > “Mail Settings”.
Once the mail server is set you have to follow this steps:
- Select the Job (or create a new one).
- Click on the “Handlers section” of the Job configuration.
- Select “Add Handler” > “mail”.
- Add the target mail addresses and the configuration “When to send”.
- Save the Job.
Next time the Job is executed, before finishing the execution, Scheduler will check if the “When to send” conditions are met and, if it is the case, it will send the Job report to the configured target emails.
The information provided in the Denodo Knowledge Base is intended to assist our users in advanced uses of Denodo. Please note that the results from the application of processes and configurations detailed in these documents may vary depending on your specific environment. Use them at your own discretion.
For an official guide of supported features, please refer to the User Manuals. For questions on critical systems or complex environments we recommend you to contact your Denodo Customer Success Manager.