|
@@ -943,18 +943,23 @@ func Initialize(additionalConfigWatchers ...ConfigWatchers) {
|
|
|
}
|
|
}
|
|
|
promCli, _ := prometheusClient.NewClient(pc)
|
|
promCli, _ := prometheusClient.NewClient(pc)
|
|
|
|
|
|
|
|
- api := prometheusAPI.NewAPI(promCli)
|
|
|
|
|
- _, err = api.Config(context.Background())
|
|
|
|
|
- if err != nil {
|
|
|
|
|
- klog.Fatalf("No valid prometheus config file at %s. Error: %s . Troubleshooting help available at: %s", address, err.Error(), prometheusTroubleshootingEp)
|
|
|
|
|
- }
|
|
|
|
|
- klog.V(1).Info("Success: retrieved a prometheus config file from: " + address)
|
|
|
|
|
-
|
|
|
|
|
- _, err = ValidatePrometheus(promCli, false)
|
|
|
|
|
- if err != nil {
|
|
|
|
|
- klog.Fatalf("Failed to query prometheus at %s. Error: %s . Troubleshooting help available at: %s", address, err.Error(), prometheusTroubleshootingEp)
|
|
|
|
|
|
|
+ m, err := ValidatePrometheus(promCli, false)
|
|
|
|
|
+ if err != nil || m.Running == false {
|
|
|
|
|
+ if err != nil {
|
|
|
|
|
+ klog.Errorf("Failed to query prometheus at %s. Error: %s . Troubleshooting help available at: %s", address, err.Error(), prometheusTroubleshootingEp)
|
|
|
|
|
+ } else if m.Running == false {
|
|
|
|
|
+ klog.Errorf("Prometheus at %s is not running. Troubleshooting help available at: %s", address, prometheusTroubleshootingEp)
|
|
|
|
|
+ }
|
|
|
|
|
+ api := prometheusAPI.NewAPI(promCli)
|
|
|
|
|
+ _, err = api.Config(context.Background())
|
|
|
|
|
+ if err != nil {
|
|
|
|
|
+ klog.Infof("No valid prometheus config file at %s. Error: %s . Troubleshooting help available at: %s. Ignore if using cortex/thanos here.", address, err.Error(), prometheusTroubleshootingEp)
|
|
|
|
|
+ } else {
|
|
|
|
|
+ klog.V(1).Info("Retrieved a prometheus config file from: " + address)
|
|
|
|
|
+ }
|
|
|
|
|
+ } else {
|
|
|
|
|
+ klog.V(1).Info("Success: retrieved the 'up' query against prometheus at: " + address)
|
|
|
}
|
|
}
|
|
|
- klog.V(1).Info("Success: retrieved the 'up' query against prometheus at: " + address)
|
|
|
|
|
|
|
|
|
|
// Kubernetes API setup
|
|
// Kubernetes API setup
|
|
|
kc, err := rest.InClusterConfig()
|
|
kc, err := rest.InClusterConfig()
|