transit

package module
v0.0.0-...-e2b3b80 Latest Latest
Warning

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

Go to latest
Published: Nov 24, 2021 License: GPL-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const (
	Value    MetricSampleType = "Value"
	Warning                   = "Warning"
	Critical                  = "Critical"
	Min                       = "Min"
	Max                       = "Max"
)

TimeSeries Metric Sample Possible Types

Variables

MonitorStatusWeightService defines weight of Monitor Status for multi-state comparison

Functions

This section is empty.

Types

type AgentIdentity

type AgentIdentity struct {
	AgentID string `json:"agentId" yaml:"agentId"`
	AppName string `json:"appName" yaml:"appName"`
	AppType string `json:"appType" yaml:"appType"`
}

AgentIdentity defines TCG Agent Identity

type BaseResource

type BaseResource struct {
	BaseTransitData
	// Device (usually IP address), leave empty if not available, will default to name
	Device string `json:"device,omitempty"`
}

type BaseTransitData

type BaseTransitData struct {
	// The unique name of the resource
	Name string `json:"name,required"`
	// Type: Required. The resource type of the resource
	// General Nagios Types are hosts, whereas CloudHub can have richer complexity
	Type ResourceType `json:"type,required"`
	// Owner relationship for associations like hypervisor->virtual machine
	Owner string `json:"owner,omitempty"`
	// CloudHub Categorization of resources
	Category string `json:"category,omitempty"`
	// Optional description of this resource, such as Nagios notes
	Description string `json:"description,omitempty"`
	// Foundation Properties
	Properties map[string]TypedValue `json:"properties,omitempty"`
}

type ComputeType

type ComputeType string

ComputeType defines CloudHub Compute Types

const (
	Query         ComputeType = "Query"
	Regex         ComputeType = "Regex"
	Synthetic     ComputeType = "Synthetic"
	Informational ComputeType = "Informational"
	Performance   ComputeType = "Performance"
	Health        ComputeType = "Health"
)

CloudHub Compute Types

type DynamicInventoryRequest

type DynamicInventoryRequest struct {
	Context       *TracerContext             `json:"context,omitempty"`
	OwnershipType HostOwnershipType          `json:"ownershipType,omitempty"`
	Resources     []DynamicInventoryResource `json:"resources"`
	Groups        []ResourceGroup            `json:"groups,omitempty"`
}

DynamicInventoryRequest defines SynchronizeInventory payload

func (DynamicInventoryRequest) String

func (inventoryRequest DynamicInventoryRequest) String() string

type DynamicInventoryResource

type DynamicInventoryResource struct {
	BaseResource
	// Inventory Service collection
	Services []DynamicInventoryService `json:"services"`
}

DynamicInventoryResource represents a resource that is included in a inventory scan. Examples include:

  • nagios host
  • virtual machine instance
  • RDS database
  • storage devices such as disks
  • cloud resources such as cloud apps, cloud functions(lambdas)

An DynamicInventoryResource is the representation of a specific monitored resource during an inventory scan. Each DynamicInventoryResource contains list of services (InventoryService) (no metrics are sent).

func (*DynamicInventoryResource) CreateProperty

func (inventoryResource *DynamicInventoryResource) CreateProperty(name string, value TypedValue)

func (DynamicInventoryResource) String

func (inventoryResource DynamicInventoryResource) String() string

type DynamicInventoryService

type DynamicInventoryService struct {
	BaseTransitData
}

DynamicInventoryService represents a Groundwork Service that is included in a inventory scan. In cloud systems, services are usually modeled as a complex metric definition, with each sampled metric variation represented as as single metric time series. During inventory scans, TCG does not gather metric samples.

DynamicInventoryService collections are attached to an DynamicInventoryResource during inventory scans.

func (*DynamicInventoryService) CreateProperty

func (inventoryService *DynamicInventoryService) CreateProperty(name string, value TypedValue)

func (DynamicInventoryService) String

func (inventoryService DynamicInventoryService) String() string

type DynamicMonitoredResource

type DynamicMonitoredResource struct {
	BaseResource
	// Restrict to a Groundwork Monitor Status
	Status MonitorStatus `json:"status,required"`
	// The last status check time on this resource
	LastCheckTime MillisecondTimestamp `json:"lastCheckTime,omitempty"`
	// The next status check time on this resource
	NextCheckTime MillisecondTimestamp `json:"nextCheckTime,omitempty"`
	// Nagios plugin output string
	LastPlugInOutput string `json:"lastPluginOutput,omitempty"`
	// Services state collection
	Services []DynamicMonitoredService `json:"services"`
}

A DynamicMonitoredResource defines the current status and services of a resource during a metrics scan. Examples include:

  • nagios host
  • virtual machine instance
  • RDS database
  • storage devices such as disks
  • cloud resources such as cloud apps, cloud functions(lambdas)

A DynamicMonitoredResource is the representation of a specific monitored resource during a metric scan. Each DynamicMonitoredResource contains list of services (MonitoredService). A DynamicMonitoredResource does not have metrics, only services.

func (*DynamicMonitoredResource) CreateProperty

func (monitoredResource *DynamicMonitoredResource) CreateProperty(name string, value TypedValue)

func (DynamicMonitoredResource) String

func (monitoredResource DynamicMonitoredResource) String() string

func (*DynamicMonitoredResource) ToInventoryResource

func (mr *DynamicMonitoredResource) ToInventoryResource() DynamicInventoryResource

func (*DynamicMonitoredResource) ToMonitoredResourceRef

func (mr *DynamicMonitoredResource) ToMonitoredResourceRef() MonitoredResourceRef

type DynamicMonitoredService

type DynamicMonitoredService struct {
	BaseTransitData
	// Restrict to a Groundwork Monitor Status
	Status MonitorStatus `json:"status,required"`
	// The last status check time on this resource
	LastCheckTime MillisecondTimestamp `json:"lastCheckTime,omitempty"`
	// The next status check time on this resource
	NextCheckTime MillisecondTimestamp `json:"nextCheckTime,omitempty"`
	// Nagios plugin output string
	LastPlugInOutput string `json:"lastPluginOutput,omitempty"`
	// metrics
	Metrics []TimeSeries `json:"metrics"`
}

A DynamicMonitoredService represents a Groundwork Service creating during a metrics scan. In cloud systems, services are usually modeled as a complex metric definition, with each sampled metric variation represented as as single metric time series.

A DynamicMonitoredService contains a collection of TimeSeries Metrics. MonitoredService collections are attached to a DynamicMonitoredResource during a metrics scan.

func (*DynamicMonitoredService) CreateProperties

func (monitoredService *DynamicMonitoredService) CreateProperties(properties map[string]interface{})

func (*DynamicMonitoredService) CreateProperty

func (monitoredService *DynamicMonitoredService) CreateProperty(name string, value TypedValue)

func (DynamicMonitoredService) String

func (monitoredService DynamicMonitoredService) String() string

func (*DynamicMonitoredService) ToInventoryService

func (ms *DynamicMonitoredService) ToInventoryService() DynamicInventoryService

type DynamicResourcesWithServicesRequest

type DynamicResourcesWithServicesRequest struct {
	Context   *TracerContext             `json:"context,omitempty"`
	Resources []DynamicMonitoredResource `json:"resources"`
	Groups    []ResourceGroup            `json:"groups,omitempty"`
}

DynamicResourcesWithServicesRequest defines SendResourcesWithMetrics payload

func (DynamicResourcesWithServicesRequest) String

func (resourcesWithServicesRequest DynamicResourcesWithServicesRequest) String() string

type GroundworkEvent

type GroundworkEvent struct {
	Device              string               `json:"device,omitempty"`
	Host                string               `json:"host,required"`
	Service             string               `json:"service,omitempty"`
	OperationStatus     string               `json:"operationStatus,omitempty"`
	MonitorStatus       string               `json:"monitorStatus,required"`
	Severity            string               `json:"severity,omitempty"`
	ApplicationSeverity string               `json:"applicationSeverity,omitempty"`
	Component           string               `json:"component,omitempty"`
	SubComponent        string               `json:"subComponent,omitempty"`
	Priority            string               `json:"priority,omitempty"`
	TypeRule            string               `json:"typeRule,omitempty"`
	TextMessage         string               `json:"textMessage,omitempty"`
	LastInsertDate      MillisecondTimestamp `json:"lastInsertDate,omitempty"`
	ReportDate          MillisecondTimestamp `json:"reportDate,required"`
	AppType             string               `json:"appType,required"`
	// Update level attributes (update only)
	MonitorServer     string `json:"monitorServer,omitempty"`
	ConsolidationName string `json:"consolidationName,omitempty"`
	LogType           string `json:"logType,omitempty"`
	ErrorType         string `json:"errorType,omitempty"`
	LoggerName        string `json:"loggerName,omitempty"`
	ApplicationName   string `json:"applicationName,omitempty"`
}

GroundworkEvent describes event

func (GroundworkEvent) String

func (groundworkEvent GroundworkEvent) String() string

type GroundworkEventAck

type GroundworkEventAck struct {
	AppType            string `json:"appType,required"`
	Host               string `json:"host,required"`
	Service            string `json:"service,omitempty"`
	AcknowledgedBy     string `json:"acknowledgedBy,omitempty"`
	AcknowledgeComment string `json:"acknowledgeComment,omitempty"`
}

GroundworkEventAck describes event ack

func (GroundworkEventAck) String

func (groundworkEventAck GroundworkEventAck) String() string

type GroundworkEventUnack

type GroundworkEventUnack struct {
	AppType string `json:"appType,required"`
	Host    string `json:"host,required"`
	Service string `json:"service,omitempty"`
}

GroundworkEventUnack describes event ack

func (GroundworkEventUnack) String

func (groundworkEventUnack GroundworkEventUnack) String() string

type GroundworkEventsAckRequest

type GroundworkEventsAckRequest struct {
	Acks []GroundworkEventAck `json:"acks"`
}

GroundworkEventsAckRequest describes request payload

type GroundworkEventsRequest

type GroundworkEventsRequest struct {
	Events []GroundworkEvent `json:"events"`
}

GroundworkEventsRequest describes request payload

func (GroundworkEventsRequest) String

func (groundworkEventsRequest GroundworkEventsRequest) String() string

type GroundworkEventsUnackRequest

type GroundworkEventsUnackRequest struct {
	Unacks []GroundworkEventUnack `json:"unacks"`
}

GroundworkEventsUnackRequest describes request payload

type GroupType

type GroupType string

GroupType defines the foundation group type

const (
	HostGroup    GroupType = "HostGroup"
	ServiceGroup GroupType = "ServiceGroup"
	CustomGroup  GroupType = "CustomGroup"
)

The group type uniquely defining corresponding foundation group type

type HostOwnershipType

type HostOwnershipType string

HostOwnershipType defines the host ownership type of inventory.

const (
	Creator HostOwnershipType = "Creator"
	Take    HostOwnershipType = "Take"
	Yield   HostOwnershipType = "Yield"
)

Take - Always take ownership, can overwrite ownership, aggressive take everything Creator - Leave ownership if already owned (owns things it creates, if I didn't create it I don't own it) Yield - Always defer ownership - don't want to own it, if someone else comes along, let them own it

type HostServiceInDowntime

type HostServiceInDowntime struct {
	HostName               string `json:"hostName"`
	ServiceDescription     string `json:"serviceDescription,omitempty"`
	ScheduledDowntimeDepth int    `json:"scheduledDowntimeDepth"`
	EntityType             string `json:"entityType"`
	EntityName             string `json:"entityName"`
}

HostServiceInDowntime describes downtime schedule

type HostServicesInDowntime

type HostServicesInDowntime struct {
	BizHostServiceInDowntimes []HostServiceInDowntime `json:"bizHostServiceInDowntimes"`
}

HostServicesInDowntime defines type used for ClearInDowntime API payload

type HostsAndServices

type HostsAndServices struct {
	HostNames                 []string `json:"hostNames"`
	ServiceDescriptions       []string `json:"serviceDescriptions"`
	HostGroupNames            []string `json:"hostGroupNames"`
	ServiceGroupCategoryNames []string `json:"serviceGroupCategoryNames"`
	SetHosts                  bool     `json:"setHosts"`
	SetServices               bool     `json:"setServices"`
}

HostsAndServices defines type used for SetInDowntime API payload

type IncidentAlert

type IncidentAlert struct {
	IncidentID    string               `json:"incidentId"`
	ResourceName  string               `json:"resourceName,required"`
	Status        string               `json:"status"`
	StartedAt     MillisecondTimestamp `json:"startedAt"`
	EndedAt       MillisecondTimestamp `json:"endedAt,omitempty"`
	ConditionName string               `json:"conditionName"`
	URL           string               `json:"url,omitempty"`
	Summary       string               `json:"summary,omitempty"`
}

IncidentAlert describes alerts received from cloud services

func (IncidentAlert) String

func (incidentAlert IncidentAlert) String() string

type InventoryRequest

type InventoryRequest struct {
	Context       *TracerContext      `json:"context,omitempty"`
	OwnershipType HostOwnershipType   `json:"ownershipType,omitempty"`
	Resources     []InventoryResource `json:"resources"`
	Groups        []ResourceGroup     `json:"groups,omitempty"`
}

InventoryRequest defines SynchronizeInventory payload

type InventoryResource

type InventoryResource struct {
	// The unique Name of the resource
	Name string `json:"name,required"`
	// Type: Required. The resource type of the resource
	// General Nagios Types are hosts, whereas CloudHub can have richer complexity
	Type ResourceType `json:"type,required"`
	// Owner relationship for associations like hypervisor->virtual machine
	Owner string `json:"owner,omitempty"`
	// CloudHub Categorization of resources
	Category string `json:"category,omitempty"`
	// Optional Description of this resource, such as Nagios notes
	Description string `json:"description,omitempty"`
	// Device is needed for detection on Foundation side
	Device string `json:"device,omitempty"`
	// Foundation Properties
	Properties map[string]TypedValue `json:"properties,omitempty"`
	Services   []InventoryService    `json:"services"`
}

type InventoryService

type InventoryService struct {
	// The unique name of the resource
	Name string `json:"name,required"`
	// Type: Required. The resource type of the resource
	// General Nagios Types are hosts, whereas CloudHub can have richer complexity
	Type ResourceType `json:"type,required"`
	// Owner relationship for associations like hypervisor->virtual machine
	Owner string `json:"owner,omitempty"`
	// CloudHub Categorization of resources
	Category string `json:"category,omitempty"`
	// Optional description of this resource, such as Nagios notes
	Description string `json:"description,omitempty"`
	// Foundation Properties
	Properties map[string]TypedValue `json:"properties,omitempty"`
}

type LabelDescriptor

type LabelDescriptor struct {
	// Description: A human-readable description for the label.
	Description string `json:"description,omitempty"`

	// Key: The label key.
	Key string `json:"key,omitempty"`

	// ValueType: The type of data that can be assigned to the label.
	//
	// Possible values:
	//   "STRING" - A variable-length string. This is the default.
	//   "BOOL" - Boolean; true or false.
	//   "INT64" - A 64-bit signed integer.
	ValueType ValueType `json:"valueType,omitempty"`
}

LabelDescriptor defines a Label.

func (LabelDescriptor) String

func (labelDescriptor LabelDescriptor) String() string

type MetricDefinition

type MetricDefinition struct {
	Name              string      `json:"name"`
	CustomName        string      `json:"customName,omitempty"`
	Description       string      `json:"description,omitempty"`
	Monitored         bool        `json:"monitored,omitempty"`
	Graphed           bool        `json:"graphed,omitempty"`
	MetricType        MetricKind  `json:"metricType"`
	ComputeType       ComputeType `json:"computeType"`
	ServiceType       string      `json:"serviceType"`
	SourceType        string      `json:"sourceType,omitempty"`
	AggregateType     string      `json:"aggregateType,omitempty"`
	WarningThreshold  int         `json:"warningThreshold"`
	CriticalThreshold int         `json:"criticalThreshold"`
	Expression        string      `json:"expression,omitempty"`
	Format            string      `json:"format,omitempty"`
}

func (MetricDefinition) String

func (metricDefinition MetricDefinition) String() string

type MetricDescriptor

type MetricDescriptor struct {
	// Custom Name: Override the resource type with a custom name of the metric descriptor.
	CustomName string `json:"name,omitempty"`

	// Description: A detailed description of the metric, which can be used
	// in documentation.
	Description string `json:"description,omitempty"`

	// DisplayName: A concise name for the metric, which can be displayed in
	// user interfaces. Use sentence case without an ending period, for
	// example "Request count". This field is optional but it is recommended
	// to be set for any metrics associated with user-visible concepts, such
	// as Quota.
	DisplayName string `json:"displayName,omitempty"`

	// Labels: The set of labels that can be used to describe a specific
	// instance of this metric type. For example, the
	// appengine.googleapis.com/http/server/response_latencies metric type
	// has a label for the HTTP response code, response_code, so you can
	// look at latencies for successful responses or just for responses that
	// failed.
	Labels []*LabelDescriptor `json:"labels,omitempty"`

	Thresholds []*ThresholdDescriptor `json:"thresholds,omitempty"`

	// Type: The metric type, including its DNS name prefix. The type is not
	// URL-encoded. All user-defined metric types have the DNS name
	// custom.googleapis.com or external.googleapis.com. Metric types should
	// use a natural hierarchical grouping. For
	// example:
	// "custom.googleapis.com/invoice/paid/amount"
	// "external.googlea
	// pis.com/prometheus/up"
	// "appengine.googleapis.com/http/server/response_
	// latencies"
	//
	Type string `json:"type,omitempty"`

	// Unit: The unit in which the metric value is reported. It is only
	// applicable if the value_type is INT64, DOUBLE, or DISTRIBUTION. The
	// supported units are a subset of The Unified Code for Units of Measure
	// (http://unitsofmeasure.org/ucum.html) standard, added as we encounter
	// the need for them in monitoring contexts.
	Unit UnitType `json:"unit,omitempty"`

	// ValueType: Whether the measurement is an integer, a floating-point
	// number, etc. Some combinations of metric_kind and value_type might
	// not be supported.
	ValueType ValueType `json:"valueType,omitempty"`

	// Groundwork Compute Type such as Synthetic
	ComputeType ComputeType `json:"computeType,omitempty"`

	// MetricKind: Whether the metric records instantaneous values, changes
	// to a value, etc. Some combinations of metric_kind and value_type
	// might not be supported.
	//
	// Possible values:
	//   "METRIC_KIND_UNSPECIFIED" - Do not use this default value.
	//   "GAUGE" - An instantaneous measurement of a value.
	//   "DELTA" - The change in a value during a time interval.
	//   "CUMULATIVE" - A value accumulated over a time interval. Cumulative
	// measurements in a time series should have the same start time and
	// increasing end times, until an event resets the cumulative value to
	// zero and sets a new start time for the following samples.
	MetricKind MetricKind `json:"metricKind"`
}

MetricDescriptor defines a metric type and its schema

func (MetricDescriptor) String

func (metricDescriptor MetricDescriptor) String() string

type MetricKind

type MetricKind string

MetricKind defines the metric kind of the time series.

const (
	MetricKindUnspecified MetricKind = "METRIC_KIND_UNSPECIFIED"
	Gauge                 MetricKind = "GAUGE"
	Delta                 MetricKind = "DELTA"
	Cumulative            MetricKind = "CUMULATIVE"
)

MetricKindUnspecified - Do not use this default value. Gauge - An instantaneous measurement of a value. Delta - The change in a value during a time interval. Cumulative - A value accumulated over a time interval. Cumulative

type MetricSampleType

type MetricSampleType string

MetricSampleType defines TimeSeries Metric Sample Possible Types

type MetricsProfile

type MetricsProfile struct {
	Name        string             `json:"name"`
	ProfileType string             `json:"profileType"`
	IsTemplate  bool               `json:"isTemplate"`
	Metrics     []MetricDefinition `json:"metrics"`
}

func (MetricsProfile) String

func (metricsProfile MetricsProfile) String() string

type MillisecondTimestamp

type MillisecondTimestamp struct {
	time.Time
}

MillisecondTimestamp refers to the JSON representation of timestamps, for time-data interchange, as a single integer representing a modified version of whole milliseconds since the UNIX epoch (00:00:00 UTC on January 1, 1970). Individual languages (Go, C, Java) will typically implement this structure using a more-complex construction in their respective contexts, containing even finer granularity for local data storage, typically at the nanosecond level.

The "modified version" comment reflects the following simplification. Despite the already fine-grained representation as milliseconds, this data value takes no account of leap seconds; for all of our calculations, we simply pretend they don't exist. Individual feeders will typically map a 00:00:60 value for a leap second, obtained as a string so the presence of the leap second is obvious, as 00:01:00, and the fact that 00:01:00 will occur again in the following second will be silently ignored. This means that any monitoring which really wants to accurately reflect International Atomic Time (TAI), UT1, or similar time coordinates will be subject to some disruption. It also means that even in ordinary circumstances, any calculations of sub-second time differences might run into surprises, since the following timestamps could appear in temporal order:

    actual time   relative reported time in milliseconds
A:  00:00:59.000  59000
B:  00:00:60.000  60000
C:  00:00:60.700  60700
D:  00:01:00.000  60000
E:  00:01:00.300  60300
F:  00:01:01.000  61000

In such a situation, (D - C) and (E - C) would be negative numbers.

In other situations, a feeder might obtain a timestamp from a system hardware clock which, say, counts local nanoseconds and has no notion of any leap seconds having been inserted into human-readable string-time representations. So there could be some amount of offset if such values are compared across such a boundary.

Beyond that, there is always the issue of computer clocks not being directly tied to atomic clocks, using inexpensive non-temperature-compensated crystals for timekeeping. Such hardware can easily drift dramatically off course, and the local timekeeping may or may not be subject to course correction using HTP, chrony, or similar software that periodically adjusts the system time to keep it synchronized with the Internet. Also, there may be large jumps in either a positive or negative direction when a drifted clock is suddenly brought back into synchronization with the rest of the world.

In addition, we ignore here all temporal effects of Special Relativity, not to mention further adjustments needed to account for General Relativity. This is not a theoretical joke; those who monitor GPS satellites should take note of the limitations of this data type, and use some other data type for time-critical data exchange and calculations.

The point of all this being, fine resolution of clock values should never be taken too seriously unless one is sure that the clocks being compared are directly hitched together, and even then one must allow for quantum leaps into the future and time travel into the past.

Finally, note that the Go zero-value of the internal implementation object we use in that language does not have a reasonable value when interpreted as milliseconds since the UNIX epoch. For that reason, the general rule is that the JSON representation of a zero-value for any field of this type, no matter what the originating language, will be to simply omit it from the JSON string. That fact must be taken into account when marshalling and unmarshalling data structures that contain such fields.

func (MillisecondTimestamp) MarshalJSON

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

MarshalJSON implements json.Marshaler.

func (MillisecondTimestamp) String

func (t MillisecondTimestamp) String() string

func (*MillisecondTimestamp) UnmarshalJSON

func (t *MillisecondTimestamp) UnmarshalJSON(input []byte) error

UnmarshalJSON implements json.Unmarshaler.

type MonitorConnection

type MonitorConnection struct {
	ID          int         `json:"id"`
	Server      string      `json:"server"`
	UserName    string      `json:"userName"`
	Password    string      `json:"password"`
	SslEnabled  bool        `json:"sslEnabled"`
	URL         string      `json:"url"`
	Views       []View      `json:"views,omitempty"`
	Extensions  interface{} `json:"extensions"`
	ConnectorID int         `json:"connectorId"`
}

MonitorConnection describes the connection to the monitored system

func (MonitorConnection) String

func (monitorConnection MonitorConnection) String() string

type MonitorStatus

type MonitorStatus string

MonitorStatus represents Groundwork service monitor status

const (
	ServiceOk                  MonitorStatus = "SERVICE_OK"
	ServiceWarning             MonitorStatus = "SERVICE_WARNING"
	ServiceUnscheduledCritical MonitorStatus = "SERVICE_UNSCHEDULED_CRITICAL"
	ServicePending             MonitorStatus = "SERVICE_PENDING"
	ServiceScheduledCritical   MonitorStatus = "SERVICE_SCHEDULED_CRITICAL"
	ServiceUnknown             MonitorStatus = "SERVICE_UNKNOWN"
	HostUp                     MonitorStatus = "HOST_UP"
	HostUnscheduledDown        MonitorStatus = "HOST_UNSCHEDULED_DOWN"
	HostPending                MonitorStatus = "HOST_PENDING"
	HostScheduledDown          MonitorStatus = "HOST_SCHEDULED_DOWN"
	HostUnreachable            MonitorStatus = "HOST_UNREACHABLE"
	HostUnchanged              MonitorStatus = "HOST_UNCHANGED"
)

Groundwork Standard Monitored Resource Statuses

func CalculateResourceStatus

func CalculateResourceStatus(services []DynamicMonitoredService) MonitorStatus

func CalculateServiceStatus

func CalculateServiceStatus(metrics *[]TimeSeries) (MonitorStatus, error)

func CalculateStatus

func CalculateStatus(value *TypedValue, warning *TypedValue, critical *TypedValue) MonitorStatus

type MonitoredResource

type MonitoredResource struct {
	// The unique name of the resource
	Name string `json:"name,required"`
	// Type: Required. The resource type of the resource
	// General Nagios Types are hosts, whereas CloudHub can have richer complexity
	Type ResourceType `json:"type,required"`
	// Owner relationship for associations like hypervisor->virtual machine
	Owner string `json:"owner,omitempty"`
	// Restrict to a Groundwork Monitor Status
	Status MonitorStatus `json:"status,required"`
	// The last status check time on this resource
	LastCheckTime MillisecondTimestamp `json:"lastCheckTime,omitempty"`
	// The next status check time on this resource
	NextCheckTime MillisecondTimestamp `json:"nextCheckTime,omitempty"`
	// Nagios plugin output string
	LastPlugInOutput string `json:"lastPluginOutput,omitempty"`
	// Foundation Properties
	Properties map[string]TypedValue `json:"properties,omitempty"`
	Services   []MonitoredService    `json:"services"`
}

type MonitoredResourceRef

type MonitoredResourceRef struct {
	// The unique name of the resource
	Name string `json:"name,required"`
	// Type: Optional. The resource type uniquely defining the resource type
	// General Nagios Types are host and service, whereas CloudHub can have richer complexity
	Type ResourceType `json:"type,omitempty"`
	// Owner relationship for associations like host->service
	Owner string `json:"owner,omitempty"`
}

MonitoredResourceRef references a MonitoredResource in a group collection

func (MonitoredResourceRef) String

func (monitoredResourceRef MonitoredResourceRef) String() string

type MonitoredService

type MonitoredService struct {
	// The unique name of the resource
	Name string `json:"name,required"`
	// Type: Required. The resource type of the resource
	// General Nagios Types are hosts, whereas CloudHub can have richer complexity
	Type ResourceType `json:"type,required"`
	// Owner relationship for associations like hypervisor->virtual machine
	Owner string `json:"owner,omitempty"`
	// CloudHub Categorization of resources
	Category string `json:"category,omitempty"`
	// Optional description of this resource, such as Nagios notes
	Description string `json:"description,omitempty"`
	// Foundation Properties
	Properties map[string]TypedValue `json:"properties,omitempty"`
	// Restrict to a Groundwork Monitor Status
	Status MonitorStatus `json:"status,required"`
	// The last status check time on this resource
	LastCheckTime MillisecondTimestamp `json:"lastCheckTime,omitempty"`
	// The next status check time on this resource
	NextCheckTime MillisecondTimestamp `json:"nextCheckTime,omitempty"`
	// Nagios plugin output string
	LastPlugInOutput string `json:"lastPluginOutput,omitempty"`
	// metrics
	Metrics []TimeSeries `json:"metrics"`
}

type OperationResult

type OperationResult struct {
	Entity   string `json:"entity"`
	Status   string `json:"status"`
	Message  string `json:"message"`
	Location string `json:"location"`
	EntityID int    `json:"entityID"`
}

OperationResult defines API answer

func (OperationResult) String

func (operationResult OperationResult) String() string

type OperationResults

type OperationResults struct {
	ResourcesAdded   int                `json:"successful"`
	ResourcesDeleted int                `json:"failed"`
	EntityType       string             `json:"entityType"`
	Operation        string             `json:"operation"`
	Warning          int                `json:"warning"`
	Count            int                `json:"count"`
	Results          *[]OperationResult `json:"results"`
}

OperationResults defines API answer

func (OperationResults) String

func (operationResults OperationResults) String() string

type ResourceGroup

type ResourceGroup struct {
	GroupName   string                 `json:"groupName,required"`
	Type        GroupType              `json:"type,required"`
	Description string                 `json:"description,omitempty"`
	Resources   []MonitoredResourceRef `json:"resources,required"`
}

ResourceGroup defines group entity

func (ResourceGroup) String

func (resourceGroup ResourceGroup) String() string

type ResourceType

type ResourceType string

ResourceType defines the resource type

const (
	Host           ResourceType = "host"
	Hypervisor     ResourceType = "hypervisor"
	Instance       ResourceType = "instance"
	VirtualMachine ResourceType = "virtual-machine"
	CloudApp       ResourceType = "cloud-app"
	CloudFunction  ResourceType = "cloud-function"
	LoadBalancer   ResourceType = "load-balancer"
	Container      ResourceType = "container"
	Storage        ResourceType = "storage"
	Network        ResourceType = "network"
	NetworkSwitch  ResourceType = "network-switch"
	NetworkDevice  ResourceType = "network-device"
)

The resource type uniquely defining the resource type General Nagios Types are host and service, whereas CloudHub can have richer complexity

type ResourcesWithServicesRequest

type ResourcesWithServicesRequest struct {
	Context   *TracerContext      `json:"context,omitempty"`
	Resources []MonitoredResource `json:"resources"`
	Groups    []ResourceGroup     `json:"groups,omitempty"`
}

type ServiceType

type ServiceType string

ServiceType defines the service type

const (
	Process ServiceType = "Process"
	Service             = "Service"
)

Possible Types

type ThresholdDescriptor

type ThresholdDescriptor struct {
	// Key: The threshold key.
	Key   string `json:"key"`
	Value int32  `json:"value"`
}

ThresholdDescriptor defines a Threshold

func (ThresholdDescriptor) String

func (thresholdDescriptor ThresholdDescriptor) String() string

type ThresholdValue

type ThresholdValue struct {
	SampleType MetricSampleType `json:"sampleType"`
	Label      string           `json:"label"`
	Value      *TypedValue      `json:"value"`
}

ThresholdValue describes threshold

func (ThresholdValue) String

func (thresholdValue ThresholdValue) String() string

type TimeInterval

type TimeInterval struct {
	// EndTime: Required. The end of the time interval.
	EndTime MillisecondTimestamp `json:"endTime,omitempty"`

	// StartTime: Optional. The beginning of the time interval. The default
	// value for the start time is the end time. The start time must not be
	// later than the end time.
	StartTime MillisecondTimestamp `json:"startTime,omitempty"`
}

TimeInterval defines a closed time interval. It extends from the start time to the end time, and includes both: [startTime, endTime]. Valid time intervals depend on the MetricKind of the metric value. In no case can the end time be earlier than the start time. For a GAUGE metric, the StartTime value is technically optional; if no value is specified, the start time defaults to the value of the end time, and the interval represents a single point in time. Such an interval is valid only for GAUGE metrics, which are point-in-time measurements. For DELTA and CUMULATIVE metrics, the start time must be earlier than the end time. In all cases, the start time of the next interval must be at least a microsecond after the end time of the previous interval. Because the interval is closed, if the start time of a new interval is the same as the end time of the previous interval, data written at the new start time could overwrite data written at the previous end time.

func (TimeInterval) String

func (value TimeInterval) String() string

type TimeSeries

type TimeSeries struct {
	MetricName string           `json:"metricName"`
	SampleType MetricSampleType `json:"sampleType,omitempty"`
	// Interval: The time interval to which the data sample applies. For
	// GAUGE metrics, only the end time of the interval is used. For DELTA
	// metrics, the start and end time should specify a non-zero interval,
	// with subsequent samples specifying contiguous and non-overlapping
	// intervals. For CUMULATIVE metrics, the start and end time should
	// specify a non-zero interval, with subsequent samples specifying the
	// same start time and increasing end times, until an event resets the
	// cumulative value to zero and sets a new start time for the following
	// samples.
	Interval          *TimeInterval     `json:"interval"`
	Value             *TypedValue       `json:"value"`
	Tags              map[string]string `json:"tags,omitempty"`
	Unit              UnitType          `json:"unit,omitempty"`
	Thresholds        *[]ThresholdValue `json:"thresholds,omitempty"`
	MetricComputeType ComputeType       `json:"-"`
	MetricExpression  string            `json:"-"`
}

TimeSeries defines a single Metric Sample, its time interval, and 0 or more thresholds

func (*TimeSeries) CreateTag

func (timeSeries *TimeSeries) CreateTag(name string, value string)

func (TimeSeries) String

func (timeSeries TimeSeries) String() string

type TracerContext

type TracerContext struct {
	AppType    string               `json:"appType"`
	AgentID    string               `json:"agentId"`
	TraceToken string               `json:"traceToken"`
	TimeStamp  MillisecondTimestamp `json:"timeStamp"`
	Version    VersionString        `json:"version"`
}

TracerContext describes a Transit call

func (TracerContext) String

func (tracerContext TracerContext) String() string

type TypedValue

type TypedValue struct {
	ValueType ValueType `json:"valueType"`

	// BoolValue: A Boolean value: true or false.
	BoolValue bool `json:"boolValue,omitempty"`

	// DoubleValue: A 64-bit double-precision floating-point number. Its
	// magnitude is approximately &plusmn;10<sup>&plusmn;300</sup> and it
	// has 16 significant digits of precision.
	DoubleValue float64 `json:"doubleValue"`

	// Int64Value: A 64-bit integer. Its range is approximately
	// &plusmn;9.2x10<sup>18</sup>.
	IntegerValue int64 `json:"integerValue"`

	// StringValue: A variable-length string value.
	StringValue string `json:"stringValue,omitempty"`

	// a time stored as full timestamp
	TimeValue *MillisecondTimestamp `json:"timeValue,omitempty"`
}

TypedValue defines a single strongly-typed value.

func (TypedValue) String

func (value TypedValue) String() string

type UnitType

type UnitType string

UnitType - Supported units are a subset of The Unified Code for Units of Measure (http://unitsofmeasure.org/ucum.html) standard, added as we encounter the need for them in monitoring contexts.

const (
	UnitCounter UnitType = "1"
	PercentCPU  UnitType = "%{cpu}"
	KB          UnitType = "KB"
	MB          UnitType = "MB"
	GB          UnitType = "GB"
)

Supported units

type ValueType

type ValueType string

ValueType defines the data type of the value of a metric

const (
	IntegerType     ValueType = "IntegerType"
	DoubleType      ValueType = "DoubleType"
	StringType      ValueType = "StringType"
	BooleanType     ValueType = "BooleanType"
	TimeType        ValueType = "TimeType"
	UnspecifiedType ValueType = "UnspecifiedType"
)

Data type of the value of a metric

type VersionString

type VersionString string

VersionString defines type of constant

const (
	ModelVersion VersionString = "1.0.0"
)

ModelVersion defines versioning

type View

type View struct {
	Name        string                 `json:"name"`
	DisplayName string                 `json:"displayName"`
	Enabled     bool                   `json:"enabled"`
	Extensions  map[string]interface{} `json:"extensions,omitempty"`
}

Directories

Path Synopsis
Package logper provides logger wrapper preventing external dependencies in library
Package logper provides logger wrapper preventing external dependencies in library

Jump to

Keyboard shortcuts

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