Prometheus + Grafana - Self Hosted monitoring stack solution
2024-03-30
Grafana and Prometheus are open-source tools used for monitoring and visualizing data, logs, and metrics in system environments. Prometheus collects metrics from various hosts and sources and stores them in a time-series database, while Grafana provides a flexible interface for visualizing this data through customizable dashboards. Running Grafana and Prometheus locally on your server or in a cloud environment gives you full control over your monitoring solution without relying on external services.
Connect to the server where Grafana will be installed. I am deploying the application to a Ubuntu 22 instance on a cloud instance.
Step1 Download Grafana for Ubuntu/Debian
Reference: https://grafana.com/grafana/download?pg=graf-deployment-options&plcmt=deploy-box-1
Step 2 On the terminal command line, follow the prompts from the output:
You can start grafana-server by executing
The next step would be to install Node Exporter on all the hosts you would like to monitor. This can include the same hosts where Grafana runs from locally.
Unpack the downloaded file
once you have changed directories to the downloaded file, run
This command launches the node_exporter process as a background task that continues to run even after the terminal session ends, making it a daemon process for exporting system metrics.
Repeat this process for all the servers/instances you wish to monitor.
Reference: https://prometheus.io/docs/guides/node-exporter/
Now we need to download Prometheus on the same host that will serve Grafana.
Unpack the file and change directory to it
Locate the prometheus.yml file and edit the static_configs
section with the server IP addresses you wish to monitor
Note: Host targets run on port 9100
Run the below command:
You should now be able to access Grafana on the IP address of your server you over port 3000. http://serverip:3000
The default username is 'admin' and the password will also be 'admin' for the first log in.
Change and update your password upon successful login
Add Prometheus datasource From within the Grafana dashboard, navigate to βconnectionsβ, βdata sourcesβ and add a new data source.
We've outlined the installation steps for node_exporter, a pivotal component in monitoring system metrics with Prometheus. By following these instructions, you've seamlessly integrated node_exporter into your system, allowing Prometheus to collect crucial metrics for analysis. With Grafana's visualization capabilities complementing Prometheus's data collection, you're now equipped to monitor and analyze system performance. Happy monitoring!
Last updated