Fix cert expire metrics math
This commit is contained in:
parent
bb257692af
commit
8d82c43fa2
1 changed files with 4 additions and 4 deletions
8
main.go
8
main.go
|
@ -650,16 +650,16 @@ func (oAdmin *OpenvpnAdmin) usersList() []OpenvpnClient {
|
||||||
switch {
|
switch {
|
||||||
case line.Flag == "V":
|
case line.Flag == "V":
|
||||||
ovpnClient.AccountStatus = "Active"
|
ovpnClient.AccountStatus = "Active"
|
||||||
ovpnClientCertificateExpire.WithLabelValues(line.Identity).Set(float64(parseDateToUnix(indexTxtDateLayout, line.ExpirationDate) - apochNow / 3600 / 24))
|
ovpnClientCertificateExpire.WithLabelValues(line.Identity).Set(float64((parseDateToUnix(indexTxtDateLayout, line.ExpirationDate) - apochNow) / 3600 / 24))
|
||||||
validCerts += 1
|
validCerts += 1
|
||||||
case line.Flag == "R":
|
case line.Flag == "R":
|
||||||
ovpnClient.AccountStatus = "Revoked"
|
ovpnClient.AccountStatus = "Revoked"
|
||||||
ovpnClient.RevocationDate = parseDateToString(indexTxtDateLayout, line.RevocationDate, stringDateFormat)
|
ovpnClient.RevocationDate = parseDateToString(indexTxtDateLayout, line.RevocationDate, stringDateFormat)
|
||||||
ovpnClientCertificateExpire.WithLabelValues(line.Identity).Set(float64(parseDateToUnix(indexTxtDateLayout, line.ExpirationDate) - apochNow / 3600 / 24))
|
ovpnClientCertificateExpire.WithLabelValues(line.Identity).Set(float64((parseDateToUnix(indexTxtDateLayout, line.ExpirationDate) - apochNow) / 3600 / 24))
|
||||||
revokedCerts += 1
|
revokedCerts += 1
|
||||||
case line.Flag == "E":
|
case line.Flag == "E":
|
||||||
ovpnClient.AccountStatus = "Expired"
|
ovpnClient.AccountStatus = "Expired"
|
||||||
ovpnClientCertificateExpire.WithLabelValues(line.Identity).Set(float64(parseDateToUnix(indexTxtDateLayout, line.ExpirationDate) - apochNow / 3600 / 24))
|
ovpnClientCertificateExpire.WithLabelValues(line.Identity).Set(float64((parseDateToUnix(indexTxtDateLayout, line.ExpirationDate) - apochNow) / 3600 / 24))
|
||||||
expiredCerts += 1
|
expiredCerts += 1
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -671,7 +671,7 @@ func (oAdmin *OpenvpnAdmin) usersList() []OpenvpnClient {
|
||||||
users = append(users, ovpnClient)
|
users = append(users, ovpnClient)
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
ovpnServerCertExpire.Set(float64(parseDateToUnix(indexTxtDateLayout,line.ExpirationDate) - apochNow / 3600 / 24))
|
ovpnServerCertExpire.Set(float64((parseDateToUnix(indexTxtDateLayout, line.ExpirationDate) - apochNow) / 3600 / 24))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue