Monitor Cloud Exchange with Prometheus and Grafana
Monitor Cloud Exchange with Prometheus and Grafana
Configure a Metric Exporter for Cloud Exchange
- Download the latest version of the linux node exporter from: Releases · prometheus/node_exporter.
$ wget https://github.com/prometheus/node_exporter/releases/download/v1.7.0/node_exporter-1.7.0.linux-amd64.tar.gz
- Extract the node exporter and start it in the background.
$ tar -xvf node_exporter-1.7.0.linux-amd64.tar.gz
$ cd node_exporter-1.7.0.linux-amd64
$ ./node_exporter & - Verify the connectivity by opening your machine address with port 9100.
> http://<machine_IP>:9100
Note
If this is to be used for an EC2 instance, make sure you expose the port from AWS console > inbound rules.
Note
We recommend that you configure Prometheus and Grafana on a new instance so it will not affect existing Cloud Exchange performance.
You will need to install docker and docker-compose on the new machine, and then use the steps in the following sections to configure Prometheus and Grafana on the new machine.
Configure Prometheus
- Create a prom directory in
/opt
.$ cd /opt
$ mkdir prom - Create a Prometheus config file with the following content.
$ vi prom/prometheus.yml
Note
Change your machine IP in the targets section.
global: scrape_interval: 15s scrape_timeout: 10s evaluation_interval: 15s alerting: alertmanagers: - follow_redirects: true enable_http2: true scheme: http timeout: 10s api_version: v2 static_configs: - targets: [] scrape_configs: - job_name: machines scrape_interval: 5s scrape_timeout: 5s scheme: http metrics_path: /metrics static_configs: - targets: - :9100
- Create a docker-compose file with following content.
$ vi prom/docker-compose.yml
version: "3.3" services: prometheus: image: prom/prometheus volumes: - ./prometheus.yml:/etc/prometheus/prometheus.yml ports: - "9090:9090"
- Start Prometheus.
$ cd prom
$ docker-compose up -d
$ cd .. - Verify the connectivity by going to:
http://<your machine ip>:9090/
Configure Grafana
- Create a grafana directory in
/opt
.$ cd /opt
$ mkdir grafana - Create a docker-compose file with following content.
$ vi grafana/docker-compose.yml
version: "3.3" services: grafana: user: "0" image: grafana/grafana-enterprise volumes: - ./data:/var/lib/grafana:z ports: - "3000:3000"
- Start Grafana.
$ cd grafana
$ docker-compose up -d
$ cd .. - Open the Grafana UI by going to:
http://<your machine ip>:3000/
- Log in with default credentials
admin / admin)
. - Change the default password.
- Log in with default credentials
- Log in to Grafana with the new password.
- Now add Prometheus as the Data Source.
- Click the menu icon, expand Connections, and click Data sources.
- Click Add data source.
- Select Prometheus.
- Enter the Prometheus settings, and then scroll down and click Save & test.
- Create a Dashboard.
- Go to the home page and click Create your first dashboard.
- Click Import dashboard.
- Enter 1860 for the ID and click Load.
- Enter a Dashboard name, select the Prometheus data source that you added previously, and then click Import.
- Now you can see the dashboard for a Cloud Exchange instance.