go.d x509check add not_revoked dimension (#18261)
Ilya Mashchenko committed
Aug 5, 2024 at 17:55 UTC
64a9356592b39929fbc2ed2a5dd8a0ca746618a5
4 files changed
+13
-6
src/go/plugin/go.d/modules/x509check/charts.go
+1
@@ -36,6 +36,7 @@ var (
36
Ctx: "x509check.revocation_status",
37
Opts: module.Opts{StoreFirst: true},
38
Dims: module.Dims{
39
+ {ID: "not_revoked"},
40
{ID: "revoked"},
41
},
42
}
src/go/plugin/go.d/modules/x509check/collect.go
+5
-1
@@ -46,9 +46,13 @@ func (x *X509Check) collectRevocation(mx map[string]int64, certs []*x509.Certifi
46
if !ok {
47
return
48
}
49
+
50
+ mx["revoked"] = 0
51
+ mx["not_revoked"] = 0
52
+
53
if rev {
54
mx["revoked"] = 1
55
} else {
52
- mx["revoked"] = 0
56
+ mx["not_revoked"] = 1
57
}
58
}
src/go/plugin/go.d/modules/x509check/metadata.yaml
+3
-2
@@ -138,11 +138,11 @@ modules:
138
alerts:
139
- name: x509check_days_until_expiration
140
metric: x509check.time_until_expiration
141
- info: time until x509 certificate expires
141
+ info: "Time until x509 certificate expires for ${label:source}"
142
link: https://github.com/netdata/netdata/blob/master/src/health/health.d/x509check.conf
143
- name: x509check_revocation_status
144
metric: x509check.revocation_status
145
- info: "x509 certificate revocation status (0: revoked, 1: valid)"
145
+ info: "x509 certificate revocation status for ${label:source}"
146
link: https://github.com/netdata/netdata/blob/master/src/health/health.d/x509check.conf
147
metrics:
148
folding:
@@ -168,4 +168,5 @@ modules:
168
unit: boolean
169
chart_type: line
170
dimensions:
171
+ - name: not_revoked
172
- name: revoked
src/health/health.d/x509check.conf
+4
-3
@@ -12,15 +12,16 @@ component: x509 certificates
12
summary: x509 certificate expiration for ${label:source}
13
info: Time until x509 certificate expires for ${label:source}
14
to: webmaster
15
-
15
+
16
template: x509check_revocation_status
17
on: x509check.revocation_status
18
class: Errors
19
type: Certificates
20
component: x509 certificates
21
calc: $revoked
22
+ units: status
23
every: 60s
23
- crit: $this != nan AND $this != 0
24
+ crit: $this == 1
25
summary: x509 certificate revocation status for ${label:source}
25
- info: x509 certificate revocation status (0: revoked, 1: valid) for ${label:source}
26
+ info: x509 certificate revocation status for ${label:source}
27
to: webmaster