Skip to content

Commit

Permalink
fix: dashboard and http rule (#9)
Browse files Browse the repository at this point in the history
  • Loading branch information
raffis authored Sep 22, 2023
1 parent 955f51a commit c777eb6
Show file tree
Hide file tree
Showing 4 changed files with 156 additions and 43 deletions.
7 changes: 7 additions & 0 deletions .github/workflows/pr-build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,13 @@ jobs:
uses: shogo82148/actions-goveralls@7b1bd2871942af030d707d6574e5f684f9891fb2 # v1.8.0
with:
path-to-profile: coverage.out
- name: Check if working tree is dirty
run: |
if [[ $(git diff --stat) != '' ]]; then
git --no-pager diff
echo 'run make test and commit changes'
exit 1
fi
- name: Build container image
run: |
make docker-build
Expand Down
95 changes: 74 additions & 21 deletions chart/saml-exporter/dashboard.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
"fiscalYearStartMonth": 0,
"gnetId": 13922,
"graphTooltip": 0,
"id": 31840,
"id": 31841,
"links": [],
"liveNow": false,
"panels": [
Expand Down Expand Up @@ -245,6 +245,74 @@
"title": "Expiring within $critical_threshold days",
"type": "stat"
},
{
"datasource": {
"type": "prometheus",
"uid": "${DS_PROMETHEUS}"
},
"fieldConfig": {
"defaults": {
"color": {
"mode": "thresholds"
},
"mappings": [],
"thresholds": {
"mode": "absolute",
"steps": [
{
"color": "green",
"value": null
},
{
"color": "dark-red",
"value": 1
}
]
},
"unit": "none"
},
"overrides": []
},
"gridPos": {
"h": 6,
"w": 3,
"x": 11,
"y": 1
},
"id": 50,
"options": {
"colorMode": "background",
"graphMode": "area",
"justifyMode": "auto",
"orientation": "auto",
"reduceOptions": {
"calcs": [
"lastNotNull"
],
"fields": "",
"values": false
},
"text": {},
"textMode": "value"
},
"pluginVersion": "9.2.0",
"targets": [
{
"datasource": {
"uid": "${DS_PROMETHEUS}"
},
"editorMode": "code",
"expr": "count(sum(rate(http_client_request{code!~\"^2.*\", job=~\".*/saml-exporter\"}[$__rate_interval])) by (host))",
"interval": "",
"legendFormat": "",
"queryType": "randomWalk",
"range": true,
"refId": "A"
}
],
"title": "Unavailable SAML Metadata",
"type": "stat"
},
{
"datasource": {
"type": "prometheus",
Expand Down Expand Up @@ -665,7 +733,7 @@
"serial_number",
"use"
],
"pattern": "^(subject_CN|secret_namespace|secret_name|Value)$"
"pattern": "^(subject_CN|Value)$"
}
}
},
Expand All @@ -683,8 +751,6 @@
"renameByName": {
"Value": "Time Left",
"entityid": "Entity ID",
"secret_name": "Secret Name",
"secret_namespace": "Secret Namespace",
"serial_number": "Serial",
"subject_CN": "Subject CN",
"use": "Usage"
Expand Down Expand Up @@ -905,7 +971,7 @@
"id": "filterFieldsByName",
"options": {
"include": {
"pattern": "^(subject_CN|secret_namespace|secret_name|Value)$"
"pattern": "^(subject_CN|Value)$"
}
}
},
Expand All @@ -915,14 +981,10 @@
"excludeByName": {},
"indexByName": {
"Value": 3,
"secret_name": 2,
"secret_namespace": 1,
"subject_CN": 0
},
"renameByName": {
"Value": "Days",
"secret_name": "Secret Name",
"secret_namespace": "Secret Namespace",
"subject_CN": "Subject CN"
}
}
Expand Down Expand Up @@ -1004,7 +1066,7 @@
"uid": "${DS_PROMETHEUS}"
},
"editorMode": "code",
"expr": "topk(10, (saml_x509_cert_not_after{secret_name!=\"\"} - saml_x509_cert_not_before) / 86400)",
"expr": "topk(10, (saml_x509_cert_not_after - saml_x509_cert_not_before) / 86400)",
"format": "table",
"instant": true,
"interval": "",
Expand All @@ -1019,7 +1081,7 @@
"id": "filterFieldsByName",
"options": {
"include": {
"pattern": "^(subject_CN|secret_namespace|secret_name|Value)$"
"pattern": "^(subject_CN|Value)$"
}
}
},
Expand All @@ -1029,14 +1091,10 @@
"excludeByName": {},
"indexByName": {
"Value": 3,
"secret_name": 2,
"secret_namespace": 1,
"subject_CN": 0
},
"renameByName": {
"Value": "Days",
"secret_name": "Secret Name",
"secret_namespace": "Secret Namespace",
"subject_CN": "Subject CN"
}
}
Expand Down Expand Up @@ -1151,7 +1209,7 @@
"uid": "RVra6BSnk"
},
"editorMode": "code",
"expr": "sum(rate(http_client_request{service=\"saml-exporter\"}[$__rate_interval])) by (code, host)",
"expr": "sum(rate(http_client_request{job=~\".*/saml-exporter\"}[$__rate_interval])) by (code, host)",
"legendFormat": "{{host}}: {{code}}",
"range": true,
"refId": "A"
Expand Down Expand Up @@ -1746,11 +1804,6 @@
"templating": {
"list": [
{
"current": {
"selected": false,
"text": "thanos",
"value": "thanos"
},
"hide": 0,
"includeAll": false,
"label": "Datasource",
Expand Down
2 changes: 1 addition & 1 deletion chart/saml-exporter/templates/prometheusrule.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ spec:
{{- toYaml .Values.prometheusRule.alertExtraAnnotations | nindent 8 }}
{{- end }}
- alert: '{{ printf "%s%s" $rulePrefix "UnavailableMetadataEndpoint" | trim }}'
expr: sum(rate(http_client_request{job="{{ include "saml-exporter.fullname" . }}", code!~"^2.*"}[5m])) > 0
expr: sum(rate(http_client_request{job="{{ .Values.podMonitor.namespace | default .Values.serviceMonitor.namespace | default .Release.Namespace}}/{{ include "saml-exporter.fullname" . }}", code!~"^2.*"}[5m])) > 0
for: 3m
labels:
severity: {{ .Values.prometheusRule.unavailableMetadataEndpointSeverity }}
Expand Down
95 changes: 74 additions & 21 deletions grafana/dashboard.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
"fiscalYearStartMonth": 0,
"gnetId": 13922,
"graphTooltip": 0,
"id": 31840,
"id": 31841,
"links": [],
"liveNow": false,
"panels": [
Expand Down Expand Up @@ -245,6 +245,74 @@
"title": "Expiring within $critical_threshold days",
"type": "stat"
},
{
"datasource": {
"type": "prometheus",
"uid": "${DS_PROMETHEUS}"
},
"fieldConfig": {
"defaults": {
"color": {
"mode": "thresholds"
},
"mappings": [],
"thresholds": {
"mode": "absolute",
"steps": [
{
"color": "green",
"value": null
},
{
"color": "dark-red",
"value": 1
}
]
},
"unit": "none"
},
"overrides": []
},
"gridPos": {
"h": 6,
"w": 3,
"x": 11,
"y": 1
},
"id": 50,
"options": {
"colorMode": "background",
"graphMode": "area",
"justifyMode": "auto",
"orientation": "auto",
"reduceOptions": {
"calcs": [
"lastNotNull"
],
"fields": "",
"values": false
},
"text": {},
"textMode": "value"
},
"pluginVersion": "9.2.0",
"targets": [
{
"datasource": {
"uid": "${DS_PROMETHEUS}"
},
"editorMode": "code",
"expr": "count(sum(rate(http_client_request{code!~\"^2.*\", job=~\".*/saml-exporter\"}[$__rate_interval])) by (host))",
"interval": "",
"legendFormat": "",
"queryType": "randomWalk",
"range": true,
"refId": "A"
}
],
"title": "Unavailable SAML Metadata",
"type": "stat"
},
{
"datasource": {
"type": "prometheus",
Expand Down Expand Up @@ -665,7 +733,7 @@
"serial_number",
"use"
],
"pattern": "^(subject_CN|secret_namespace|secret_name|Value)$"
"pattern": "^(subject_CN|Value)$"
}
}
},
Expand All @@ -683,8 +751,6 @@
"renameByName": {
"Value": "Time Left",
"entityid": "Entity ID",
"secret_name": "Secret Name",
"secret_namespace": "Secret Namespace",
"serial_number": "Serial",
"subject_CN": "Subject CN",
"use": "Usage"
Expand Down Expand Up @@ -905,7 +971,7 @@
"id": "filterFieldsByName",
"options": {
"include": {
"pattern": "^(subject_CN|secret_namespace|secret_name|Value)$"
"pattern": "^(subject_CN|Value)$"
}
}
},
Expand All @@ -915,14 +981,10 @@
"excludeByName": {},
"indexByName": {
"Value": 3,
"secret_name": 2,
"secret_namespace": 1,
"subject_CN": 0
},
"renameByName": {
"Value": "Days",
"secret_name": "Secret Name",
"secret_namespace": "Secret Namespace",
"subject_CN": "Subject CN"
}
}
Expand Down Expand Up @@ -1004,7 +1066,7 @@
"uid": "${DS_PROMETHEUS}"
},
"editorMode": "code",
"expr": "topk(10, (saml_x509_cert_not_after{secret_name!=\"\"} - saml_x509_cert_not_before) / 86400)",
"expr": "topk(10, (saml_x509_cert_not_after - saml_x509_cert_not_before) / 86400)",
"format": "table",
"instant": true,
"interval": "",
Expand All @@ -1019,7 +1081,7 @@
"id": "filterFieldsByName",
"options": {
"include": {
"pattern": "^(subject_CN|secret_namespace|secret_name|Value)$"
"pattern": "^(subject_CN|Value)$"
}
}
},
Expand All @@ -1029,14 +1091,10 @@
"excludeByName": {},
"indexByName": {
"Value": 3,
"secret_name": 2,
"secret_namespace": 1,
"subject_CN": 0
},
"renameByName": {
"Value": "Days",
"secret_name": "Secret Name",
"secret_namespace": "Secret Namespace",
"subject_CN": "Subject CN"
}
}
Expand Down Expand Up @@ -1151,7 +1209,7 @@
"uid": "RVra6BSnk"
},
"editorMode": "code",
"expr": "sum(rate(http_client_request{service=\"saml-exporter\"}[$__rate_interval])) by (code, host)",
"expr": "sum(rate(http_client_request{job=~\".*/saml-exporter\"}[$__rate_interval])) by (code, host)",
"legendFormat": "{{host}}: {{code}}",
"range": true,
"refId": "A"
Expand Down Expand Up @@ -1746,11 +1804,6 @@
"templating": {
"list": [
{
"current": {
"selected": false,
"text": "thanos",
"value": "thanos"
},
"hide": 0,
"includeAll": false,
"label": "Datasource",
Expand Down

0 comments on commit c777eb6

Please sign in to comment.