}
module, ok := c.Modules[moduleName]
if !ok {
- http.Error(w, fmt.Sprintf("Unknown module %q", moduleName), 400)
+ http.Error(w, fmt.Sprintf("Unknown module %q", moduleName), http.StatusBadRequest)
return
}
timeoutSeconds = module.Timeout.Seconds()
}
timeoutSeconds -= *timeoutOffset
- ctx, cancel := context.WithTimeout(context.Background(), time.Duration(timeoutSeconds*1e9))
+ ctx, cancel := context.WithTimeout(context.Background(), time.Duration(timeoutSeconds*float64(time.Second)))
defer cancel()
r = r.WithContext(ctx)
params := r.URL.Query()
target := params.Get("target")
if target == "" {
- http.Error(w, "Target parameter is missing", 400)
+ http.Error(w, "Target parameter is missing", http.StatusBadRequest)
return
}
prober, ok := Probers[module.Prober]
if !ok {
- http.Error(w, fmt.Sprintf("Unknown prober %q", module.Prober), 400)
+ http.Error(w, fmt.Sprintf("Unknown prober %q", module.Prober), http.StatusBadRequest)
return
}
if resp.TLS != nil {
isSSLGauge.Set(float64(1))
registry.MustRegister(probeSSLEarliestCertExpiryGauge)
- probeSSLEarliestCertExpiryGauge.Set(float64(getEarliestCertExpiry(resp.TLS).UnixNano() / 1e9))
+ probeSSLEarliestCertExpiryGauge.Set(float64(getEarliestCertExpiry(resp.TLS).Unix()))
if httpConfig.FailIfSSL {
level.Error(logger).Log("msg", "Final request was over SSL")
success = false
if module.TCP.TLS {
state := conn.(*tls.Conn).ConnectionState()
registry.MustRegister(probeSSLEarliestCertExpiry)
- probeSSLEarliestCertExpiry.Set(float64(getEarliestCertExpiry(&state).UnixNano()) / 1e9)
+ probeSSLEarliestCertExpiry.Set(float64(getEarliestCertExpiry(&state).Unix()))
}
scanner := bufio.NewScanner(conn)
for i, qr := range module.TCP.QueryResponse {
// Get certificate expiry.
state := tlsConn.ConnectionState()
registry.MustRegister(probeSSLEarliestCertExpiry)
- probeSSLEarliestCertExpiry.Set(float64(getEarliestCertExpiry(&state).UnixNano()) / 1e9)
+ probeSSLEarliestCertExpiry.Set(float64(getEarliestCertExpiry(&state).Unix()))
}
}
return true