chronograf

package
v2.0.7 Latest Latest
Warning

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

Go to latest
Published: Jun 4, 2021 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ErrUpstreamTimeout                 = Error("request to backend timed out")
	ErrSourceNotFound                  = Error("source not found")
	ErrServerNotFound                  = Error("server not found")
	ErrLayoutNotFound                  = Error("layout not found")
	ErrDashboardNotFound               = Error("dashboard not found")
	ErrUserNotFound                    = Error("user not found")
	ErrLayoutInvalid                   = Error("layout is invalid")
	ErrDashboardInvalid                = Error("dashboard is invalid")
	ErrSourceInvalid                   = Error("source is invalid")
	ErrServerInvalid                   = Error("server is invalid")
	ErrAlertNotFound                   = Error("alert not found")
	ErrAuthentication                  = Error("user not authenticated")
	ErrUninitialized                   = Error("client uninitialized. Call Open() method")
	ErrInvalidAxis                     = Error("Unexpected axis in cell. Valid axes are 'x', 'y', and 'y2'")
	ErrInvalidColorType                = Error("Invalid color type. Valid color types are 'min', 'max', 'threshold', 'text', and 'background'")
	ErrInvalidColor                    = Error("Invalid color. Accepted color format is #RRGGBB")
	ErrInvalidLegend                   = Error("Invalid legend. Both type and orientation must be set")
	ErrInvalidLegendType               = Error("Invalid legend type. Valid legend type is 'static'")
	ErrInvalidLegendOrient             = Error("Invalid orientation type. Valid orientation types are 'top', 'bottom', 'right', 'left'")
	ErrUserAlreadyExists               = Error("user already exists")
	ErrOrganizationNotFound            = Error("organization not found")
	ErrMappingNotFound                 = Error("mapping not found")
	ErrOrganizationAlreadyExists       = Error("organization already exists")
	ErrCannotDeleteDefaultOrganization = Error("cannot delete default organization")
	ErrConfigNotFound                  = Error("cannot find configuration")
	ErrAnnotationNotFound              = Error("annotation not found")
	ErrInvalidCellOptionsText          = Error("invalid text wrapping option. Valid wrappings are 'truncate', 'wrap', and 'single line'")
	ErrInvalidCellOptionsSort          = Error("cell options sortby cannot be empty'")
	ErrInvalidCellOptionsColumns       = Error("cell options columns cannot be empty'")
	ErrOrganizationConfigNotFound      = Error("could not find organization config")
)

General errors.

View Source
const (
	// InfluxDB is the open-source time-series database
	InfluxDB = "influx"
	// InfluxEnteprise is the clustered HA time-series database
	InfluxEnterprise = "influx-enterprise"
	// InfluxRelay is the basic HA layer over InfluxDB
	InfluxRelay = "influx-relay"
)

Supported time-series databases

View Source
const MappingWildcard string = "*"

MappingWildcard is the wildcard value for mappings

Variables

This section is empty.

Functions

This section is empty.

Types

type AlertNodes

type AlertNodes struct {
	IsStateChangesOnly bool         `json:"stateChangesOnly"` // IsStateChangesOnly will only send alerts on state changes.
	UseFlapping        bool         `json:"useFlapping"`      // UseFlapping enables flapping detection. Flapping occurs when a service or host changes state too frequently, resulting in a storm of problem and recovery notification
	Posts              []*Post      `json:"post"`             // HTTPPost  will post the JSON alert data to the specified URLs.
	TCPs               []*TCP       `json:"tcp"`              // TCP  will send the JSON alert data to the specified endpoint via TCP.
	Email              []*Email     `json:"email"`            // Email  will send alert data to the specified emails.
	Exec               []*Exec      `json:"exec"`             // Exec  will run shell commands when an alert triggers
	Log                []*Log       `json:"log"`              // Log  will log JSON alert data to files in JSON lines format.
	VictorOps          []*VictorOps `json:"victorOps"`        // VictorOps  will send alert to all VictorOps
	PagerDuty          []*PagerDuty `json:"pagerDuty"`        // PagerDuty  will send alert to all PagerDuty
	PagerDuty2         []*PagerDuty `json:"pagerDuty2"`       // PagerDuty2  will send alert to  PagerDuty v2
	Pushover           []*Pushover  `json:"pushover"`         // Pushover  will send alert to all Pushover
	Sensu              []*Sensu     `json:"sensu"`            // Sensu  will send alert to all Sensu
	Slack              []*Slack     `json:"slack"`            // Slack  will send alert to Slack
	Telegram           []*Telegram  `json:"telegram"`         // Telegram  will send alert to all Telegram
	HipChat            []*HipChat   `json:"hipChat"`          // HipChat  will send alert to all HipChat
	Alerta             []*Alerta    `json:"alerta"`           // Alerta  will send alert to all Alerta
	OpsGenie           []*OpsGenie  `json:"opsGenie"`         // OpsGenie  will send alert to all OpsGenie
	OpsGenie2          []*OpsGenie  `json:"opsGenie2"`        // OpsGenie2  will send alert to all OpsGenie v2
	Talk               []*Talk      `json:"talk"`             // Talk will send alert to all Talk
	Kafka              []*Kafka     `json:"kafka"`            // Kafka will send alert to all Kafka
}

AlertNodes defines all possible kapacitor interactions with an alert.

func (*AlertNodes) MarshalJSON

func (n *AlertNodes) MarshalJSON() ([]byte, error)

MarshalJSON converts AlertNodes to JSON

type AlertRule

type AlertRule struct {
	ID            string        `json:"id,omitempty"`           // ID is the unique ID of the alert
	TICKScript    TICKScript    `json:"tickscript"`             // TICKScript is the raw tickscript associated with this Alert
	Query         *QueryConfig  `json:"query"`                  // Query is the filter of data for the alert.
	Every         string        `json:"every"`                  // Every how often to check for the alerting criteria
	AlertNodes    AlertNodes    `json:"alertNodes"`             // AlertNodes defines the destinations for the alert
	Message       string        `json:"message"`                // Message included with alert
	Details       string        `json:"details"`                // Details is generally used for the Email alert.  If empty will not be added.
	Trigger       string        `json:"trigger"`                // Trigger is a type that defines when to trigger the alert
	TriggerValues TriggerValues `json:"values"`                 // Defines the values that cause the alert to trigger
	Name          string        `json:"name"`                   // Name is the user-defined name for the alert
	Type          string        `json:"type"`                   // Represents the task type where stream is data streamed to kapacitor and batch is queried by kapacitor
	DBRPs         []DBRP        `json:"dbrps"`                  // List of database retention policy pairs the task is allowed to access
	Status        string        `json:"status"`                 // Represents if this rule is enabled or disabled in kapacitor
	Executing     bool          `json:"executing"`              // Whether the task is currently executing
	Error         string        `json:"error"`                  // Any error encountered when kapacitor executes the task
	Created       time.Time     `json:"created"`                // Date the task was first created
	Modified      time.Time     `json:"modified"`               // Date the task was last modified
	LastEnabled   time.Time     `json:"last-enabled,omitempty"` // Date the task was last set to status enabled
}

AlertRule represents rules for building a tickscript alerting task

type Alerta

type Alerta struct {
	Token       string   `json:"token"`       // Token is the authentication token that overrides the global configuration.
	Resource    string   `json:"resource"`    // Resource under alarm, deliberately not host-centric
	Event       string   `json:"event"`       // Event is the event name eg. NodeDown, QUEUE:LENGTH:EXCEEDED
	Environment string   `json:"environment"` // Environment is the effected environment; used to namespace the resource
	Group       string   `json:"group"`       // Group is an event group used to group events of similar type
	Value       string   `json:"value"`       // Value is the event value eg. 100%, Down, PingFail, 55ms, ORA-1664
	Origin      string   `json:"origin"`      // Origin is the name of monitoring component that generated the alert
	Service     []string `json:"service"`     // Service is the list of affected services
}

Alerta sends the output of the alert to an alerta service

type Allowances

type Allowances []string

Allowances defines what actions a user can have on a scoped permission

type Annotation

type Annotation struct {
	ID        string    // ID is the unique annotation identifier
	StartTime time.Time // StartTime starts the annotation
	EndTime   time.Time // EndTime ends the annotation
	Text      string    // Text is the associated user-facing text describing the annotation
	Type      string    // Type describes the kind of annotation
}

Annotation represents a time-based metadata associated with a source

type AnnotationStore

type AnnotationStore interface {
	All(ctx context.Context, start, stop time.Time) ([]Annotation, error) // All lists all Annotations between start and stop
	Add(context.Context, *Annotation) (*Annotation, error)                // Add creates a new annotation in the store
	Delete(ctx context.Context, id string) error                          // Delete removes the annotation from the store
	Get(ctx context.Context, id string) (*Annotation, error)              // Get retrieves an annotation
	Update(context.Context, *Annotation) error                            // Update replaces annotation
}

AnnotationStore represents storage and retrieval of annotations

type Assets

type Assets interface {
	Handler() http.Handler
}

Assets returns a handler to serve the website.

type AuthConfig

type AuthConfig struct {
	// SuperAdminNewUsers configuration option that specifies which users will auto become super admin
	SuperAdminNewUsers bool `json:"superAdminNewUsers"`
}

AuthConfig is the global application config section for auth parameters

type Axis

type Axis struct {
	Bounds       []string `json:"bounds"` // bounds are an arbitrary list of client-defined strings that specify the viewport for a cell
	LegacyBounds [2]int64 `json:"-"`      // legacy bounds are for testing a migration from an earlier version of axis
	Label        string   `json:"label"`  // label is a description of this Axis
	Prefix       string   `json:"prefix"` // Prefix represents a label prefix for formatting axis values
	Suffix       string   `json:"suffix"` // Suffix represents a label suffix for formatting axis values
	Base         string   `json:"base"`   // Base represents the radix for formatting axis values
	Scale        string   `json:"scale"`  // Scale is the axis formatting scale. Supported: "log", "linear"
}

Axis represents the visible extents of a visualization

type BuildInfo

type BuildInfo struct {
	Version string
	Commit  string
}

BuildInfo is sent to the usage client to track versions and commits

type BuildStore

type BuildStore interface {
	Get(context.Context) (BuildInfo, error)
	Update(context.Context, BuildInfo) error
}

BuildStore is the storage and retrieval of Chronograf build information

type Cell

type Cell struct {
	X          int32           `json:"x"`
	Y          int32           `json:"y"`
	W          int32           `json:"w"`
	H          int32           `json:"h"`
	I          string          `json:"i"`
	Name       string          `json:"name"`
	Queries    []Query         `json:"queries"`
	Axes       map[string]Axis `json:"axes"`
	Type       string          `json:"type"`
	CellColors []CellColor     `json:"colors"`
}

Cell is a rectangle and multiple time series queries to visualize.

type CellColor

type CellColor struct {
	ID    string `json:"id"`    // ID is the unique id of the cell color
	Type  string `json:"type"`  // Type is how the color is used. Accepted (min,max,threshold)
	Hex   string `json:"hex"`   // Hex is the hex number of the color
	Name  string `json:"name"`  // Name is the user-facing name of the hex color
	Value string `json:"value"` // Value is the data value mapped to this color
}

CellColor represents the encoding of data into visualizations

type ColumnEncoding

type ColumnEncoding struct {
	Type  string `json:"type"`
	Value string `json:"value"`
	Name  string `json:"name,omitempty"`
}

ColumnEncoding is the settings for a specific column of the Log Viewer UI

type Config

type Config struct {
	Auth AuthConfig `json:"auth"`
}

Config is the global application Config for parameters that can be set via API, with different sections, such as Auth

type ConfigStore

type ConfigStore interface {
	// Initialize creates the initial configuration
	Initialize(context.Context) error
	// Get retrieves the whole Config from the ConfigStore
	Get(context.Context) (*Config, error)
	// Update updates the whole Config in the ConfigStore
	Update(context.Context, *Config) error
}

ConfigStore is the storage and retrieval of global application Config

type DBRP

type DBRP struct {
	DB string `json:"db"`
	RP string `json:"rp"`
}

DBRP represents a database and retention policy for a time series source

type Dashboard

type Dashboard struct {
	ID           DashboardID     `json:"id"`
	Cells        []DashboardCell `json:"cells"`
	Templates    []Template      `json:"templates"`
	Name         string          `json:"name"`
	Organization string          `json:"organization"` // Organization is the organization ID that resource belongs to
}

Dashboard represents all visual and query data for a dashboard

type DashboardCell

type DashboardCell struct {
	ID            string           `json:"i"`
	X             int32            `json:"x"`
	Y             int32            `json:"y"`
	W             int32            `json:"w"`
	H             int32            `json:"h"`
	Name          string           `json:"name"`
	Queries       []DashboardQuery `json:"queries"`
	Axes          map[string]Axis  `json:"axes"`
	Type          string           `json:"type"`
	CellColors    []CellColor      `json:"colors"`
	Legend        Legend           `json:"legend"`
	TableOptions  TableOptions     `json:"tableOptions,omitempty"`
	FieldOptions  []RenamableField `json:"fieldOptions"`
	TimeFormat    string           `json:"timeFormat"`
	DecimalPlaces DecimalPlaces    `json:"decimalPlaces"`
	// These were added after this code was brought over to influxdb.
	Note           string `json:"note,omitempty"`
	NoteVisibility string `json:"noteVisibility,omitempty"`
}

DashboardCell holds visual and query information for a cell

type DashboardID

type DashboardID int

DashboardID is the dashboard ID

type DashboardQuery

type DashboardQuery struct {
	Command     string      `json:"query"`                 // Command is the query itself
	Label       string      `json:"label,omitempty"`       // Label is the Y-Axis label for the data
	Range       *Range      `json:"range,omitempty"`       // Range is the default Y-Axis range for the data
	QueryConfig QueryConfig `json:"queryConfig,omitempty"` // QueryConfig represents the query state that is understood by the data explorer
	Source      string      `json:"source"`                // Source is the optional URI to the data source for this queryConfig
	Shifts      []TimeShift `json:"-"`                     // Shifts represents shifts to apply to an influxql query's time range.  Clients expect the shift to be in the generated QueryConfig
	// This was added after this code was brought over to influxdb.
	Type string `json:"type,omitempty"`
}

DashboardQuery includes state for the query builder. This is a transition struct while we move to the full InfluxQL AST

type DashboardsStore

type DashboardsStore interface {
	// All lists all dashboards from the DashboardStore
	All(context.Context) ([]Dashboard, error)
	// Create a new Dashboard in the DashboardStore
	Add(context.Context, Dashboard) (Dashboard, error)
	// Delete the Dashboard from the DashboardStore if `ID` exists.
	Delete(context.Context, Dashboard) error
	// Get retrieves a dashboard if `ID` exists.
	Get(ctx context.Context, id DashboardID) (Dashboard, error)
	// Update replaces the dashboard information
	Update(context.Context, Dashboard) error
}

DashboardsStore is the storage and retrieval of dashboards

type Database

type Database struct {
	Name          string `json:"name"`                    // a unique string identifier for the database
	Duration      string `json:"duration,omitempty"`      // the duration (when creating a default retention policy)
	Replication   int32  `json:"replication,omitempty"`   // the replication factor (when creating a default retention policy)
	ShardDuration string `json:"shardDuration,omitempty"` // the shard duration (when creating a default retention policy)
}

Database represents a database in a time series source

type Databases

type Databases interface {
	// AllDB lists all databases in the current data source
	AllDB(context.Context) ([]Database, error)
	// Connect connects to a database in the current data source
	Connect(context.Context, *Source) error
	// CreateDB creates a database in the current data source
	CreateDB(context.Context, *Database) (*Database, error)
	// DropDB drops a database in the current data source
	DropDB(context.Context, string) error

	// AllRP lists all retention policies in the current data source
	AllRP(context.Context, string) ([]RetentionPolicy, error)
	// CreateRP creates a retention policy in the current data source
	CreateRP(context.Context, string, *RetentionPolicy) (*RetentionPolicy, error)
	// UpdateRP updates a retention policy in the current data source
	UpdateRP(context.Context, string, string, *RetentionPolicy) (*RetentionPolicy, error)
	// DropRP drops a retention policy in the current data source
	DropRP(context.Context, string, string) error

	// GetMeasurements lists measurements in the current data source
	GetMeasurements(ctx context.Context, db string, limit, offset int) ([]Measurement, error)
}

Databases represents a databases in a time series source

type DecimalPlaces

type DecimalPlaces struct {
	IsEnforced bool  `json:"isEnforced"`
	Digits     int32 `json:"digits"`
}

DecimalPlaces indicates whether decimal places should be enforced, and how many digits it should show.

type DurationRange

type DurationRange struct {
	Upper string `json:"upper"`
	Lower string `json:"lower"`
}

DurationRange represents the lower and upper durations of the query config

type Email

type Email struct {
	To []string `json:"to"` // ToList is the list of email recipients.
}

Email sends the alert to a list of email addresses

type Environment

type Environment struct {
	TelegrafSystemInterval time.Duration `json:"telegrafSystemInterval"`
}

Environment is the set of front-end exposed environment variables that were set on the server

type Error

type Error string

Error is a domain error encountered while processing chronograf requests

func (Error) Error

func (e Error) Error() string

type Exec

type Exec struct {
	Command []string `json:"command"` // Command is the space separated command and args to execute.
}

Exec executes a shell command on an alert

type Field

type Field struct {
	Value interface{} `json:"value"`
	Type  string      `json:"type"`
	Alias string      `json:"alias"`
	Args  []Field     `json:"args,omitempty"`
}

Field represent influxql fields and functions from the UI

type GroupBy

type GroupBy struct {
	Time string   `json:"time"`
	Tags []string `json:"tags"`
}

GroupBy represents influxql group by tags from the UI

type HipChat

type HipChat struct {
	Room  string `json:"room"`  // Room is the HipChat room to post messages.
	Token string `json:"token"` // Token is the HipChat authentication token.
}

HipChat sends alerts to stride.com

type ID

type ID interface {
	// Generate creates a unique ID string
	Generate() (string, error)
}

ID creates uniq ID string

type Kafka

type Kafka struct {
	Cluster  string `json:"cluster"`
	Topic    string `json:"kafka-topic"`
	Template string `json:"template"`
}

Kafka sends alerts to any Kafka brokers specified in the handler config

type KapacitorNode

type KapacitorNode struct {
	Name       string              `json:"name"`
	Args       []string            `json:"args"`
	Properties []KapacitorProperty `json:"properties"`
}

KapacitorNode adds arguments and properties to an alert

type KapacitorProperty

type KapacitorProperty struct {
	Name string   `json:"name"`
	Args []string `json:"args"`
}

KapacitorProperty modifies the node they are called on

type Layout

type Layout struct {
	ID          string `json:"id"`
	Application string `json:"app"`
	Measurement string `json:"measurement"`
	Autoflow    bool   `json:"autoflow"`
	Cells       []Cell `json:"cells"`
}

Layout is a collection of Cells for visualization

type LayoutsStore

type LayoutsStore interface {
	// All returns all dashboards in the store
	All(context.Context) ([]Layout, error)
	// Add creates a new dashboard in the LayoutsStore
	Add(context.Context, Layout) (Layout, error)
	// Delete the dashboard from the store
	Delete(context.Context, Layout) error
	// Get retrieves Layout if `ID` exists
	Get(ctx context.Context, ID string) (Layout, error)
	// Update the dashboard in the store.
	Update(context.Context, Layout) error
}

LayoutsStore stores dashboards and associated Cells

type Legend

type Legend struct {
	Type        string `json:"type,omitempty"`
	Orientation string `json:"orientation,omitempty"`
}

Legend represents the encoding of data into a legend

type Log

type Log struct {
	FilePath string `json:"filePath"` // Absolute path the the log file; it will be created if it does not exist.
}

Log sends the output of the alert to a file

type LogViewerColumn

type LogViewerColumn struct {
	Name      string           `json:"name"`
	Position  int32            `json:"position"`
	Encodings []ColumnEncoding `json:"encodings"`
}

LogViewerColumn is a specific column of the Log Viewer UI

type LogViewerConfig

type LogViewerConfig struct {
	Columns []LogViewerColumn `json:"columns"`
}

LogViewerConfig is the configuration settings for the Log Viewer UI

type Logger

type Logger interface {
	Debug(...interface{})
	Info(...interface{})
	Error(...interface{})

	WithField(string, interface{}) Logger

	// Logger can be transformed into an io.Writer.
	// That writer is the end of an io.Pipe and it is your responsibility to close it.
	Writer() *io.PipeWriter
}

Logger represents an abstracted structured logging implementation. It provides methods to trigger log messages at various alert levels and a WithField method to set keys for a structured log message.

type Mapping

type Mapping struct {
	ID                   string `json:"id"`
	Organization         string `json:"organizationId"`
	Provider             string `json:"provider"`
	Scheme               string `json:"scheme"`
	ProviderOrganization string `json:"providerOrganization"`
}

A Mapping is the structure that is used to determine a users role within an organization. The high level idea is to grant certain roles to certain users without them having to be given explicit role within the organization.

One can think of a mapping like so:

Provider:Scheme:Group -> Organization
github:oauth2:influxdata -> Happy
beyondcorp:ldap:influxdata -> TheBillHilliettas

Any of Provider, Scheme, or Group may be provided as a wildcard *

github:oauth2:* -> MyOrg
*:*:* -> AllOrg

type MappingsStore

type MappingsStore interface {
	// Add creates a new Mapping.
	// The Created mapping is returned back to the user with the
	// ID field populated.
	Add(context.Context, *Mapping) (*Mapping, error)
	// All lists all Mapping in the MappingsStore
	All(context.Context) ([]Mapping, error)
	// Delete removes an Mapping from the MappingsStore
	Delete(context.Context, *Mapping) error
	// Get retrieves an Mapping from the MappingsStore
	Get(context.Context, string) (*Mapping, error)
	// Update updates an Mapping in the MappingsStore
	Update(context.Context, *Mapping) error
}

MappingsStore is the storage and retrieval of Mappings

type Measurement

type Measurement struct {
	Name string `json:"name"` // a unique string identifier for the measurement
}

Measurement represents a measurement in a time series source

type NoopLogger

type NoopLogger struct{}

NoopLogger is a chronograf logger that does nothing.

func (*NoopLogger) Debug

func (l *NoopLogger) Debug(...interface{})

func (*NoopLogger) Error

func (l *NoopLogger) Error(...interface{})

func (*NoopLogger) Info

func (l *NoopLogger) Info(...interface{})

func (*NoopLogger) WithField

func (l *NoopLogger) WithField(string, interface{}) Logger

func (*NoopLogger) Writer

func (l *NoopLogger) Writer() *io.PipeWriter

type OpsGenie

type OpsGenie struct {
	Teams      []string `json:"teams"`      // Teams that the alert will be routed to send notifications
	Recipients []string `json:"recipients"` // Recipients can be a single user, group, escalation, or schedule (https://docs.opsgenie.com/docs/alert-recipients-and-teams)
}

OpsGenie sends alerts to opsgenie.com

type Organization

type Organization struct {
	ID   string `json:"id"`
	Name string `json:"name"`
	// DefaultRole is the name of the role that is the default for any users added to the organization
	DefaultRole string `json:"defaultRole,omitempty"`
}

Organization is a group of resources under a common name

type OrganizationConfig

type OrganizationConfig struct {
	OrganizationID string          `json:"organization"`
	LogViewer      LogViewerConfig `json:"logViewer"`
}

OrganizationConfig is the organization config for parameters that can be set via API, with different sections, such as LogViewer

type OrganizationConfigStore

type OrganizationConfigStore interface {
	// FindOrCreate gets an existing OrganizationConfig and creates one if none exists
	FindOrCreate(ctx context.Context, orgID string) (*OrganizationConfig, error)
	// Put replaces the whole organization config in the OrganizationConfigStore
	Put(context.Context, *OrganizationConfig) error
}

OrganizationConfigStore is the storage and retrieval of organization Configs

type OrganizationQuery

type OrganizationQuery struct {
	// If an ID is provided in the query, the lookup time for an organization will be O(1).
	ID *string
	// If Name is provided, the lookup time will be O(n).
	Name *string
}

OrganizationQuery represents the attributes that a organization may be retrieved by. It is predominantly used in the OrganizationsStore.Get method. It is expected that only one of ID or Name will be specified, but will prefer ID over Name if both are specified.

type OrganizationsStore

type OrganizationsStore interface {
	// Add creates a new Organization.
	// The Created organization is returned back to the user with the
	// ID field populated.
	Add(context.Context, *Organization) (*Organization, error)
	// All lists all Organizations in the OrganizationsStore
	All(context.Context) ([]Organization, error)
	// Delete removes an Organization from the OrganizationsStore
	Delete(context.Context, *Organization) error
	// Get retrieves an Organization from the OrganizationsStore
	Get(context.Context, OrganizationQuery) (*Organization, error)
	// Update updates an Organization in the OrganizationsStore
	Update(context.Context, *Organization) error
	// CreateDefault creates the default organization
	CreateDefault(ctx context.Context) error
	// DefaultOrganization returns the DefaultOrganization
	DefaultOrganization(ctx context.Context) (*Organization, error)
}

OrganizationsStore is the storage and retrieval of Organizations

While not necessary for the app to function correctly, it is expected that Implementors of the OrganizationsStore will take care to guarantee that the Organization.Name is unique. Allowing for duplicate names creates a confusing UX experience for the User.

type PagerDuty

type PagerDuty struct {
	ServiceKey string `json:"serviceKey"` // ServiceKey is the GUID of one of the "Generic API" integrations
}

PagerDuty sends alerts to the pagerduty.com service

type Permission

type Permission struct {
	Scope   Scope      `json:"scope"`
	Name    string     `json:"name,omitempty"`
	Allowed Allowances `json:"allowed"`
}

Permission is a specific allowance for User or Role bound to a scope of the data source

type Permissions

type Permissions []Permission

Permissions represent the entire set of permissions a User or Role may have

type Point

type Point struct {
	Database        string
	RetentionPolicy string
	Measurement     string
	Time            int64
	Tags            map[string]string
	Fields          map[string]interface{}
}

Point is a field set in a series

type Post

type Post struct {
	URL     string            `json:"url"`     // URL is the destination of the POST.
	Headers map[string]string `json:"headers"` // Headers are added to the output POST
}

Post will POST alerts to a destination URL

type Pushover

type Pushover struct {
	// UserKey is the User/Group key of your user (or you), viewable when logged
	// into the Pushover dashboard. Often referred to as USER_KEY
	// in the Pushover documentation.
	UserKey string `json:"userKey"`

	// Device is the users device name to send message directly to that device,
	// rather than all of a user's devices (multiple device names may
	// be separated by a comma)
	Device string `json:"device"`

	// Title is your message's title, otherwise your apps name is used
	Title string `json:"title"`

	// URL is a supplementary URL to show with your message
	URL string `json:"url"`

	// URLTitle is a title for your supplementary URL, otherwise just URL is shown
	URLTitle string `json:"urlTitle"`

	// Sound is the name of one of the sounds supported by the device clients to override
	// the user's default sound choice
	Sound string `json:"sound"`
}

Pushover sends alerts to pushover.net

type Query

type Query struct {
	Command  string   `json:"query"`              // Command is the query itself
	DB       string   `json:"db,omitempty"`       // DB is optional and if empty will not be used.
	RP       string   `json:"rp,omitempty"`       // RP is a retention policy and optional; if empty will not be used.
	Epoch    string   `json:"epoch,omitempty"`    // Epoch is the time format for the return results
	Wheres   []string `json:"wheres,omitempty"`   // Wheres restricts the query to certain attributes
	GroupBys []string `json:"groupbys,omitempty"` // GroupBys collate the query by these tags
	Label    string   `json:"label,omitempty"`    // Label is the Y-Axis label for the data
	Range    *Range   `json:"range,omitempty"`    // Range is the default Y-Axis range for the data
}

Query retrieves a Response from a TimeSeries.

type QueryConfig

type QueryConfig struct {
	ID              string              `json:"id,omitempty"`
	Database        string              `json:"database"`
	Measurement     string              `json:"measurement"`
	RetentionPolicy string              `json:"retentionPolicy"`
	Fields          []Field             `json:"fields"`
	Tags            map[string][]string `json:"tags"`
	GroupBy         GroupBy             `json:"groupBy"`
	AreTagsAccepted bool                `json:"areTagsAccepted"`
	Fill            string              `json:"fill,omitempty"`
	RawText         *string             `json:"rawText"`
	Range           *DurationRange      `json:"range"`
	Shifts          []TimeShift         `json:"shifts"`
}

QueryConfig represents UI query from the data explorer

type Range

type Range struct {
	Upper int64 `json:"upper"` // Upper is the upper bound
	Lower int64 `json:"lower"` // Lower is the lower bound
}

Range represents an upper and lower bound for data

type RenamableField

type RenamableField struct {
	InternalName string `json:"internalName"`
	DisplayName  string `json:"displayName"`
	Visible      bool   `json:"visible"`
}

RenamableField is a column/row field in a DashboardCell of type Table

type Response

type Response interface {
	MarshalJSON() ([]byte, error)
}

Response is the result of a query against a TimeSeries

type RetentionPolicy

type RetentionPolicy struct {
	Name          string `json:"name"`                    // a unique string identifier for the retention policy
	Duration      string `json:"duration,omitempty"`      // the duration
	Replication   int32  `json:"replication,omitempty"`   // the replication factor
	ShardDuration string `json:"shardDuration,omitempty"` // the shard duration
	Default       bool   `json:"isDefault,omitempty"`     // whether the RP should be the default
}

RetentionPolicy represents a retention policy in a time series source

type Role

type Role struct {
	Name         string      `json:"name"`
	Permissions  Permissions `json:"permissions,omitempty"`
	Users        []User      `json:"users,omitempty"`
	Organization string      `json:"organization,omitempty"`
}

Role is a restricted set of permissions assigned to a set of users.

type RolesStore

type RolesStore interface {
	// All lists all roles from the RolesStore
	All(context.Context) ([]Role, error)
	// Create a new Role in the RolesStore
	Add(context.Context, *Role) (*Role, error)
	// Delete the Role from the RolesStore
	Delete(context.Context, *Role) error
	// Get retrieves a role if name exists.
	Get(ctx context.Context, name string) (*Role, error)
	// Update the roles' users or permissions
	Update(context.Context, *Role) error
}

RolesStore is the Storage and retrieval of authentication information

type Router

type Router interface {
	http.Handler
	GET(string, http.HandlerFunc)
	PATCH(string, http.HandlerFunc)
	POST(string, http.HandlerFunc)
	DELETE(string, http.HandlerFunc)
	PUT(string, http.HandlerFunc)

	Handler(string, string, http.Handler)
}

Router is an abstracted Router based on the API provided by the julienschmidt/httprouter package.

type Scope

type Scope string

Scope defines the location of access of a permission

const (
	// AllScope grants permission for all databases.
	AllScope Scope = "all"
	// DBScope grants permissions for a specific database
	DBScope Scope = "database"
)

type Sensu

type Sensu struct {
	Source   string   `json:"source"`   // Source is the check source, used to create a proxy client for an external resource
	Handlers []string `json:"handlers"` // Handlers are Sensu event handlers are for taking action on events
}

Sensu sends alerts to sensu or sensuapp.org

type Server

type Server struct {
	ID                 int                    `json:"id,string"`          // ID is the unique ID of the server
	SrcID              int                    `json:"srcId,string"`       // SrcID of the data source
	Name               string                 `json:"name"`               // Name is the user-defined name for the server
	Username           string                 `json:"username"`           // Username is the username to connect to the server
	Password           string                 `json:"password"`           // Password is in CLEARTEXT
	URL                string                 `json:"url"`                // URL are the connections to the server
	InsecureSkipVerify bool                   `json:"insecureSkipVerify"` // InsecureSkipVerify as true means any certificate presented by the server is accepted.
	Active             bool                   `json:"active"`             // Is this the active server for the source?
	Organization       string                 `json:"organization"`       // Organization is the organization ID that resource belongs to
	Type               string                 `json:"type"`               // Type is the kind of service (e.g. kapacitor or flux)
	Metadata           map[string]interface{} `json:"metadata"`           // Metadata is any other data that the frontend wants to store about this service
}

Server represents a proxy connection to an HTTP server

type ServersStore

type ServersStore interface {
	// All returns all servers in the store
	All(context.Context) ([]Server, error)
	// Add creates a new source in the ServersStore and returns Server with ID
	Add(context.Context, Server) (Server, error)
	// Delete the Server from the store
	Delete(context.Context, Server) error
	// Get retrieves Server if `ID` exists
	Get(ctx context.Context, ID int) (Server, error)
	// Update the Server in the store.
	Update(context.Context, Server) error
}

ServersStore stores connection information for a `Server`

type Slack

type Slack struct {
	Channel   string `json:"channel"`   // Slack channel in which to post messages.
	Username  string `json:"username"`  // Username of the Slack bot.
	IconEmoji string `json:"iconEmoji"` // IconEmoji is an emoji name surrounded in ':' characters; The emoji image will replace the normal user icon for the slack bot.
	Workspace string `json:"workspace"` // Workspace is the slack workspace for the alert handler
}

Slack sends alerts to a slack.com channel

type Source

type Source struct {
	ID                 int    `json:"id,string"`                    // ID is the unique ID of the source
	Name               string `json:"name"`                         // Name is the user-defined name for the source
	Type               string `json:"type,omitempty"`               // Type specifies which kinds of source (enterprise vs oss)
	Username           string `json:"username,omitempty"`           // Username is the username to connect to the source
	Password           string `json:"password,omitempty"`           // Password is in CLEARTEXT
	SharedSecret       string `json:"sharedSecret,omitempty"`       // ShareSecret is the optional signing secret for Influx JWT authorization
	URL                string `json:"url"`                          // URL are the connections to the source
	MetaURL            string `json:"metaUrl,omitempty"`            // MetaURL is the url for the meta node
	InsecureSkipVerify bool   `json:"insecureSkipVerify,omitempty"` // InsecureSkipVerify as true means any certificate presented by the source is accepted.
	Default            bool   `json:"default"`                      // Default specifies the default source for the application
	Telegraf           string `json:"telegraf"`                     // Telegraf is the db telegraf is written to.  By default it is "telegraf"
	Organization       string `json:"organization"`                 // Organization is the organization ID that resource belongs to
	Role               string `json:"role,omitempty"`               // Not Currently Used. Role is the name of the minimum role that a user must possess to access the resource.
	DefaultRP          string `json:"defaultRP"`                    // DefaultRP is the default retention policy used in database queries to this source
}

Source is connection information to a time-series data store.

type SourcesStore

type SourcesStore interface {
	// All returns all sources in the store
	All(context.Context) ([]Source, error)
	// Add creates a new source in the SourcesStore and returns Source with ID
	Add(context.Context, Source) (Source, error)
	// Delete the Source from the store
	Delete(context.Context, Source) error
	// Get retrieves Source if `ID` exists
	Get(ctx context.Context, ID int) (Source, error)
	// Update the Source in the store.
	Update(context.Context, Source) error
}

SourcesStore stores connection information for a `TimeSeries`

type TCP

type TCP struct {
	Address string `json:"address"` // Endpoint is the Address and port to send the alert
}

TCP sends the alert to the address

type TICKScript

type TICKScript string

TICKScript task to be used by kapacitor

type TSDBStatus

type TSDBStatus interface {
	// Connect will connect to the time series using the information in `Source`.
	Connect(ctx context.Context, src *Source) error
	// Ping returns version and TSDB type of time series database if reachable.
	Ping(context.Context) error
	// Version returns the version of the TSDB database
	Version(context.Context) (string, error)
	// Type returns the type of the TSDB database
	Type(context.Context) (string, error)
}

TSDBStatus represents the current status of a time series database

type TableOptions

type TableOptions struct {
	VerticalTimeAxis bool           `json:"verticalTimeAxis"`
	SortBy           RenamableField `json:"sortBy"`
	Wrapping         string         `json:"wrapping"`
	FixFirstColumn   bool           `json:"fixFirstColumn"`
}

TableOptions is a type of options for a DashboardCell with type Table

type Talk

type Talk struct{}

Talk sends alerts to Jane Talk (https://jianliao.com/site)

type Telegram

type Telegram struct {
	ChatID                string `json:"chatId"`                // ChatID is the Telegram user/group ID to post messages to.
	ParseMode             string `json:"parseMode"`             // ParseMode tells telegram how to render the message (Markdown or HTML)
	DisableWebPagePreview bool   `json:"disableWebPagePreview"` // IsDisableWebPagePreview will disables link previews in alert messages.
	DisableNotification   bool   `json:"disableNotification"`   // IsDisableNotification will disables notifications on iOS devices and disables sounds on Android devices. Android users continue to receive notifications.
}

Telegram sends alerts to telegram.org

type Template

type Template struct {
	TemplateVar
	ID    TemplateID     `json:"id"`              // ID is the unique ID associated with this template
	Type  string         `json:"type"`            // Type can be fieldKeys, tagKeys, tagValues, csv, constant, measurements, databases, map, influxql, text
	Label string         `json:"label"`           // Label is a user-facing description of the Template
	Query *TemplateQuery `json:"query,omitempty"` // Query is used to generate the choices for a template
}

Template represents a series of choices to replace TemplateVars within InfluxQL

type TemplateID

type TemplateID string

TemplateID is the unique ID used to identify a template

type TemplateQuery

type TemplateQuery struct {
	Command     string `json:"influxql"`     // Command is the query itself
	DB          string `json:"db,omitempty"` // DB is optional and if empty will not be used.
	RP          string `json:"rp,omitempty"` // RP is a retention policy and optional; if empty will not be used.
	Measurement string `json:"measurement"`  // Measurement is the optionally selected measurement for the query
	TagKey      string `json:"tagKey"`       // TagKey is the optionally selected tag key for the query
	FieldKey    string `json:"fieldKey"`     // FieldKey is the optionally selected field key for the query
}

TemplateQuery is used to retrieve choices for template replacement

type TemplateValue

type TemplateValue struct {
	Value    string `json:"value"`         // Value is the specific value used to replace a template in an InfluxQL query
	Type     string `json:"type"`          // Type can be tagKey, tagValue, fieldKey, csv, map, measurement, database, constant, influxql
	Selected bool   `json:"selected"`      // Selected states that this variable has been picked to use for replacement
	Key      string `json:"key,omitempty"` // Key is the key for the Value if the Template Type is 'map'
}

TemplateValue is a value use to replace a template in an InfluxQL query

type TemplateVar

type TemplateVar struct {
	Var    string          `json:"tempVar"` // Var is the string to replace within InfluxQL
	Values []TemplateValue `json:"values"`  // Values are the replacement values within InfluxQL
}

TemplateVar is a named variable within an InfluxQL query to be replaced with Values

type Ticker

type Ticker interface {
	// Generate will create the tickscript to be used as a kapacitor task
	Generate(AlertRule) (TICKScript, error)
}

Ticker generates tickscript tasks for kapacitor

type TimeSeries

type TimeSeries interface {
	// Connect will connect to the time series using the information in `Source`.
	Connect(context.Context, *Source) error
	// Query retrieves time series data from the database.
	Query(context.Context, Query) (Response, error)
	// Write records points into a series
	Write(context.Context, []Point) error
	// UsersStore represents the user accounts within the TimeSeries database
	Users(context.Context) UsersStore
	// Permissions returns all valid names permissions in this database
	Permissions(context.Context) Permissions
	// Roles represents the roles associated with this TimesSeriesDatabase
	Roles(context.Context) (RolesStore, error)
}

TimeSeries represents a queryable time series database.

type TimeShift

type TimeShift struct {
	Label    string `json:"label"`    // Label user facing description
	Unit     string `json:"unit"`     // Unit influxql time unit representation i.e. ms, s, m, h, d
	Quantity string `json:"quantity"` // Quantity number of units
}

TimeShift represents a shift to apply to an influxql query's time range

type TriggerValues

type TriggerValues struct {
	Change     string `json:"change,omitempty"`   // Change specifies if the change is a percent or absolute
	Period     string `json:"period,omitempty"`   // Period length of time before deadman is alerted
	Shift      string `json:"shift,omitempty"`    // Shift is the amount of time to look into the past for the alert to compare to the present
	Operator   string `json:"operator,omitempty"` // Operator for alert comparison
	Value      string `json:"value,omitempty"`    // Value is the boundary value when alert goes critical
	RangeValue string `json:"rangeValue"`         // RangeValue is an optional value for range comparisons
}

TriggerValues specifies the alerting logic for a specific trigger type

type User

type User struct {
	ID          uint64      `json:"id,string,omitempty"`
	Name        string      `json:"name"`
	Passwd      string      `json:"password,omitempty"`
	Permissions Permissions `json:"permissions,omitempty"`
	Roles       []Role      `json:"roles"`
	Provider    string      `json:"provider,omitempty"`
	Scheme      string      `json:"scheme,omitempty"`
	SuperAdmin  bool        `json:"superAdmin,omitempty"`
}

User represents an authenticated user.

type UserQuery

type UserQuery struct {
	ID       *uint64
	Name     *string
	Provider *string
	Scheme   *string
}

UserQuery represents the attributes that a user may be retrieved by. It is predominantly used in the UsersStore.Get method.

It is expected that only one of ID or Name, Provider, and Scheme will be specified, but all are provided UserStores should prefer ID.

type UsersStore

type UsersStore interface {
	// All lists all users from the UsersStore
	All(context.Context) ([]User, error)
	// Create a new User in the UsersStore
	Add(context.Context, *User) (*User, error)
	// Delete the User from the UsersStore
	Delete(context.Context, *User) error
	// Get retrieves a user if name exists.
	Get(ctx context.Context, q UserQuery) (*User, error)
	// Update the user's permissions or roles
	Update(context.Context, *User) error
	// Num returns the number of users in the UsersStore
	Num(context.Context) (int, error)
}

UsersStore is the Storage and retrieval of authentication information

While not necessary for the app to function correctly, it is expected that Implementors of the UsersStore will take care to guarantee that the combinartion of a users Name, Provider, and Scheme are unique.

type VictorOps

type VictorOps struct {
	RoutingKey string `json:"routingKey"` // RoutingKey is what is used to map the alert to a team
}

VictorOps sends alerts to the victorops.com service

Directories

Path Synopsis
cmd
Package oauth2 provides http.Handlers necessary for implementing Oauth2 authentication with multiple Providers.
Package oauth2 provides http.Handlers necessary for implementing Oauth2 authentication with multiple Providers.

Jump to

Keyboard shortcuts

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