Prometheus Grafana安装教程

Prometheus Grafana监控安装配置教程

一、下载Prometheus

https://prometheus.io/download/

二、关闭防火墙

[root@grafana ~]# systemctl disable firewalld.service
[root@grafana ~]# systemctl stop firewalld.service

二、安装Prometheus

[root@grafana tmp]# tar xvf prometheus-2.33.3.linux-amd64.tar.gz -C /usr/local/

[root@grafana tmp]# cd /usr/local/

[root@grafana local]# ln -s prometheus-2.33.3.linux-amd64 prometheus

三、创建数据目录

[root@grafana ~]# mkdir -p /data/prometheus/data 

四、创建用户并授权

[root@grafana ~]# groupadd prometheus
[root@grafana ~]# useradd -g prometheus prometheus
[root@grafana ~]# id prometheus
uid=1001(prometheus) gid=1001(prometheus) groups=1001(prometheus)

[root@grafana ~]# echo -e "prometheus"|passwd --stdin prometheus

[root@grafana ~]# chown -R prometheus.prometheus /usr/local/prometheus /data/prometheus

五、查看帮助文件

./prometheus --help
./prometheus --version

六、启动

两种启动方式二选一: 1.添加systemd服务启动,2.使用脚本手工启动

1.Sytemed启动
配置systemd服务:

[root@grafana ~]# cat > /usr/lib/systemd/system/prometheus.service <<EOF
[Unit]
Description=prometheus
Documentation=https://prometheus.io/
After=network.target
[Service]
Type=simple
User=prometheus
Group=prometheus
ExecStart=/usr/local/prometheus/prometheus --config.file=/usr/local/prometheus/prometheus.yml --storage.tsdb.path=/data/prometheus/data
Restart=on-failure
[Install]
WantedBy=multi-user.target
EOF

启动:
[root@grafana ~]# systemctl daemon-reload
[root@grafana ~]# systemctl enable prometheus.service
[root@grafana ~]# systemctl start prometheus.service
2.脚本启动
[root@grafana ~]# su - prometheus
[prometheus@grafana ~]$ cd /usr/local/prometheus
[prometheus@grafana prometheus]$  nohup ./prometheus --config.file="prometheus.yml" --storage.tsdb.path=/data/prometheus/data &> /dev/null &

## 查看端口(默认9090)
[root@grafana prometheus]# ss -tnlp |grep 9090
LISTEN     0      128         :::9090
:::*                   users:(("prometheus",pid=70319,fd=7))

[root@grafana prometheus]# ps -ef |grep prometheus

七、Web控制台登录

http://192.168.1.81:9090/
暂无评论

发送评论 编辑评论


				
|´・ω・)ノ
ヾ(≧∇≦*)ゝ
(☆ω☆)
(╯‵□′)╯︵┴─┴
 ̄﹃ ̄
(/ω\)
∠( ᐛ 」∠)_
(๑•̀ㅁ•́ฅ)
→_→
୧(๑•̀⌄•́๑)૭
٩(ˊᗜˋ*)و
(ノ°ο°)ノ
(´இ皿இ`)
⌇●﹏●⌇
(ฅ´ω`ฅ)
(╯°A°)╯︵○○○
φ( ̄∇ ̄o)
ヾ(´・ ・`。)ノ"
( ง ᵒ̌皿ᵒ̌)ง⁼³₌₃
(ó﹏ò。)
Σ(っ °Д °;)っ
( ,,´・ω・)ノ"(´っω・`。)
╮(╯▽╰)╭
o(*////▽////*)q
>﹏<
( ๑´•ω•) "(ㆆᴗㆆ)
😂
😀
😅
😊
🙂
🙃
😌
😍
😘
😜
😝
😏
😒
🙄
😳
😡
😔
😫
😱
😭
💩
👻
🙌
🖕
👍
👫
👬
👭
🌚
🌝
🙈
💊
😶
🙏
🍦
🍉
😣
Source: github.com/k4yt3x/flowerhd
颜文字
Emoji
小恐龙
花!
上一篇
下一篇