modify n9eetc dir
This commit is contained in:
parent
7ccb2aaa9c
commit
e0c1bebb13
|
@ -29,6 +29,7 @@ _test
|
||||||
/build
|
/build
|
||||||
/dist
|
/dist
|
||||||
/etc/*.local.yml
|
/etc/*.local.yml
|
||||||
|
/etc/*.local.conf
|
||||||
/etc/plugins/*.local.yml
|
/etc/plugins/*.local.yml
|
||||||
/data*
|
/data*
|
||||||
/tarball
|
/tarball
|
||||||
|
|
|
@ -1 +1,31 @@
|
||||||
cpu_usage_idle: CPU空闲率(单位:%)
|
cpu_usage_idle: CPU空闲率(单位:%)
|
||||||
|
cpu_usage_active: CPU使用率(单位:%)
|
||||||
|
cpu_usage_system: CPU内核态时间占比(单位:%)
|
||||||
|
cpu_usage_user: CPU用户态时间占比(单位:%)
|
||||||
|
cpu_usage_nice: 低优先级用户态CPU时间占比,也就是进程nice值被调整为1-19之间的CPU时间。这里注意,nice可取值范围是-20到19,数值越大,优先级反而越低(单位:%)
|
||||||
|
cpu_usage_iowait: CPU等待I/O的时间占比(单位:%)
|
||||||
|
cpu_usage_irq: CPU处理硬中断的时间占比(单位:%)
|
||||||
|
cpu_usage_softirq: CPU处理软中断的时间占比(单位:%)
|
||||||
|
cpu_usage_steal: 在虚拟机环境下有该指标,表示CPU被其他虚拟机争用的时间占比,超过20就表示争抢严重(单位:%)
|
||||||
|
cpu_usage_guest: 通过虚拟化运行其他操作系统的时间,也就是运行虚拟机的CPU时间占比(单位:%)
|
||||||
|
cpu_usage_guest_nice: 以低优先级运行虚拟机的时间占比(单位:%)
|
||||||
|
|
||||||
|
disk_free: 硬盘分区剩余量(单位:byte)
|
||||||
|
disk_used: 硬盘分区使用量(单位:byte)
|
||||||
|
disk_used_percent: 硬盘分区使用率(单位:%)
|
||||||
|
disk_total: 硬盘分区总量(单位:byte)
|
||||||
|
disk_inodes_free: 硬盘分区inode剩余量
|
||||||
|
disk_inodes_used: 硬盘分区inode使用量
|
||||||
|
disk_inodes_total: 硬盘分区inode总量
|
||||||
|
|
||||||
|
diskio_io_time: 从设备视角来看I/O请求总时间,队列中有I/O请求就计数(单位:毫秒),counter类型,需要用函数求rate才有使用价值
|
||||||
|
diskio_iops_in_progress: 已经分配给设备驱动且尚未完成的IO请求,不包含在队列中但尚未分配给设备驱动的IO请求,gauge类型
|
||||||
|
diskio_merged_reads: 相邻读请求merge读的次数,counter类型
|
||||||
|
diskio_merged_writes: 相邻写请求merge写的次数,counter类型
|
||||||
|
diskio_read_bytes: 读取的byte数量,counter类型,需要用函数求rate才有使用价值
|
||||||
|
diskio_read_time: 读请求总时间(单位:毫秒),counter类型,需要用函数求rate才有使用价值
|
||||||
|
diskio_reads: 读请求次数,counter类型,需要用函数求rate才有使用价值
|
||||||
|
diskio_weighted_io_time: 从I/O请求视角来看I/O等待总时间,如果同时有多个I/O请求,时间会叠加(单位:毫秒)
|
||||||
|
diskio_write_bytes: 写入的byte数量,counter类型,需要用函数求rate才有使用价值
|
||||||
|
diskio_write_time: 写请求总时间(单位:毫秒),counter类型,需要用函数求rate才有使用价值
|
||||||
|
diskio_writes: 写请求次数,counter类型,需要用函数求rate才有使用价值
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
#!/usr/bin/python
|
#!/usr/bin/env python
|
||||||
# -*- coding: UTF-8 -*-
|
# -*- coding: UTF-8 -*-
|
||||||
import sys
|
import sys
|
||||||
import json
|
import json
|
||||||
|
@ -11,7 +11,8 @@ notify_channel_funcs = {
|
||||||
"sms":"sms",
|
"sms":"sms",
|
||||||
"voice":"voice",
|
"voice":"voice",
|
||||||
"dingtalk":"dingtalk",
|
"dingtalk":"dingtalk",
|
||||||
"wecom":"wecom"
|
"wecom":"wecom",
|
||||||
|
"feishu":"feishu"
|
||||||
}
|
}
|
||||||
|
|
||||||
mail_host = "smtp.163.com"
|
mail_host = "smtp.163.com"
|
||||||
|
@ -118,6 +119,45 @@ class Sender(object):
|
||||||
except urllib2.HTTPError, error:
|
except urllib2.HTTPError, error:
|
||||||
print(error)
|
print(error)
|
||||||
|
|
||||||
|
@classmethod
|
||||||
|
def send_feishu(cls, payload):
|
||||||
|
users = payload.get('event').get("notify_users_obj")
|
||||||
|
|
||||||
|
tokens = {}
|
||||||
|
phones = {}
|
||||||
|
|
||||||
|
for u in users:
|
||||||
|
if u.get("phone"):
|
||||||
|
phones[u.get("phone")] = 1
|
||||||
|
|
||||||
|
contacts = u.get("contacts")
|
||||||
|
if contacts.get("feishu_robot_token", ""):
|
||||||
|
tokens[contacts.get("feishu_robot_token", "")] = 1
|
||||||
|
|
||||||
|
opener = urllib2.build_opener(urllib2.HTTPHandler())
|
||||||
|
method = "POST"
|
||||||
|
|
||||||
|
for t in tokens:
|
||||||
|
url = "https://open.feishu.cn/open-apis/bot/v2/hook/{}".format(t)
|
||||||
|
body = {
|
||||||
|
"msg_type": "text",
|
||||||
|
"content": {
|
||||||
|
"text": payload.get('tpls').get("feishu.tpl", "feishu.tpl not found")
|
||||||
|
},
|
||||||
|
"at": {
|
||||||
|
"atMobiles": phones.keys(),
|
||||||
|
"isAtAll": False
|
||||||
|
}
|
||||||
|
}
|
||||||
|
request = urllib2.Request(url, data=json.dumps(body))
|
||||||
|
request.add_header("Content-Type",'application/json;charset=utf-8')
|
||||||
|
request.get_method = lambda: method
|
||||||
|
try:
|
||||||
|
connection = opener.open(request)
|
||||||
|
print(connection.read())
|
||||||
|
except urllib2.HTTPError, error:
|
||||||
|
print(error)
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def send_sms(cls, payload):
|
def send_sms(cls, payload):
|
||||||
users = payload.get('event').get("notify_users_obj")
|
users = payload.get('event').get("notify_users_obj")
|
||||||
|
|
|
@ -2,5 +2,5 @@
|
||||||
规则名称: {{.RuleName}}{{if .RuleNote}}
|
规则名称: {{.RuleName}}{{if .RuleNote}}
|
||||||
规则备注: {{.RuleNote}}{{end}}
|
规则备注: {{.RuleNote}}{{end}}
|
||||||
监控指标: {{.TagsJSON}}
|
监控指标: {{.TagsJSON}}
|
||||||
触发时间: {{timeformat .TriggerTime}}
|
{{if .IsRecovered}}恢复时间:{{timeformat .LastEvalTime}}{{else}}触发时间: {{timeformat .TriggerTime}}
|
||||||
触发时值: {{.TriggerValue}}
|
触发时值: {{.TriggerValue}}{{end}}
|
|
@ -0,0 +1,6 @@
|
||||||
|
级别状态: S{{.Severity}} {{if .IsRecovered}}Recovered{{else}}Triggered{{end}}
|
||||||
|
规则名称: {{.RuleName}}{{if .RuleNote}}
|
||||||
|
规则备注: {{.RuleNote}}{{end}}
|
||||||
|
监控指标: {{.TagsJSON}}
|
||||||
|
{{if .IsRecovered}}恢复时间:{{timeformat .LastEvalTime}}{{else}}触发时间: {{timeformat .TriggerTime}}
|
||||||
|
触发时值: {{.TriggerValue}}{{end}}
|
|
@ -162,6 +162,13 @@
|
||||||
<th>监控指标:</th>
|
<th>监控指标:</th>
|
||||||
<td>{{.TagsJSON}}</td>
|
<td>{{.TagsJSON}}</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
|
||||||
|
{{if .IsRecovered}}
|
||||||
|
<tr>
|
||||||
|
<th>恢复时间:</th>
|
||||||
|
<td>{{timeformat .LastEvalTime}}</td>
|
||||||
|
</tr>
|
||||||
|
{{else}}
|
||||||
<tr>
|
<tr>
|
||||||
<th>触发时值:</th>
|
<th>触发时值:</th>
|
||||||
<td>{{.TriggerValue}}</td>
|
<td>{{.TriggerValue}}</td>
|
||||||
|
@ -172,6 +179,8 @@
|
||||||
{{timeformat .TriggerTime}}
|
{{timeformat .TriggerTime}}
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
{{end}}
|
||||||
|
|
||||||
<tr>
|
<tr>
|
||||||
<th>PromQL:</th>
|
<th>PromQL:</th>
|
||||||
<td>
|
<td>
|
||||||
|
|
|
@ -2,5 +2,5 @@
|
||||||
**规则标题**: {{.RuleName}}{{if .RuleNote}}
|
**规则标题**: {{.RuleName}}{{if .RuleNote}}
|
||||||
**规则备注**: {{.RuleNote}}{{end}}
|
**规则备注**: {{.RuleNote}}{{end}}
|
||||||
**监控指标**: {{.TagsJSON}}
|
**监控指标**: {{.TagsJSON}}
|
||||||
**触发时间**: {{timeformat .TriggerTime}}
|
{{if .IsRecovered}}**恢复时间**:{{timeformat .LastEvalTime}}{{else}}**触发时间**: {{timeformat .TriggerTime}}
|
||||||
**触发时值**: {{.TriggerValue}}
|
**触发时值**: {{.TriggerValue}}{{end}}
|
|
@ -8,7 +8,7 @@ RunMode = "release"
|
||||||
AdminRole = "Admin"
|
AdminRole = "Admin"
|
||||||
|
|
||||||
# Linkage with notify.py script
|
# Linkage with notify.py script
|
||||||
NotifyChannels = [ "email", "dingtalk", "wecom" ]
|
NotifyChannels = [ "email", "dingtalk", "wecom", "feishu" ]
|
||||||
|
|
||||||
[[ContactKeys]]
|
[[ContactKeys]]
|
||||||
Label = "Wecom Robot Token"
|
Label = "Wecom Robot Token"
|
||||||
|
@ -18,6 +18,10 @@ Key = "wecom_robot_token"
|
||||||
Label = "Dingtalk Robot Token"
|
Label = "Dingtalk Robot Token"
|
||||||
Key = "dingtalk_robot_token"
|
Key = "dingtalk_robot_token"
|
||||||
|
|
||||||
|
[[ContactKeys]]
|
||||||
|
Label = "Feishu Robot Token"
|
||||||
|
Key = "feishu_robot_token"
|
||||||
|
|
||||||
[Log]
|
[Log]
|
||||||
# log write dir
|
# log write dir
|
||||||
Dir = "logs"
|
Dir = "logs"
|
||||||
|
|
Loading…
Reference in New Issue