diff --git a/README.md b/README.md index 6d1a353..69e23b4 100644 --- a/README.md +++ b/README.md @@ -12,6 +12,7 @@ Go apps console monitoring tool. Minimal configuration efforts. Quick and easy m * Single- and multi-apps mode * Local and remote apps support +* HTTP and HTTPS endpoints, including Basic Auth support * Arbitrary number of apps and vars to monitor (from 1 to 30+, depends on size of your terminal) * Track restarted/failed apps * Show maximum value @@ -72,32 +73,42 @@ That's it. More examples: ./expvarmon -ports="80" - ./expvarmon -ports="23000-23010,80" -i=1m + ./expvarmon -ports="23000-23010,http://example.com:80-81" -i=1m ./expvarmon -ports="80,remoteapp:80" -vars="mem:memstats.Alloc,duration:Response.Mean,Counter" ./expvarmon -ports="1234-1236" -vars="Goroutines" -self + ./expvarmon -ports="https://user:pass@my.remote.app.com:443" -vars="Goroutines" -self ## Advanced usage If you need to monitor more (or less) vars, you can specify them with -vars command line flag. $ expvarmon -help - Usage of ./expvarmon: - -dummy=false: Use dummy (console) output - -i=5s: Polling interval - -ports="": Ports for accessing services expvars (start-end,port2,port3) - -self=false: Monitor itself - -vars="mem:memstats.Alloc,mem:memstats.Sys,mem:memstats.HeapAlloc,mem:memstats.HeapInuse,memstats.EnableGC,memstats.NumGC,duration:memstats.PauseTotalNs": Vars to monitor (comma-separated) - Examples: - ./expvarmon -ports="80" - ./expvarmon -ports="23000-23010,80" -i=1m - ./expvarmon -ports="80,remoteapp:80" -vars="mem:memstats.Alloc,duration:Response.Mean,Counter" - ./expvarmon -ports="1234-1236" -vars="Goroutines" -self - For more details and docs, see README: http://github.com/divan/expvarmon + Usage of ./expvarmon: + -dummy=false: Use dummy (console) output + -i=5s: Polling interval + -ports="": Ports/URLs for accessing services expvars (start-end,port2,port3,https://host:port) + -self=false: Monitor itself + -vars="mem:memstats.Alloc,mem:memstats.Sys,mem:memstats.HeapAlloc,mem:memstats.HeapInuse,memstats.EnableGC,memstats.NumGC,duration:memstats.PauseTotalNs": Vars to monitor (comma-separated) -So, yes, you can specify multiple ports, using '-' for ranges, and specify host(s) for remote apps. + Examples: + ./expvarmon -ports="80" + ./expvarmon -ports="23000-23010,http://example.com:80-81" -i=1m + ./expvarmon -ports="80,remoteapp:80" -vars="mem:memstats.Alloc,duration:Response.Mean,Counter" + ./expvarmon -ports="1234-1236" -vars="Goroutines" -self + + For more details and docs, see README: http://github.com/divan/expvarmon + +So, yes, you can specify multiple ports, using '-' for ranges, and specify fully-qualified URLs for remote apps. You can also monitor expvarmon itself, using -self flag. +### Basic Auth + +If your expvar endpoint is protected by Basic Auth, you have two options: + + - Set environmental variables *HTTP_USER* and *HTTP_PASSWORD* accordingly. These values will be applied to each endpoint. + - Embed your credentials to URL via command line flag: `-ports="http://user:pass@myapp:1234"` + ### Vars Expvarmon doesn't restrict you to monitor only memstats. You can publish your own counters and variables using [expvar.Publish()](http://golang.org/pkg/expvar/#Publish) method or using expvar wrappers libraries. Just pass your variables names as they appear in JSON to -var command line flag. @@ -113,9 +124,3 @@ Vars are specified as a comma-separated list of var identifiers with (optional) | mem: | renders int64 as memory string (KB, MB, etc) | | duration: | renders int64 as time.Duration (1s, 2ms, 12h23h) | | str: | doesn't display sparklines chart for this value, just display as string | - -## TODO - -* ports auto-discovery for given hostname -* more tests coverage -* better usage of color highlighting (for max values or failed apps), after relevant patches will be merged to TermUI diff --git a/main.go b/main.go index e36ba61..3296ff4 100644 --- a/main.go +++ b/main.go @@ -13,7 +13,7 @@ import ( var ( interval = flag.Duration("i", 5*time.Second, "Polling interval") - urls = flag.String("ports", "", "Ports for accessing services expvars (start-end,port2,port3)") + urls = flag.String("ports", "", "Ports/URLs for accessing services expvars (start-end,port2,port3,https://host:port)") varsArg = flag.String("vars", "mem:memstats.Alloc,mem:memstats.Sys,mem:memstats.HeapAlloc,mem:memstats.HeapInuse,memstats.EnableGC,memstats.NumGC,duration:memstats.PauseTotalNs", "Vars to monitor (comma-separated)") dummy = flag.Bool("dummy", false, "Use dummy (console) output") self = flag.Bool("self", false, "Monitor itself") @@ -112,7 +112,7 @@ func Usage() { fmt.Fprintf(os.Stderr, ` Examples: %s -ports="80" - %s -ports="23000-23010,80" -i=1m + %s -ports="23000-23010,http://example.com:80-81" -i=1m %s -ports="80,remoteapp:80" -vars="mem:memstats.Alloc,duration:Response.Mean,Counter" %s -ports="1234-1236" -vars="Goroutines" -self