Devops | Monitoring Tutorial | How to Install Prometheus | AWS Amazon Linux 2
Setup Prometheus Binaries
Step 1: Update the yum package repositories.
sudo yum update -y
Step 2: Go to official Prometheus downloads page and get the download link for Linux binary.
Step 3: Create a Prometheus user, required directories, and make prometheus user as the owner of those directories.
sudo useradd --no-create-home --shell /bin/false prometheus
sudo mkdir /etc/prometheus
sudo mkdir /var/lib/prometheus
sudo chown prometheus:prometheus /etc/prometheus
sudo chown prometheus:prometheus /var/lib/prometheus
Step 4: Download the source using curl, untar it and rename the extracted folder to prometheus-files.
https://github.com/prometheus/prometheus/releases/download/v2.18.1/prometheus-2.18.1.linux-amd64.tar.gz
curl -LO https://github.com/prometheus/prometheus/releases/download/v2.3.2/prometheus-2.3.2.linux-amd64.tar.gz
tar -xvf prometheus-2.3.2.linux-amd64.tar.gz
mv prometheus-2.18.1.linux-amd64 prometheus-files
Step 5: Copy prometheus and promtool binary from prometheus-files folder to /usr/local/bin and change the ownership to prometheus user.
sudo cp prometheus-files/prometheus /usr/local/bin/
sudo cp prometheus-files/promtool /usr/local/bin/
sudo chown prometheus:prometheus /usr/local/bin/prometheus
sudo chown prometheus:prometheus /usr/local/bin/promtool
Step 6: Move the consoles and console_libraries directories from prometheus-files to /etc/prometheus folder and change the ownership to prometheus user.
sudo cp -r prometheus-files/consoles /etc/prometheus
sudo cp -r prometheus-files/console_libraries /etc/prometheus
sudo chown -R prometheus:prometheus /etc/prometheus/consoles
sudo chown -R prometheus:prometheus /etc/prometheus/console_libraries
Setup Prometheus Configuration
All the prometheus configurations should be present in /etc/prometheus/prometheus.yml file.
Step 1: Create the prometheus.yml file.
sudo vi /etc/prometheus/prometheus.yml
Step 2: Copy the following contents to the prometheus.yml file.
global:
scrape_interval: 10s
scrape_configs:
- job_name: 'prometheus'
scrape_interval: 5s
static_configs:
- targets: ['localhost:9090']
Step 3: Change the ownership of the file to prometheus user.
sudo chown prometheus:prometheus /etc/prometheus/prometheus.yml
Setup Prometheus Service File
Step 1: Create a prometheus service file.
sudo vi /etc/systemd/system/prometheus.service
Step 2: Copy the following content to the file.
sudo chown prometheus:prometheus /etc/prometheus/prometheus.yml
Setup Prometheus Service File
Step 1: Create a prometheus service file.
sudo vi /etc/systemd/system/prometheus.service
Step 2: Copy the following content to the file.
[Unit]
Description=Prometheus
Wants=network-online.target
After=network-online.target
[Service]
User=prometheus
Group=prometheus
Type=simple
ExecStart=/usr/local/bin/prometheus \
--config.file /etc/prometheus/prometheus.yml \
--storage.tsdb.path /var/lib/prometheus/ \
--web.console.templates=/etc/prometheus/consoles \
--web.console.libraries=/etc/prometheus/console_libraries
[Install]
WantedBy=multi-user.target
Step 3: Reload the systemd service to register the prometheus service and start the prometheus service.
sudo systemctl daemon-reload
sudo systemctl start prometheus
Check the prometheus service status using the following command.
sudo systemctl status prometheus
Access Prometheus Web UI
Now you will be able to access the prometheus UI on 9090 port of the prometheus server.
http:ec2serverip:9090/graph
Right now we have just configured prometheus. You need to register the target in the prometheus.yml file to get the metrics from the source systems.
Видео Devops | Monitoring Tutorial | How to Install Prometheus | AWS Amazon Linux 2 канала Cloud Tech Masters
Step 1: Update the yum package repositories.
sudo yum update -y
Step 2: Go to official Prometheus downloads page and get the download link for Linux binary.
Step 3: Create a Prometheus user, required directories, and make prometheus user as the owner of those directories.
sudo useradd --no-create-home --shell /bin/false prometheus
sudo mkdir /etc/prometheus
sudo mkdir /var/lib/prometheus
sudo chown prometheus:prometheus /etc/prometheus
sudo chown prometheus:prometheus /var/lib/prometheus
Step 4: Download the source using curl, untar it and rename the extracted folder to prometheus-files.
https://github.com/prometheus/prometheus/releases/download/v2.18.1/prometheus-2.18.1.linux-amd64.tar.gz
curl -LO https://github.com/prometheus/prometheus/releases/download/v2.3.2/prometheus-2.3.2.linux-amd64.tar.gz
tar -xvf prometheus-2.3.2.linux-amd64.tar.gz
mv prometheus-2.18.1.linux-amd64 prometheus-files
Step 5: Copy prometheus and promtool binary from prometheus-files folder to /usr/local/bin and change the ownership to prometheus user.
sudo cp prometheus-files/prometheus /usr/local/bin/
sudo cp prometheus-files/promtool /usr/local/bin/
sudo chown prometheus:prometheus /usr/local/bin/prometheus
sudo chown prometheus:prometheus /usr/local/bin/promtool
Step 6: Move the consoles and console_libraries directories from prometheus-files to /etc/prometheus folder and change the ownership to prometheus user.
sudo cp -r prometheus-files/consoles /etc/prometheus
sudo cp -r prometheus-files/console_libraries /etc/prometheus
sudo chown -R prometheus:prometheus /etc/prometheus/consoles
sudo chown -R prometheus:prometheus /etc/prometheus/console_libraries
Setup Prometheus Configuration
All the prometheus configurations should be present in /etc/prometheus/prometheus.yml file.
Step 1: Create the prometheus.yml file.
sudo vi /etc/prometheus/prometheus.yml
Step 2: Copy the following contents to the prometheus.yml file.
global:
scrape_interval: 10s
scrape_configs:
- job_name: 'prometheus'
scrape_interval: 5s
static_configs:
- targets: ['localhost:9090']
Step 3: Change the ownership of the file to prometheus user.
sudo chown prometheus:prometheus /etc/prometheus/prometheus.yml
Setup Prometheus Service File
Step 1: Create a prometheus service file.
sudo vi /etc/systemd/system/prometheus.service
Step 2: Copy the following content to the file.
sudo chown prometheus:prometheus /etc/prometheus/prometheus.yml
Setup Prometheus Service File
Step 1: Create a prometheus service file.
sudo vi /etc/systemd/system/prometheus.service
Step 2: Copy the following content to the file.
[Unit]
Description=Prometheus
Wants=network-online.target
After=network-online.target
[Service]
User=prometheus
Group=prometheus
Type=simple
ExecStart=/usr/local/bin/prometheus \
--config.file /etc/prometheus/prometheus.yml \
--storage.tsdb.path /var/lib/prometheus/ \
--web.console.templates=/etc/prometheus/consoles \
--web.console.libraries=/etc/prometheus/console_libraries
[Install]
WantedBy=multi-user.target
Step 3: Reload the systemd service to register the prometheus service and start the prometheus service.
sudo systemctl daemon-reload
sudo systemctl start prometheus
Check the prometheus service status using the following command.
sudo systemctl status prometheus
Access Prometheus Web UI
Now you will be able to access the prometheus UI on 9090 port of the prometheus server.
http:ec2serverip:9090/graph
Right now we have just configured prometheus. You need to register the target in the prometheus.yml file to get the metrics from the source systems.
Видео Devops | Monitoring Tutorial | How to Install Prometheus | AWS Amazon Linux 2 канала Cloud Tech Masters
Показать
Комментарии отсутствуют
Информация о видео
Другие видео канала
Spark Structured Streaming -Use Case E commerce | Part-4b | Scala Spark job Submit | EMR Cluster|AWSDevops | Tomcat Tutorial | How to Install & Configure Apache Tomcat 10 as a service | AWS EC2Devops | Docker | Pushing and Pulling to and from Docker Hub| Dockerize Python Flask AppAWS | RDS Tutorial | Connecting to RDS from Ec2 and from windows os using OpenVpn & SQL WorkBenchDevops | Jenkins Tutorial | Jenkins Master |Launch AWS Instances as Jenkins slaves automaticallyAnsible Conditionals - Create Directory If Not Exists | Create only if tomcat not exists | PlayBookDevops | Kubernetes Tutorial | Managing Resources for Containers | CPU requests and limitsDevops | DockerTutorial|Setup Docker Private Registry| Create&Build own Private Docker Registry| AWSDevops | ELK Tutorial | Elasticsearch: What It Is, How It Works, And What It’s Used ForDevops | Monitoring Tutorial | How to Install Grafana on Ubuntu 18.04 LTS | AWSDevops | DockerTutorial | Installation of Docker & Docker Compose| AWS | UbuntuHow to install mongodb and perform crud operationSpark Structured Streaming -Use Case E commerce | Part-4a | Scala Code Spark Submit |Maven| WindowsInterview | AWS & Devops Interview Questions Recording | Real Telephonic Interview Conversation -2How to install teamcity 12.x on Amazon Linux2Devops | Monitoring Tutorial | Monitor Linux Servers with Prometheus Node Exporter | AWS EC2Devops | Kubernetes Tutorial | Managing Resources for Containers | Memory requests and limitsDevops | DockerTutorial | How to run Nginx using Docker | PostgreSQL & MySQL using DockerInstall Artifactory in Amazon Linux2 and AWS EC2Azure | Devops | Deploy an Azure Kubernetes Service cluster using the Azure CLIDevops Interview Question and Answers | Maven Interview Questions and Answers