本文主要是介绍open-falcon alarm 部署,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!
目的
部署 falcon-alarm
falcon-alarm 用于处理告警信息
支持 sms, 邮件 等方式进行告警处理
服务器
ns-yun-020026
ns-yun-020027
ns-yun-020028
部署
版本修改
alarm/g/g.go
const (VERSION = "20200818"
)
编译
# make alarm
go build -o bin/alarm/falcon-alarm ./modules/alarm
创建目录
mkdir /apps/svr/falcon-plus/alarm/{bin,config,logs} -p
配置文件
/apps/svr/falcon-plus/alarm/config/cfg.json
{"log_level": "info","http": {"enabled": true,"listen": "0.0.0.0:9912"},"redis": {"addr": "xx.xxx.xx.26:6379", (redis server ip)"maxIdle": 5,"highQueues": ["event:p0", (事件处理优先级)"event:p1","event:p2","event:p3"],"lowQueues": ["event:p4","event:p5","event:p6"],"userIMQueue": "/queue/user/im","userSmsQueue": "/queue/user/sms","userMailQueue": "/queue/user/mail"},"api": {"im": "","sms": "","mail": "","dashboard": "http://falcon-dashboard.133.com","cmdb": "http://test.cmdb3.sysop.133.com/","plus_api":"http://falcon-api.133.com","plus_api_token": "default-token-used-in-server-side"},"send_ok": true,"change_ignore": false,"send_more_max": true"falcon_portal": {"addr":"falcon:falcontest@tcp(ns-yun-020021.133.com:3306)/alarms?charset=utf8&loc=Asia%2FChongqing","idle": 10,"max": 100},"worker": {"im": 10,"sms": 10,"mail": 50},"housekeeper": {"event_retention_days": 15,"event_delete_batch": 1000}
}
目录结构
[root@ns-yun-020026 alarm]# pwd
/apps/svr/falcon-plus/alarm
[root@ns-yun-020026 alarm]# tree .
.
├── bin
│ └── falcon-alarm 启动文件
├── config
│ └── cfg.json 配置文件
└── logs
启动测试
[root@ns-yun-020026 alarm]# bin/falcon-alarm -c config/cfg.json
2020/08/19 10:39:30 cfg.go:124: read config file: config/cfg.json successfully
启动配置文件
/usr/lib/systemd/system/falcon-alarm.service
[Unit]
Description=falcon alarm
After=network-online.target
Before=shutdown.target[Service]
Type=simple
User=apps
Group=apps
LimitNOFILE=65535
ExecStart=/apps/svr/falcon-plus/alarm/bin/falcon-alarm -c /apps/svr/falcon-plus/alarm/config/cfg.json
Restart=always
StandardOutput=journal
启动 alarm
[root@ns-yun-020026 system]# vim falcon-alarm.service
[root@ns-yun-020026 system]# systemctl daemon-reload
[root@ns-yun-020026 system]# systemctl start falcon-alarm
[root@ns-yun-020026 system]# systemctl status falcon-alarm
● falcon-alarm.service - falcon alarmLoaded: loaded (/usr/lib/systemd/system/falcon-alarm.service; static; vendor preset: disabled)Active: active (running) since Wed 2020-08-19 10:42:45 CST; 3s agoMain PID: 13335 (falcon-alarm)CGroup: /system.slice/falcon-alarm.service└─13335 /apps/svr/falcon-plus/alarm/bin/falcon-alarm -c /apps/svr/falcon-plus/alarm/config/cfg.json
Aug 19 10:42:45 ns-yun-020026.133.com systemd[1]: Started falcon alarm.
Aug 19 10:42:45 ns-yun-020026.133.com systemd[1]: Starting falcon alarm...
Aug 19 10:42:45 ns-yun-020026.133.com falcon-alarm[13335]: 2020/08/19 10:42:45 cfg.go:124: read config file: /apps/...ully
Hint: Some lines were ellipsized, use -l to show in full.
这篇关于open-falcon alarm 部署的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!