cat /etc/systemd/system/prometheus.service
[Unit] Description=Prometheus service After=network.target [Service] User=root Type=simple ExecReload=/bin/sh -c "/bin/kill -1 `/usr/bin/pgrep prometheus`" ExecStop=/bin/sh -c "/bin/kill -9 `/usr/bin/pgrep prometheus`" ExecStart=/usr/local/prometheus/prometheus --config.file=/usr/local/prometheus.yml --storage.tsdb.path=/usr/local/prometheus/data [Install] WantedBy=multi-user.target
pushgateway与node_exporter
这俩官方提供的服务功能也可写成如上系统服务形式
官文:https://prometheus.io/docs/prometheus/latest/configuration/configuration/
ExecReload=/bin/sh -c "/bin/kill -1 /usr/bin/pgrep prometheus"
解释: -9 为强制杀死信号,-1 为官文说的 SIGHUP信号
reload 不生效可能是配置文件语法错误,日志会显示对应的行位置
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)