Skip to content

Commit

Permalink
add schema access option and update readme
Browse files Browse the repository at this point in the history
  • Loading branch information
Alex Orfanos committed Feb 4, 2021
1 parent 4f5d6ff commit 123f2ce
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ Host/port are by default `localhost:8880`, you can change the configuration by u
Usage of ./vmalertcli:
-action="groups": VMAlert action to take {groups|alerts|metrics|reload}
-host="localhost": Host where VMAlert responds
-schema="http": Schema to use when accessing VMAlert
-port=8880: VMAlert port
-pretty=false: Pretty print {false|true}
```
Expand All @@ -26,7 +27,7 @@ Put binary in $PATH (release will be updated).

View alert groups:
```
vmalertcli -action groups -pretty
vmalertcli -schema http -action groups -pretty
```

View VMAlert metrics:
Expand Down
5 changes: 4 additions & 1 deletion main.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import (

var (
vmalertHost = flag.String("host", "localhost", "Host where VMAlert responds")
vmalertSchema = flag.String("schema", "http", "Use http|https")
vmalertPort = flag.Int("port", 8880, "VMAlert port")
vmalertAction = flag.String("action", "groups", "VMAlert action to take {groups|alerts|metrics|reload|status <groupName> <alertId>}")
prettyPrint = flag.Bool("pretty", false, "Pretty print {false|true}")
Expand All @@ -39,7 +40,9 @@ func getJsonData(apiBase string, apiEndpoint string) []byte {
func main() {
host := *vmalertHost
action := *vmalertAction
vmalertBase := "http://" + host + ":" + strconv.Itoa(*vmalertPort)
schema := *vmalertSchema

vmalertBase := schema + "://" + host + ":" + strconv.Itoa(*vmalertPort)

switch takeAction := action; takeAction {
case "groups":
Expand Down

0 comments on commit 123f2ce

Please sign in to comment.