controllers

package
v2.3.2+incompatible Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 11, 2020 License: MIT Imports: 20 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var PhoneCallMessage = ""

Functions

func CallOthers

func CallOthers(Num int, logsign string)

func GetUserPhone

func GetUserPhone(neednum int) string

获取用户号码

func LogsSign

func LogsSign() string

func PhoneCallPost

func PhoneCallPost(url string, u TXphonecall, logsign string) string

func PostALYmessage

func PostALYmessage(Messages, PhoneNumbers, logsign string) string

func PostALYphonecall

func PostALYphonecall(Messages string, PhoneNumbers, logsign string) string

func PostHWmessage

func PostHWmessage(Messages string, PhoneNumbers, logsign string) string

华为云短信子程序

func PostTXmessage

func PostTXmessage(Messages string, PhoneNumbers, logsign string) string

腾讯短信子程序

func PostTXphonecall

func PostTXphonecall(Messages string, PhoneNumbers, logsign string) string

腾讯语音子程序

func PostToDingDing

func PostToDingDing(title, text, Ddurl, logsign string) string

func PostToWeiXin

func PostToWeiXin(text, WXurl, logsign string) string

func SendMessageG

func SendMessageG(message Graylog2, typeid int, logsign string) string

func SendMessageG3

func SendMessageG3(message Graylog3, typeid int, logsign string) string

func SendMessageGrafana

func SendMessageGrafana(message Grafana, typeid int, logsign string) string

typeid 为0,触发电话告警和钉钉告警, typeid 为1 仅触发dingding告警

func SendMessageP

func SendMessageP(message Prometheus, logsign string) string
func GetCSTtime(date string)(string)  {
	T1:=date[0:10]
	T2:=date[11:19]
	T3:=T1+" "+T2
	tm2, _ := time.Parse("2006-01-02 15:04:05", T3)
	h, _ := time.ParseDuration("-1h")
	tm3:=tm2.Add(-8*h)
	tm:=tm3.Format("2006-01-02 15:04:05")
	return tm
}

func SendMessageR

func SendMessageR(message Prometheus, rwxurl, rddurl, rphone, logsign string) string

Types

type AlerMessages

type AlerMessages []Alerts

按照 Alert.Level 从大到小排序

func (AlerMessages) Len

func (a AlerMessages) Len() int

func (AlerMessages) Less

func (a AlerMessages) Less(i, j int) bool

func (AlerMessages) Swap

func (a AlerMessages) Swap(i, j int)

type AlertEvent

type AlertEvent struct {
	Source string `json:"source`
}

type Alerts

type Alerts struct {
	Status       string
	Labels       Labels      `json:"labels"`
	Annotations  Annotations `json:"annotations"`
	StartsAt     string      `json:"startsAt"`
	EndsAt       string      `json:"endsAt"`
	GeneratorUrl string      `json:"generatorURL"` //prometheus 告警返回地址
}

type Annotations

type Annotations struct {
	Description string `json:"description"`
	Summary     string `json:"summary"`
	//Level string `json:"level"`  //2019年11月20日 16:04:04 删除Annotations level,改用label中的level
	Mobile string `json:"mobile"` //2019年2月25日 19:09:23 增加手机号支持
	Ddurl  string `json:"ddurl"`  //2019年3月12日 20:33:38 增加多个钉钉告警支持
	Wxurl  string `json:"wxurl"`  //2019年3月12日 20:33:38 增加多个钉钉告警支持
}

type Backlog

type Backlog struct {
	Timestamp string  `json:"timestamp"` //开始时间
	Index     string  `json:"index"`     //索引
	Message   string  `json:"message"`
	Fields    G3Field `json:"fields`
}

type CallBack

type CallBack struct {
	Voiceprompt_callback Vcallback `json:"voiceprompt_callback"`
}

type Check_result

type Check_result struct {
	MatchingMessages   []MatchingMessage `json:"matching_messages"`
	Result_description string            `json:"result_description"`
}

type DDMessage

type DDMessage struct {
	Msgtype  string `json:"msgtype"`
	Markdown struct {
		Title string `json:"title"`
		Text  string `json:"text"`
	} `json:"markdown"`
	At struct {
		AtMobiles []string `json:"atMobiles"`
		IsAtAll   bool     `json:"isAtAll"`
	} `json:"at"`
}

type G2Field

type G2Field struct {
	Gl2RemoteIp   string `json:"gl2_remote_ip"`
	Gl2RemotePort int    `json:"gl_2_remote_port"`
}

type G3Field

type G3Field struct {
	Gl2RemoteIp   string `json:"gl2_remote_ip"`
	Gl2RemotePort int    `json:"gl_2_remote_port"`
}

type Grafana

type Grafana struct {
	Message  string `json:"message"`
	RuleName string `json:"ruleName"`
	RuleUrl  string `json:"ruleUrl"`
	State    string `json:"state"`
}

type GrafanaController

type GrafanaController struct {
	beego.Controller
}

func (*GrafanaController) GrafanaALYdh

func (c *GrafanaController) GrafanaALYdh()

func (*GrafanaController) GrafanaALYdx

func (c *GrafanaController) GrafanaALYdx()

func (*GrafanaController) GrafanaDingding

func (c *GrafanaController) GrafanaDingding()

func (*GrafanaController) GrafanaHwdx

func (c *GrafanaController) GrafanaHwdx()

func (*GrafanaController) GrafanaTxdh

func (c *GrafanaController) GrafanaTxdh()

func (*GrafanaController) GrafanaTxdx

func (c *GrafanaController) GrafanaTxdx()

func (*GrafanaController) GrafanaWeixin

func (c *GrafanaController) GrafanaWeixin()

type Graylog2

type Graylog2 struct {
	Check_result Check_result `json:"check_result"`
}

graylog2告警部分

type Graylog2Controller

type Graylog2Controller struct {
	beego.Controller
}

func (*Graylog2Controller) GraylogALYdh

func (c *Graylog2Controller) GraylogALYdh()

func (*Graylog2Controller) GraylogALYdx

func (c *Graylog2Controller) GraylogALYdx()

func (*Graylog2Controller) GraylogDingding

func (c *Graylog2Controller) GraylogDingding()

for graylog alert

func (*Graylog2Controller) GraylogHwdx

func (c *Graylog2Controller) GraylogHwdx()

func (*Graylog2Controller) GraylogTxdh

func (c *Graylog2Controller) GraylogTxdh()

func (*Graylog2Controller) GraylogTxdx

func (c *Graylog2Controller) GraylogTxdx()

func (*Graylog2Controller) GraylogWeixin

func (c *Graylog2Controller) GraylogWeixin()

type Graylog3

type Graylog3 struct {
	Description string     `json:"event_definition_description"`
	Event       AlertEvent `json:"event"`
	Backlogs    []Backlog  `json:"backlog"`
}

graylog3告警部分

type Graylog3Controller

type Graylog3Controller struct {
	beego.Controller
}

func (*Graylog3Controller) GraylogALYdh

func (c *Graylog3Controller) GraylogALYdh()

func (*Graylog3Controller) GraylogALYdx

func (c *Graylog3Controller) GraylogALYdx()

func (*Graylog3Controller) GraylogDingding

func (c *Graylog3Controller) GraylogDingding()

for graylog3 alert

func (*Graylog3Controller) GraylogHwdx

func (c *Graylog3Controller) GraylogHwdx()

func (*Graylog3Controller) GraylogTxdh

func (c *Graylog3Controller) GraylogTxdh()

func (*Graylog3Controller) GraylogTxdx

func (c *Graylog3Controller) GraylogTxdx()

func (*Graylog3Controller) GraylogWeixin

func (c *Graylog3Controller) GraylogWeixin()

type Labels

type Labels struct {
	Alertname string `json:"alertname"`
	Instance  string `json:"instance"`
	Level     string `json:"level"` //2019年11月20日 16:03:10更改告警级别定义位置,适配prometheus alertmanager rule
}

type MainController

type MainController struct {
	beego.Controller
}

func (*MainController) AlertTest

func (c *MainController) AlertTest()

func (*MainController) Get

func (c *MainController) Get()

main page

type Mark

type Mark struct {
	Content string `json:"content"`
}

type MatchingMessage

type MatchingMessage struct {
	Index     string  `json:"index"`
	Message   string  `json:"message"`
	Fields    G2Field `json:"fields"`
	Timestamp string  `json:"timestamp"`
}

type Mobiles

type Mobiles struct {
	Mobile     string `json:"mobile"`
	Nationcode string `json:"nationcode"`
}

腾讯短信接口消息格式

type Prometheus

type Prometheus struct {
	Status      string
	Alerts      []Alerts
	Externalurl string `json:"externalURL"` //alertmanage 返回地址
}

type PrometheusController

type PrometheusController struct {
	beego.Controller
}

func (*PrometheusController) PrometheusAlert

func (c *PrometheusController) PrometheusAlert()

for prometheus alert 关于告警级别level共有5个级别,0-4,0 信息,1 警告,2 一般严重,3 严重,4 灾难

func (*PrometheusController) PrometheusRouter

func (c *PrometheusController) PrometheusRouter()

type Re

type Re struct {
	Result int    `json:"result"`
	Errmsg string `json:"errmsg"`
}

type TXmessage

type TXmessage struct {
	Ext    string    `json:"ext"`
	Extend string    `json:"extend"`
	Params []string  `json:"params"`
	Sig    string    `json:"sig"`
	Sign   string    `json:"sign"`
	Tel    []Mobiles `json:"tel"`
	Time   int       `json:"time"`
	Tpl_id int       `json:"tpl_id"`
}

type TXphonecall

type TXphonecall struct {
	Ext       string   `json:"ext"`
	Tpl_id    int      `json:"tpl_id"`
	Params    []string `json:"params"`
	Playtimes int      `json:"playtimes"`
	Sig       string   `json:"sig"`
	Tel       Mobiles  `json:"tel"`
	Time      int      `json:"time"`
}

腾讯语音提醒接口

type TengXunStatusController

type TengXunStatusController struct {
	beego.Controller
}

func (*TengXunStatusController) TengXunStatus

func (c *TengXunStatusController) TengXunStatus()

type Vcallback

type Vcallback struct {
	Result         string `json:"result"`
	Accept_time    string `json:"accept_time"`
	Call_from      string `json:"call_from"`
	Callid         string `json:"callid"`
	End_calltime   string `json:"end_calltime"`
	Fee            string `json:"fee"`
	Mobile         string `json:"mobile"`
	Nationcode     string `json:"nationcode"`
	Start_calltime string `json:"start_calltime"`
}

type WXMessage

type WXMessage struct {
	Msgtype  string `json:"msgtype"`
	Markdown Mark   `json:"markdown"`
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL