Interval display added

This commit is contained in:
Ivan Daniluk 2015-05-02 22:54:00 +03:00
parent 1118a04707
commit bef7cb57db
3 changed files with 4 additions and 4 deletions

View File

@ -11,8 +11,8 @@ import (
var (
interval = flag.Duration("i", 5*time.Second, "Polling interval")
portsArg = flag.String("ports", "1234", "Ports for accessing services expvars")
varsArg = flag.String("vars", "mem:memstats.Alloc,mem:memstats.Sys", "Default vars to monitor")
portsArg = flag.String("ports", "1234", "Ports for accessing services expvars (comma-separated)")
varsArg = flag.String("vars", "mem:memstats.Alloc,mem:memstats.Sys", "Vars to monitor (comma-separated)")
dummy = flag.Bool("dummy", false, "Use dummy (console) output")
)

2
ui.go
View File

@ -122,7 +122,7 @@ func (t *TermUI) Init(data UIData) error {
// Update updates UI widgets from UIData.
func (t *TermUI) Update(data UIData) {
t.Title.Text = fmt.Sprintf("monitoring %d services, press q to quit", len(data.Services))
t.Title.Text = fmt.Sprintf("monitoring %d services every %v, press q to quit", len(data.Services), *interval)
t.Status.Text = fmt.Sprintf("Last update: %v", data.LastTimestamp.Format("15:04:05 02/Jan/06"))
// List with service names

View File

@ -77,7 +77,7 @@ func (t *TermUISingle) Update(data UIData) {
// single mode assumes we have one service only to monitor
service := data.Services[0]
t.Title.Text = fmt.Sprintf("monitoring %s, press q to quit", service.Name)
t.Title.Text = fmt.Sprintf("monitoring %s every %v, press q to quit", service.Name, *interval)
t.Status.Text = fmt.Sprintf("Last update: %v", data.LastTimestamp.Format("15:04:05 02/Jan/06"))
// Sparklines