Alertmanager服务未启动



我在VM(ubuntu(上配置了Prometheus、节点导出器和alertmanager,如下所示:https://www.youtube.com/watch?v=7gW5pSM6dlU

普罗米修斯和节点导出器运行良好,但我无法启动alertmanager。

user1@ubuntu1:/usr/local/bin/alertmanager$ sudo service alertmanager start
user1@ubuntu1:/usr/local/bin/alertmanager$ sudo service alertmanager status
● alertmanager.service - Prometheus Alert Manager
Loaded: loaded (/etc/systemd/system/alertmanager.service; disabled; vendor preset: enabled)
Active: failed (Result: exit-code) since Tue 2022-01-04 18:48:11 CET; 4s ago
Process: 4205 ExecStart=/usr/local/bin/alertmanager --config.file=/usr/local/bin/alertmanager/alertmanager.yml (code=exited, status=203/EXEC)
Main PID: 4205 (cde=exited, status=203/EXEC)
sty 04 18:48:11 ubuntu1 systemd[1]: Started Prometheus Alert Manager.
sty 04 18:48:11 ubuntu1 systemd[4205]: alertmanager.service: Failed to execute command: Permission denied
sty 04 18:48:11 ubuntu1 systemd[4205]: alertmanager.service: Failed at step EXEC spawning /usr/local/bin/alertmanager: Permission denied
sty 04 18:48:11 ubuntu1 systemd[1]: alertmanager.service: Main process exited, code=exited, status=203/EXEC
sty 04 18:48:11 ubuntu1 systemd[1]: alertmanager.service: Failed with result 'exit-code'.

但是amtool成功地检查了我的配置文件:

user1@ubuntu1:/usr/local/bin/alertmanager$ ./amtool check-config ./alertmanager.yml
Checking './alertmanager.yml'  SUCCESS
Found:
- global config
- route
- 1 inhibit rules
- 1 receivers
- 0 templates 

我的alertmanager配置文件如下:

global:
resolve_timeout: 5m
route:
group_by: [Alertname]
group_interval: 30s
repeat_interval: 30s
# Send all notifications to me.
receiver: email-me
receivers:
- name: email-me
email_configs:
- send_resolved: true
to: my_real_email@gmail.com
from: my_real_email@gmail.com
smarthost: smtp.gamil.com:587
auth_username: my_real_email@gmail.com
auth_identity: my_real_email@gmail.com
auth_password: 'my_password'
inhibit_rules:
- source_match:
severity: 'critical'
target_match: 
severity: 'warning'
equal: ['alertname', 'dev', 'instance']

我的服务是这样的:

[Unit]
Description=Prometheus Alert Manager
After=network.targer
[Service]
Type=simple
ExecStart=/usr/local/bin/alertmanager --config.file=/usr/local/bin/alertmanager/alertmanager.yml
[Install]
WantedBy=multi-user.target

我不知道为什么它显示";"许可被拒绝";,因为我用sudo开始服务。有什么想法吗?

好的,我再次设置了VM、Prometheus和Alertmanager,现在服务开始了,没有任何问题。

权限被拒绝错误,因此尝试在altermanager.service文件中添加用户和组

[Unit]
Description=AlertManager Server Service
Wants=network-online.target
After=network-online.target
[Service]
Type=simple
User=root
Group=root
ExecStart=/etc/prometheus/exporter/alertmanager/alertmanager 
--config.file="/etc/prometheus/exporter/alertmanager/alertmanager.yml" 
--storage.path="/etc/prometheus/exporter/alertmanager/data/" 
--web.listen-address=0.0.0.0:9093 
--web.external-url="http://localhost:9093/alertmanager" 
--log.level=debug 
Restart=always
[Install]
WantedBy=multi-user.target

相关内容

  • 没有找到相关文章

最新更新