Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 305292f

Browse files
Initial commit
0 parents commit 305292f

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

46 files changed

+970
-0
lines changed

‎.gitattributes‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
* linguist-language=GO

‎.gitignore‎

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
.buildpath
2+
.hgignore.swp
3+
.project
4+
.orig
5+
.swp
6+
.idea/
7+
.settings/
8+
.vscode/
9+
bin/
10+
**/.DS_Store
11+
gf
12+
main
13+
main.exe
14+
output/
15+
manifest/output/
16+
temp/
17+
temp.yaml
18+
bin

‎Dockerfile‎

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
FROM loads/alpine:3.8
2+
3+
###############################################################################
4+
# INSTALLATION
5+
###############################################################################
6+
WORKDIR /app
7+
8+
ADD ./temp/linux_amd64/notifier .
9+
RUN chmod +x notifier
10+
11+
###############################################################################
12+
# START
13+
###############################################################################
14+
EXPOSE 8080
15+
16+
CMD ./notifier

‎LICENSE‎

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) 2023 lingcoder
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

‎Makefile‎

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
ROOT_DIR = $(shell pwd)
2+
NAMESPACE = "default"
3+
DEPLOY_NAME = "prometheus-notifier"
4+
DOCKER_NAME = "prometheus-notifier"
5+
PREFIX = "lingcoder"
6+
7+
include ./hack/hack.mk
8+
9+
.PHONY: build-image
10+
11+
build-image:
12+
docker build -t $(PREFIX)/$(DOCKER_NAME) .

‎README.md‎

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
# prometheus-notifier
2+
3+
<div align=center>
4+
<img src="https://img.shields.io/badge/golang-^1.21-red"/>
5+
<img src="https://img.shields.io/badge/grafana-^10-green"/>
6+
<img src="https://img.shields.io/badge/alertmanager-^0.26-blue"/>
7+
</div>
8+
9+
### 已支持的通知方式
10+
11+
- [x] feishu 飞书群组机器人

‎api/v1/base.go‎

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
package v1
2+
3+
import (
4+
"time"
5+
)
6+
7+
type BaseReq struct {
8+
Lang string `json:"lang"`
9+
URL string `json:"url"`
10+
}
11+
12+
// Message defines the JSON object send to webhook endpoints.
13+
type Message struct {
14+
*Data
15+
16+
// The protocol version.
17+
Version string `json:"version"`
18+
GroupKey string `json:"groupKey"`
19+
TruncatedAlerts uint64 `json:"truncatedAlerts"`
20+
}
21+
22+
type Data struct {
23+
Receiver string `json:"receiver"`
24+
Status string `json:"status"`
25+
Alerts []Alert `json:"alerts"`
26+
27+
GroupLabels map[string]string `json:"groupLabels"`
28+
CommonLabels map[string]string `json:"commonLabels"`
29+
CommonAnnotations map[string]string `json:"commonAnnotations"`
30+
31+
ExternalURL string `json:"externalURL"`
32+
}
33+
34+
type Alert struct {
35+
Status string `json:"status"`
36+
Labels map[string]string `json:"labels"`
37+
Annotations map[string]string `json:"annotations"`
38+
StartsAt time.Time `json:"startsAt"`
39+
EndsAt time.Time `json:"endsAt"`
40+
GeneratorURL string `json:"generatorURL"`
41+
Fingerprint string `json:"fingerprint"`
42+
}
43+
44+
type BaseRes struct {
45+
}

‎api/v1/custom.go‎

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
package v1
2+
3+
type CustomReq struct {
4+
BaseReq
5+
Body Message
6+
}

‎api/v1/feishu.go‎

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
package v1
2+
3+
type FeishuReq struct {
4+
BaseReq
5+
Body Message
6+
}

‎api/v1/index.go‎

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
package v1
2+
3+
type WelcomeReq struct {
4+
}
5+
6+
type WelcomeRes struct {
7+
}

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /