Documentation
¶
Overview ¶
Package wavefront provides a library for interacting with the Wavefront API, along with a writer for sending metrics to a Wavefront proxy.
Index ¶
- Constants
- type Alert
- type Alerts
- type Chart
- type ChartSetting
- type Client
- func (c *Client) Alerts() *Alerts
- func (c *Client) Dashboards() *Dashboards
- func (c *Client) Debug(enable bool)
- func (c Client) Do(req *http.Request) (io.ReadCloser, error)
- func (c *Client) Events() *Events
- func (c *Client) NewQuery(params *QueryParams) *Query
- func (c Client) NewRequest(method, path string, params *map[string]string, body []byte) (*http.Request, error)
- func (c *Client) NewSearch(searchType string, params *SearchParams) *Search
- func (c *Client) Targets() *Targets
- type Config
- type Dashboard
- type Dashboards
- type DataPoint
- type Event
- type Events
- func (e Events) Close(event *Event) error
- func (a Events) Create(event *Event) error
- func (e Events) Delete(event *Event) error
- func (e Events) Find(filter []*SearchCondition, timeRange *TimeRange) ([]*Event, error)
- func (e Events) FindByID(id string) (*Event, error)
- func (e Events) Update(event *Event) error
- type ParameterDetail
- type Query
- type QueryParams
- type QueryResponse
- type Row
- type Search
- type SearchCondition
- type SearchParams
- type SearchResponse
- type Section
- type Source
- type SourceLabelPair
- type Target
- type Targets
- type TimeRange
- type TimeSeries
- type Wavefronter
Constants ¶
const ( // some constants provided for time convenience LastHour = 60 * 60 Last3Hours = LastHour * 3 Last6Hours = LastHour * 6 Last24Hours = LastHour * 24 LastDay = Last24Hours LastWeek = LastDay * 7 )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Alert ¶
type Alert struct { // Name is the name given to an Alert Name string `json:"name"` // ID is the Wavefront-assigned ID of an existing Alert ID *string `json:"id,omitempty"` // AdditionalInfo is any extra information about the Alert AdditionalInfo string `json:"additionalInformation"` // Target is a comma-separated list of targets for the Alert Target string `json:"target"` // Condition is the condition under which the Alert will fire Condition string `json:"condition"` // DisplayExpression is the ts query to generate a graph of this Alert, in the UI DisplayExpression string `json:"displayExpression,omitempty"` // Minutes is the number of minutes the Condition must be met, before the // Alert will fire Minutes int `json:"minutes"` // ResolveAfterMinutes is the number of minutes the Condition must be un-met // before the Alert is considered resolved ResolveAfterMinutes int `json:"resolveAfterMinutes,omitempty"` // Minutes to wait before re-sending notification of firing alert. NotificationResendFrequencyMinutes int `json:"notificationResendFrequencyMinutes"` // Severity is the severity of the Alert, and can be one of SEVERE, // SMOKE, WARN or INFO Severity string `json:"severity"` // Status is the current status of the Alert Status []string `json:"status"` // Tags are the tags applied to the Alert Tags []string FailingHostLabelPairs []SourceLabelPair `json:"failingHostLabelPairs,omitempty"` InMaintenanceHostLabelPairs []SourceLabelPair `json:"inMaintenanceHostLabelPairs,omitempty"` }
Alert represents a single Wavefront Alert
func (*Alert) MarshalJSON ¶
func (*Alert) UnmarshalJSON ¶
UnmarshalJSON is a custom JSON unmarshaller for an Alert, used in order to populate the Tags field in a more intuitive fashion
type Alerts ¶
type Alerts struct {
// contains filtered or unexported fields
}
Alerts is used to perform alert-related operations against the Wavefront API
func (Alerts) Create ¶
Create is used to create an Alert in Wavefront. If successful, the ID field of the alert will be populated.
func (Alerts) Delete ¶
Delete is used to delete an existing Alert. The ID field of the alert must be populated
func (Alerts) Find ¶
func (a Alerts) Find(filter []*SearchCondition) ([]*Alert, error)
Find returns all alerts filtered by the given search conditions. If filter is nil, all alerts are returned.
type Chart ¶
type Chart struct { // Name is the name of a chart Name string `json:"name"` // Description is the description of the chart Description string `json:"description"` // Base (unknown usage, defaults to 1) Base int `json:"base"` // Include obsolete metrics older than 4 weeks ago into current time window IncludeObsoleteMetrics bool `json:"includeObsoleteMetrics"` // Interpolate points that existed in past/future into current time window InterpolatePoints bool `json:"interpolatePoints"` // Don't include default events on the chart NoDefaultEvents bool `json:"noDefaultEvents"` // Strategy to use when aggregating metric points (LAST, AVERAGE, COUNT, etc) Summarization string `json:"summarization"` // Sources is an Array of Source Sources []Source `json:"sources"` // Units are the units to use for the y axis Units string `json:"units,omitempty"` // ChartSettings are custom settings for the chart ChartSettings ChartSetting `json:"chartSettings"` }
Chart represents a single Chart, on a single Row with in Section of a Wavefront Dashboard
type ChartSetting ¶
type ChartSetting struct { AutoColumnTags bool `json:"autoColumnTags,omitempty"` ColumnTags string `json:"columnTags,omitempty"` CustomTags []string `json:"customTags,omitempty"` ExpectedDataSpacing int `json:"expectedDataSpacing,omitempty"` FixedLegendDisplayStats []string `json:"fixedLegendDisplayStats,omitempty"` FixedLegendEnabled bool `json:"fixedLegendEnabled,omitempty"` FixedLegendFilterField string `json:"fixedLegendFilterField,omitempty"` FixedLegendFilterLimit int `json:"fixedLegendFilterLimit,omitempty"` FixedLegendFilterSort string `json:"fixedLegendFilterSort,omitempty"` FixedLegendHideLabel bool `json:"fixedLegendHideLabel,omitempty"` FixedLegendPosition string `json:"fixedLegendPosition,omitempty"` FixedLegendUseRawStats bool `json:"fixedLegendUseRawStats,omitempty"` GroupBySource bool `json:"groupBySource,omitempty"` InvertDynamicLegendHoverControl bool `json:"invertDynamicLegendHoverControl,omitempty"` LineType string `json:"lineType,omitempty"` Max float32 `json:"max,omitempty"` Min float32 `json:"min,omitempty"` NumTags int `json:"numTags,omitempty"` PlainMarkdownContent string `json:"plainMarkdownContent,omitempty"` ShowHosts bool `json:"showHosts,omitempty"` ShowLabels bool `json:"showLabels,omitempty"` ShowRawValues bool `json:"showRawValues,omitempty"` SortValuesDescending bool `json:"sortValuesDescending,omitempty"` SparklineDecimalPrecision int `json:"sparklineDecimalPrecision,omitempty"` SparklineDisplayColor string `json:"sparklineDisplayColor,omitempty"` SparklineDisplayFontSize string `json:"sparklineDisplayFontSize,omitempty"` SparklineDisplayHorizontalPosition string `json:"sparklineDisplayHorizontalPosition,omitempty"` SparklineDisplayPostfix string `json:"sparklineDisplayPostfix,omitempty"` SparklineDisplayPrefix string `json:"sparklineDisplayPrefix,omitempty"` SparklineDisplayValueType string `json:"sparklineDisplayValueType,omitempty"` SparklineDisplayVerticalPosition string `json:"sparklineDisplayVerticalPosition,omitempty"` SparklineFillColor string `json:"sparklineFillColor,omitempty"` SparklineLineColor string `json:"sparklineLineColor,omitempty"` SparklineSize string `json:"sparklineSize,omitempty"` SparklineValueColorMapApplyTo string `json:"sparklineValueColorMapApplyTo,omitempty"` SparklineValueColorMapColors []string `json:"sparklineValueColorMapColors,omitempty"` SparklineValueColorMapValues []int `json:"sparklineValueColorMapValues,omitempty"` SparklineValueColorMapValuesV2 []float32 `json:"sparklineValueColorMapValuesV2,omitempty"` SparklineValueTextMapText []string `json:"sparklineValueTextMapText,omitempty"` SparklineValueTextMapThresholds []float32 `json:"sparklineValueTextMapThresholds,omitempty"` StackType string `json:"stackType,omitempty"` TagMode string `json:"tagMode,omitempty"` TimeBasedColoring bool `json:"timeBasedColoring,omitempty"` Type string `json:"type,omitempty"` Windowing string `json:"windowing,omitempty"` WindowSize int `json:"windowSize,omitempty"` Xmax float32 `json:"xmax,omitempty"` Xmin float32 `json:"xmin,omitempty"` Y0ScaleSIBy1024 bool `json:"y0ScaleSIBy1024,omitempty"` Y0UnitAutoscaling bool `json:"y0UnitAutoscaling,omitempty"` Y1Max float32 `json:"y1Max,omitempty"` Y1Min float32 `json:"y1Min,omitempty"` Y1ScaleSIBy1024 bool `json:"y1ScaleSIBy1024,omitempty"` Y1UnitAutoscaling bool `json:"y1UnitAutoscaling,omitempty"` Y1Units string `json:"y1Units,omitempty"` Ymax float32 `json:"ymax,omitempty"` Ymin float32 `json:"ymin,omitempty"` }
ChartSetting represents various custom settings for a Chart
type Client ¶
type Client struct { // Config is a Config object that will be used to construct requests Config *Config // BaseURL is the full URL of the Wavefront API, of the form // https://example.wavefront.com/api/v2 BaseURL *url.URL // contains filtered or unexported fields }
Client is used to generate API requests against the Wavefront API.
func (*Client) Dashboards ¶
func (c *Client) Dashboards() *Dashboards
Dashboards is used to return a client for Dashboard-related operations
func (Client) Do ¶
Do executes a request against the Wavefront API. The response body is returned if the request is successful, and should be closed by the requester.
func (*Client) NewQuery ¶
func (c *Client) NewQuery(params *QueryParams) *Query
NewQuery returns a Query based on QueryParams
func (Client) NewRequest ¶
func (c Client) NewRequest(method, path string, params *map[string]string, body []byte) (*http.Request, error)
NewRequest creates a request object to query the Wavefront API. Path is a relative URI that should be specified with no trailing slash, it will be resolved against the BaseURL of the client. Params should be passed as a map[string]string, these will be converted to query parameters.
type Config ¶
type Config struct { // Address is the address of the Wavefront API, of the form example.wavefront.com Address string // Token is an authentication token that will be passed with all requests Token string // SET HTTP Proxy configuration HttpProxy string // SkipTLSVerify disables SSL certificate checking and should be used for // testing only SkipTLSVerify bool }
Config is used to hold configuration used when constructing a Client
type Dashboard ¶
type Dashboard struct { // Name is the name given to an Dashboard Name string `json:"name"` // ID is the Wavefront-assigned ID of an existing Dashboard ID string `json:"id"` // Tags are the tags applied to the Dashboard Tags []string `json:"-"` // Description is a description given to the Dashboard Description string `json:"description"` // Url is the relative url to access the dashboard by on a cluster Url string `json:"url"` // Sections is an array of Section that split up the dashboard Sections []Section `json:"sections"` // Additional dashboard settings ChartTitleBgColor string `json:"chartTitleBgColor,omitempty"` ChartTitleColor string `json:"chartTitleColor,omitempty"` ChartTitleScalar int `json:"chartTitleScalar,omitempty"` DefaultEndTime int `json:"defaultEndTime,omitempty"` DefaultStartTime int `json:"defaultStartTime,omitempty"` DefaultTimeWindow string `json:"defaultTimeWindow"` DisplayDescription bool `json:"displayDescription"` DisplayQueryParameters bool `json:"displayQueryParameters"` DisplaySectionTableOfContents bool `json:"displaySectionTableOfContents"` EventFilterType string `json:"eventFilterType"` EventQuery string `json:"eventQuery"` Favorite bool `json:"favorite"` // Additional dashboard information Customer string `json:"customer,omitempty"` Deleted bool `json:"deleted,omitempty"` Hidden bool `json:"hidden,omitempty"` NumCharts int `json:"numCharts,omitempty"` NumFavorites int `json:"numFavorites,omitempty"` CreatorId string `json:"creatorId,omitempty"` UpdaterId string `json:"updaterId,omitempty"` SystemOwned bool `json:"systemOwned,omitempty"` ViewsLastDay int `json:"viewsLastDay,omitempty"` ViewsLastMonth int `json:"viewsLastMonth,omitempty"` ViewsLastWeek int `json:"viewsLastWeek,omitempty"` CreatedEpochMillis int64 `json:"createdEpochMillis,omitempty"` UpdatedEpochMillis int64 `json:"updatedEpochMillis,omitempty"` // Parameters (reserved - usage unknown at this time) Parameters struct{} `json:"parameters"` // ParameterDetails sets variables that can be used within queries ParameterDetails map[string]ParameterDetail `json:"parameterDetails"` }
Dashboard represents a single Wavefront Dashboard
func (*Dashboard) MarshalJSON ¶
func (*Dashboard) UnmarshalJSON ¶
UnmarshalJSON is a custom JSON unmarshaller for an Dashboard, used in order to populate the Tags field in a more intuitive fashion
type Dashboards ¶
type Dashboards struct {
// contains filtered or unexported fields
}
Dashboards is used to perform Dashboard-related operations against the Wavefront API
func (Dashboards) Create ¶
func (a Dashboards) Create(dashboard *Dashboard) error
Create is used to create an Dashboard in Wavefront. If successful, the ID field of the Dashboard will be populated.
func (Dashboards) Delete ¶
func (a Dashboards) Delete(dashboard *Dashboard) error
Delete is used to delete an existing Dashboard. The ID field of the Dashboard must be populated
func (Dashboards) Find ¶
func (a Dashboards) Find(filter []*SearchCondition) ([]*Dashboard, error)
Find returns all Dashboards filtered by the given search conditions. If filter is nil, all Dashboards are returned.
func (Dashboards) Get ¶
func (a Dashboards) Get(dashboard *Dashboard) error
Get is used to retrieve an existing Dashboard by ID. The ID field must be provided
func (Dashboards) Update ¶
func (a Dashboards) Update(dashboard *Dashboard) error
Update is used to update an existing Dashboard. The ID field of the Dashboard must be populated
type DataPoint ¶
type DataPoint []float64
DataPoint represents a single timestamp/value data point as returned by Wavefront
type Event ¶
type Event struct { // Name is the name given to the Event Name string `json:"name"` // ID is the Wavefront-assigned ID of an existing Event ID *string `json:"id,omitempty"` // StartTime is the start time, in epoch milliseconds, of the Event. // If zero, it will be set to current time StartTime int64 `json:"startTime"` // EndTime is the end time, in epoch milliseconds, of the Event EndTime int64 `json:"endTime,omitempty"` // Tags are the tags associated with the Event Tags []string `json:"tags"` // Severity is the severity category of the Event, can be INFO, WARN, // SEVERE or UNCLASSIFIED Severity string // Type is the type of the Event, e.g. "Alert", "Deploy" etc. Type string // Details is a description of the Event Details string // Instantaneous, if true, creates a point-in-time Event (i.e. with no duration) Instantaneous bool `json:"isEphemeral"` }
Event represents a single Wavefront Event
func (*Event) MarshalJSON ¶
func (*Event) UnmarshalJSON ¶
UnmarshalJSON is a custom JSON unmarshaller for an Event, used to explode the annotations.
type Events ¶
type Events struct {
// contains filtered or unexported fields
}
Events is used to perform event-related operations against the Wavefront API
func (Events) Create ¶
Create is used to create an Event in Wavefront. If successful, the ID field of the event will be populated.
func (Events) Delete ¶
Delete is used to delete an existing Event. The ID field of the Event must be populated
func (Events) Find ¶
func (e Events) Find(filter []*SearchCondition, timeRange *TimeRange) ([]*Event, error)
Find returns all events filtered by the given search conditions. If filter is nil then all Events are returned. The result set is limited to the first 100 entries. If more results are required the Search type can be used directly.
type ParameterDetail ¶
type ParameterDetail struct { // Label represents the name of the variable Label string `json:"label"` // DefaultValue maps to keys in the map ValuesToReadableStrings DefaultValue string `json:"defaultValue"` // HideFromView Whether to hide from the view of the user viewing the Dashboard HideFromView bool `json:"hideFromView"` // ParameterType (SIMPLE, LIST, DYNAMIC) ParameterType string `json:"parameterType"` // ValuesToReadableStrings ValuesToReadableStrings map[string]string `json:"valuesToReadableStrings"` // QueryValue QueryValue string `json:"queryValue,omitempty"` // TagKey Only required for a DynamicFieldType of TAG_KEY TagKey string `json:"tagKey,omitempty"` // DynamicFieldType (TAG_KEY, MATCHING_SOURCE_TAG, SOURCE_TAG, SOURCE, METRIC_NAME) Only required for a Parameter type of Dynamic. DynamicFieldType string `json:"dynamicFieldType,omitempty"` }
ParameterDetail represents a parameter to dashboard that can be consumed in queries
type Query ¶
type Query struct { // Params is the set of parameters that will be used when executing the Query Params *QueryParams // Response will be the response of the last executed Query Response *QueryResponse // contains filtered or unexported fields }
Query represents a query to be made against the Charts API
func (*Query) Execute ¶
func (q *Query) Execute() (*QueryResponse, error)
Execute is used to execute a query against the Wavefront Chart API
func (*Query) SetEndTime ¶
SetEndTime sets the time at which the query should end
func (*Query) SetStartTime ¶
SetStartTime sets the time from which to query for points. 'seconds' is the number of seconds before the end-time that the query will be inclusive of. EndTime must be set before calling this function. Some constants are provided for convenience: LastHour, Last3Hours, LastDay etc.
type QueryParams ¶
type QueryParams struct { // Name is an optional name to identify the query Name string `query:"n"` // QueryString is the actual timeseries query to be executed QueryString string `query:"q"` // StartTime is the start time for the query in epoch milliseconds StartTime string `query:"s"` // EndTime is the end time for the query in epoch milliseconds EndTime string `query:"e"` // Granularity is the granularity of the points returned, and can be one of // d,h,m or s Granularity string `query:"g"` // MaxPoints is the maximum number of points to return MaxPoints string `query:"p"` // SeriesOutsideTimeWindow is a boolean to indicate whether series with only // points that are outside of the query window will be returned SeriesOutsideTimeWindow bool `query:"i"` // AutoEvents is a boolean to indicate whether to return Events for sources // included in the query AutoEvents bool `query:"autoEvents"` // SummarizationStrategy is the strategy to be used when grouping points together. // Valid values are MEAN, MEDIAN, MIN, MAX, SUN, COUNT, LAST, FIRST SummarizationStrategy string `query:"summarization"` // ListMode is a boolean to indicate whether to retrieve events more optimally // displayed for a list. ListMode bool `query:"listmode"` // StrictMode is a boolean which, if true, will not return points outside of the // query window. Defaults to false if ommitted. StrictMode bool `query:"strict"` // IncludeObsoleteMetrics is a boolean to indicate whether to return points from // sources which have stopped reporting. Defaults to false if ommitted. IncludeObsoleteMetrics bool `query:"includeObsoleteMetrics"` }
QueryParams represents parameters that will be passed when making a Query
func NewQueryParams ¶
func NewQueryParams(query string) *QueryParams
NewQueryParams takes a query string and returns a set of QueryParams with a query window of one hour since now and a set of sensible default vakues
func NewQueryParamsNoStrict ¶
func NewQueryParamsNoStrict(query string) *QueryParams
type QueryResponse ¶
type QueryResponse struct { RawResponse *bytes.Reader TimeSeries []TimeSeries `json:"timeseries"` Query string `json:"query"` Stats map[string]int `json:"stats"` Name string `json:"name"` Granularity int `json:"granularity"` Hosts []string `json:"hostsUsed"` Warnings string `json:"warnings"` }
QueryResponse is used to represent a Wavefront query response
func (QueryResponse) String ¶
func (qr QueryResponse) String() string
String outputs the time-series of a QueryResponse object in a human-readable format
func (*QueryResponse) UnmarshalJSON ¶
func (qr *QueryResponse) UnmarshalJSON(data []byte) error
type Row ¶
type Row struct { // Name represents the display name of the Row Name string `json:"name"` // HeightFactor sets the height of the Row HeightFactor int `json:"heightFactor"` // Charts is an array of Chart that this row contains Charts []Chart `json:"charts"` }
Row represents a single Row withing a Section of a Wavefront Dashboard
type Search ¶
type Search struct { // Type is the type of entity to be searched for (i.e. alert, event, dashboard, // extlink, cloudintegration etc.) Type string // Params are the Search parameters to be applied Params *SearchParams // Deleted is whether to search against the /{entity}/deleted endpoint (for // deleted items) instead of the normal one. Defaults to false. Deleted bool // contains filtered or unexported fields }
Search represents a search to be made against the Search API
func (*Search) Execute ¶
func (s *Search) Execute() (*SearchResponse, error)
Execute is used to carry out a search
type SearchCondition ¶
type SearchCondition struct { // Key is the type of parameter to be matched (e.g. tags, status, id) Key string `json:"key"` // Value is the value of Key to be searched for (e.g. the tag name, or snoozed) Value string `json:"value"` // MatchingMethod must be one of CONTAINS, STARTSWITH, EXACT, TAGPATH MatchingMethod string `json:"matchingMethod"` }
SearchCondition represents a single search condition. Multiple conditions can be applied to one search, they will act as a logical AND.
type SearchParams ¶
type SearchParams struct { // Conditions are the search conditions to be matched. // If multiple are given they will act like a logical AND Conditions []*SearchCondition `json:"query"` // Limit is the max number of results to be returned. Defaults to 100. Limit int `json:"limit"` // Offset is the offset from the first result to be returned. // For instance, an Offset of 100 will yield results 101 - 200 // (assuming a Limit of 100). Defaults to 0. Offset int `json:"offset"` // TimeRange is the range between which results will be searched. // This is only valid for certain search types (e.g. Events) TimeRange *TimeRange `json:"timeRange,omitempty"` }
SearchParams represents paramaters used to effect a Search. If multiple search terms are given they will act like a logical AND. If Conditions is nil, all items of the given Type will be returned
type SearchResponse ¶
type SearchResponse struct { // RawResponse is the raw JSON response returned by Wavefront from a Search // operation RawResponse *bytes.Reader // Response is the response body of a Search operation Response struct { // Items will be the Wavefront entities returned by a successful search // operation (i.e. the Alerts, or Dashboards etc.) Items json.RawMessage // MoreResults indicates whether there are further items to be returned in a // paginated response. MoreItems bool `json:"moreItems"` } `json:"response"` // NextOffset is the offset that should be used to retrieve the next page of // results in a paginated response. If there are no more results, it will be zero. NextOffset int }
SearchResponse represents the result of a successful search operation
type Section ¶
type Section struct { // Name is the name given to this section Name string `json:"name"` // Rows is an array of Rows in this section Rows []Row `json:"rows"` }
Section Represents a Single section within a Dashboard
type Source ¶
type Source struct { // Name is the name given to the source Name string `json:"name"` // Query is a wavefront Query Query string `json:"query"` // Disabled indicated whether the source is disabled from being rendered on the chart Disabled bool `json:"disabled,omitempty"` // ScatterPlotSource ScatterPlotSource string `json:"scatterPlotSource"` // QuerybuilderEnabled QuerybuilderEnabled bool `json:"querybuilderEnabled"` // SourceDescription SourceDescription string `json:"sourceDescription"` // SourceColor SourceColor string `json:"sourceColor,omitempty"` }
Source represents a single Source for a Chart
type SourceLabelPair ¶
type Target ¶
type Target struct { // Description is a description of the target Target Description string `json:"description"` // ID is the Wavefront-assigned ID of an existing Target ID *string `json:"id"` // Template is the Mustache template for the notification body Template string `json:"template"` // Title is the title(name) of the Target Title string `json:"title"` // Method must be EMAIL, WEBHOOK or PAGERDUTY Method string `json:"method"` // Recipient is a comma-separated list of email addresses, webhook URL, // or 32-digit PagerDuty key to which notifications will be sent for this Target Recipient string `json:"recipient"` // EmailSubject is the subject of the email which will be sent for this Target // (EMAIL targets only) EmailSubject string `json:"emailSubject"` // IsHTMLContent is a boolean value for wavefront to add HTML Boilerplate // while using HTML Templates as email. // (EMAIL targets only) IsHtmlContent bool `json:"isHtmlContent"` // ContentType is the content type for webhook posts (e.g. application/json) // (WEBHOOK targets only) ContentType string `json:"contentType"` // CustomHeaders are any custom HTTP headers that should be sent with webhook, // in key:value syntax (WEBHOOK targets only) CustomHeaders map[string]string `json:"customHttpHeaders"` // Triggers is a list of Alert states that will trigger this notification // and can include ALERT_OPENED, ALERT_RESOLVED, ALERT_STATUS_RESOLVED, // ALERT_AFFECTED_BY_MAINTENANCE_WINDOW, ALERT_SNOOZED, ALERT_NO_DATA, // ALERT_NO_DATA_RESOLVED Triggers []string `json:"triggers"` }
Target represents a Wavefront Alert Target, for routing notifications associated with Alerts. Targets can be either email or webhook targets, and the Method must be set appropriately.
type Targets ¶
type Targets struct {
// contains filtered or unexported fields
}
Targets is used to perform target-related operations against the Wavefront API
func (Targets) Create ¶
Create is used to create a Target in Wavefront. If successful, the ID field of the target will be populated.
func (Targets) Delete ¶
Delete is used to delete an existing Target. The ID field of the target must be populated
func (Targets) Find ¶
func (t Targets) Find(filter []*SearchCondition) ([]*Target, error)
Find returns all targets filtered by the given search conditions. If filter is nil, all targets are returned.
type TimeRange ¶
type TimeRange struct { // StartTime is the time, in epoch milliseconds from which search results // will be returned. StartTime int64 `json:"earliestStartTimeEpochMillis"` // EndTime is the time, in epoch milliseconds up to which search results // will be returned. EndTime int64 `json:"latestStartTimeEpochMillis"` }
TimeRange represents a range of times to search between. It is only valid for certain search types (e.g. Events)
func NewTimeRange ¶
NewTimeRange returns a *TimeRange encompassing the period seconds before the given endTime. If endTime is 0, the current time will be used.
type TimeSeries ¶
type TimeSeries struct { DataPoints []DataPoint `json:"data"` Label string `json:"label"` Host string `json:"host"` Tags map[string]string `json:"tags"` }
TimeSeries represents a single TimeSeries as returned by Wavefront
type Wavefronter ¶
type Wavefronter interface { NewRequest(method, path string, params *map[string]string, body []byte) (*http.Request, error) Do(req *http.Request) (io.ReadCloser, error) }
Wavefronter is an interface that a Wavefront client must satisfy (generally this is abstracted for easier testing)