Skip to content

Commit ecddfc7

Browse files
updated docs
1 parent 01ddff7 commit ecddfc7

File tree

2 files changed

+19
-4
lines changed

2 files changed

+19
-4
lines changed

app/vlselect/main.go

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -217,6 +217,17 @@ func decRequestConcurrency() {
217217
func processSelectRequest(ctx context.Context, w http.ResponseWriter, r *http.Request, path string) bool {
218218
httpserver.EnableCORS(w, r)
219219
startTime := time.Now()
220+
if strings.HasPrefix(path, "/select/vmalert/") {
221+
vmalertRequests.Inc()
222+
if len(*vmalertProxyURL) == 0 {
223+
w.WriteHeader(http.StatusBadRequest)
224+
w.Header().Set("Content-Type", "application/json")
225+
fmt.Fprintf(w, "%s", `{"status":"error","msg":"for accessing vmalert flag '-vmalert.proxyURL' must be configured"}`)
226+
return true
227+
}
228+
proxyVMAlertRequests(w, r)
229+
return true
230+
}
220231
switch path {
221232
case "/select/logsql/facets":
222233
logsqlFacetsRequests.Inc()
@@ -332,6 +343,7 @@ func proxyVMAlertRequests(w http.ResponseWriter, r *http.Request) {
332343
// Forward other panics to the caller.
333344
panic(err)
334345
}()
346+
r.URL.Path = strings.TrimPrefix(r.URL.Path, "/select")
335347
r.Host = vmalertProxyHost
336348
vmalertProxy.ServeHTTP(w, r)
337349
}
@@ -394,4 +406,5 @@ var (
394406
rulesRequests = metrics.NewCounter(`vl_http_requests_total{path="/select/api/v1/rules"}`)
395407
alertsRequests = metrics.NewCounter(`vl_http_requests_total{path="/select/api/v1/alerts"}`)
396408
notifiersRequests = metrics.NewCounter(`vl_http_requests_total{path="/select/api/v1/notifiers"}`)
409+
vmalertRequests = metrics.NewCounter(`vm_http_requests_total{path="/select/vmalert"}`)
397410
)

docs/victorialogs/README.md

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -263,13 +263,15 @@ cloud provider, or third-party tools. Note that the snapshot must be **consisten
263263

264264
## vmalert
265265

266-
VictoriaLogs is capable of proxying requests to [vmalert](https://docs.victoriametrics.com/victoriametrics/vmalert/)
266+
VictoriaLogs is capable of proxying requests to [VMAlert](https://docs.victoriametrics.com/victoriametrics/vmalert/)
267267
when `-vmalert.proxyURL` flag is set. Use this feature for the following cases:
268268
* for proxying requests from [Grafana Alerting UI](https://grafana.com/docs/grafana/latest/alerting/);
269-
* for accessing vmalerts UI through VictoriaLogs Web interface.
269+
* for accessing VMAlert API through VictoriaLogs Web interface.
270270

271-
For accessing vmalerts UI through VictoriaLogs configure `-vmalert.proxyURL` flag and visit
272-
`http://<victorialogs-addr>:9428/vmalert/` link.
271+
For accessing VMAlert API through VictoriaLogs configure `-vmalert.proxyURL` flag. List of proxied VMAlert endpoints:
272+
- `http://<victorialogs-addr>:9428/select/api/v1/alerts` - lists all alerts
273+
- `http://<victorialogs-addr>:9428/select/api/v1/rules` - lists groups of alerting and recording rules
274+
- `http://<victorialogs-addr>:9428/select/api/v1/notifiers` - lists VMAlert notifiers
273275

274276
## Multitenancy
275277

0 commit comments

Comments
 (0)