azureservice

package
v0.3.6 Latest Latest
Warning

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

Go to latest
Published: Jan 12, 2024 License: BSD-3-Clause Imports: 28 Imported by: 0

README

Azure

Installation

  1. Create a directory for the install. Suggested: mkdir -p /opt/circonus/cloud-agent
  2. Download the latest release
  3. Unpack the release in the directory created in first step
  4. In this directory, create a config folder. Suggested: mkdir /opt/circonus/cloud-agent/etc/azure.d
  5. Auto-create a service specific configuration template in the desired format (yaml, toml, or json). Suggested: sbin/circonus-cloud-agentd --enable-azure --azure-example-conf=yaml > etc/azure.d/azure-config.yaml.
    • Note, the id in the template is defaulted to the filename. This should be changed to a name that will be unique across all cloud-agents used in Circonus
    • Follow configuration instructions to finish config settings
  6. Setup as a system service or run in foreground ensuring that --enable-azure is specified

Options

$  sbin/circonus-cloud-agentd -h
The Circonus Cloud Agent collects metrics from cloud infrastructures and fowards them to Circonus.

Usage:
  circonus-cloud-agent [flags]

Flags:
      --azure-conf-dir string       Azure configuration directory (default "/opt/circonus/cloud-agent/etc/azure.d")
      --azure-example-conf string   Show Azure config (json|toml|yaml) and exit
  -c, --config string               config file (default: circonus-cloud-agent.yaml|.json|.toml)
  -d, --debug                       [ENV: CCA_DEBUG] Enable debug messages
      --enable-azure                Enable Azure metric collection client
  -h, --help                        help for circonus-cloud-agent
      --log-level string            [ENV: CCA_LOG_LEVEL] Log level [(panic|fatal|error|warn|info|debug|disabled)] (default "info")
      --log-pretty                  [ENV: CCA_LOG_PRETTY] Output formatted/colored log lines [ignored on windows]
  -V, --version                     Show version and exit

Configuration

Setting up application in Azure
  1. Login to the Azure portal
  2. Create application
    1. Name the application (e.g. circonus-cloud-agent)
    2. Add reader role to subscription for the application
  3. Collect application configuration information
    1. Directory ID
    2. Application ID
    3. Application secret
    4. Subscription ID
  4. Add these to the azure section of the config file.
Circonus
  1. Use Circonus UI to create or identify an API Token to use
  2. Add the key to the config file under the circonus section
Azure configuration file settings
  • directory_id
  • application_id
  • application_secret
  • subscription_id
  • resource_filter - Use the resourceFilter setting to limit the resources from which metrics are collected. Otherwise, ALL metrics from ALL resources will be collected. The suggested method would be to add a tag to each resource from which to collect metrics and use a filter expression such as tagname eq 'circonus' and tagValue eq 'enabled'
  • cloud_name - default AzurePublicCloud
  • user_agent - default circonus-cloud-agent
  • interval - collection interval in minutes [>=default], default 5
Example configuration

Minimum configuration:

---
id: ...
azure:
  directory_id: ...
  application_id: ...
  application_secret: ...
  subscription_id: ...
circonus:
  key: ...

Documentation

Index

Constants

View Source
const (
	// KeyEnabled toggles whether the Azure module is active or not.
	KeyEnabled = "azure.enabled"
	// DefaultEnabled defines the default setting.
	DefaultEnabled = false

	// KeyConfDir defines the azure configuration directory.
	KeyConfDir = "azure.conf_dir"

	// KeyConfExample shows an example configuration.
	KeyConfExample = "azure.config_example"
)

Variables

View Source
var (
	// DefaultConfDir is the default location of azure configuration files.
	DefaultConfDir = path.Join(defaults.EtcPath, "azure.d")
)

Functions

This section is empty.

Types

type AzureConfig

type AzureConfig struct {
	DirectoryID       string `json:"directory_id" toml:"directory_id" yaml:"directory_id"`                   // aka tenant id
	ApplicationID     string `json:"application_id" toml:"application_id" yaml:"application_id"`             // aka client id
	ApplicationSecret string `json:"application_secret" toml:"application_secret" yaml:"application_secret"` // aka client secret
	SubscriptionID    string `json:"subscription_id" toml:"subscription_id" yaml:"subscription_id"`          // azure subscription id
	ResourceFilter    string `json:"resource_filter" toml:"resource_filter" yaml:"resource_filter"`          // filter expression for which resources to collect metrics about -- limit resources from which metrics are collected, otherwise **ALL** metrics from **ALL** resources will be collected. Suggested method, add a tag to each resource from which to collect metrics (e.g. Tag Name:circonus and Tag Value:enabled) then use the expression: `tagName eq 'circonus' and tagValue eq 'enabled'`
	CloudName         string `json:"cloud_name" toml:"cloud_name" yaml:"cloud_name"`                         // DEFAULT: "AzurePublicCloud"
	UserAgent         string `json:"user_agent" toml:"user_agent" yaml:"user_agent"`                         // DEFAULT: "circonus-cloud-agent"
	Interval          int    `json:"collect_interval" toml:"collect_interval" yaml:"collect_interval"`       // DEFAULT: 5 - How often to collect metrics.(minutes >= 5)
}

AzureConfig defines the Azure sdk credentials.

type AzureService

type AzureService struct {
	// contains filtered or unexported fields
}

AzureService defines the Azure cloud service client.

func New

func New(ctx context.Context) (*AzureService, error)

New returns an Azure cloud service metric collection client.

func (*AzureService) Enabled

func (svc *AzureService) Enabled() bool

Enabled indicates whether the Azure service is enabled.

func (*AzureService) Scan

func (svc *AzureService) Scan() error

Scan checks the service config directory for configurations and loads them.

func (*AzureService) Start

func (svc *AzureService) Start() error

Start begins collecting metrics from Azure.

type Config

type Config struct {
	ID       string                 `json:"id" toml:"id" yaml:"id"`                   // unique id for this service client instance, no spaces (ties several things together, short and immutable - logging, check search/create, tags, etc.)
	Azure    AzureConfig            `json:"azure" toml:"azure" yaml:"azure"`          // REQUIRED, azure configuration
	Circonus circonus.ServiceConfig `json:"circonus" toml:"circonus" yaml:"circonus"` // REQUIRED, circonus config: api credentials, check, broker, etc.
	Tags     circonus.Tags          `json:"tags" toml:"tags" yaml:"tags"`             // global tags, added to all metrics
}

Config for instance of Azure metric collection service.

type Instance

type Instance struct {
	sync.Mutex
	// contains filtered or unexported fields
}

Instance Azure SDK/API Instance for fetching metrics and forwarding them to Circonus Note: a Instance has a 1:1 relation with azure:circ - each Instance has (or, may have) a different set of azure and/or circonus credentials.

func (*Instance) Start

func (inst *Instance) Start() error

Start runs the instance based on the configured interval.

Jump to

Keyboard shortcuts

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