当前位置:网站首页>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 .
边栏推荐
- Markdown syntax summary
- 上线项目之局域网上线软件使用-----phpStudy
- 【Redis】有序集合的交集与并集
- Harmonyos application development -- mynotepad[memo][api v6] based on textfield and image pseudo rich text
- . NET Core . NET Framework
- 数字电路概述
- Retrofit magic, reject duplicate code!
- SAP retail wrmo replenishment monitoring
- Uncover the secrets of Huawei cloud enterprise redis issue 16: acid'true' transactions beyond open source redis
- Phpkf CMS 3.00 beta y6 remote code execution
猜你喜欢

Beitong G3 game console unpacking experience. It turns out that mobile game experts have achieved this

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

How does PMO select and train project managers?

Steps for formulating the project PMO strategic plan

What are the main dimensions of PMO performance appraisal?

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

Facing the problem of lock waiting, how to realize the second level positioning and analysis of data warehouse

How PMO uses two dimensions for performance appraisal

Four aspects of PMO Department value assessment

Lightweight, dynamic and smooth listening, hero earphone hands-on experience, can really create
随机推荐
打新债到底是用什么软件比较安全?打新债平台有哪些
How to reduce snapshots
Global and Chinese market for hydropower plants 2022-2028: Research Report on technology, participants, trends, market size and share
2021 three "myths" of science and technology industry -- yuancosmos, NFT and web 3
Setinterval stop
Use Tencent cloud lightweight application server to build an unlimited network disk -zpan building tutorial
同花顺股票开户是安全的吗?
Advantages of token mechanism over cookie mechanism
[typescript] some summaries in actual combat
Cool 3D sphere text cloud effect!
What is the process of opening a mobile card account? Is online account opening safe?
Those programmers wrote super funny 56 code comments (worth collecting)!!
Is it safe to open an online securities account or to go to the business department
Chrome extension development Chinese tutorial-1
How to view the role of PMO in agile organizations?
What if there are too few jetpack compose theme colors? Design your own color system
I am 30 years old, no longer young, and have nothing
100 lines of code, using pyGame to make a snake game!
How to evaluate performance optimization? Covering too much knowledge?
How to use smart cloud disk service differences between local disk service and cloud disk service