夜莺-Nightingale
夜莺V6
项目介绍 架构介绍
快速开始
黄埔营
安装部署
升级
采集器
使用手册
API
数据库表结构
FAQ
开源生态
Prometheus
版权声明
第1章:天降奇兵
第2章:探索PromQL
第3章:Prometheus告警处理
第4章:Exporter详解
第5章:数据与可视化
第6章:集群与高可用
第7章:Prometheus服务发现
第8章:监控Kubernetes
第9章:Prometheus Operator
参考资料

附:部署 Prometheus 作为时序库使用

Prometheus 的安装非常简单,就是一个二进制,下载启动就可以了。之所以还要单列一个章节来说明,是因为 Prometheus 要想作为时序库接收 remote write 协议的数据,即夜莺收到时序数据之后,要想转发给 Prometheus,需要 Prometheus 添加一个特定的启动参数 ,否则夜莺转发数据的时候会报 404,因为没有这个参数,Prometheus 就不会开启 /api/v1/write 接口的处理监听。这个启动参数是:

  • --enable-feature=remote-write-receiver 这是老版本的写法
  • --web.enable-remote-write-receiver 这是新版本的写法

要想确定你的 Prometheus 具体应该使用哪个写法,可以通过 help 信息来确认:

./prometheus --help | grep receiver

下面是一段小脚本,用于安装 Prometheus,供参考:

version=2.45.3
filename=prometheus-${version}.linux-amd64
mkdir -p /opt/prometheus
wget https://github.com/prometheus/prometheus/releases/download/v${version}/${filename}.tar.gz
tar xf ${filename}.tar.gz
cp -far ${filename}/*  /opt/prometheus/

# service 
cat <<EOF >/etc/systemd/system/prometheus.service
[Unit]
Description="prometheus"
Documentation=https://prometheus.io/
After=network.target

[Service]
Type=simple

ExecStart=/opt/prometheus/prometheus --config.file=/opt/prometheus/prometheus.yml --storage.tsdb.path=/opt/prometheus/data --web.enable-lifecycle --web.enable-remote-write-receiver

Restart=on-failure
SuccessExitStatus=0
LimitNOFILE=65536
StandardOutput=syslog
StandardError=syslog
SyslogIdentifier=prometheus


[Install]
WantedBy=multi-user.target
EOF

systemctl enable prometheus
systemctl restart prometheus
systemctl status prometheus
开源版
Flashcat
Flashduty