TABLE OF CONTENT
1. Introduction to Prometheus2. Introduction to Grafana3. Tools and Services Before installing Prometheus5, set up AWS. Installing Metrics Server on EKS6. Installing and setting up Prometheus with Helm7. Installing and setting up Grafana8. Integrating Prometheus and Grafana9. Monitoring & Visualizing using Grafana10. CloudThat
Introduction to Prometheus
Prometheus, an open-source monitoring tool and alerting tool that monitors resource utilization and health on both on-premises and cloud platforms, is Prometheus. Prometheus was developed by SoundCloud and has been on the market since 2012 Prometheus is a popular choice for many organizations due to its simplicity and low cost. A large user base and a strong community of developers are constantly updating it. Prometheus joined CNCF in 2016, which also governs Kubernetes.
Metrics are crucial in understanding the resource usage by host machines and applications. They help businesses do the right capacity planning, reduce user latency and avoid downtime of their apps, and design highly-available and load-balanced infrastructure. Time Series metrics can be used to measure various resource consumption, such as CPU, Memory, R/W and IOPS. They can also be used to monitor network in & out traffic at periodic intervals. Prometheus is one of the most popular applications that can monitor “Time Series” data.
a) Prometheus’ Features
Prometheus ships with its language, “PromQL”, to query metrics it has gathered from different sources.
Prometheus collects metric data as either key-value pairs (labels), or name-based.
It is easy to set up a Prometheus metrics service. It can be run as one node or as federated servers.
Prometheus can add target endpoints via Service Discovery. This allows you to use node exporters or client libraries to add them.
Once Prometheus is installed on a server that collects data from backend targets’ servers, the collected metrics can then be visualized using “Expression Browser”.
b) Prometheus Architecture
Prometheus works mainly through a Pull-based model for gathering data via HTTP endpoints at the targets. Push-gateway setups allow for push-based data collection. Prometheus architecture can also be broken down into five components.
The heart of the monitoring system is the central Prometheus Server.
Targets: These are the producers and recipients of metrics. The metric data on them is exposed to the Prometheus Server via Client Library. (To access metrics related to application code in multiple supported languages. These libraries convert the metrics into Prometheus readable format. Exporters (are used when application source code is not available. They live with the application. Ex: Database Exporter, Node Exporter for host stats, HaProxy Exporter for storage, messaging & HTTP).
Service Discovery: This is a way to discover services such as EC2 instances or K8S on cloud and extract data from them.
Storage: Prometheus stores the data on the local host, or in a cloud environment. An external persistent storage volume may be used.
Alerting and Visualizing: The expression Browser is a web-based user interface that allows you to visualize these metrics in one central location. Alerts can be created and managed using the Alertmanager component in Prometheus.
Introduction to Grafana
Grafana was launched in 2014 and has been the leading open-source Alerting & Visualization tool for organizations. Grafana’s main feature is its ability to store data anywhere, and all data can be gathered and visualized from one dashboard. Grafana provides a variety of ready-made templates that can be customized based on the services or tools used. These dynamic dashboards are c