prometheus-运行
二进制包安装-运行
nohup方式运行
nohup ./prometheus &
运行日志
nohup.out
systemctl方式运行
vim prometheus.service
粘贴下面内容
[Unit]
Description=Prometheus service
After=network-online.target
[Service]
Type=simple
ExecStart=/usr/local/prometheus/prometheus --config.file=/usr/local/prometheus/prometheus.yml --log.level=warn --storage.tsdb.path=/usr/local/prometheus/data/
Restart=on-failue
ExecStop=/bin/kill -9 $MAINPID
[Install]
WantedBy=multi-user.target
mv prometheus.service /lib/systemd/system/
加载systemctl 服务
systemctl daemon-reload
启动
systemctl start prometheus
查看状态
systemctl status prometheus
重启
systemctl restart prometheus
关闭
systemctl stop prometheus
创建开机自启
systemctl enable prometheus
问题:如果启动prometheus后metrics数据无法在prometheus的graph中搜索查看
问题可能是时间和时区造成的设置下服务器时间和时区
ntpdate 0.asia.pool.ntp.org
设置上海时区
timedatectl set-timezone Asia/Shanghai
浙公网安备 33010602011771号