ops-itop / itop-extensions

my extensions of itop
29 stars 12 forks source link

将部分 configuration-snippet 配置固化为选项 #110

Open annProg opened 4 years ago

annProg commented 4 years ago

比如限流,limit_req_zone需要预先定义,如果限流时写错了名字,会导致ingress-nginx无法更新upstream,报错:

{"log":"E1226 10:32:58.844524       9 controller.go:189] Unexpected failure reloading the backend:\n","stream":"stderr","time":"2019-12-26T02:32:58.844575907Z"}
{"log":"\n","stream":"stderr","time":"2019-12-26T02:32:58.844584888Z"}
{"log":"-------------------------------------------------------------------------------\n","stream":"stderr","time":"2019-12-26T02:32:58.844589789Z"}
{"log":"Error: exit status 1\n","stream":"stderr","time":"2019-12-26T02:32:58.844594916Z"}
{"log":"nginx: the configuration file /tmp/nginx-cfg987373816 syntax is ok\n","stream":"stderr","time":"2019-12-26T02:32:58.844599805Z"}
{"log":"2019/12/26 10:32:58 [emerg] 23256#23256: zero size shared memory zone \"qps301\"\n","stream":"stderr","time":"2019-12-26T02:32:58.844604897Z"}
{"log":"nginx: [emerg] zero size shared memory zone \"qps301\"\n","stream":"stderr","time":"2019-12-26T02:32:58.844610252Z"}
{"log":"nginx: configuration file /tmp/nginx-cfg987373816 test failed\n","stream":"stderr","time":"2019-12-26T02:32:58.8446154Z"}
{"log":"\n","stream":"stderr","time":"2019-12-26T02:32:58.844637877Z"}

考虑将这种常用配置固化为选项(添加正则校验),在 cmdbApi 代码中生成 configuration-snippet

另外,需要有针对Ingress-nginx 报错的报警

annProg commented 4 years ago

查看ingress-nginx 报错的方法

grep -A10 "E1226" xxx.log

# E日期
# -A10 是为了看到报错内容