Monitoring with Grafana

Guide to using Grafana and CloudWatch

  1. In the Grafana interface:

    • Select Connections.
    • Select Data sources.
    • Select Add data source.

    Monitoring with Grafana

  2. In the Add data source interface:

    • Find CloudWatch.
    • Select CloudWatch.

    Monitoring with Grafana

  3. In the Data Sources interface:

    • In the Name field, enter cloudwatch.
    • In the Connection Details section, at Authentication Provider, select Access & secret key.
    • Access Key ID, enter the access key id of IAM user.
    • Secret Access Key, enter the secret access key of the IAM user.

    Monitoring with Grafana

    • Select Region ap-southeast-1.

    Monitoring with Grafana

  4. Select Save & test.

    Monitoring with Grafana

  5. When connected successfully, you can query data from CloudWatch.

    Monitoring with Grafana

  6. In the Grafana interface:

    • Select Dashboard.
    • Select Create Dashboard.

    Monitoring with Grafana

    • Select Add Visualization.

    Monitoring with Grafana

  7. In the Visualization creation interface:

    • Select data source as cloudwatch.

    Monitoring with Grafana

    • In the Query section:

      • Select Region, choose ap-southeast-1.
      • Select CloudWatch Metrics.
      • Select Metric Search.
    • Select Namespace, choose AWS/EC2.

    • Select Metric name, choose CPUUtilization.

    • Select Statistic, choose Average.

    • Select Dimensions, choose InstanceId and enter the Instance ID of the Grafana-Server instance.

    • After configuration, select Run queries.

    Monitoring with Grafana

Note: If you cannot query with Statistic: Average, you can change Statistic to Sum or Maximum to query data.

  1. After executing the Query, the dashboard will display data according to your configuration.

    Monitoring with Grafana

  2. Save dashboard:

    • In Dashboard name, enter Grafana-Monitoring.
    • In Folder, select Dashboards.
    • Select Save.

    Monitoring with Grafana

  3. In the Dashboard section, you can select Share and copy the share link to share the dashboard with others.

    Monitoring with Grafana

    • You can select theme as shown in the image.

    Monitoring with Grafana

  4. Paste the share link into a new browser to view the dashboard.

    Monitoring with Grafana

When copying the link, the URL will be in localhost format because Grafana uses the server’s local address by default. To view the dashboard externally, you need to replace localhost with the Public IPv4 address of the EC2 instance.

  1. Executing Explore:

    • In Namespace, select AWS/EC2.
    • In Metric name, select CPUUtilization.
    • In Statistic, select Average.
    • In Dimensions, select InstanceID and enter the Instance ID of the Grafana-Server instance.
    • Select Run query.
    • Select Bars to view the chart.

    Monitoring with Grafana

Some Reference Sources

Below are some reference sources and notes for installing Grafana on an EC2 instance on AWS:

Grafana Official Website: The official Grafana website provides detailed documentation and support materials on how to install and use Grafana. You can learn more about installing Grafana on EC2 here: grafana.com/grafana

LinkedIn Post by Vinay Kumar: This post may contain specific instructions on how to install Grafana on an AWS EC2 instance. LinkedIn often has many posts from experts in this field. Vinay Kumar’s Post

AWS with Atiq Blog: This blog may share specific guides on installing and configuring Grafana on AWS. It’s a reference source that can provide advice and guidance from experienced individuals. AWS with Atiq Blog

Additionally, here are some important notes when installing Grafana on EC2:

  1. Choose the appropriate EC2 instance type: Determine the EC2 instance type you want to use based on the requirements of your Grafana application. This may vary depending on the workload and resources you need.

  2. Security: Always follow best security practices when installing Grafana, including ensuring strong password storage and secure authentication.

  3. Data Backup: Ensure you have a data backup strategy for Grafana to avoid the loss of important data.

  4. Data Sources Setup: Install and configure data sources (e.g., Prometheus, InfluxDB) for Grafana to be able to display and monitor data from different sources.

  5. Maintenance Management: Ensure you understand how to manage and maintain your Grafana instance, including updates and system security.

Remember to proceed with care and refer to the reference sources to ensure a successful installation of Grafana on your EC2 instance.