datadog

package module
v0.0.0-...-1a10698 Latest Latest
Warning

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

Go to latest
Published: Apr 12, 2018 License: BSD-3-Clause Imports: 13 Imported by: 0

README

GoDoc Build status

Datadog API in Go

Hi!

This is a Go wrapper for the Datadog API. You should use this library if you need to interact with the Datadog system. You can post metrics with it if you want, but this library is probably mostly used for automating dashboards/alerting and retrieving data (events, etc).

The source API documentation is here: http://docs.datadoghq.com/api/

USAGE

To use this project, include it in your code like:

    import "github.com/zorkian/go-datadog-api"

Then, you can work with it:

    client := datadog.NewClient("api key", "application key")
    
    dash, err := client.GetDashboard(10880)
    if err != nil {
        log.Fatalf("fatal: %s\n", err)
    }
    log.Printf("dashboard %d: %s\n", dash.Id, dash.Title)

That's all; it's pretty easy to use. Check out the Godoc link for the available API methods and, if you can't find the one you need, let us know (or patches welcome)!

DOCUMENTATION

Please see: http://godoc.org/github.com/zorkian/go-datadog-api

BUGS/PROBLEMS/CONTRIBUTING

There are certainly some, but presently no known major bugs. If you do find something that doesn't work as expected, please file an issue on Github:

https://github.com/zorkian/go-datadog-api/issues

Thanks in advance! And, as always, patches welcome!

DEVELOPMENT

  • Get dependencies with make updatedeps.
  • Run tests tests with make test.
  • Integration tests can be run with make testacc.

The acceptance tests require DATADOG_API_KEY and DATADOG_APP_KEY to be available in your environment variables.

Warning: the integrations tests will create and remove real resources in your Datadog account

Please see the LICENSE file for the included license information.

Copyright 2013 by authors and contributors.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Alert

type Alert struct {
	Id           int    `json:"id,omitempty"`
	Creator      int    `json:"creator,omitempty"`
	Query        string `json:"query,omitempty"`
	Name         string `json:"name,omitempty"`
	Message      string `json:"message,omitempty"`
	Silenced     bool   `json:"silenced,omitempty"`
	NotifyNoData bool   `json:"notify_no_data,omitempty"`
	State        string `json:"state,omitempty"`
}

Alert represents the data of an alert: a query that can fire and send a message to the users.

type AlertGraphWidget

type AlertGraphWidget struct {
	TitleSize    int    `json:"title_size,omitempty"`
	VizType      string `json:"timeseries,omitempty"`
	Title        bool   `json:"title,omitempty"`
	TitleAlign   string `json:"title_align,omitempty"`
	TitleText    string `json:"title_text,omitempty"`
	Height       int    `json:"height,omitempty"`
	Width        int    `json:"width,omitempty"`
	X            int    `json:"y,omitempty"`
	Y            int    `json:"x,omitempty"`
	AlertId      int    `json:"alert_id,omitempty"`
	Timeframe    string `json:"timeframe,omitempty"`
	Type         string `json:"type,omitempty"`
	AddTimeframe bool   `json:"add_timeframe,omitempty"`
}

type AlertValueWidget

type AlertValueWidget struct {
	TitleSize    int    `json:"title_size,omitempty"`
	Title        bool   `json:"title,omitempty"`
	TitleAlign   string `json:"title_align,omitempty"`
	TextAlign    string `json:"text_align,omitempty"`
	TitleText    string `json:"title_text,omitempty"`
	Precision    int    `json:"precision,omitempty"`
	AlertId      int    `json:"alert_id,omitempty"`
	Timeframe    string `json:"timeframe,omitempty"`
	AddTimeframe bool   `json:"add_timeframe,omitempty"`
	Y            int    `json:"y,omitempty"`
	X            int    `json:"x,omitempty"`
	TextSize     string `json:"text_size,omitempty"`
	Height       int    `json:"height,omitempty"`
	Width        int    `json:"width,omitempty"`
	Type         string `json:"type,omitempty"`
	Unit         string `json:"unit,omitempty"`
}

type ChangeWidget

type ChangeWidget struct {
	TitleSize  int     `json:"title_size,omitempty"`
	Title      bool    `json:"title,omitempty"`
	TitleAlign string  `json:"title_align,omitempty"`
	TitleText  string  `json:"title_text,omitempty"`
	Height     int     `json:"height,omitempty"`
	Width      int     `json:"width,omitempty"`
	X          int     `json:"y,omitempty"`
	Y          int     `json:"x,omitempty"`
	Aggregator string  `json:"aggregator,omitempty"`
	TileDef    TileDef `json:"tile_def,omitempty"`
}

type CheckStatusWidget

type CheckStatusWidget struct {
	TitleSize  int    `json:"title_size,omitempty"`
	Title      bool   `json:"title,omitempty"`
	TitleAlign string `json:"title_align,omitempty"`
	TextAlign  string `json:"text_align,omitempty"`
	TitleText  string `json:"title_text,omitempty"`
	Height     int    `json:"height,omitempty"`
	Width      int    `json:"width,omitempty"`
	X          int    `json:"y,omitempty"`
	Y          int    `json:"x,omitempty"`
	Tags       string `json:"tags,omitempty"`
	Timeframe  string `json:"timeframe,omitempty"`
	TextSize   string `json:"text_size,omitempty"`
	Type       string `json:"type,omitempty"`
	Check      string `json:"check,omitempty"`
	Group      string `json:"group,omitempty"`
	Grouping   string `json:"grouping,omitempty"`
}

type Client

type Client struct {

	//The Http Client that is used to make requests
	HttpClient *http.Client
	// contains filtered or unexported fields
}

Client is the object that handles talking to the Datadog API. This maintains state information for a particular application connection.

func NewClient

func NewClient(apiKey, appKey string) *Client

NewClient returns a new datadog.Client which can be used to access the API methods. The expected argument is the API key.

func (*Client) AddTagsToHost

func (self *Client) AddTagsToHost(host, source string, tags []string) error

AddTagsToHost does exactly what it says on the tin. Given a list of tags, add them to the host. The source is optionally specificed, and defaults to "users" as per the API documentation.

func (*Client) CreateAlert

func (self *Client) CreateAlert(alert *Alert) (*Alert, error)

CreateAlert adds a new alert to the system. This returns a pointer to an Alert so you can pass that to UpdateAlert later if needed.

func (*Client) CreateComment

func (self *Client) CreateComment(handle, message string) (*Comment, error)

CreateComment adds a new comment to the system.

func (*Client) CreateDashboard

func (self *Client) CreateDashboard(dash *Dashboard) (*Dashboard, error)

CreateDashboard creates a new dashboard when given a Dashboard struct. Note that the Id, Resource, Url and similar elements are not used in creation.

func (*Client) CreateDowntime

func (self *Client) CreateDowntime(downtime *Downtime) (*Downtime, error)

CreateDowntime adds a new downtme to the system. This returns a pointer to a Downtime so you can pass that to UpdateDowntime or CancelDowntime later if needed.

func (*Client) CreateMonitor

func (self *Client) CreateMonitor(monitor *Monitor) (*Monitor, error)

Createmonitor adds a new monitor to the system. This returns a pointer to an monitor so you can pass that to Updatemonitor later if needed.

func (*Client) CreateRelatedComment

func (self *Client) CreateRelatedComment(handle, message string,
	relid int) (*Comment, error)

CreateRelatedComment adds a new comment, but lets you specify the related identifier for the comment.

func (*Client) CreateScreenboard

func (self *Client) CreateScreenboard(board *Screenboard) (*Screenboard, error)

CreateScreenboard creates a new screenboard when given a Screenboard struct. Note that the Id, Resource, Url and similar elements are not used in creation.

func (*Client) DeleteAlert

func (self *Client) DeleteAlert(id int) error

DeleteAlert removes an alert from the system.

func (*Client) DeleteComment

func (self *Client) DeleteComment(id int) error

DeleteComment does exactly what you expect.

func (*Client) DeleteDashboard

func (self *Client) DeleteDashboard(id int) error

DeleteDashboard deletes a dashboard by the identifier.

func (*Client) DeleteDowntime

func (self *Client) DeleteDowntime(id int) error

DeleteDowntime removes an downtime from the system.

func (*Client) DeleteMonitor

func (self *Client) DeleteMonitor(id int) error

Deletemonitor removes an monitor from the system.

func (*Client) DeleteScreenboard

func (self *Client) DeleteScreenboard(id int) error

DeleteScreenboard deletes a screenboard by the identifier.

func (*Client) DeleteUser

func (self *Client) DeleteUser(handle string) error

DeleteUser deletes a user and returns an error if deletion failed

func (*Client) EditComment

func (self *Client) EditComment(id int, handle, message string) error

EditComment changes the message and possibly handle of a particular comment.

func (*Client) GetAlert

func (self *Client) GetAlert(id int) (*Alert, error)

GetAlert retrieves an alert by identifier.

func (*Client) GetAlerts

func (self *Client) GetAlerts() ([]Alert, error)

GetAlerts returns a slice of all alerts.

func (*Client) GetDashboard

func (self *Client) GetDashboard(id int) (*Dashboard, error)

GetDashboard returns a single dashboard created on this account.

func (*Client) GetDashboards

func (self *Client) GetDashboards() ([]DashboardLite, error)

GetDashboards returns a list of all dashboards created on this account.

func (*Client) GetDowntime

func (self *Client) GetDowntime(id int) (*Downtime, error)

Getdowntime retrieves an downtime by identifier.

func (*Client) GetDowntimes

func (self *Client) GetDowntimes() ([]Downtime, error)

GetDowntimes returns a slice of all downtimes.

func (*Client) GetEvent

func (self *Client) GetEvent(id int) (*Event, error)

GetEvent gets a single event given an identifier.

func (*Client) GetEvents

func (self *Client) GetEvents(start, end int,
	priority, sources, tags string) ([]Event, error)

QueryEvents returns a slice of events from the query stream.

func (*Client) GetHostTags

func (self *Client) GetHostTags(host, source string) ([]string, error)

GetHostTags returns a slice of tags for a given host and source.

func (*Client) GetHostTagsBySource

func (self *Client) GetHostTagsBySource(host, source string) (TagMap, error)

GetHostTagsBySource is a different way of viewing the tags. It returns a map of source:[tag,tag].

func (*Client) GetMonitor

func (self *Client) GetMonitor(id int) (*Monitor, error)

Getmonitor retrieves an monitor by identifier.

func (*Client) GetMonitors

func (self *Client) GetMonitors() ([]Monitor, error)

GetMonitors returns a slice of all monitors.

func (*Client) GetScreenboard

func (self *Client) GetScreenboard(id int) (*Screenboard, error)

GetScreenboard returns a single screenboard created on this account.

func (*Client) GetScreenboards

func (self *Client) GetScreenboards() ([]*ScreenboardLite, error)

GetScreenboards returns a list of all screenboards created on this account.

func (*Client) GetTags

func (self *Client) GetTags(source string) (TagMap, error)

GetTags returns a map of tags.

func (*Client) GetUser

func (self *Client) GetUser(handle string) (user User, err error)

GetUser returns the user that match a handle, or an error if not found

func (*Client) GetUsers

func (self *Client) GetUsers() (users []User, err error)

GetUsers returns all user, or an error if not found

func (*Client) InviteUsers

func (self *Client) InviteUsers(emails []string) error

InviteUsers takes a slice of email addresses and sends invitations to them.

func (*Client) MuteAlerts

func (self *Client) MuteAlerts() error

MuteAlerts turns off alerting notifications.

func (*Client) MuteMonitor

func (self *Client) MuteMonitor(id int) error

MuteMonitor turns off monitoring notifications for a monitor.

func (*Client) MuteMonitors

func (self *Client) MuteMonitors() error

MuteMonitors turns off monitoring notifications.

func (*Client) PostEvent

func (self *Client) PostEvent(event *Event) (*Event, error)

PostEvent takes as input an event and then posts it to the server.

func (*Client) PostMetrics

func (client *Client) PostMetrics(series []Metric) error

PostMetrics takes as input a slice of metrics and then posts them up to the server for posting data.

func (*Client) QueryMetrics

func (client *Client) QueryMetrics(from, to int64, query string) ([]Series, error)

QueryMetrics takes as input from, to (seconds from Unix Epoch) and query string and then requests timeseries data for that time peried

func (*Client) RemoveHostTags

func (self *Client) RemoveHostTags(host, source string) error

RemoveHostTags removes all tags from a host for the given source. If none is given, the API defaults to "users".

func (*Client) RevokeScreenboard

func (self *Client) RevokeScreenboard(id int) error

RevokeScreenboard revokes a currently shared screenboard

func (*Client) SearchHosts

func (self *Client) SearchHosts(search string) ([]string, error)

SearchHosts searches through the hosts facet, returning matching hostnames.

func (*Client) SearchMetrics

func (self *Client) SearchMetrics(search string) ([]string, error)

SearchMetrics searches through the metrics facet, returning matching ones.

func (*Client) SetKeys

func (c *Client) SetKeys(apiKey, appKey string)

SetKeys changes the value of apiKey and appKey.

func (*Client) ShareScreenboard

func (self *Client) ShareScreenboard(id int, response *ScreenShareResponse) error

ShareScreenboard shares an existing screenboard, it takes and updates ScreenShareResponse

func (*Client) Snapshot

func (self *Client) Snapshot(query string, start, end time.Time, eventQuery string) (string, error)

Snapshot creates an image from a graph and returns the URL of the image.

func (*Client) UnmuteAlerts

func (self *Client) UnmuteAlerts() error

UnmuteAlerts turns on alerting notifications.

func (*Client) UnmuteMonitor

func (self *Client) UnmuteMonitor(id int) error

UnmuteMonitor turns on monitoring notifications for a monitor.

func (*Client) UnmuteMonitors

func (self *Client) UnmuteMonitors() error

UnmuteMonitors turns on monitoring notifications.

func (*Client) UpdateAlert

func (self *Client) UpdateAlert(alert *Alert) error

UpdateAlert takes an alert that was previously retrieved through some method and sends it back to the server.

func (*Client) UpdateDashboard

func (self *Client) UpdateDashboard(dash *Dashboard) error

UpdateDashboard in essence takes a Dashboard struct and persists it back to the server. Use this if you've updated your local and need to push it back.

func (*Client) UpdateDowntime

func (self *Client) UpdateDowntime(downtime *Downtime) error

UpdateDowntime takes a downtime that was previously retrieved through some method and sends it back to the server.

func (*Client) UpdateHostTags

func (self *Client) UpdateHostTags(host, source string, tags []string) error

UpdateHostTags overwrites existing tags for a host, allowing you to specify a new set of tags for the given source. This defaults to "users".

func (*Client) UpdateMonitor

func (self *Client) UpdateMonitor(monitor *Monitor) error

Updatemonitor takes an monitor that was previously retrieved through some method and sends it back to the server.

func (*Client) UpdateScreenboard

func (self *Client) UpdateScreenboard(board *Screenboard) error

UpdateScreenboard in essence takes a Screenboard struct and persists it back to the server. Use this if you've updated your local and need to push it back.

func (*Client) UpdateUser

func (self *Client) UpdateUser(user User) error

UpdateUser updates a user with the content of `user`, and returns an error if the update failed

type Comment

type Comment struct {
	Id        int    `json:"id"`
	RelatedId int    `json:"related_event_id"`
	Handle    string `json:"handle"`
	Message   string `json:"message"`
	Resource  string `json:"resource"`
	Url       string `json:"url"`
}

Comment is a special form of event that appears in a stream.

type ConditionalFormat

type ConditionalFormat struct {
	Color      string `json:"color,omitempty"`
	Comparator string `json:"comparator,omitempty"`
	Inverted   bool   `json:"invert,omitempty"`
	Value      int    `json:"value,omitempty"`
}

type Dashboard

type Dashboard struct {
	Id                int                `json:"id"`
	Description       string             `json:"description"`
	Title             string             `json:"title"`
	Graphs            []Graph            `json:"graphs"`
	TemplateVariables []TemplateVariable `json:"template_variables,omitempty"`
}

Dashboard represents a user created dashboard. This is the full dashboard struct when we load a dashboard in detail.

type DashboardLite

type DashboardLite struct {
	Id          int    `json:"id,string"` // TODO: Remove ',string'.
	Resource    string `json:"resource"`
	Description string `json:"description"`
	Title       string `json:"title"`
}

DashboardLite represents a user created dashboard. This is the mini struct when we load the summaries.

type DataPoint

type DataPoint [2]float64

DataPoint is a tuple of [UNIX timestamp, value]. This has to use floats because the value could be non-integer.

type Downtime

type Downtime struct {
	Active     bool        `json:"active,omitempty"`
	Canceled   int         `json:"canceled,omitempty"`
	Disabled   bool        `json:"disabled,omitempty"`
	End        int         `json:"end,omitempty"`
	Id         int         `json:"id,omitempty"`
	Message    string      `json:"message,omitempty"`
	Recurrence *Recurrence `json:"recurrence,omitempty"`
	Scope      []string    `json:"scope,omitempty"`
	Start      int         `json:"start,omitempty"`
}

type Event

type Event struct {
	Id          int      `json:"id,omitempty"`
	Title       string   `json:"title,omitempty"`
	Text        string   `json:"text,omitempty"`
	Time        int      `json:"date_happened,omitempty"` // UNIX time.
	Priority    string   `json:"priority,omitempty"`
	AlertType   string   `json:"alert_type,omitempty"`
	Host        string   `json:"host,omitempty"`
	Aggregation string   `json:"aggregation_key,omitempty"`
	SourceType  string   `json:"source_type,omitempty"`
	Tags        []string `json:"tags,omitempty"`
	Url         string   `json:"url,omitempty"`
	Resource    string   `json:"resource,omitempty"`
}

Event is a single event. If this is being used to post an event, then not all fields will be filled out.

type EventStreamWidget

type EventStreamWidget struct {
	EventSize  string   `json:"event_size,omitempty"`
	Height     int      `json:"height,omitempty"`
	Query      string   `json:"query,omitempty"`
	Timeframe  string   `json:"timeframe,omitempty"`
	Title      bool     `json:"title,omitempty"`
	TitleAlign string   `json:"title_align,omitempty"`
	TitleSize  TextSize `json:"title_size,omitempty"`
	TitleText  string   `json:"title_text,omitempty"`
	Type       string   `json:"type,omitempty"`
	Width      int      `json:"width,omitempty"`
	X          int      `json:"x,omitempty"`
	Y          int      `json:"y,omitempty"`
}

type EventTimelineWidget

type EventTimelineWidget struct {
	TitleSize  int    `json:"title_size,omitempty"`
	Title      bool   `json:"title,omitempty"`
	TitleAlign string `json:"title_align,omitempty"`
	TitleText  string `json:"title_text,omitempty"`
	Height     int    `json:"height,omitempty"`
	Width      int    `json:"width,omitempty"`
	X          int    `json:"y,omitempty"`
	Y          int    `json:"x,omitempty"`
	Type       string `json:"type,omitempty"`
	Timeframe  string `json:"timeframe,omitempty"`
	Query      string `json:"query,omitempty"`
}

type FreeTextWidget

type FreeTextWidget struct {
	Color     string `json:"color,omitempty"`
	FontSize  string `json:"font_size,omitempty"`
	Height    int    `json:"height,omitempty"`
	Text      string `json:"text,omitempty"`
	TextAlign string `json:"text_align,omitempty"`
	Type      string `json:"type,omitempty"`
	Width     int    `json:"width,omitempty"`
	X         int    `json:"x,omitempty"`
	Y         int    `json:"y,omitempty"`
}

type Graph

type Graph struct {
	Title      string     `json:"title"`
	Events     []struct{} `json:"events"`
	Definition struct {
		Viz      string `json:"viz"`
		Requests []struct {
			Query   string `json:"q"`
			Stacked bool   `json:"stacked"`
		} `json:"requests"`
	} `json:"definition"`
}

Graph represents a graph that might exist on a dashboard.

type GraphWidget

type GraphWidget struct {
	TitleSize  int     `json:"title_size,omitempty"`
	Title      bool    `json:"title,omitempty"`
	TitleAlign string  `json:"title_align,omitempty"`
	TitleText  string  `json:"title_text,omitempty"`
	Height     int     `json:"height,omitempty"`
	Width      int     `json:"width,omitempty"`
	X          int     `json:"y,omitempty"`
	Y          int     `json:"x,omitempty"`
	Type       string  `json:"type,omitempty"`
	Timeframe  string  `json:"timeframe,omitempty"`
	LegendSize int     `json:"legend_size,omitempty"`
	Legend     bool    `json:"legend,omitempty"`
	TileDef    TileDef `json:"tile_def,omitempty"`
}

type HostMapWidget

type HostMapWidget struct {
	TitleSize  int     `json:"title_size,omitempty"`
	Title      bool    `json:"title,omitempty"`
	TitleAlign string  `json:"title_align,omitempty"`
	TitleText  string  `json:"title_text,omitempty"`
	Height     int     `json:"height,omitempty"`
	Width      int     `json:"width,omitempty"`
	X          int     `json:"y,omitempty"`
	Y          int     `json:"x,omitempty"`
	Query      string  `json:"query,omitempty"`
	Timeframe  string  `json:"timeframe,omitempty"`
	LegendSize int     `json:"legend_size,omitempty"`
	Type       string  `json:"type,omitempty"`
	Legend     bool    `json:"legend,omitempty"`
	TileDef    TileDef `json:"tile_def,omitempty"`
}

type IFrameWidget

type IFrameWidget struct {
	TitleSize  int    `json:"title_size,omitempty"`
	Title      bool   `json:"title,omitempty"`
	Url        string `json:"url,omitempty"`
	TitleAlign string `json:"title_align,omitempty"`
	TitleText  string `json:"title_text,omitempty"`
	Height     int    `json:"height,omitempty"`
	Width      int    `json:"width,omitempty"`
	X          int    `json:"y,omitempty"`
	Y          int    `json:"x,omitempty"`
	Type       string `json:"type,omitempty"`
}

type ImageWidget

type ImageWidget struct {
	Height     int      `json:"height,omitempty"`
	Sizing     string   `json:"sizing,omitempty"`
	Title      bool     `json:"title,omitempty"`
	TitleAlign string   `json:"title_align,omitempty"`
	TitleSize  TextSize `json:"title_size,omitempty"`
	TitleText  string   `json:"title_text,omitempty"`
	Type       string   `json:"type,omitempty"`
	Url        string   `json:"url,omitempty"`
	Width      int      `json:"width,omitempty"`
	X          int      `json:"x,omitempty"`
	Y          int      `json:"y,omitempty"`
}

type Metric

type Metric struct {
	Metric         string      `json:"metric,omitempty"`
	Points         []DataPoint `json:"points,omitempty"`
	Type           string      `json:"type,omitempty"`
	Host           string      `json:"host,omitempty"`
	Tags           []string    `json:"tags,omitempty"`
	Unit           string      `json:"unit,omitempty"`
	SourceTypeName string      `json:"source_type_name,omitempty"`
	Interval       int         `json:"interval,omitempty"`
}

Metric represents a collection of data points that we might send or receive on one single metric line.

type Monitor

type Monitor struct {
	Id      int      `json:"id,omitempty"`
	Type    string   `json:"type,omitempty"`
	Query   string   `json:"query,omitempty"`
	Name    string   `json:"name,omitempty"`
	Message string   `json:"message,omitempty"`
	Tags    []string `json:"tags,omitempty"`
	Options Options  `json:"options,omitempty"`
}

Monitors allow you to watch a metric or check that you care about, notifying your team when some defined threshold is exceeded.

type NoteWidget

type NoteWidget struct {
	TitleSize    int    `json:"title_size,omitempty"`
	Title        bool   `json:"title,omitempty"`
	RefreshEvery int    `json:"refresh_every,omitempty"`
	TickPos      string `json:"tick_pos,omitempty"`
	TitleAlign   string `json:"title_align,omitempty"`
	TickEdge     string `json:"tick_edge,omitempty"`
	TextAlign    string `json:"text_align,omitempty"`
	TitleText    string `json:"title_text,omitempty"`
	Height       int    `json:"height,omitempty"`
	Color        string `json:"bgcolor,omitempty"`
	Html         string `json:"html,omitempty"`
	Y            int    `json:"y,omitempty"`
	X            int    `json:"x,omitempty"`
	FontSize     int    `json:"font_size,omitempty"`
	Tick         bool   `json:"tick,omitempty"`
	Note         string `json:"type,omitempty"`
	Width        int    `json:"width,omitempty"`
	AutoRefresh  bool   `json:"auto_refresh,omitempty"`
}

type Options

type Options struct {
	NoDataTimeframe   int            `json:"no_data_timeframe,omitempty"`
	NotifyAudit       bool           `json:"notify_audit,omitempty"`
	NotifyNoData      bool           `json:"notify_no_data,omitempty"`
	RenotifyInterval  int            `json:"renotify_interval,omitempty"`
	Silenced          map[string]int `json:"silenced,omitempty"`
	TimeoutH          int            `json:"timeout_h,omitempty"`
	EscalationMessage string         `json:"escalation_message,omitempty"`
	Thresholds        ThresholdCount `json:"thresholds,omitempty"`
	IncludeTags       bool           `json:"include_tags,omitempty"`
}

type QueryValueWidget

type QueryValueWidget struct {
	Timeframe           string              `json:"timeframe,omitempty"`
	TimeframeAggregator string              `json:"aggr,omitempty"`
	Aggregator          string              `json:"aggregator,omitempty"`
	CalcFunc            string              `json:"calc_func,omitempty"`
	ConditionalFormats  []ConditionalFormat `json:"conditional_formats,omitempty"`
	Height              int                 `json:"height,omitempty"`
	IsValidQuery        bool                `json:"is_valid_query,omitempty,omitempty"`
	Metric              string              `json:"metric,omitempty"`
	MetricType          string              `json:"metric_type,omitempty"`
	Precision           int                 `json:"precision,omitempty"`
	Query               string              `json:"query,omitempty"`
	ResultCalcFunc      string              `json:"res_calc_func,omitempty"`
	Tags                []string            `json:"tags,omitempty"`
	TextAlign           string              `json:"text_align,omitempty"`
	TextSize            TextSize            `json:"text_size,omitempty"`
	Title               bool                `json:"title,omitempty"`
	TitleAlign          string              `json:"title_align,omitempty"`
	TitleSize           TextSize            `json:"title_size,omitempty"`
	TitleText           string              `json:"title_text,omitempty"`
	Type                string              `json:"type,omitempty"`
	Unit                string              `json:"auto,omitempty"`
	Width               int                 `json:"width,omitempty"`
	X                   int                 `json:"x,omitempty"`
	Y                   int                 `json:"y,omitempty"`
}

type Recurrence

type Recurrence struct {
	Period           int      `json:"period,omitempty"`
	Type             string   `json:"type,omitempty"`
	UntilDate        int      `json:"until_date,omitempty"`
	UntilOccurrences int      `json:"until_occurrences,omitempty"`
	WeekDays         []string `json:"week_days,omitempty"`
}

type ScreenShareResponse

type ScreenShareResponse struct {
	BoardId   int    `json:"board_id"`
	PublicUrl string `json:"public_url"`
}

type Screenboard

type Screenboard struct {
	Id                int                `json:"id,omitempty"`
	Title             string             `json:"board_title,omitempty"`
	Height            string             `json:"height,omitempty"`
	Width             string             `json:"width,omitempty"`
	Shared            bool               `json:"shared,omitempty"`
	Templated         bool               `json:"templated,omitempty"`
	TemplateVariables []TemplateVariable `json:"template_variables,omitempty"`
	Widgets           []Widget           `json:"widgets,omitempty"`
}

Screenboard represents a user created screenboard. This is the full screenboard struct when we load a screenboard in detail.

type ScreenboardLite

type ScreenboardLite struct {
	Id       int    `json:"id,omitempty"`
	Resource string `json:"resource,omitempty"`
	Title    string `json:"title,omitempty"`
}

ScreenboardLite represents a user created screenboard. This is the mini struct when we load the summaries.

type Series

type Series struct {
	Metric      string      `json:"metric,omitempty"`
	DisplayName string      `json:"display_name,omitempty"`
	Points      []DataPoint `json:"pointlist,omitempty"`
	Start       float64     `json:"start,omitempty"`
	End         float64     `json:"end,omitempty"`
	Interval    int         `json:"interval,omitempty"`
	Aggr        string      `json:"aggr,omitempty"`
	Length      int         `json:"length,omitempty"`
	Scope       string      `json:"scope,omitempty"`
	Expression  string      `json:"expression,omitempty"`
	QueryIndex  int         `json:"query_index,omitempty"`
}

Series represents a collection of data points we get when we query for timeseries data

type TagMap

type TagMap map[string][]string

TagMap is used to receive the format given to us by the API.

type TemplateVariable

type TemplateVariable struct {
	Name    string `json:"name"`
	Prefix  string `json:"prefix"`
	Default string `json:"default"`
}

Template variable represents a template variable that might exist on a dashboard

type TextSize

type TextSize struct {
	Size int
	Auto bool
}

type ThresholdCount

type ThresholdCount struct {
	Ok       json.Number `json:"ok,omitempty"`
	Critical json.Number `json:"critical,omitempty"`
	Warning  json.Number `json:"warning,omitempty"`
}

type TileDef

type TileDef struct {
	Events   []TileDefEvent      `json:"events,omitempty"`
	Markers  []TimeseriesMarker  `json:"markers,omitempty"`
	Requests []TimeseriesRequest `json:"requests,omitempty"`
	Viz      string              `json:"viz,omitempty"`
}

type TileDefEvent

type TileDefEvent struct {
	Query string `json:"q"`
}

type TimeseriesMarker

type TimeseriesMarker struct {
	Label string `json:"label,omitempty"`
	Type  string `json:"type,omitempty"`
	Value string `json:"value,omitempty"`
}

type TimeseriesRequest

type TimeseriesRequest struct {
	Query              string                 `json:"q,omitempty"`
	Type               string                 `json:"type,omitempty"`
	ConditionalFormats []ConditionalFormat    `json:"conditional_formats,omitempty"`
	Style              TimeseriesRequestStyle `json:"style,omitempty"`
}

type TimeseriesRequestStyle

type TimeseriesRequestStyle struct {
	Palette string `json:"palette,omitempty"`
}

type TimeseriesWidget

type TimeseriesWidget struct {
	Height     int      `json:"height,omitempty"`
	Legend     bool     `json:"legend,omitempty"`
	TileDef    TileDef  `json:"tile_def,omitempty"`
	Timeframe  string   `json:"timeframe,omitempty"`
	Title      bool     `json:"title,omitempty"`
	TitleAlign string   `json:"title_align,omitempty"`
	TitleSize  TextSize `json:"title_size,omitempty"`
	TitleText  string   `json:"title_text,omitempty"`
	Type       string   `json:"type,omitempty"`
	Width      int      `json:"width,omitempty"`
	X          int      `json:"x,omitempty"`
	Y          int      `json:"y,omitempty"`
}

type ToplistWidget

type ToplistWidget struct {
	Height     int      `json:"height,omitempty"`
	Legend     bool     `json:"legend,omitempty"`
	LegendSize int      `json:"legend_size,omitempty"`
	TileDef    TileDef  `json:"tile_def,omitempty"`
	Timeframe  string   `json:"timeframe,omitempty"`
	Title      bool     `json:"title,omitempty"`
	TitleAlign string   `json:"title_align,omitempty"`
	TitleSize  TextSize `json:"title_size,omitempty"`
	TitleText  string   `json:"title_text,omitempty"`
	Type       string   `json:"type,omitempty"`
	Width      int      `json:"width,omitempty"`
	X          int      `json:"x,omitempty"`
	Y          int      `json:"y,omitempty"`
}

type User

type User struct {
	Handle   string `json:"handle,omitempty"`
	Email    string `json:"email,omitempty"`
	Name     string `json:"name,omitempty"`
	Role     string `json:"role,omitempty"`
	IsAdmin  bool   `json:"is_admin,omitempty"`
	Verified bool   `json:"verified,omitempty"`
	Disabled bool   `json:"disabled,omitempty"`
}

type Widget

type Widget struct {
	Default             string              `json:"default,omitempty"`
	Name                string              `json:"name,omitempty"`
	Prefix              string              `json:"prefix,omitempty"`
	TimeseriesWidget    TimeseriesWidget    `json:"timeseries,omitempty"`
	QueryValueWidget    QueryValueWidget    `json:"query_value,omitempty"`
	EventStreamWidget   EventStreamWidget   `json:"event_stream,omitempty"`
	FreeTextWidget      FreeTextWidget      `json:"free_text,omitempty"`
	ToplistWidget       ToplistWidget       `json:"toplist,omitempty"`
	ImageWidget         ImageWidget         `json:"image,omitempty"`
	ChangeWidget        ChangeWidget        `json:"change,omitempty"`
	GraphWidget         GraphWidget         `json:"graph,omitempty"`
	EventTimelineWidget EventTimelineWidget `json:"event_timeline,omitempty"`
	AlertValueWidget    AlertValueWidget    `json:"alert_value,omitempty"`
	AlertGraphWidget    AlertGraphWidget    `json:"alert_graph,omitempty"`
	HostMapWidget       HostMapWidget       `json:"hostmap,omitempty"`
	CheckStatusWidget   CheckStatusWidget   `json:"check_status,omitempty"`
	IFrameWidget        IFrameWidget        `json:"iframe,omitempty"`
	NoteWidget          NoteWidget          `json:"frame,omitempty"`
}

type Widget struct {

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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