Skip to content

Commit 0d65315

Browse files
committed
更新readme和配置文件脱敏处理
1 parent f27d404 commit 0d65315

File tree

10 files changed

+303
-0
lines changed

10 files changed

+303
-0
lines changed

submitted/prometheusalert/.helmignore

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
# Patterns to ignore when building packages.
2+
# This supports shell glob matching, relative path matching, and
3+
# negation (prefixed with !). Only one pattern per line.
4+
.DS_Store
5+
# Common VCS dirs
6+
.git/
7+
.gitignore
8+
.bzr/
9+
.bzrignore
10+
.hg/
11+
.hgignore
12+
.svn/
13+
# Common backup files
14+
*.swp
15+
*.bak
16+
*.tmp
17+
*~
18+
# Various IDEs
19+
.project
20+
.idea/
21+
*.tmproj

submitted/prometheusalert/Chart.yaml

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
apiVersion: v1
2+
name: prometheusalert
3+
description: A Alert Center for Prometheus Grafana and Graylog
4+
home: https://github.com/feiyu563/PrometheusAlert
5+
icon: https://raw.githubusercontent.com/feiyu563/PrometheusAlert/master/doc/logo.png
6+
maintainers:
7+
8+
name: jikun.zhang
9+
sources:
10+
- https://github.com/feiyu563/PrometheusAlert
11+
type: application
12+
version: 1.0.0
13+
appVersion: 1.2.0
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
appname = PrometheusAlert
2+
#监听端口
3+
httpport = 8080
4+
runmode = dev
5+
#开启JSON请求
6+
copyrequestbody = true
7+
#钉钉机器人地址
8+
ddurl=https://oapi.dingtalk.com/robot/send?access_token=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
9+
#告警消息标题
10+
title=NB
11+
#链接到告警平台地址
12+
alerturl=http://prometheus.local
13+
#logo图标地址
14+
logourl=https://raw.githubusercontent.com/feiyu563/PrometheusAlert/master/doc/logo.png
15+
#短信接口key
16+
appkey=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
17+
#短信模版ID
18+
tpl_id=xxxxxxx
19+
#短信sdk app id
20+
sdkappid=xxxxxxxxxxx
21+
#短信告警级别(等于3就进行短信告警) 告警级别定义 0 信息,1 警告,2 一般严重,3 严重,4 灾难
22+
messagelevel=3
23+
#电话接口key
24+
phonecallappkey=xxxxxxxxxxxxxxxxxxxxx
25+
#电话模版ID
26+
phonecalltpl_id=xxxxxxxxx
27+
#电话sdk app id
28+
phonecallsdkappid=xxxxxxxxx
29+
#电话告警级别(等于4就进行语音告警) 告警级别定义 0 信息,1 警告,2 一般严重,3 严重,4 灾难
30+
phonecalllevel=4
31+
#默认拨打号码,如使用了user.csv号码轮询功能的,请勿开启
32+
#defaultphone=
33+
#未使用user.csv或者user.csv中的号码轮询结束备用号码
34+
backupphone=xxxxxxxxxxx
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
1. Get the application URL by running these commands:
2+
{{- if .Values.ingress.enabled }}
3+
{{- range $host := .Values.ingress.hosts }}
4+
{{- range .paths }}
5+
http{{ if $.Values.ingress.tls }}s{{ end }}://{{ $host.host }}{{ . }}
6+
{{- end }}
7+
{{- end }}
8+
{{- else if contains "NodePort" .Values.service.type }}
9+
export NODE_PORT=$(kubectl get -o jsonpath="{.spec.ports[0].nodePort}" services {{ template "prometheusalert.fullname" . }})
10+
export NODE_IP=$(kubectl get nodes -o jsonpath="{.items[0].status.addresses[0].address}")
11+
echo http://$NODE_IP:$NODE_PORT
12+
{{- else if contains "LoadBalancer" .Values.service.type }}
13+
NOTE: It may take a few minutes for the LoadBalancer IP to be available.
14+
You can watch the status of by running 'kubectl get svc -w {{ template "prometheusalert.fullname" . }}'
15+
export SERVICE_IP=$(kubectl get svc {{ template "prometheusalert.fullname" . }} -o jsonpath='{.status.loadBalancer.ingress[0].ip}')
16+
echo http://$SERVICE_IP:{{ .Values.service.port }}
17+
{{- else if contains "ClusterIP" .Values.service.type }}
18+
export POD_NAME=$(kubectl get pods -l "app={{ template "prometheusalert.name" . }},release={{ .Release.Name }}" -o jsonpath="{.items[0].metadata.name}")
19+
echo "Visit http://127.0.0.1:8080 to use your application"
20+
kubectl port-forward $POD_NAME 8080:80
21+
{{- end }}
22+
2.visit it in k8s cluster by:
23+
{{ template "prometheusalert.fullname" . }}.{{ .Release.Namespace }}:{{ .Values.service.port }}
24+
25+
3.how to use it:
26+
Please visit https://github.com/feiyu563/PrometheusAlert to get help!
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
{{/* vim: set filetype=mustache: */}}
2+
{{/*
3+
Expand the name of the chart.
4+
*/}}
5+
{{- define "prometheusalert.name" -}}
6+
{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" -}}
7+
{{- end -}}
8+
9+
{{/*
10+
Create a default fully qualified app name.
11+
We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec).
12+
If release name contains chart name it will be used as a full name.
13+
*/}}
14+
{{- define "prometheusalert.fullname" -}}
15+
{{- if .Values.fullnameOverride -}}
16+
{{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" -}}
17+
{{- else -}}
18+
{{- $name := default .Chart.Name .Values.nameOverride -}}
19+
{{- if contains $name .Release.Name -}}
20+
{{- .Release.Name | trunc 63 | trimSuffix "-" -}}
21+
{{- else -}}
22+
{{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" -}}
23+
{{- end -}}
24+
{{- end -}}
25+
{{- end -}}
26+
27+
{{/*
28+
Create chart name and version as used by the chart label.
29+
*/}}
30+
{{- define "prometheusalert.chart" -}}
31+
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" -}}
32+
{{- end -}}
33+
34+
{{/*
35+
Common labels
36+
*/}}
37+
{{- define "prometheusalert.labels" -}}
38+
app.kubernetes.io/name: {{ include "prometheusalert.name" . }}
39+
helm.sh/chart: {{ include "prometheusalert.chart" . }}
40+
app.kubernetes.io/instance: {{ .Release.Name }}
41+
{{- if .Chart.AppVersion }}
42+
app.kubernetes.io/version: {{ .Chart.AppVersion | quote }}
43+
{{- end }}
44+
app.kubernetes.io/managed-by: {{ .Release.Service }}
45+
{{- end -}}
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
apiVersion: v1
2+
kind: ConfigMap
3+
metadata:
4+
labels:
5+
{{ include "prometheusalert.labels" . | indent 4 }}
6+
name: {{ template "prometheusalert.fullname" . }}
7+
data:
8+
{{ (.Files.Glob "config/*").AsConfig | indent 2 }}
Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
apiVersion: apps/v1beta2
2+
kind: Deployment
3+
metadata:
4+
name: {{ template "prometheusalert.fullname" . }}
5+
labels:
6+
{{ include "prometheusalert.labels" . | indent 4 }}
7+
spec:
8+
replicas: {{ .Values.replicaCount }}
9+
selector:
10+
matchLabels:
11+
app.kubernetes.io/name: {{ include "prometheusalert.name" . }}
12+
app.kubernetes.io/instance: {{ .Release.Name }}
13+
template:
14+
metadata:
15+
labels:
16+
app.kubernetes.io/name: {{ include "prometheusalert.name" . }}
17+
app.kubernetes.io/instance: {{ .Release.Name }}
18+
spec:
19+
containers:
20+
- name: {{ .Chart.Name }}
21+
image: "{{ .Values.image.repository }}"
22+
imagePullPolicy: {{ .Values.image.pullPolicy }}
23+
env:
24+
- name: TZ
25+
value: "Asia/Shanghai"
26+
ports:
27+
- name: http
28+
containerPort: 8080
29+
protocol: TCP
30+
volumeMounts:
31+
- name: prometheus-alert-center-conf
32+
mountPath: /app/conf/app.conf
33+
subPath: app.conf
34+
livenessProbe:
35+
httpGet:
36+
path: /
37+
port: http
38+
readinessProbe:
39+
httpGet:
40+
path: /
41+
port: http
42+
resources:
43+
{{ toYaml .Values.resources | indent 12 }}
44+
{{- with .Values.nodeSelector }}
45+
nodeSelector:
46+
{{ toYaml . | indent 8 }}
47+
{{- end }}
48+
{{- with .Values.affinity }}
49+
affinity:
50+
{{ toYaml . | indent 8 }}
51+
{{- end }}
52+
{{- with .Values.tolerations }}
53+
tolerations:
54+
{{ toYaml . | indent 8 }}
55+
{{- end }}
56+
volumes:
57+
- name: prometheus-alert-center-conf
58+
configMap:
59+
name: {{ template "prometheusalert.fullname" . }}
60+
items:
61+
- key: app.conf
62+
path: app.conf
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
{{- if .Values.ingress.enabled -}}
2+
{{- $fullName := include "prometheusalert.fullname" . -}}
3+
{{- $svcPort := .Values.service.port -}}
4+
apiVersion: extensions/v1beta1
5+
kind: Ingress
6+
metadata:
7+
name: {{ $fullName }}
8+
labels:
9+
{{ include "prometheusalert.labels" . | indent 4 }}
10+
{{- with .Values.ingress.annotations }}
11+
annotations:
12+
{{- toYaml . | nindent 4 }}
13+
{{- end }}
14+
spec:
15+
{{- if .Values.ingress.tls }}
16+
tls:
17+
{{- range .Values.ingress.tls }}
18+
- hosts:
19+
{{- range .hosts }}
20+
- {{ . | quote }}
21+
{{- end }}
22+
secretName: {{ .secretName }}
23+
{{- end }}
24+
{{- end }}
25+
rules:
26+
{{- range .Values.ingress.hosts }}
27+
- host: {{ .host | quote }}
28+
http:
29+
paths:
30+
{{- range .paths }}
31+
- path: {{ . }}
32+
backend:
33+
serviceName: {{ $fullName }}
34+
servicePort: {{ $svcPort }}
35+
{{- end }}
36+
{{- end }}
37+
{{- end }}
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
apiVersion: v1
2+
kind: Service
3+
metadata:
4+
name: {{ template "prometheusalert.fullname" . }}
5+
labels:
6+
{{ include "prometheusalert.labels" . | indent 4 }}
7+
spec:
8+
type: {{ .Values.service.type }}
9+
ports:
10+
- port: {{ .Values.service.port }}
11+
targetPort: http
12+
protocol: TCP
13+
name: http
14+
selector:
15+
app.kubernetes.io/name: {{ include "prometheusalert.name" . }}
16+
app.kubernetes.io/instance: {{ .Release.Name }}

submitted/prometheusalert/values.yaml

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
# Default values for prometheusalert.
2+
# This is a YAML-formatted file.
3+
# Declare variables to be passed into your templates.
4+
5+
replicaCount: 1
6+
7+
image:
8+
repository: feiyu563/prometheus-alert:latest
9+
pullPolicy: IfNotPresent
10+
11+
nameOverride: ""
12+
fullnameOverride: ""
13+
14+
service:
15+
type: ClusterIP
16+
port: 80
17+
18+
ingress:
19+
enabled: true
20+
annotations: {}
21+
# kubernetes.io/ingress.class: nginx
22+
# kubernetes.io/tls-acme: "true"
23+
hosts:
24+
- host: prometheus-alert.local
25+
paths: ["/"]
26+
27+
tls: []
28+
29+
resources:
30+
limits:
31+
cpu: 1000m
32+
memory: 1024Mi
33+
requests:
34+
cpu: 100m
35+
memory: 128Mi
36+
37+
nodeSelector: {}
38+
39+
tolerations: []
40+
41+
affinity: {}

0 commit comments

Comments
 (0)