<img height="1" width="1" style="display:none;" alt="" src="https://px.ads.linkedin.com/collect/?pid=2826169&amp;fmt=gif">
Start  trial

    Start trial

      img-blog-curtain-author-rajesh-kandasamy-blue-to-cyan
      Monitor Fujitsu Enterprise Postgres on AWS using Amazon CloudWatch for enhanced observability with customizable metrics collection scripts.

      Introduction

      With the recent release of Fujitsu Enterprise Postgres 17, monitoring capabilities with Amazon CloudWatch have been introduced. This allows customers hosting Fujitsu Enterprise Postgres on the AWS cloud to utilize the observability solutions provided by AWS.

      The Fujitsu Enterprise Postgres 17 server includes a sample shell script that facilitates the collection of database metrics and the subsequent transmission of this data to Amazon CloudWatch.

      Location of sample metrics collection script: /opt/fsepv17server64/share/putting-metrics-to-monitoring-tool.sh.sample

      Note: The shell script can be customized to suit your requirements.

      The shell script facilitates the following tasks:

      • Querying the catalog tables using psql commands
      • Converting the SQL command output to JSON format
      • Forwarding the metric data in JSON format to CloudWatch using AWS CLI

      How to configure monitoring using Amazon CloudWatch

      Follow the below steps to monitor Fujitsu Enterprise Postgres database using Amazon CloudWatch.

      1  Install AWS CLI

      To install the AWS CLI v2, run the following commands (AWS CLI version must be 2.x or later).

      curl "https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip" -o "awscliv2.zip"
      unzip awscliv2.zip sudo ./aws/install aws –-version
      For futher details on AWS CLI installation, refer to AWS documentation > Installing or updating to the latest version of the AWS CLI

      2  Create an IAM role

      Create an IAM role and attach to the EC2 instance where the Fujitsu Enterprise Postgres database is hosted. Assign permission CloudWatchAgentServerPolicy to forward metric data to AWS CloudWatch.

      3  Prepare the metrics collection script

      Copy the sample metrics collection script to the desired location and make necessary changes to connect to the database.

      cp /opt/fsepv17server64/share/putting-metrics-to-monitoring-tool.sh.sample 
      /fep/monitor/put-metrics-to-cloudwatch.sh

      Update the values to the environment variables below in the metric collection script.

      export PGUSER="fepuser"
      export PGDATABASE="postgres"
      export PGHOST="localhost"
      export PGPORT="27500"

      Also, you can update the Namespace and Dimension value with meaningful values or application names.

      export NAMESPACE="FEP17_METRICS"
      DIMENSION_VALUE="Demo"

      4  Create database extension

      Create the database extension pg_stat_statements to collect the statistics for the SQL statements executed.

      CREATE EXTENSION IF NOT EXISTS pg_stat_statements ;

      5  Schedule metrics collection script

      In the final step, schedule the metrics collection script to run periodically using crontab.

      Set the environment and schedule the script to run every 10 minutes.

      export PATH=/opt/fsepv17server64/bin:/awscli/bin:$PATH
      [fepuser@fep17-server: ~]$ crontab -l
      # Job to collect metrics every 10 mins
      */10 * * * * /fep/monitor/put-metrics-to-cloudwatch.sh
      The sample metrics collection script can be adapted for use with older versions of Fujitsu Enterprise Postgres by modifying certain SQL queries and the JSON collection script. I have made these adjustments and successfully tested the script with a Fujitsu Enterprise Postgres 11 cluster.

      Dashboard

      In Amazon CloudWatch, all the collected metrics are displayed under the defined namespace FEP17_METRICS, as below:

      This image shows all the tablespaces and their growth.

      Alerts

      Additionally, alerting can be configured to notify users via email or other methods when the metric value exceeds the defined threshold. The image below illustrates the tablespace alarm, which was triggered when usage surpassed the 2GiB threshold.

       

      Topics: Fujitsu Enterprise Postgres, AWS cloud, Amazon cloud, Amazon CloudWatch, AWS monitoring, Database metrics, Cloud observability, Shell script customization

      Receive our blog

      Search by topic

      Posts by Tag

      See all
      Fujitsu Enterprise Postgres
      The hybrid multi-cloud Postgres backed by Fujitsu
      photo-rajesh-kandasamy-in-hlight-circle-blue-to-cyan
      Rajesh Kandasamy
      Technical Consultant, Fujitsu Enterprise Postgres Center of Excellence
      Rajesh is a Technical Consultant with the Fujitsu Enterprise Postgres Center of Excellence and holds an OSS-DB Silver certification in PostgreSQL.
      He brings over 12 years of experience in various relational database management systems (RDBMS) such as PostgreSQL, Oracle, and SQL Server, as well as NoSQL technologies like MongoDB. In his role, he provides consulting and support to Fujitsu Enterprise Postgres customers, helping them leverage features effectively.

      Receive our blog

      Fill the form to receive notifications of future posts

      Search by topic

      see all >