diff --git a/app/vmagent/main.go b/app/vmagent/main.go
index 8d33df888..22be00942 100644
--- a/app/vmagent/main.go
+++ b/app/vmagent/main.go
@@ -148,7 +148,15 @@ func requestHandler(w http.ResponseWriter, r *http.Request) bool {
if r.Method != "GET" {
return false
}
- fmt.Fprintf(w, "vmagent - see docs at https://docs.victoriametrics.com/vmagent.html")
+ fmt.Fprintf(w, "
vmagent
")
+ fmt.Fprintf(w, "See docs at https://docs.victoriametrics.com/vmagent.html")
+ fmt.Fprintf(w, "Useful endpoints:")
+ httpserver.WriteAPIHelp(w, [][2]string{
+ {"/targets", "discovered targets list"},
+ {"/api/v1/targets", "advanced information about discovered targets in JSON format"},
+ {"/metrics", "available service metrics"},
+ {"/-/reload", "reload configuration"},
+ })
return true
}
path := strings.Replace(r.URL.Path, "//", "/", -1)
diff --git a/app/vmalert/web.go b/app/vmalert/web.go
index 8fc71359e..51ff476a7 100644
--- a/app/vmalert/web.go
+++ b/app/vmalert/web.go
@@ -17,25 +17,19 @@ type requestHandler struct {
m *manager
}
-var pathList = [][]string{
- {"/api/v1/groups", "list all loaded groups and rules"},
- {"/api/v1/alerts", "list all active alerts"},
- {"/api/v1/groupID/alertID/status", "get alert status by ID"},
- // /metrics is served by httpserver by default
- {"/metrics", "list of application metrics"},
- {"/-/reload", "reload configuration"},
-}
-
func (rh *requestHandler) handler(w http.ResponseWriter, r *http.Request) bool {
switch r.URL.Path {
case "/":
if r.Method != "GET" {
return false
}
- for _, path := range pathList {
- p, doc := path[0], path[1]
- fmt.Fprintf(w, "%q - %s
", p, p, doc)
- }
+ httpserver.WriteAPIHelp(w, [][2]string{
+ {"/api/v1/groups", "list all loaded groups and rules"},
+ {"/api/v1/alerts", "list all active alerts"},
+ {"/api/v1/groupID/alertID/status", "get alert status by ID"},
+ {"/metrics", "list of application metrics"},
+ {"/-/reload", "reload configuration"},
+ })
return true
case "/api/v1/groups":
data, err := rh.listGroups()
diff --git a/docs/CHANGELOG.md b/docs/CHANGELOG.md
index 5c0270c62..b1603ead8 100644
--- a/docs/CHANGELOG.md
+++ b/docs/CHANGELOG.md
@@ -10,6 +10,7 @@ sort: 15
* FEATURE: add OpenTSDB migration option to vmctl. See more details [here](https://docs.victoriametrics.com/vmctl#migrating-data-from-opentsdb).
Thanks to @johnseekins!
* FEATURE: improved new time series registration speed on systems with many CPU cores. See [this issue](https://github.com/VictoriaMetrics/VictoriaMetrics/issues/1244). Thanks to @waldoweng for the idea and [draft implementation](https://github.com/VictoriaMetrics/VictoriaMetrics/pull/1243).
+* FEATURE: vmagent: list user-visible endpoints at `http://vmagent:8429/`. See [this issue](https://github.com/VictoriaMetrics/VictoriaMetrics/issues/1251).
* BUGFIX: vmagent: properly update `role: endpoints` and `role: endpointslices` scrape targets if the underlying service changes in `kubernetes_sd_config`. See [this issue](https://github.com/VictoriaMetrics/VictoriaMetrics/issues/1240).
* BUGFIX: vmagent: apply `scrape_timeout` on receiving the first response byte from `stream_parse: true` scrape targets. Previously it was applied to receiving and *processing* the full response stream. This could result in false timeout errors when scrape target exposes millions of metrics as described [here](https://github.com/VictoriaMetrics/VictoriaMetrics/issues/1017#issuecomment-767235047).
diff --git a/lib/httpserver/httpserver.go b/lib/httpserver/httpserver.go
index 616da6c22..4bcdf21a3 100644
--- a/lib/httpserver/httpserver.go
+++ b/lib/httpserver/httpserver.go
@@ -11,6 +11,7 @@ import (
"net"
"net/http"
"net/http/pprof"
+ "path"
"runtime"
"strconv"
"strings"
@@ -559,3 +560,12 @@ func IsTLS() bool {
func GetPathPrefix() string {
return *pathPrefix
}
+
+// WriteAPIHelp writes pathList to w in HTML format.
+func WriteAPIHelp(w io.Writer, pathList [][2]string) {
+ for _, p := range pathList {
+ p, doc := p[0], p[1]
+ p = path.Join(*pathPrefix, p)
+ fmt.Fprintf(w, "%s - %s
", p, p, doc)
+ }
+}