monitoring

package
v0.3.0-alpha Latest Latest
Warning

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

Go to latest
Published: Sep 13, 2022 License: Apache-2.0, MIT Imports: 20 Imported by: 0

README

This module is a fork of the https://github.com/iamseth/oracledb_exporter. This module is modified from the original version to include Oracle DB support.

Documentation

Overview

Package monitoring is used for monitoring agent. This is based off iamseth/oracledb_exporter. The significant difference is the reliance on yaml instead of toml and the use of gRPC via dbdaemon instead of oracle client and tcp.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GeneratePrometheusMetrics

func GeneratePrometheusMetrics(dbdClient dbdpb.DatabaseDaemonClient, parse func(row map[string]string) error, query string) error

GeneratePrometheusMetrics parses metric query SQL results. Inspired by https://kylewbanks.com/blog/query-result-to-map-in-golang

func GetMetricType

func GetMetricType(metricType string, metricsType map[string]string) prometheus.ValueType

GetMetricType returns the prometheus type of a metric.

func ParseSQLResponse

func ParseSQLResponse(resp *dbdpb.RunCMDResponse) ([]map[string]string, error)

ParseSQLResponse parses the JSON result-set (returned by runSQLPlus API) and returns a list of rows with column-value mapping.

func ScrapeGenericValues

func ScrapeGenericValues(dbdClient dbdpb.DatabaseDaemonClient, ch chan<- prometheus.Metric, context string, labels []string,
	metricsDesc map[string]string, metricsType map[string]string, metricsBuckets map[string]map[string]string, fieldToAppend string, ignoreZeroResult bool, request string) error

ScrapeGenericValues is a generic method for retrieving metrics.

func ScrapeMetric

func ScrapeMetric(dbdClient dbdpb.DatabaseDaemonClient, ch chan<- prometheus.Metric, metricDefinition Metric) error

ScrapeMetric calls ScrapeGenericValues using Metric struct values.

Types

type Exporter

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

Exporter collects Oracle DB metrics. It implements prometheus.Collector.

func NewExporter

func NewExporter(ctx context.Context, defaultFileMetrics, customMetrics, service string, port int, qt string) (*Exporter, error)

NewExporter returns a new Oracle DB exporter for the provided DSN.

func (*Exporter) Collect

func (e *Exporter) Collect(ch chan<- prometheus.Metric)

Collect implements prometheus.Collector.

func (*Exporter) Describe

func (e *Exporter) Describe(ch chan<- *prometheus.Desc)

Describe describes all the metrics exported by the Oracle DB exporter.

type Metric

type Metric struct {
	Context          string                       `yaml:"context"`
	Labels           []string                     `yaml:"labels"`
	MetricsDesc      map[string]string            `yaml:"metricsdesc"`
	MetricsType      map[string]string            `yaml:"metricstype"`
	MetricsBuckets   map[string]map[string]string `yaml:"metricsbuckets"`
	FieldToAppend    string                       `yaml:"fieldtoappend"`
	Request          string                       `yaml:"request"`
	IgnoreZeroResult bool                         `yaml:"ignorezeroresult"`
}

Metric describes labels, type, and other information of a metric.

type Metrics

type Metrics struct {
	Metric []Metric `yaml:"metric"`
}

Metrics are used to load multiple metrics from file.

Jump to

Keyboard shortcuts

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