Documentation
¶
Index ¶
- Constants
- Variables
- func GetEOLStatus(eol string, thresholds []Threshold) (string, error)
- func GetEnvIntValue(envname string) (*int, error)
- func GetHostedZoneLimitWithBackoff(client awsclient.Client, ctx context.Context, hostedZoneId *string, ...) (*route53.GetHostedZoneLimitOutput, error)
- func ListHostedZonesWithBackoff(client awsclient.Client, ctx context.Context, ...) (*route53.ListHostedZonesOutput, error)
- func WithKeyValue(m map[string]string, key string, value string) map[string]string
- type BaseConfig
- type Config
- type EC2Config
- type EC2Exporter
- type EOLInfo
- type EOLKey
- type ElastiCacheConfig
- type ElastiCacheExporter
- type MSKConfig
- type MSKExporter
- type MSKInfo
- type MetricProxy
- type MetricProxyItem
- type MetricsCache
- type RDSConfig
- type RDSExporter
- type RDSLogsMetrics
- type Route53Config
- type Route53Exporter
- type Threshold
- type VPCCollector
- type VPCConfig
- type VPCExporter
- func (e *VPCExporter) Collect(ch chan<- prometheus.Metric)
- func (e *VPCExporter) CollectInRegion(session *session.Session, region *string, wg *sync.WaitGroup)
- func (e *VPCExporter) CollectLoop()
- func (e *VPCExporter) Describe(ch chan<- *prometheus.Desc)
- func (e *VPCExporter) GetQuotaValue(client *servicequotas.ServiceQuotas, serviceCode string, quotaCode string) (float64, error)
Constants ¶
const ( SERVICE_CODE_KEY = "service_code" QUOTA_CODE_KEY = "quota_code" )
const ( QUOTA_VPCS_PER_REGION string = "L-F678F1CE" QUOTA_SUBNETS_PER_VPC string = "L-407747CB" QUOTA_ROUTES_PER_ROUTE_TABLE string = "L-93826ACB" QUOTA_INTERFACE_VPC_ENDPOINTS_PER_VPC string = "L-29B6F2EB" QUOTA_ROUTE_TABLES_PER_VPC string = "L-589F43AA" QUOTA_IPV4_BLOCKS_PER_VPC string = "L-83CA0A9D" SERVICE_CODE_VPC string = "vpc" )
Variables ¶
var AllocatedStorage *prometheus.Desc = prometheus.NewDesc( prometheus.BuildFQName(namespace, "", "rds_allocatedstorage"), "The amount of allocated storage in bytes.", []string{"aws_region", "dbinstance_identifier"}, nil, )
var DBInstanceClass *prometheus.Desc = prometheus.NewDesc( prometheus.BuildFQName(namespace, "", "rds_dbinstanceclass"), "The DB instance class (type).", []string{"aws_region", "dbinstance_identifier", "instance_class"}, nil, )
var DBInstanceStatus *prometheus.Desc = prometheus.NewDesc( prometheus.BuildFQName(namespace, "", "rds_dbinstancestatus"), "The instance status.", []string{"aws_region", "dbinstance_identifier", "instance_status"}, nil, )
var DBMaxConnections = map[string]map[string]int64{ "db.t3.micro": map[string]int64{ "default": 112, "default.mysql5.7": 45, "default.mysql8.0": 45, }, "db.t3.small": map[string]int64{ "default": 225, "default.mysql5.7": 130, "default.mysql8.0": 130, }, "db.t3.medium": map[string]int64{ "default": 450, "default.mysql5.7": 300, "default.mysql8.0": 300, }, "db.t4g.micro": map[string]int64{ "default": 112, "default.mysql5.7": 45, "default.mysql8.0": 45, }, "db.t4g.small": map[string]int64{ "default": 225, "default.mysql5.7": 130, "default.mysql8.0": 130, }, "db.t4g.medium": map[string]int64{ "default": 450, "default.mysql5.7": 300, "default.mysql8.0": 300, }, "db.t4g.large": map[string]int64{ "default": 900, "default.mysql5.7": 600, "default.mysql8.0": 600, }, "db.t4g.xlarge": map[string]int64{ "default": 1800, "default.mysql5.7": 1300, "default.mysql8.0": 1300, }, "db.t4g.2xlarge": map[string]int64{ "default": 3600, "default.mysql5.7": 2600, "default.mysql8.0": 2600, }, "db.m5.large": map[string]int64{ "default": 900, "default.mysql5.7": 600, "default.mysql8.0": 600, }, "db.m5.xlarge": map[string]int64{ "default": 1800, "default.mysql5.7": 1300, "default.mysql8.0": 1300, }, "db.m5.2xlarge": map[string]int64{ "default": 3600, "default.mysql5.7": 2600, "default.mysql8.0": 2600, }, "db.m5.4xlarge": map[string]int64{ "default": 5000, "default.mysql5.7": 5300, "default.mysql8.0": 5300, }, "db.m5.8xlarge": map[string]int64{ "default": 5000, "default.mysql5.7": 10700, "default.mysql8.0": 10700, }, "db.m5.16xlarge": map[string]int64{ "default": 5000, "default.aurora-mysql5.7": 6000, "default.aurora-mysql5.8": 6000, "default.aurora-mysql8.0": 6000, "default.mysql5.7": 21600, "default.mysql8.0": 21600, }, "db.m6g.large": map[string]int64{ "default": 900, "default.mysql5.7": 600, "default.mysql8.0": 600, }, "db.m6g.xlarge": map[string]int64{ "default": 1800, "default.mysql5.7": 1300, "default.mysql8.0": 1300, }, "db.m6g.2xlarge": map[string]int64{ "default": 3600, "default.mysql5.7": 2600, "default.mysql8.0": 2600, }, "db.m6g.4xlarge": map[string]int64{ "default": 5000, "default.mysql5.7": 5300, "default.mysql8.0": 5300, }, "db.m6g.8xlarge": map[string]int64{ "default": 5000, "default.mysql5.7": 10700, "default.mysql8.0": 10700, }, "db.m6g.12xlarge": map[string]int64{ "default": 5000, "default.mysql5.7": 16200, "default.mysql8.0": 16200, }, "db.m6gd.xlarge": map[string]int64{ "default": 1800, "default.mysql5.7": 1300, "default.mysql8.0": 1300, }, "db.m6gd.2xlarge": map[string]int64{ "default": 3600, "default.mysql5.7": 2600, "default.mysql8.0": 2600, }, "db.m6i.2xlarge": map[string]int64{ "default": 3600, "default.mysql5.7": 2600, "default.mysql8.0": 2600, }, "db.m7g.large": map[string]int64{ "default": 900, "default.mysql5.7": 600, "default.mysql8.0": 600, }, "db.m7g.xlarge": map[string]int64{ "default": 1800, "default.mysql5.7": 1300, "default.mysql8.0": 1300, }, "db.m7g.2xlarge": map[string]int64{ "default": 3600, "default.mysql5.7": 2600, "default.mysql8.0": 2600, }, "db.m7g.4xlarge": map[string]int64{ "default": 5000, "default.mysql5.7": 5300, "default.mysql8.0": 5300, }, "db.m7g.8xlarge": map[string]int64{ "default": 5000, "default.mysql5.7": 10700, "default.mysql8.0": 10700, }, "db.m7g.12xlarge": map[string]int64{ "default": 5000, "default.mysql5.7": 16200, "default.mysql8.0": 16200, }, "db.r5.large": map[string]int64{ "default": 1800, "default.mysql5.7": 1300, "default.mysql8.0": 1300, }, "db.r5.xlarge": map[string]int64{ "default": 3600, "default.mysql5.7": 2600, "default.mysql8.0": 2600, }, "db.r5.2xlarge": map[string]int64{ "default": 5000, "default.mysql5.7": 5300, "default.mysql8.0": 5300, "default.aurora-mysql5.7": 3000, "default.aurora-mysql5.8": 3000, "default.aurora-mysql8.0": 3000, }, "db.r5.4xlarge": map[string]int64{ "default": 5000, "default.mysql5.7": 10700, "default.mysql8.0": 10700, }, "db.r5.8xlarge": map[string]int64{ "default": 5000, "default.mysql5.7": 21600, "default.mysql8.0": 21600, }, "db.r5.12xlarge": map[string]int64{ "default": 5000, "default.mysql5.7": 32768, "default.mysql8.0": 32768, }, "db.r5.16xlarge": map[string]int64{ "default": 5000, "default.mysql5.7": 43400, "default.mysql8.0": 43400, }, "db.r5.24xlarge": map[string]int64{ "default": 5000, "default.mysql5.7": 65400, "default.mysql8.0": 65400, }, "db.r6g.12xlarge": map[string]int64{ "default": 5000, "default.mysql5.7": 32768, "default.mysql8.0": 32768, }, "db.r6i.large": map[string]int64{ "default": 1800, "default.mysql5.7": 1300, "default.mysql8.0": 1300, }, "db.r6i.16xlarge": map[string]int64{ "default": 5000, "default.mysql5.7": 43400, "default.mysql8.0": 43400, }, }
Attention: use "default" for all Postgres versions (non-aurora)!
var EOLInfos *prometheus.Desc = prometheus.NewDesc( prometheus.BuildFQName(namespace, "", "rds_eol_info"), "The EOL date and status for the DB engine type and version.", []string{"aws_region", "dbinstance_identifier", "engine", "engine_version", "eol_date", "eol_status"}, nil, )
var EngineVersion *prometheus.Desc = prometheus.NewDesc( prometheus.BuildFQName(namespace, "", "rds_engineversion"), "The DB engine type and version.", []string{"aws_region", "dbinstance_identifier", "engine", "engine_version", "aws_account_id"}, nil, )
var LatestRestorableTime *prometheus.Desc = prometheus.NewDesc( prometheus.BuildFQName(namespace, "", "rds_latestrestorabletime"), "Latest restorable time (UTC date timestamp).", []string{"aws_region", "dbinstance_identifier"}, nil, )
var LogsAmount *prometheus.Desc = prometheus.NewDesc( prometheus.BuildFQName(namespace, "", "rds_logs_amount"), "The amount of existent log files", []string{"aws_region", "dbinstance_identifier"}, nil, )
var LogsStorageSize *prometheus.Desc = prometheus.NewDesc( prometheus.BuildFQName(namespace, "", "rds_logsstorage_size_bytes"), "The amount of storage consumed by log files (in bytes)", []string{"aws_region", "dbinstance_identifier"}, nil, )
var MSKInfos *prometheus.Desc = prometheus.NewDesc( prometheus.BuildFQName(namespace, "", "msk_eol_info"), "The MSK eol date and status for the version.", []string{"aws_region", "cluster_name", "msk_version", "eol_date", "eol_status"}, nil, )
var MaxConnections *prometheus.Desc = prometheus.NewDesc( prometheus.BuildFQName(namespace, "", "rds_maxconnections"), "The DB's max_connections value", []string{"aws_region", "dbinstance_identifier"}, nil, )
var MaxConnectionsMappingError *prometheus.Desc = prometheus.NewDesc( prometheus.BuildFQName(namespace, "", "rds_maxconnections_error"), "Indicates no mapping found for instance/parameter group.", []string{"aws_region", "dbinstance_identifier", "instance_class"}, nil, )
var PendingMaintenanceActions *prometheus.Desc = prometheus.NewDesc( prometheus.BuildFQName(namespace, "", "rds_pendingmaintenanceactions"), "Pending maintenance actions for a RDS instance. 0 indicates no available maintenance and a separate metric with a value of 1 will be published for every separate action.", []string{"aws_region", "dbinstance_identifier", "action", "auto_apply_after", "current_apply_date", "description"}, nil, )
var PubliclyAccessible *prometheus.Desc = prometheus.NewDesc( prometheus.BuildFQName(namespace, "", "rds_publiclyaccessible"), "Indicates if the DB is publicly accessible", []string{"aws_region", "dbinstance_identifier"}, nil, )
var RDS_LOGS_METRICS_TTL = "LOGS_METRICS_TTL"
Default TTL value for RDS logs related metrics To get the log metrics an api call for each instance is needed Since this cause rate limit problems to the AWS api, these metrics are cached for this amount of time before requesting them again
var RDS_LOGS_METRICS_TTL_DEFAULT = 300
var RDS_LOGS_METRICS_WORKERS = "LOGS_METRICS_WORKERS"
RDS log metrics are requested in parallel with a workerPool. this variable sets the number of workers
var RDS_LOGS_METRICS_WORKERS_DEFAULT = 10
var RedisVersion *prometheus.Desc = prometheus.NewDesc( prometheus.BuildFQName(namespace, "", "elasticache_redisversion"), "The ElastiCache engine type and version.", []string{"aws_region", "replication_group_id", "engine", "engine_version", "aws_account_id"}, nil, )
var StorageEncrypted *prometheus.Desc = prometheus.NewDesc( prometheus.BuildFQName(namespace, "", "rds_storageencrypted"), "Indicates if the DB storage is encrypted", []string{"aws_region", "dbinstance_identifier"}, nil, )
var TransitGatewaysQuota *prometheus.Desc
var TransitGatewaysUsage *prometheus.Desc
Functions ¶
func GetEOLStatus ¶
Determines status from the number of days until EOL
func GetEnvIntValue ¶
Types ¶
type BaseConfig ¶
type Config ¶
type Config struct { RdsConfig RDSConfig `yaml:"rds"` VpcConfig VPCConfig `yaml:"vpc"` Route53Config Route53Config `yaml:"route53"` EC2Config EC2Config `yaml:"ec2"` ElastiCacheConfig ElastiCacheConfig `yaml:"elasticache"` MskConfig MSKConfig `yaml:"msk"` }
type EC2Config ¶
type EC2Config struct { BaseConfig `yaml:"base,inline"` Regions []string `yaml:"regions"` }
type EC2Exporter ¶
type EC2Exporter struct {
// contains filtered or unexported fields
}
func NewEC2Exporter ¶
func (*EC2Exporter) Collect ¶
func (e *EC2Exporter) Collect(ch chan<- prometheus.Metric)
func (*EC2Exporter) CollectLoop ¶
func (e *EC2Exporter) CollectLoop()
func (*EC2Exporter) Describe ¶
func (e *EC2Exporter) Describe(ch chan<- *prometheus.Desc)
type ElastiCacheConfig ¶
type ElastiCacheConfig struct { BaseConfig `yaml:"base,inline"` Regions []string `yaml:"regions"` }
type ElastiCacheExporter ¶
type ElastiCacheExporter struct {
// contains filtered or unexported fields
}
func NewElastiCacheExporter ¶
func NewElastiCacheExporter(sessions []*session.Session, logger log.Logger, config ElastiCacheConfig, awsAccountId string) *ElastiCacheExporter
NewElastiCacheExporter creates a new ElastiCacheExporter instance
func (*ElastiCacheExporter) Collect ¶
func (e *ElastiCacheExporter) Collect(ch chan<- prometheus.Metric)
func (*ElastiCacheExporter) CollectLoop ¶
func (e *ElastiCacheExporter) CollectLoop()
func (*ElastiCacheExporter) Describe ¶
func (e *ElastiCacheExporter) Describe(ch chan<- *prometheus.Desc)
type MSKConfig ¶
type MSKConfig struct { BaseConfig `yaml:"base,inline"` Regions []string `yaml:"regions"` MSKInfos []MSKInfo `yaml:"msk_info"` Thresholds []Threshold `yaml:"thresholds"` }
type MSKExporter ¶
type MSKExporter struct {
// contains filtered or unexported fields
}
func NewMSKExporter ¶
func NewMSKExporter(sessions []*session.Session, logger log.Logger, config MSKConfig, awsAccountId string) *MSKExporter
NewMSKExporter creates a new MSKExporter instance
func (*MSKExporter) Collect ¶
func (e *MSKExporter) Collect(ch chan<- prometheus.Metric)
func (*MSKExporter) CollectLoop ¶
func (e *MSKExporter) CollectLoop()
func (*MSKExporter) Describe ¶
func (e *MSKExporter) Describe(ch chan<- *prometheus.Desc)
type MetricProxy ¶
type MetricProxy struct {
// contains filtered or unexported fields
}
func NewMetricProxy ¶
func NewMetricProxy() *MetricProxy
func (*MetricProxy) GetMetricById ¶
func (mp *MetricProxy) GetMetricById(id string) (*MetricProxyItem, error)
func (*MetricProxy) StoreMetricById ¶
func (mp *MetricProxy) StoreMetricById(id string, value interface{}, ttl int)
type MetricProxyItem ¶
type MetricProxyItem struct {
// contains filtered or unexported fields
}
type MetricsCache ¶
type MetricsCache struct {
// contains filtered or unexported fields
}
func NewMetricsCache ¶
func NewMetricsCache(ttl time.Duration) *MetricsCache
func (*MetricsCache) AddMetric ¶
func (mc *MetricsCache) AddMetric(metric prometheus.Metric)
AddMetric adds a metric to the cache
func (*MetricsCache) GetAllMetrics ¶
func (mc *MetricsCache) GetAllMetrics() []prometheus.Metric
GetAllMetrics Iterates over all cached metrics and discards expired ones.
type RDSConfig ¶
type RDSConfig struct { BaseConfig `yaml:"base,inline"` Regions []string `yaml:"regions"` EOLInfos []EOLInfo `yaml:"eol_info"` Thresholds []Threshold `yaml:"thresholds"` }
type RDSExporter ¶
type RDSExporter struct {
// contains filtered or unexported fields
}
RDSExporter defines an instance of the RDS Exporter
func NewRDSExporter ¶
func NewRDSExporter(sessions []*session.Session, logger log.Logger, config RDSConfig, awsAccountId string) *RDSExporter
NewRDSExporter creates a new RDSExporter instance
func (*RDSExporter) Collect ¶
func (e *RDSExporter) Collect(ch chan<- prometheus.Metric)
Collect is used by the Prometheus client to collect and return the metrics values
func (*RDSExporter) CollectLoop ¶
func (e *RDSExporter) CollectLoop()
func (*RDSExporter) Describe ¶
func (e *RDSExporter) Describe(ch chan<- *prometheus.Desc)
Describe is used by the Prometheus client to return a description of the metrics
type RDSLogsMetrics ¶
type RDSLogsMetrics struct {
// contains filtered or unexported fields
}
Struct to store RDS Instances log files data This struct is used to store the data in the MetricsProxy
type Route53Config ¶
type Route53Config struct { BaseConfig `yaml:"base,inline"` Region string `yaml:"region"` // Use only a single Region for now, as the current metric is global }
type Route53Exporter ¶
type Route53Exporter struct { RecordsPerHostedZoneQuota *prometheus.Desc RecordsPerHostedZoneUsage *prometheus.Desc HostedZonesPerAccountQuota *prometheus.Desc HostedZonesPerAccountUsage *prometheus.Desc LastUpdateTime *prometheus.Desc Cancel context.CancelFunc // contains filtered or unexported fields }
func NewRoute53Exporter ¶
func NewRoute53Exporter(sess *session.Session, logger log.Logger, config Route53Config, awsAccountId string) *Route53Exporter
func (*Route53Exporter) Collect ¶
func (e *Route53Exporter) Collect(ch chan<- prometheus.Metric)
func (*Route53Exporter) CollectLoop ¶
func (e *Route53Exporter) CollectLoop()
CollectLoop runs indefinitely to collect the route53 metrics in a cache. Metrics are only written into the cache once all have been collected to ensure that we don't have a partial collect.
func (*Route53Exporter) Describe ¶
func (e *Route53Exporter) Describe(ch chan<- *prometheus.Desc)
type VPCCollector ¶
type VPCCollector struct {
// contains filtered or unexported fields
}
type VPCConfig ¶
type VPCConfig struct { BaseConfig `yaml:"base,inline"` Regions []string `yaml:"regions"` }
type VPCExporter ¶
type VPCExporter struct { VpcsPerRegionQuota *prometheus.Desc VpcsPerRegionUsage *prometheus.Desc SubnetsPerVpcQuota *prometheus.Desc SubnetsPerVpcUsage *prometheus.Desc RoutesPerRouteTableQuota *prometheus.Desc RoutesPerRouteTableUsage *prometheus.Desc InterfaceVpcEndpointsPerVpcQuota *prometheus.Desc InterfaceVpcEndpointsPerVpcUsage *prometheus.Desc RouteTablesPerVpcQuota *prometheus.Desc RouteTablesPerVpcUsage *prometheus.Desc IPv4BlocksPerVpcQuota *prometheus.Desc IPv4BlocksPerVpcUsage *prometheus.Desc // contains filtered or unexported fields }
func NewVPCExporter ¶
func (*VPCExporter) Collect ¶
func (e *VPCExporter) Collect(ch chan<- prometheus.Metric)
func (*VPCExporter) CollectInRegion ¶
func (*VPCExporter) CollectLoop ¶
func (e *VPCExporter) CollectLoop()
func (*VPCExporter) Describe ¶
func (e *VPCExporter) Describe(ch chan<- *prometheus.Desc)
func (*VPCExporter) GetQuotaValue ¶
func (e *VPCExporter) GetQuotaValue(client *servicequotas.ServiceQuotas, serviceCode string, quotaCode string) (float64, error)