1
0
mirror of https://github.com/divan/expvarmon.git synced 2025-04-29 13:49:19 +08:00

Import of termui fixed

This commit is contained in:
Ivan Daniluk 2015-05-03 19:46:36 +03:00
parent f2dba40e41
commit 877c0f6f2e
3 changed files with 11 additions and 6 deletions

13
main.go
View File

@ -6,15 +6,15 @@ import (
"sync" "sync"
"time" "time"
"github.com/divan/termui" "github.com/gizak/termui"
) )
var ( var (
interval = flag.Duration("i", 5*time.Second, "Polling interval") interval = flag.Duration("i", 5*time.Second, "Polling interval")
portsArg = flag.String("ports", "1234", "Ports for accessing services expvars (comma-separated)") portsArg = flag.String("ports", "", "Ports for accessing services expvars (comma-separated)")
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)") 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") dummy = flag.Bool("dummy", false, "Use dummy (console) output")
bind = flag.String("expvar", "1234", "Port to listen to be able monitor itself") self = flag.Bool("self", false, "Monitor itself?")
) )
func main() { func main() {
@ -29,7 +29,12 @@ func main() {
log.Fatal(err) log.Fatal(err)
} }
go StartHttp(*bind) if *self {
port, err := StartSelfMonitor()
if err == nil {
ports = append(ports, port)
}
}
data := NewUIData(vars) data := NewUIData(vars)
for _, port := range ports { for _, port := range ports {

View File

@ -4,7 +4,7 @@ import (
"fmt" "fmt"
"time" "time"
"github.com/divan/termui" "github.com/gizak/termui"
) )
// TermUI is a termUI implementation of UI interface. // TermUI is a termUI implementation of UI interface.

View File

@ -4,7 +4,7 @@ import (
"fmt" "fmt"
"time" "time"
"github.com/divan/termui" "github.com/gizak/termui"
) )
// TermUISingle is a termUI implementation of UI interface. // TermUISingle is a termUI implementation of UI interface.