sysdb

package
v0.0.0-...-8d51551 Latest Latest
Warning

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

Go to latest
Published: Jan 26, 2016 License: BSD-2-Clause Imports: 2 Imported by: 2

Documentation

Overview

Package sysdb declares core constants and types used by SysDB packages.

Index

Constants

View Source
const (
	LogEmerg   = LogPriority(0)
	LogErr     = LogPriority(3)
	LogWarning = LogPriority(4)
	LogNotice  = LogPriority(5)
	LogInfo    = LogPriority(6)
	LogDebug   = LogPriority(7)
)

Log priorities supported by SysDB.

View Source
const (
	Second = Duration(1000000000)
	Minute = 60 * Second
	Hour   = 60 * Minute
	Day    = 24 * Hour
	Month  = Duration(30436875 * 24 * 60 * 60 * 1000)
	Year   = Duration(3652425 * 24 * 60 * 60 * 100000)
)

Common durations. All values greater than or equal to a day are not exact values but subject to daylight savings time changes, leap years, etc. They are available mostly for providing human readable display formats.

Variables

This section is empty.

Functions

This section is empty.

Types

type Attribute

type Attribute struct {
	Name           string   `json:"name"`
	Value          string   `json:"value"`
	LastUpdate     Time     `json:"last_update"`
	UpdateInterval Duration `json:"update_interval"`
	Backends       []string `json:"backends"`
}

An Attribute describes a host, metric, or service attribute.

type DataPoint

type DataPoint struct {
	Timestamp Time    `json:"timestamp"`
	Value     float64 `json:"value,string"`
}

A DataPoint describes a datum at a certain point of time.

type Duration

type Duration time.Duration

A Duration represents the elapsed time between two instants as a nanoseconds count.

It supports marshaling to and unmarshaling from the SysDB JSON format (a sequence of decimal numbers with a unit suffix).

func (Duration) MarshalJSON

func (d Duration) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaler interface. The duration is a quoted string in the SysDB JSON format.

func (Duration) String

func (d Duration) String() string

String returns the duration formatted using a predefined format string.

func (*Duration) UnmarshalJSON

func (d *Duration) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaler interface. The duration is expected to be a quoted string in the SysDB JSON format.

type Host

type Host struct {
	Name           string      `json:"name"`
	LastUpdate     Time        `json:"last_update"`
	UpdateInterval Duration    `json:"update_interval"`
	Backends       []string    `json:"backends"`
	Attributes     []Attribute `json:"attributes"`
	Metrics        []Metric    `json:"metrics"`
	Services       []Service   `json:"services"`
}

A Host describes a host object stored in the SysDB store.

type LogPriority

type LogPriority int

The LogPriority describes the priority of a log message.

type Metric

type Metric struct {
	Name           string      `json:"name"`
	Timeseries     bool        `json:"timeseries"`
	LastUpdate     Time        `json:"last_update"`
	UpdateInterval Duration    `json:"update_interval"`
	Backends       []string    `json:"backends"`
	Attributes     []Attribute `json:"attributes"`
}

A Metric describes a metric known to SysDB.

type Service

type Service struct {
	Name           string      `json:"name"`
	LastUpdate     Time        `json:"last_update"`
	UpdateInterval Duration    `json:"update_interval"`
	Backends       []string    `json:"backends"`
	Attributes     []Attribute `json:"attributes"`
}

A Service describes a service object stored in the SysDB store.

type Time

type Time time.Time

A Time represents an instant in time with nanosecond precision.

It supports marshaling to and unmarshaling from the SysDB JSON format (YYYY-MM-DD hh:mm:ss +-zzzz).

func (Time) Equal

func (t Time) Equal(u Time) bool

Equal reports whether t and u represent the same time instant.

func (Time) MarshalJSON

func (t Time) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaler interface. The time is a quoted string in the SysDB JSON format.

func (Time) String

func (t Time) String() string

String returns the time formatted using a predefined format string.

func (*Time) UnmarshalJSON

func (t *Time) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaler interface. The time is expected to be a quoted string in the SysDB JSON format.

type Timeseries

type Timeseries struct {
	Start Time                   `json:"start"`
	End   Time                   `json:"end"`
	Data  map[string][]DataPoint `json:"data"`
}

A Timeseries describes a sequence of data-points.

Jump to

Keyboard shortcuts

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