v1.1.11 Latest Latest

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

Go to latest
Published: Mar 9, 2023 License: Apache-2.0 Imports: 25 Imported by: 0



Package checkmgr provides a check management interface to circonus-gometrics



This section is empty.


This section is empty.


This section is empty.


type BrokerCNType

type BrokerCNType string

BrokerCNType broker common name

type BrokerConfig

type BrokerConfig struct {
	// a specific broker id (numeric portion of cid)
	ID string
	// one or more tags used to select 1-n brokers from which to select
	// when creating a new check (e.g. datacenter:abc or loc:dfw,dc:abc)
	SelectTag string
	// for a broker to be considered viable it must respond to a
	// connection attempt within this amount of time e.g. 200ms, 2s, 1m
	MaxResponseTime string
	// TLS configuration to use when communicating within broker
	TLSConfig *tls.Config

BrokerConfig options for broker

type CACert

type CACert struct {
	Contents string `json:"contents"`

CACert contains cert returned from Circonus API

type CheckConfig

type CheckConfig struct {
	// a specific submission url
	SubmissionURL string
	// a specific check id (not check bundle id)
	ID string
	// unique instance id string
	// used to search for a check to use
	// used as when creating a check
	InstanceID string
	// explicitly set (default: instance id)
	TargetHost string
	// a custom display name for the check (as viewed in UI Checks)
	// default: instance id
	DisplayName string
	// unique check searching tag (or tags)
	// used to search for a check to use (combined with instanceid)
	// used as a regular tag when creating a check
	SearchTag string
	// httptrap check secret (for creating a check)
	Secret string
	// additional tags to add to a check (when creating a check)
	// these tags will not be added to an existing check
	Tags string
	// max amount of time to to hold on to a submission url
	// when a given submission fails (due to retries) if the
	// time the url was last updated is > than this, the trap
	// url will be refreshed (e.g. if the broker is changed
	// in the UI) **only relevant when check management is enabled**
	// e.g. 5m, 30m, 1h, etc.
	MaxURLAge string
	// force metric activation - if a metric has been disabled via the UI
	// the default behavior is to *not* re-activate the metric; this setting
	// overrides the behavior and will re-activate the metric when it is
	// encountered. "(true|false)", default "false"
	ForceMetricActivation string
	// Type of check to use (default: httptrap)
	Type string
	// Custom check config fields (default: none)
	CustomConfigFields map[string]string

CheckConfig options for check

type CheckDisplayNameType

type CheckDisplayNameType string

CheckDisplayNameType check display name

type CheckInstanceIDType

type CheckInstanceIDType string

CheckInstanceIDType check instance id

type CheckManager

type CheckManager struct {
	Log   *log.Logger
	Debug bool
	// contains filtered or unexported fields

CheckManager settings

func New

func New(cfg *Config) (*CheckManager, error)

New returns a new check manager

func NewCheckManager

func NewCheckManager(cfg *Config) (*CheckManager, error)

NewCheckManager returns a new check manager

func (*CheckManager) ActivateMetric

func (cm *CheckManager) ActivateMetric(name string) bool

ActivateMetric determines if a given metric should be activated

func (*CheckManager) AddMetricTags

func (cm *CheckManager) AddMetricTags(metricName string, tags []string, appendTags bool) bool

AddMetricTags updates check bundle metrics with tags

func (*CheckManager) GetSubmissionURL

func (cm *CheckManager) GetSubmissionURL() (*Trap, error)

GetSubmissionURL returns submission url for circonus

func (*CheckManager) Initialize

func (cm *CheckManager) Initialize()

Initialize for sending metrics

func (*CheckManager) IsMetricActive

func (cm *CheckManager) IsMetricActive(name string) bool

IsMetricActive checks whether a given metric name is currently active(enabled)

func (*CheckManager) IsReady

func (cm *CheckManager) IsReady() bool

IsReady reflects if the check has been initialied and metrics can be sent to Circonus

func (*CheckManager) RefreshTrap

func (cm *CheckManager) RefreshTrap() error

RefreshTrap check when the last time the URL was reset, reset if needed

func (*CheckManager) ResetTrap

func (cm *CheckManager) ResetTrap() error

ResetTrap URL, force request to the API for the submission URL and broker ca cert

func (*CheckManager) UpdateCheck

func (cm *CheckManager) UpdateCheck(newMetrics map[string]*api.CheckBundleMetric)

UpdateCheck determines if the check needs to be updated (new metrics, tags, etc.)

type CheckSecretType

type CheckSecretType string

CheckSecretType check secret

type CheckTagsType

type CheckTagsType string

CheckTagsType check tags

type CheckTargetType

type CheckTargetType string

CheckTargetType check target/host

type CheckTypeType

type CheckTypeType string

CheckTypeType check type

type Config

type Config struct {
	Log   *log.Logger
	Debug bool

	// Circonus API config
	API api.Config
	// Check specific configuration options
	Check CheckConfig
	// Broker specific configuration options
	Broker BrokerConfig

Config options

type Trap

type Trap struct {
	URL           *url.URL
	TLS           *tls.Config
	IsSocket      bool
	SockTransport *httpunix.Transport

Trap config

Jump to

Keyboard shortcuts

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