diff --git a/main.go b/main.go index 5dc08e1..1e6686d 100644 --- a/main.go +++ b/main.go @@ -9,6 +9,7 @@ import ( "log" "net/http" "os" + "regexp" "strconv" "time" @@ -491,6 +492,17 @@ func (e *Exporter) getDatastoreMetric(datastore Datastore, ch chan<- prometheus. // check if status code is 200 if resp.StatusCode != 200 { + if resp.StatusCode == 400 { + // check if datastore is being deleted + isBeingDeleted, err := regexp.MatchString("(?i)datastore is being deleted", string(body[:])) + if err != nil { + return err + } + if isBeingDeleted { + log.Printf("INFO: Datastore: %s is being deleted, Skip scrape datastore metric", datastore.Store) + return nil + } + } return fmt.Errorf("ERROR: --Status code %d returned from endpoint: %s", resp.StatusCode, e.endpoint) }