tools

package
v0.0.0-...-3bd56f2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 16, 2017 License: Apache-2.0 Imports: 21 Imported by: 0

Documentation

Index

Constants

View Source
const (
	MQTT_START_TOPIC        = "/lorhammer"
	MQTT_INIT_TOPIC         = "/lorhammer/all"
	MQTT_ORCHESTRATOR_TOPIC = "/lorhammer/orchestrator"
)

Variables

View Source
var LOG_GRAFANA = logrus.WithField("logger", "tools/grafana")

Functions

func DetectIp

func DetectIp(localIp string) (string, error)

func FreeTcpPort

func FreeTcpPort() (int, error)

func Hostname

func Hostname(ip string, port int) (string, error)

func Random

func Random(min, max int) int

* Deprecated use Random64 instead

func Random64

func Random64(min, max int64) int64

func RandomBytes

func RandomBytes(nb int) []byte

func RandomDuration

func RandomDuration(min, max time.Duration) time.Duration

Types

type Consul

type Consul interface {
	GetAddress() string
	Register(ip string, hostname string, httpPort int) error
	ServiceFirst(name string, prefix string) (string, error)
	DeRegister(string) error
	AllServices() ([]ConsulService, error)
}

func NewConsul

func NewConsul(consulAddress string) (Consul, error)

type ConsulService

type ConsulService struct {
	ServiceID   string
	ServiceName string
}

type GrafanaClient

type GrafanaClient struct {
	// contains filtered or unexported fields
}

func NewGrafana

func NewGrafana(consulClient Consul) (*GrafanaClient, error)

func (*GrafanaClient) MakeSnapshot

func (grafana *GrafanaClient) MakeSnapshot(startTime time.Time, endTime time.Time) (string, error)

type Mqtt

type Mqtt interface {
	Connect() error
	HandleCmd(topics []string, handle func(cmd model.CMD)) error
	PublishCmd(topic string, cmdName model.CommandName) error
	PublishSubCmd(topic string, cmdName model.CommandName, subCmd interface{}) error
}

func NewMqtt

func NewMqtt(hostname string, consulClient Consul) (Mqtt, error)

type Prometheus

type Prometheus interface {
	StartTimer() func()
	AddGateway(nb int)
	SubGateway(nb int)
	AddNodes(nb int)
	SubNodes(nb int)
	AddLongRequest(nb int)
}

func NewPrometheus

func NewPrometheus() Prometheus

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL