Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: removing status metric in security_cert as nowhere used #1651

Merged
merged 1 commit into from
Jan 6, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 4 additions & 5 deletions cmd/collectors/zapi/plugins/certificate/certificate.go
Original file line number Diff line number Diff line change
Expand Up @@ -93,14 +93,14 @@ func (my *Certificate) Run(data *matrix.Matrix) ([]*matrix.Matrix, error) {
}

// update certificate instance based on admin vaserver serial
for _, certificateInstance := range data.GetInstances() {
for certificateInstanceKey, certificateInstance := range data.GetInstances() {
if certificateInstance.IsExportable() {
certificateInstance.SetExportable(false)
serialNumber := certificateInstance.GetLabel("serial_number")

if serialNumber == adminVserverSerial {
certificateInstance.SetExportable(true)
my.setCertificateIssuerType(certificateInstance)
my.setCertificateIssuerType(certificateInstance, certificateInstanceKey)
my.setCertificateValidity(data, certificateInstance)
}
}
Expand All @@ -112,17 +112,16 @@ func (my *Certificate) Run(data *matrix.Matrix) ([]*matrix.Matrix, error) {
return nil, nil
}

func (my *Certificate) setCertificateIssuerType(instance *matrix.Instance) {
func (my *Certificate) setCertificateIssuerType(instance *matrix.Instance, certificateInstanceKey string) {
var (
cert *x509.Certificate
err error
)

certificatePEM := instance.GetLabel("certificatePEM")
certUUID := instance.GetLabel("uuid")

if certificatePEM == "" {
my.Logger.Debug().Str("uuid", certUUID).Msg("Certificate is not found")
my.Logger.Debug().Str("certificateInstanceKey", certificateInstanceKey).Msg("Certificate is not found")
instance.SetLabel("certificateIssuerType", "unknown")
} else {
instance.SetLabel("certificateIssuerType", "self_signed")
Expand Down
3 changes: 0 additions & 3 deletions conf/rest/9.12.0/security_certificate.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,6 @@ counters:
- type="server"

plugins:
- LabelAgent:
value_to_num:
- status name - - `0`
- Certificate:
schedule:
- data: 180s # should be multiple of data poll duration
Expand Down
2 changes: 0 additions & 2 deletions conf/zapi/cdot/9.8.0/security_certificate.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,6 @@ plugins:
- LabelAgent:
include_equals:
- type `server`
value_to_num:
- status name - - `0`
- Certificate:
schedule:
- data: 180s # should be multiple of data poll duration
Expand Down