metrics

package
v0.0.0-...-674f7be Latest Latest
Warning

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

Go to latest
Published: Oct 8, 2016 License: Apache-2.0 Imports: 22 Imported by: 0

Documentation

Index

Constants

View Source
const (
	CONTAINER_INDEX_PREFIX = "container_"

	THRESHOLD_LOW_SUFFIX  = "_low_threshold"
	THRESHOLD_HIGH_SUFFIX = "_high_threshold"

	THRESHOLD_CAL_RESULT_SUFFIX = "_result"

	LINKER_SG_ID            = "LINKER_SERVICE_GROUP_ID"
	LINKER_SGI_ID           = "LINKER_SERVICE_GROUP_INSTANCE_ID"
	LINKDER_SO_ID           = "LINKER_SERVICE_ORDER_ID"
	LINKER_APP_CONTAINER_ID = "LINKER_APP_CONTAINER_ID"
	LINKER_MESOS_TASK_ID    = "MESOS_TASK_ID"
	//	LINKER_WEAVE_CIDR = "WEAVE_CIDR"
	LINKER_WEAVE_CIDR         = "HOST"
	LINKER_GROUP_ID           = "LINKER_GROUP_ID"
	LINKER_APP_ID             = "LINKER_APP_ID"
	LINKER_REPAIR_TEMPALTE_ID = "LINKER_REPAIR_TEMPLATE_ID"

	INDEX_MEMORY_USAGE                    = "memory_usage"
	INDEX_CPU_USAGE                       = "cpu_usage"
	INDEX_LOAD_USAGE                      = "load_usage"
	INDEX_NETWORK_TRANSMIT_PACKAGES_TOTAL = "network_transmit_packets_per_second_total"
	INDEX_NETWORK_RECEIVE_PACKAGES_TOTAL  = "network_receive_packets_per_second_total"
	INDEX_NETWORK_TRANSMIT_PACKAGE_NUMBER = "transmit_package_number"
	INDEX_GW_CONNECTIONS                  = "gw_conn_number"
	INDEX_PGW_CONNECTIONS                 = "pgw_conn_number"
	INDEX_SGW_CONNECTIONS                 = "sgw_conn_number"

	ALERT_NAME = "alert_name"

	ALERT_ENABLE = "ALERT_ENABLE"

	ALERT_HIGH_MEMORY                  = "HighMemoryAlert"
	ALERT_LOW_MEMORY                   = "LowMemoryAlert"
	ALERT_HIGH_CPU                     = "HighCpuAlert"
	ALERT_LOW_CPU                      = "LowCpuAlert"
	ALERT_HIGH_REV_PACKAGES            = "HighRevPackagesAlert"
	ALERT_LOW_REV_PACKAGES             = "LowRevPackagesAlert"
	ALERT_HIGH_TRANSMIT_PACKAGE_NUMBER = "HighTransmitPackageNumberAlert"
	ALERT_LOW_TRANSMIT_PACKAGE_NUMBER  = "LowTransmitPackageNumberAlert"

	ALERT_HIGH_CURRENT_SESSION = "HighCurrentSessionAlert"
	ALERT_LOW_CURRENT_SESSION  = "LowCurrentSessionAlert"

	//PGW & SGW Instances alerts
	ALERT_PGW_HIGH_CONNECTIONS = "HighPgwConnectionsAlert"
	ALERT_PGW_LOW_CONNECTIONS  = "LowPgwConnectionsAlert"
	ALERT_SGW_HIGH_CONNECTIONS = "HighSgwConnectionsAlert"
	ALERT_SGW_LOW_CONNECTIONS  = "LowSgwConnectionsAlert"

	INDEX_CURRENT_SESSION = "current_session"
	MIN_NODE_NUMBER       = "INSTANCE_MIN_NUM"
	MAX_NODE_NUMBER       = "INSTANCE_MAX_NUM"

	DNS_DOMAINNAME            = "marathonlb-lb-linkerdns.marathon.mesos"
	LINKER_ELASTICSERACH_PORT = "10092"
)
View Source
const (
	LINKER_HAPROXY_STACK_SERVERS = "stack_servers"
	//	LINKER_HAPROXY_HSS_SERVERS = "hss_servers"
	LINKER_HAPROXY_HSS_SERVERS = "hssdcos_hss_10068"
)

Variables

This section is empty.

Functions

func CallGwMonitor

func CallGwMonitor(ip, port string) (gwType string, connections, instances int, err error)

Call monitor RESTful API

func GetContainerEnvValue

func GetContainerEnvValue(containerInfo *docker.Container, envName string) (envValue string)

func UdpCall

func UdpCall(host, port, key1, key2 string) (node, packageNumber int, err error)

Types

type ContainerNameToLabelsFunc

type ContainerNameToLabelsFunc func(containerName string) map[string]string

type Exporter

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

Exporter collects HAProxy stats from the given URI and exports them using the prometheus metrics package.

func NewExporter

func NewExporter(uri string, selectedServerMetrics map[int]*prometheus.GaugeVec, timeout time.Duration) *Exporter

NewExporter returns an initialized Exporter.

func (*Exporter) Collect

func (e *Exporter) Collect(ch chan<- prometheus.Metric) (value int64, total int)

Collect fetches the stats from configured HAProxy location and delivers them as Prometheus metrics. It implements prometheus.Collector.

func (*Exporter) Describe

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

Describe describes all the metrics ever exported by the HAProxy exporter. It implements prometheus.Collector.

type PrometheusCollector

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

PrometheusCollector implements prometheus.Collector.

func NewPrometheusCollector

func NewPrometheusCollector(infoProvider infoProvider, f ContainerNameToLabelsFunc) *PrometheusCollector

NewPrometheusCollector returns a new PrometheusCollector.

func (*PrometheusCollector) CalLinkerHAProxyIndexs

func (c *PrometheusCollector) CalLinkerHAProxyIndexs(index, description string, container *info.ContainerInfo, ch chan<- prometheus.Metric, value int64, total int64)

func (*PrometheusCollector) CalLinkerIndexs

func (c *PrometheusCollector) CalLinkerIndexs(index, description string, container *info.ContainerInfo, ch chan<- prometheus.Metric, now, previous *info.ContainerStats, nodeNumber int64)

func (*PrometheusCollector) Collect

func (c *PrometheusCollector) Collect(ch chan<- prometheus.Metric)

Collect fetches the stats from all containers and delivers them as Prometheus metrics. It implements prometheus.PrometheusCollector.

func (*PrometheusCollector) Describe

func (c *PrometheusCollector) Describe(ch chan<- *prometheus.Desc)

Describe describes all the metrics ever exported by cadvisor. It implements prometheus.PrometheusCollector.

func (*PrometheusCollector) FetchElasticSerachInfo

func (c *PrometheusCollector) FetchElasticSerachInfo(index, description string, container *info.ContainerInfo, ch chan<- prometheus.Metric)

func (*PrometheusCollector) GetGwMonitorInfo

func (c *PrometheusCollector) GetGwMonitorInfo(index, description string, container *info.ContainerInfo, ch chan<- prometheus.Metric)

Call PGW/SGW monitor

func (*PrometheusCollector) GetLinkerUDPMonitorInfo

func (c *PrometheusCollector) GetLinkerUDPMonitorInfo(index, description, port, protocol, key1, key2 string, container *info.ContainerInfo, ch chan<- prometheus.Metric)

func (*PrometheusCollector) IsAlertEnable

func (c *PrometheusCollector) IsAlertEnable(container *docker.Container) (result bool)

Jump to

Keyboard shortcuts

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