Coder Social home page Coder Social logo

exasol / cloudwatch-adapter Goto Github PK

View Code? Open in Web Editor NEW
2.0 9.0 1.0 249 KB

Makes Exasol database monitoring data available in AWS CloudWatch

License: MIT License

Shell 0.28% Java 99.72%
aws-cloudwatch exasol-integration aws-cloudwatch-metrics monitoring

cloudwatch-adapter's Introduction

Exasol – AWS Cloudwatch Adapter

Build Status

Quality Gate Status

Security Rating Reliability Rating Maintainability Rating Technical Debt

Code Smells Coverage Duplicated Lines (%) Lines of Code

This adapter transfers the statistics from the Exasol database to AWS CloudWatch metrics. This adapter runs independently of the Exasol database in an AWS Lambda function.

Setup

Create an Exasol User

The CloudWatch adapter accesses your Exasol database via its SQL interface. For that it needs credentials. We recommend creating a dedicated user for that purpose:

CREATE USER CLOUDWATCH_ADAPTER IDENTIFIED BY "<PASSWORD>";

GRANT CREATE SESSION TO CLOUDWATCH_ADAPTER;

Don't forget to use a strong, randomly generated password instead of <PASSWORD>.

Store Credentials in AWS Secrets Manager

Create a new secret in the AWS Secrets Manager with the following values:

  • host: VPC internal ip address of your Exasol database
  • port: Exasol JDBC port (default: 8563)
  • username: Name of an Exasol user account with CREATE SESSION privileges
  • password: Password for the account
  • certificateFingerprint: Fingerprint of the database's TLS certificate. This is only required if Exasol uses a self-signed certificate.

VPC Setup

The CloudWatch adapter must run in the same AWS VPC that the Exasol database runs. By that it can access the Exasol database using a internal IP address.

From within the VPC it can however not access the default Endpoints for AWS CloudWatch and SecretsManager.

To add them, go to the AWS VPC Console / Endpoints. There create endpoints for the following AWS services:

  • com.amazonaws.<REGION>.monitoring
  • com.amazonaws.<REGION>.secretsmanager

Make sure that you select the VPC, Subnet and Security group of your Exasol database.

It is important to enable DNS for the endpoint. If it's not possible, you might have to enable DNS in your VPC.

Setup CloudWatch Adapter

  • Open the AWS Lambda Console
  • Click "Create Function"
  • Select "Browse serverless application repository"
  • Search for "ExasolCloudWatchAdapter"
  • Fill out the application settings
    • ExasolDeploymentName: A name describing the Exasol installation you want to monitor. The adapter adds this name as a dimension to the metrics in Cloudwatch. This will help you to distinguish the data if you monitor more than one Exasol deployment.

    • ExasolConnectionSecretArn: ARN of Secrets Manager secret you created in a previous step.

    • Metrics: A comma-separated list of metrics. If empty, the adapter reports all metrics. List of supported metrics.

    • SubnetId: ID of the VPC subnet of the Exasol database.

    • SecurityGroup: ID of the security group of the Exasol database.

  • Click on "Deploy"

Create a Dashboard

Now the adapter should transmit the metrics to CloudWatch. To visualize them you have to create a CloudWatch dashboard. You could start from scratch and build your own dashboard. We, however, recommend you to start with our example dashboard. This comes with lots of preconfigured widgets, designed by the best practices of our monitoring experts.

Troubleshooting

If the adapter does not work properly, first check its log output. For that go to the AWS Management Console / Lambda, select the Lambda function of the adapter, and click on Monitoring. There click on View logs in CloudWatch and scan the log files for error messages.

Known Bugs

  • In case your Exasol database uses a timezone with time-shift as DBTIMEZONE, this adapter will not report the hour when the time is shifted back, since Exasol stores the statistics entries in the DBTIMEZONE and by that, the log entries are ambiguous in that hour (see #2).
  • Due to a bug in SAM we can not publish the app with a retry count set to 0. This can lead to duplicate reported data if the Lambda fails after reporting some points and EventBridge triggers it again (see #21).

Additional Information

The design of this adapter ensures that points are never written twice, which would lead to wrong statistics. It does, however not assure that all points are written. In case of temporary errors with the Exasol database or the CloudWatch API, it can occur that data points are missing.

cloudwatch-adapter's People

Contributors

jakobbraun avatar kaklakariada avatar morazow avatar redcatbear avatar

Stargazers

 avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Forkers

rohankumardubey

cloudwatch-adapter's Issues

Finish release

A new version of this project was released.
Now we need to deploy it to the AWS severless application store.

For that, please pick the packed SAM template from the latest run of Prepare SAM release workflow and send it to the person responsible for releasing on the Exasol AG AWS account.

Report metrics from EXA_SYSTEM_EVENTS more often

The metrics from EXA_SYSTEM_EVENTS are only written from time to time. For example one per day. For using them in Cloudwatch alarms it's however required that they are reported at least every 5 minutes.

Solution:

report most recent value every 5 mins.

Fix SAM template

Currently, the SAM deployment fails with a ClassNotFoundException.

Finish release

A new version of this project was released.
Now we need to deploy it to the AWS severless application store.

For that, please pick the packed SAM template from the latest run of Prepare SAM release workflow and send it to the person responsible for releasing on the Exasol AG AWS account.

Finish release

A new version of this project was released.
Now we need to deploy it to the AWS severless application store.

For that, please pick the packed SAM template from the latest run of Prepare SAM release workflow and send it to the person responsible for releasing on the Exasol AG AWS account.

Update log4j to fix CVE-2021-44228

Cloudwatch adapter uses log4j versions affected by CVE-2021-44228:

[INFO]    org.apache.logging.log4j:log4j-core:jar:2.14.1:compile
[INFO]    org.apache.logging.log4j:log4j-slf4j18-impl:jar:2.14.1:compile
[INFO]    com.amazonaws:aws-lambda-java-log4j2:jar:1.2.0:compile
[INFO]    org.apache.logging.log4j:log4j-api:jar:2.14.1:compile

Dependency tree

[INFO] +- com.amazonaws:aws-lambda-java-log4j2:jar:1.2.0:compile
[INFO] +- org.apache.logging.log4j:log4j-api:jar:2.14.1:compile
[INFO] +- org.apache.logging.log4j:log4j-core:jar:2.14.1:compile
[INFO] +- org.apache.logging.log4j:log4j-slf4j18-impl:jar:2.14.1:compile

Remove exclude for E-PK-CORE-53 dependencies.md file has outdated content

After setting required maven version to 3.8.7. or higher with PK ticket #444 (project-keeper release 2.9.6) users can remove the suppressed warning from file .project-keeper.yml:

  - regex: "(?s)E-PK-CORE-53: The dependencies.md file has outdated content.*"

Affected repositories:

Project uses outdated repo maven.exasol.com

Error:  Failed to execute goal on project cloudwatch-adapter: Could not resolve dependencies for project com.exasol:cloudwatch-adapter:jar:1.0.5: Failed to collect dependencies at com.exasol:exasol-jdbc:jar:7.1.11: Failed to read artifact descriptor for com.exasol:exasol-jdbc:jar:7.1.11: Could not transfer artifact com.exasol:exasol-jdbc:pom:7.1.11 from/to maven.exasol.com (https://maven.exasol.com/artifactory/exasol-releases): transfer failed for https://maven.exasol.com/artifactory/exasol-releases/com/exasol/exasol-jdbc/7.1.11/exasol-jdbc-7.1.11.pom: Unknown host maven.exasol.com -> [Help 1]

Finish release

A new version of this project was released.
Now we need to deploy it to the AWS severless application store.

For that, please pick the packed SAM template from the latest run of Prepare SAM release workflow and send it to the person responsible for releasing on the Exasol AG AWS account.

Add support for reporting backup events

For administrators it would be helpful to create CloudWatch alerts that indicate if an Exasol backup succeeded or failed.

For that we can add a Metric based on events in the EXA_SYSTEM_EVENTS table. We need to report the following events:

  • BACKUP_START
  • BACKUP_END
  • BACKUP_ABORTED

The user must be able to configure which events should be used.

Fix release

Release is broken due to invalid artifact name.

Report not possible during time-shift

In case your Exasol database uses a timezone with a time-shift as DBTIMEZONE, this adapter will not report the hour when the time is shifted back, since Exasol stores the statistics entries in the DBTIMEZONE and by that, the log entries are ambiguous in that hour.

Steps for Fix:

  • Change column EXA_STATISTICS table to use TIMESTAMP WITH LOCAL TIMEZONE instead of TIMESTAMP or store entries in UTC.
  • Change this adapter to use the new API

Finish release

A new version of this project was released.
Now we need to deploy it to the AWS severless application store.

For that, please pick the packed SAM template from the latest run of Prepare SAM release workflow and send it to the person responsible for releasing on the Exasol AG AWS account.

Report temporary db-ram more often

For monitoring the database it would be great to report the temporary db ram size more often then every 30 minutes.
That could be possible by reading it as an aggregation of all rows of SYS.EXA_ALL_SESSIONS.

(This is a follow-up of #61)

Fix SAM CI

Right now, CI fails since sam is not installed correctly

Basic adapter

Acceptance criteria

  1. Adapter makes a single performance metric available in CloudWatch

Add configuration for VPC

Currently, users have to reconfigure the VPC of the lambda after its creation.

It would be more convenient to directly have a property for the VPC.

I don't see metrics collected

Hello,

I have installed cloudwatch-adapter for exasol (DB version 7.1.6), currently I just see these messages in cloudwatch:

  • sun.reflect.Reflection.getCallerClass is not supported. _This will impact performance.

  • Transforming org/apache/logging/log4j/core/lookup/JndiLookup (lambdainternal.CustomerClassLoader@433c675d)

  • START RequestId: bbf47e5c-7f52-4e5a-b58a-25dd37c8027b Version: $LATEST

  • 2022-03-20 18:40:14 bbf47e5c-7f52-4e5a-b58a-25dd37c8027b INFO CloudWatchAdapter - Writing 108 points.

  • END RequestId: bbf47e5c-7f52-4e5a-b58a-25dd37c8027b

  • REPORT RequestId: bbf47e5c-7f52-4e5a-b58a-25dd37c8027b Duration: 4497.37 ms Billed Duration: 4498 ms Memory Size: 512 MB Max Memory Used: 184 MB Init Duration: 4733.76 ms

**Checking inside of DB I just see these commands performed by user CLOUDWATCH_ADAPTER **

  • SELECT NOW()

  • SELECT CONVERT_TZ(MEASURE_TIME, DBTIMEZONE, 'UTC', 'INVALID REJECT AMBIGUOUS REJECT') as UTC_MEASURE_TIME, t.* FROM "EXA_STATISTICS"."EXA_DB_SIZE_LAST_DAY" t WHERE MEASURE_TIME >= CONVERT_TZ(?, 'UTC', DBTIMEZONE, 'INVALID REJECT AMBIGUOUS REJECT') AND MEASURE_TIME < CONVERT_TZ(?, 'UTC', DBTIMEZONE, 'INVALID REJECT AMBIGUOUS REJECT');

  • COMMIT /* AUTO */

-ALTER SESSION SET TIME_ZONE = 'UTC'

Dependency check build fails

Error:  Failed to execute goal org.sonatype.ossindex.maven:ossindex-maven-plugin:3.2.0:audit (default-cli) on project cloudwatch-adapter: Detected 1 vulnerable components:
Error:    com.fasterxml.jackson.core:jackson-databind:jar:2.12.6.1:test; https://ossindex.sonatype.org/component/pkg:maven/com.fasterxml.jackson.core/[email protected]?utm_source=ossindex-client&utm_medium=integration&utm_content=1.8.1
Error:      * [CVE-2022-42003] CWE-502: Deserialization of Untrusted Data (7.5); https://ossindex.sonatype.org/vulnerability/CVE-2022-42003?component-type=maven&component-name=com.fasterxml.jackson.core%2Fjackson-databind&utm_source=ossindex-client&utm_medium=integration&utm_content=1.8.1
Error:      * [CVE-2022-42004] CWE-502: Deserialization of Untrusted Data (7.5); https://ossindex.sonatype.org/vulnerability/CVE-2022-42004?component-type=maven&component-name=com.fasterxml.jackson.core%2Fjackson-databind&utm_source=ossindex-client&utm_medium=integration&utm_content=1.8.1

Metrics have wrong unit

While Exasol stores the values in MiB, GiB and MiB/s Cloudwatch uses MB, GB, and MB/s.

Currently, the CloudtWach adapter reports the unchanged value under the wrong unit.

Fix:

Convert data during transfer

Add metrics for query count

Add metrics that count the queries, grouped by their type.
The information can be aggregated from EXA_SQL_LAST_DAY

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.