当前位置:网站首页>Prometheus primary body test
Prometheus primary body test
2022-06-23 21:28:00 【Bess Croft】
Preface
Why did I choose Prometheus (Prometheus)?Prometheus Is in accordance with the Google SRE The concept of operation and maintenance , It is practical and forward-looking . It's also based on Go Language development , Good performance , Installation and deployment are also simple , Even cross platform ( Include arm platform ). As the basis for service and business monitoring ,Prometheus It's a very good choice .
What is Prometheus ?
We quote official terms here :
Prometheus Is an open source system monitoring and alerting toolkit , It can collect system information , And send it to one or more monitoring centers .Prometheus Collect and store its indicators as time series data , That is, the indicator information is stored together with the time stamp recording it , And optional key value pairs called tags .
Here we introduce the figure of the official website , explain Prometheus And some of its ecosystem components :
install
There are many ways to install , Binary packages or Docker Fine , Here we choose binary packages .
Installation environment
Here I use Ubuntu 20.04, Don't ask me why , This is the machine with the largest memory (24G Memory ), It's just , It is arm64 Architecturally , So the following tutorial is running on arm64 On the server of the architecture , Of course , You can also use this tutorial in amd64 Installation under architecture , Including Tencent cloud KVM And lightweight application servers , There are only a few nuances , Let's talk about .
install Prometheus
download Prometheus
You can go to the official website , perhaps GitHub Of Publish the page Download installation package , What I download here is GitHub Bags in the warehouse .
- If you are amd64 Architecture server
wget https://github.com/prometheus/prometheus/releases/download/v2.31.0/prometheus-2.31.0.linux-amd64.tar.gz tar xfz prometheus-2.31.0.linux-amd64.tar.gz sudo cp prometheus-2.31.0.linux-amd64/prometheus /usr/local/bin/ sudo cp prometheus-2.31.0.linux-amd64/promtool /usr/local/bin/
- If you are arm64 Architecture server
wget https://github.com/prometheus/prometheus/releases/download/v2.31.0/prometheus-2.31.0.linux-arm64.tar.gz tar xfz prometheus-2.31.0.linux-arm64.tar.gz sudo cp prometheus-2.31.0.linux-arm64/prometheus /usr/local/bin/ sudo cp prometheus-2.31.0.linux-arm64/promtool /usr/local/bin/
The main difference , Just download different packages , The latter configuration is almost the same
To configure Prometheus
- Check
prometheus --version
Carry out orders , As shown in the figure below , It was successful !
We just unzipped the folder below , You can find a subdirectory prometheus , Then you can find a configuration file prometheus.yml . We need to put prometheus.yml This initial configuration file is copied to /etc/prometheus Under the table of contents , Then the simple configuration can be started . Of course , You can also configure it according to your own needs , Please refer to the official The configuration document .
sudo mkdir -p /etc/prometheus sudo cp prometheus.yml /etc/prometheus/
- The default partial configuration is as follows :
scrape_configs:
- job_name: "prometheus"
static_configs:
- targets: ["localhost:9090"] We can see that the port is 9090 , You can change it to something else as needed .
start-up Prometheus
Now let's start to see
prometheus --config.file "/etc/prometheus/prometheus.yml"
- If something goes wrong , You can use
prometoolTool to check your profile .
promtool check config "/etc/prometheus/prometheus.yml"
If you output the following prompt , It means there's no problem !
Checking /etc/prometheus/prometheus.yml SUCCESS: 0 rule files found
To configure service Way to run Prometheus
- Create a new one
servicefile
sudo vim /etc/systemd/system/prometheus.service
- Edit the following content and save it !
[Unit] Description=prometheus [Service] User=root ExecStart=prometheus --config.file "/etc/prometheus/prometheus.yml" Restart=on-abort [Install] WantedBy=multi-user.target
- Set boot up
sudo systemctl enable prometheus
- start-up Prometheus
sudo systemctl start prometheus
This is the end of it !
To configure HTTPS And reverse proxy
If your server is HTTPS Of , Then configuration is required HTTPS Certificate and private key of , Here I use Let's Encrypt Certificate , You can download it on the official website . I won't tell you how to operate it , If you don't , You should learn how to use Nginx, And learn to configure HTTPS certificate .
- To configure Nginx Reverse proxy
Here I release my configuration , You can according to your needs , Reference use :
location /
{
proxy_pass http://127.0.0.1:9090;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header REMOTE-HOST $remote_addr;
add_header X-Cache $upstream_cache_status;
#Set Nginx Cache
add_header Cache-Control no-cache;
}Prometheus Start listening to the local loopback address localhost:9090 , Therefore, the public network cannot be accessed directly , I don't really recommend that you open the firewall , This can bring certain security protection .
preview
At this time, let's visit the domain name , You can see the page !
Here's a hint , This is not a production environment , Just to practice and learn , So it doesn't matter , The production environment does not recommend this ! Can pass ssh Port forwarding method to achieve remote access .
边栏推荐
- Harmonyos application development -- mynotepad[memo][api v6] based on textfield and image pseudo rich text
- What is a database index? Xinhua dictionary to help you
- 2021 three "myths" of science and technology industry -- yuancosmos, NFT and web 3
- 我在深圳,到哪里开户比较好?在线开户安全么?
- JS chain call
- Share a super Mary source code
- [5 minutes to play lighthouse] quickly use Chang'an chain
- Global and Chinese market of American football catch gloves 2022-2028: Research Report on technology, participants, trends, market size and share
- Summary of multiple methods for obtaining the last element of JS array
- C WPF new open source control library: newbeecoder Nbtreeview of UI
猜你喜欢

Steps for formulating the project PMO strategic plan
![Harmonyos application development -- mynotepad[memo][api v6] based on textfield and image pseudo rich text](/img/b1/71cc36c45102bdb9c06e099eb42267.jpg)
Harmonyos application development -- mynotepad[memo][api v6] based on textfield and image pseudo rich text

Four aspects of PMO Department value assessment
Application of JDBC in performance test

I am 30 years old, no longer young, and have nothing

How to gradually improve PMO's own ability and management level

New SQL syntax quick manual!

Uncover the secrets of Huawei cloud enterprise redis issue 16: acid'true' transactions beyond open source redis

How does PMO select and train project managers?

How to view the role of PMO in agile organizations?
随机推荐
Encryption and decryption analysis of returned data of an e-commerce app (IV)
100 lines of code, using pyGame to make a snake game!
Cobalt Strike Spawn & Tunnel
JS delete object attribute
Process crash does not generate dump. Configure localdumps
DM sub database and sub table DDL "optimistic coordination" mode introduction - tidb tool sharing
How to convert []byte to io. in go Reader?
Facing the problem of lock waiting, how to realize the second level positioning and analysis of data warehouse
How can the cloud disk service be connected to the server? How many hard disks can the server mount?
The new track of flagship chip is finally clear
Setinterval stop
[development skills] how to add "live broadcast" status display bar on easynvr platform
What are the advantages of attaching a virtual machine to a hard disk cloud server
Gradle asked seven times. You should know that~
How PMO uses two dimensions for performance appraisal
This article introduces you to the necessity of database connection pooling
Global and Chinese market of American football catch gloves 2022-2028: Research Report on technology, participants, trends, market size and share
Model selection and optimization
同花顺开户是安全的吗?
Memory patch amsi bypass