当前位置:网站首页>node_ Exporter deployment
node_ Exporter deployment
2022-07-04 19:34:00 【Code Taoist】
First, check the current server centos Version of
cat /etc/centos-release
Monitored server operations :
One 、 Download installation package ( decompression 、 Change the name )
centos7:
wget https://github.com/prometheus/node_exporter/releases/download/v1.3.0/node_exporter-1.3.0.linux-amd64.tar.gz
centos6:
You can go directly to the web page https://github.com/prometheus/nodeexporter/releases/download/v1.3.0/nodeexporter-1.3.0.linux-amd64.tar.gz Direct download
Upload it to the server to be monitored and unzip it to the directory /usr/local/
decompression :
tar xf node_exporter-1.3.0.linux-amd64.tar.gz -C /usr/local/
cd /usr/local/
mv node_exporter-1.3.0.linux-amd64/ node_exporter
Two 、 The configuration file , It is divided into centos6 and centos7 Methods
centos7 Methods
If not, create directories and files /usr/lib/systemd/system/node_exporter.service
Create directory :mkdir
create a file :touch
#vi /usr/lib/systemd/system/node_exporter.service
[unit]
Description=The node_exporter Server
After=network.target
[Service]
ExecStart=/usr/local/node_exporter/node_exporter
Restart=on-failure
RestartSec=15s
SyslogIdentifier=node_exporter
[Install]
WantedBy=multi-user.target
wq Save and exit
#systemctl daemon-reload
#systemctl enable node_exporter
#systemctl restart node_exporter
# ss -antl
State Recv-Q Send-Q Local Address:Port Peer Address:Port Process
LISTEN 0 128 0.0.0.0:22 0.0.0.0:*
LISTEN 0 128 [::]:22 [::]:*
LISTEN 0 128 *:9100 *:*
centos6
vi /etc/init.d/node_exporte
The notes inside should also be added , If you don't add it, you will report an error
Add the following to the file
#!/bin/bash
# chkconfig: 2345 10 90
# description: node_exporter
# 20220630
case "$1" in
start)
nohup /usr/local/node_exporter >/usr/local/logs/node_exporter.log 2>&1 &
echo "node_exporter started"
;;
stop)
ps -ef | grep node_exporter | grep -v grep | awk '{print "kill -9 "$2}' | sh
echo "node_exporter stoped"
;;
esac
:wq Save and exit
Configuration file executable permissions
#chmod +x /etc/init.d/node_exporter
take node_exporter Add to system services
#chkconfig --add node_exporter
On or off node_exporter
service node_exporter start
service node_exporter stop
Turn on node_exporter.service Self starting
chkconfig node_exporter on
3、 ... and 、 De configuration prometheus Host computer /usr/local/prometheus/prometheus.yml Add monitored servers , The following is the whole source code ,localhost There is no need to change , Just add the last ip
vim /usr/local/prometheus/prometheus.yml
global:
scrape_interval: 15s
scrape_timeout: 10s
evaluation_interval: 15s
alerting:
alertmanagers:
# static_configs:
#- targets: [localhost:9093]
# - localhost:9093
scrape_configs:
- job_name: prometheus
scrape_interval: 15s
scrape_timeout: 10s
metrics_path: /metrics
scheme: http
static_configs:
- targets:
- localhost:9090
- job_name: node
static_configs:
- targets: ['localhost:9100']
- job_name: node1
static_configs:
- targets: ['192.168.0.xxx:9100']
:wq Save and exit
Check if the configuration file is correct , If there is an error, modify
./promtool check config prometheus.yml
Four 、 start-up prometheus command
stay prometheus Start on host :
/usr/local/prometheus/prometheus --config.file=/usr/local/prometheus/prometheus.yml &
&
start-up 9100
docker run -d --name node_exporter --restart=always -p 9100:9100 prom/node-exporter
Go to the web page and open http://192.168.0.125:9090/targets?search= There are many. job_name Generated and in state up The deployment is complete
If the startup fails : If the report is wrong err="error starting web server: listen tcp 0.0.0.0:9090: bind: address already in use Then proceed to the following steps ;
lsof -i:9090
Kill the process
kill -9 Process number
If not, go /usr/local/prometheus/data/, It must be your own installation prometheus/data Under the table of contents
rm -rf lock
【// I used to use docker So it should be installed in docker Kill it inside ,
docker ps
docker stop Containers id
Check the process
docker ps -a
Kill the process
docker rm Process number
Look at the container
docker images
Delete container
docker rmi Containers id
】
The host restarts prometheus
/usr/local/prometheus/prometheus --config.file=/usr/local/prometheus/prometheus.yml
More useful reference :
start-up prometheus Problems encountered :
https://blog.csdn.net/wyp257/article/details/118326062
https://zhuanlan.zhihu.com/p/66631919
https://blog.csdn.net/apple198942/article/details/119780818
Prometheus How to help solve performance problems : https://blog.csdn.net/shandeai520/article/details/102865729
Theoretical knowledge :https://yunlzheng.gitbook.io/prometheus-book/part-ii-prometheus-jin-jie/grafana/grafana-intro
ps:Prometheus The best configuration file is : Just use your own , Add parameters yourself , Pay attention to spaces and line breaks , Check after each parameter change :./promtool check config prometheus.yml
If everything is ok , Other nodes on the web page still don't come out , Then on the host vim /etc/hosts The configuration is monitored ip And the host name , Repeat the above starting operation
边栏推荐
- Is Guoyuan futures a regular platform? Is it safe to open an account in Guoyuan futures?
- FPGA时序约束分享01_四大步骤简述
- English语法_名词 - 使用
- sqlserver的CDC第一次查询的能读取到数据,但后面增删改读取不到,是什么原因
- Leetcode fizzbuzz C # answer
- Is the securities account opened by qiniu safe?
- 26. Delete the duplicate item C solution in the ordered array
- Stream stream
- Download the first Tencent technology open day course essence!
- Wireshark网络抓包
猜你喜欢
node_exporter部署
Stream stream
在线SQL转Excel(xls/xlsx)工具
牛客小白月赛7 谁是神箭手
Master the use of auto analyze in data warehouse
Opencv functions and methods related to binary threshold processing are summarized for comparison and use
每日一题(2022-07-02)——最低加油次数
Hough Transform 霍夫变换原理
如何使用Async-Awati异步任务处理代替BackgroundWorker?
用实际例子详细探究OpenCV的轮廓绘制函数drawContours()
随机推荐
mysql中explain语句查询sql是否走索引,extra中的几种类型整理汇总
函数式接口
Shell programming core technology II
Nebula importer data import practice
性能优化之关键渲染路径
YOLOv5s-ShuffleNetV2
测试工程师如何“攻城”(上)
明明的随机数
“只跑一趟”,小区装维任务主动推荐探索
Download the first Tencent technology open day course essence!
The difference and usage between substr (), slice (), and substring () in the string interception methods of "understand series after reading"
关于判断点是否位于轮廓内的一点思考
2021 合肥市信息学竞赛小学组
大div中有多个div,这些div在同一行显示,溢出后产生滚动条而不换行
用实际例子详细探究OpenCV的轮廓绘制函数drawContours()
Generate XML elements
HDU 1097 A hard puzzle
Pytest 可视化测试报告之 Allure
Leetcode ransom letter C # answer
Unity adds a function case similar to editor extension to its script, the use of ContextMenu