Installing Prometheus on Ubuntu 18.04
Prometheus is an open-source monitoring and alerting toolkit. It was originally created at SoundCloud in 2012 and has since gained popularity as a powerful monitoring solution.
Here are the steps to install Prometheus on Ubuntu 18.04:
$ sudo apt update
$ sudo apt install prometheus
$ sudo nano /etc/prometheus/prometheus.yml
$ sudo systemctl start prometheus
$ sudo systemctl enable prometheus
- First, update the package list by running the following command.
- Then, install Prometheus by executing the command.
- After the installation, you need to configure Prometheus. The main configuration file is located at
/etc/prometheus/prometheus.yml. Edit the file using your preferred text editor. - In the configuration file, you can specify targets to scrape for metrics. For example, add the following lines to scrape metrics from a web server running on localhost:
scrape_configs: - job_name: 'my_web_server' static_configs: - targets: ['localhost:9090'] - Save the changes and exit the text editor.
- Next, start the Prometheus service.
- To enable Prometheus to start on system boot, run the enable command.
- You can verify that Prometheus is running correctly by accessing its web interface. Open a web browser and navigate to
http://localhost:9090. - From the Prometheus web interface, you can explore the available metrics and create custom queries to monitor your systems.
That's it! You have successfully installed Prometheus on Ubuntu 18.04.