|
|
|
@ -53,6 +53,17 @@ var ( |
|
|
|
|
) |
|
|
|
|
) |
|
|
|
|
|
|
|
|
|
const ( |
|
|
|
|
healMetricsNamespace = "self_heal" |
|
|
|
|
gatewayNamespace = "gateway" |
|
|
|
|
cacheNamespace = "cache" |
|
|
|
|
s3Namespace = "s3" |
|
|
|
|
bucketNamespace = "bucket" |
|
|
|
|
minioNamespace = "minio" |
|
|
|
|
diskNamespace = "disk" |
|
|
|
|
interNodeNamespace = "internode" |
|
|
|
|
) |
|
|
|
|
|
|
|
|
|
func init() { |
|
|
|
|
prometheus.MustRegister(httpRequestsDuration) |
|
|
|
|
prometheus.MustRegister(newMinioCollector()) |
|
|
|
@ -86,6 +97,7 @@ func (c *minioCollector) Collect(ch chan<- prometheus.Metric) { |
|
|
|
|
minioVersionInfo.WithLabelValues(Version, CommitID).Set(float64(1.0)) |
|
|
|
|
|
|
|
|
|
storageMetricsPrometheus(ch) |
|
|
|
|
nodeHealthMetricsPrometheus(ch) |
|
|
|
|
bucketUsageMetricsPrometheus(ch) |
|
|
|
|
networkMetricsPrometheus(ch) |
|
|
|
|
httpMetricsPrometheus(ch) |
|
|
|
@ -94,6 +106,26 @@ func (c *minioCollector) Collect(ch chan<- prometheus.Metric) { |
|
|
|
|
healingMetricsPrometheus(ch) |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
func nodeHealthMetricsPrometheus(ch chan<- prometheus.Metric) { |
|
|
|
|
nodesUp, nodesDown := GetPeerOnlineCount() |
|
|
|
|
ch <- prometheus.MustNewConstMetric( |
|
|
|
|
prometheus.NewDesc( |
|
|
|
|
prometheus.BuildFQName(minioNamespace, "nodes", "online"), |
|
|
|
|
"Total number of MinIO nodes online", |
|
|
|
|
nil, nil), |
|
|
|
|
prometheus.GaugeValue, |
|
|
|
|
float64(nodesUp), |
|
|
|
|
) |
|
|
|
|
ch <- prometheus.MustNewConstMetric( |
|
|
|
|
prometheus.NewDesc( |
|
|
|
|
prometheus.BuildFQName(minioNamespace, "nodes", "offline"), |
|
|
|
|
"Total number of MinIO nodes offline", |
|
|
|
|
nil, nil), |
|
|
|
|
prometheus.GaugeValue, |
|
|
|
|
float64(nodesDown), |
|
|
|
|
) |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
// collects healing specific metrics for MinIO instance in Prometheus specific format
|
|
|
|
|
// and sends to given channel
|
|
|
|
|
func healingMetricsPrometheus(ch chan<- prometheus.Metric) { |
|
|
|
@ -104,7 +136,6 @@ func healingMetricsPrometheus(ch chan<- prometheus.Metric) { |
|
|
|
|
if !exists { |
|
|
|
|
return |
|
|
|
|
} |
|
|
|
|
healMetricsNamespace := "self_heal" |
|
|
|
|
|
|
|
|
|
var dur time.Duration |
|
|
|
|
if !bgSeq.lastHealActivity.IsZero() { |
|
|
|
@ -174,7 +205,7 @@ func gatewayMetricsPrometheus(ch chan<- prometheus.Metric) { |
|
|
|
|
|
|
|
|
|
ch <- prometheus.MustNewConstMetric( |
|
|
|
|
prometheus.NewDesc( |
|
|
|
|
prometheus.BuildFQName("gateway", globalGatewayName, "bytes_received"), |
|
|
|
|
prometheus.BuildFQName(gatewayNamespace, globalGatewayName, "bytes_received"), |
|
|
|
|
"Total number of bytes received by current MinIO Gateway "+globalGatewayName+" backend", |
|
|
|
|
nil, nil), |
|
|
|
|
prometheus.CounterValue, |
|
|
|
@ -182,7 +213,7 @@ func gatewayMetricsPrometheus(ch chan<- prometheus.Metric) { |
|
|
|
|
) |
|
|
|
|
ch <- prometheus.MustNewConstMetric( |
|
|
|
|
prometheus.NewDesc( |
|
|
|
|
prometheus.BuildFQName("gateway", globalGatewayName, "bytes_sent"), |
|
|
|
|
prometheus.BuildFQName(gatewayNamespace, globalGatewayName, "bytes_sent"), |
|
|
|
|
"Total number of bytes sent by current MinIO Gateway to "+globalGatewayName+" backend", |
|
|
|
|
nil, nil), |
|
|
|
|
prometheus.CounterValue, |
|
|
|
@ -191,7 +222,7 @@ func gatewayMetricsPrometheus(ch chan<- prometheus.Metric) { |
|
|
|
|
s := m.GetRequests() |
|
|
|
|
ch <- prometheus.MustNewConstMetric( |
|
|
|
|
prometheus.NewDesc( |
|
|
|
|
prometheus.BuildFQName("gateway", globalGatewayName, "requests"), |
|
|
|
|
prometheus.BuildFQName(gatewayNamespace, globalGatewayName, "requests"), |
|
|
|
|
"Total number of requests made to "+globalGatewayName+" by current MinIO Gateway", |
|
|
|
|
[]string{"method"}, nil), |
|
|
|
|
prometheus.CounterValue, |
|
|
|
@ -200,7 +231,7 @@ func gatewayMetricsPrometheus(ch chan<- prometheus.Metric) { |
|
|
|
|
) |
|
|
|
|
ch <- prometheus.MustNewConstMetric( |
|
|
|
|
prometheus.NewDesc( |
|
|
|
|
prometheus.BuildFQName("gateway", globalGatewayName, "requests"), |
|
|
|
|
prometheus.BuildFQName(gatewayNamespace, globalGatewayName, "requests"), |
|
|
|
|
"Total number of requests made to "+globalGatewayName+" by current MinIO Gateway", |
|
|
|
|
[]string{"method"}, nil), |
|
|
|
|
prometheus.CounterValue, |
|
|
|
@ -209,7 +240,7 @@ func gatewayMetricsPrometheus(ch chan<- prometheus.Metric) { |
|
|
|
|
) |
|
|
|
|
ch <- prometheus.MustNewConstMetric( |
|
|
|
|
prometheus.NewDesc( |
|
|
|
|
prometheus.BuildFQName("gateway", globalGatewayName, "requests"), |
|
|
|
|
prometheus.BuildFQName(gatewayNamespace, globalGatewayName, "requests"), |
|
|
|
|
"Total number of requests made to "+globalGatewayName+" by current MinIO Gateway", |
|
|
|
|
[]string{"method"}, nil), |
|
|
|
|
prometheus.CounterValue, |
|
|
|
@ -218,7 +249,7 @@ func gatewayMetricsPrometheus(ch chan<- prometheus.Metric) { |
|
|
|
|
) |
|
|
|
|
ch <- prometheus.MustNewConstMetric( |
|
|
|
|
prometheus.NewDesc( |
|
|
|
|
prometheus.BuildFQName("gateway", globalGatewayName, "requests"), |
|
|
|
|
prometheus.BuildFQName(gatewayNamespace, globalGatewayName, "requests"), |
|
|
|
|
"Total number of requests made to "+globalGatewayName+" by current MinIO Gateway", |
|
|
|
|
[]string{"method"}, nil), |
|
|
|
|
prometheus.CounterValue, |
|
|
|
@ -238,7 +269,7 @@ func cacheMetricsPrometheus(ch chan<- prometheus.Metric) { |
|
|
|
|
|
|
|
|
|
ch <- prometheus.MustNewConstMetric( |
|
|
|
|
prometheus.NewDesc( |
|
|
|
|
prometheus.BuildFQName("cache", "hits", "total"), |
|
|
|
|
prometheus.BuildFQName(cacheNamespace, "hits", "total"), |
|
|
|
|
"Total number of disk cache hits in current MinIO instance", |
|
|
|
|
nil, nil), |
|
|
|
|
prometheus.CounterValue, |
|
|
|
@ -246,7 +277,7 @@ func cacheMetricsPrometheus(ch chan<- prometheus.Metric) { |
|
|
|
|
) |
|
|
|
|
ch <- prometheus.MustNewConstMetric( |
|
|
|
|
prometheus.NewDesc( |
|
|
|
|
prometheus.BuildFQName("cache", "misses", "total"), |
|
|
|
|
prometheus.BuildFQName(cacheNamespace, "misses", "total"), |
|
|
|
|
"Total number of disk cache misses in current MinIO instance", |
|
|
|
|
nil, nil), |
|
|
|
|
prometheus.CounterValue, |
|
|
|
@ -254,7 +285,7 @@ func cacheMetricsPrometheus(ch chan<- prometheus.Metric) { |
|
|
|
|
) |
|
|
|
|
ch <- prometheus.MustNewConstMetric( |
|
|
|
|
prometheus.NewDesc( |
|
|
|
|
prometheus.BuildFQName("cache", "data", "served"), |
|
|
|
|
prometheus.BuildFQName(cacheNamespace, "data", "served"), |
|
|
|
|
"Total number of bytes served from cache of current MinIO instance", |
|
|
|
|
nil, nil), |
|
|
|
|
prometheus.CounterValue, |
|
|
|
@ -264,7 +295,7 @@ func cacheMetricsPrometheus(ch chan<- prometheus.Metric) { |
|
|
|
|
// Cache disk usage percentage
|
|
|
|
|
ch <- prometheus.MustNewConstMetric( |
|
|
|
|
prometheus.NewDesc( |
|
|
|
|
prometheus.BuildFQName("cache", "usage", "percent"), |
|
|
|
|
prometheus.BuildFQName(cacheNamespace, "usage", "percent"), |
|
|
|
|
"Total percentage cache usage", |
|
|
|
|
[]string{"disk"}, nil), |
|
|
|
|
prometheus.GaugeValue, |
|
|
|
@ -273,7 +304,7 @@ func cacheMetricsPrometheus(ch chan<- prometheus.Metric) { |
|
|
|
|
) |
|
|
|
|
ch <- prometheus.MustNewConstMetric( |
|
|
|
|
prometheus.NewDesc( |
|
|
|
|
prometheus.BuildFQName("cache", "usage", "high"), |
|
|
|
|
prometheus.BuildFQName(cacheNamespace, "usage", "high"), |
|
|
|
|
"Indicates cache usage is high or low, relative to current cache 'quota' settings", |
|
|
|
|
[]string{"disk"}, nil), |
|
|
|
|
prometheus.GaugeValue, |
|
|
|
@ -311,7 +342,7 @@ func httpMetricsPrometheus(ch chan<- prometheus.Metric) { |
|
|
|
|
for api, value := range httpStats.CurrentS3Requests.APIStats { |
|
|
|
|
ch <- prometheus.MustNewConstMetric( |
|
|
|
|
prometheus.NewDesc( |
|
|
|
|
prometheus.BuildFQName("s3", "requests", "current"), |
|
|
|
|
prometheus.BuildFQName(s3Namespace, "requests", "current"), |
|
|
|
|
"Total number of running s3 requests in current MinIO server instance", |
|
|
|
|
[]string{"api"}, nil), |
|
|
|
|
prometheus.CounterValue, |
|
|
|
@ -323,7 +354,7 @@ func httpMetricsPrometheus(ch chan<- prometheus.Metric) { |
|
|
|
|
for api, value := range httpStats.TotalS3Requests.APIStats { |
|
|
|
|
ch <- prometheus.MustNewConstMetric( |
|
|
|
|
prometheus.NewDesc( |
|
|
|
|
prometheus.BuildFQName("s3", "requests", "total"), |
|
|
|
|
prometheus.BuildFQName(s3Namespace, "requests", "total"), |
|
|
|
|
"Total number of s3 requests in current MinIO server instance", |
|
|
|
|
[]string{"api"}, nil), |
|
|
|
|
prometheus.CounterValue, |
|
|
|
@ -335,7 +366,7 @@ func httpMetricsPrometheus(ch chan<- prometheus.Metric) { |
|
|
|
|
for api, value := range httpStats.TotalS3Errors.APIStats { |
|
|
|
|
ch <- prometheus.MustNewConstMetric( |
|
|
|
|
prometheus.NewDesc( |
|
|
|
|
prometheus.BuildFQName("s3", "errors", "total"), |
|
|
|
|
prometheus.BuildFQName(s3Namespace, "errors", "total"), |
|
|
|
|
"Total number of s3 errors in current MinIO server instance", |
|
|
|
|
[]string{"api"}, nil), |
|
|
|
|
prometheus.CounterValue, |
|
|
|
@ -353,7 +384,7 @@ func networkMetricsPrometheus(ch chan<- prometheus.Metric) { |
|
|
|
|
// Network Sent/Received Bytes (internode)
|
|
|
|
|
ch <- prometheus.MustNewConstMetric( |
|
|
|
|
prometheus.NewDesc( |
|
|
|
|
prometheus.BuildFQName("internode", "tx", "bytes_total"), |
|
|
|
|
prometheus.BuildFQName(interNodeNamespace, "tx", "bytes_total"), |
|
|
|
|
"Total number of bytes sent to the other peer nodes by current MinIO server instance", |
|
|
|
|
nil, nil), |
|
|
|
|
prometheus.CounterValue, |
|
|
|
@ -362,7 +393,7 @@ func networkMetricsPrometheus(ch chan<- prometheus.Metric) { |
|
|
|
|
|
|
|
|
|
ch <- prometheus.MustNewConstMetric( |
|
|
|
|
prometheus.NewDesc( |
|
|
|
|
prometheus.BuildFQName("internode", "rx", "bytes_total"), |
|
|
|
|
prometheus.BuildFQName(interNodeNamespace, "rx", "bytes_total"), |
|
|
|
|
"Total number of internode bytes received by current MinIO server instance", |
|
|
|
|
nil, nil), |
|
|
|
|
prometheus.CounterValue, |
|
|
|
@ -372,7 +403,7 @@ func networkMetricsPrometheus(ch chan<- prometheus.Metric) { |
|
|
|
|
// Network Sent/Received Bytes (Outbound)
|
|
|
|
|
ch <- prometheus.MustNewConstMetric( |
|
|
|
|
prometheus.NewDesc( |
|
|
|
|
prometheus.BuildFQName("s3", "tx", "bytes_total"), |
|
|
|
|
prometheus.BuildFQName(s3Namespace, "tx", "bytes_total"), |
|
|
|
|
"Total number of s3 bytes sent by current MinIO server instance", |
|
|
|
|
nil, nil), |
|
|
|
|
prometheus.CounterValue, |
|
|
|
@ -381,7 +412,7 @@ func networkMetricsPrometheus(ch chan<- prometheus.Metric) { |
|
|
|
|
|
|
|
|
|
ch <- prometheus.MustNewConstMetric( |
|
|
|
|
prometheus.NewDesc( |
|
|
|
|
prometheus.BuildFQName("s3", "rx", "bytes_total"), |
|
|
|
|
prometheus.BuildFQName(s3Namespace, "rx", "bytes_total"), |
|
|
|
|
"Total number of s3 bytes received by current MinIO server instance", |
|
|
|
|
nil, nil), |
|
|
|
|
prometheus.CounterValue, |
|
|
|
@ -421,7 +452,7 @@ func bucketUsageMetricsPrometheus(ch chan<- prometheus.Metric) { |
|
|
|
|
// Total space used by bucket
|
|
|
|
|
ch <- prometheus.MustNewConstMetric( |
|
|
|
|
prometheus.NewDesc( |
|
|
|
|
prometheus.BuildFQName("bucket", "usage", "size"), |
|
|
|
|
prometheus.BuildFQName(bucketNamespace, "usage", "size"), |
|
|
|
|
"Total bucket size", |
|
|
|
|
[]string{"bucket"}, nil), |
|
|
|
|
prometheus.GaugeValue, |
|
|
|
@ -430,7 +461,7 @@ func bucketUsageMetricsPrometheus(ch chan<- prometheus.Metric) { |
|
|
|
|
) |
|
|
|
|
ch <- prometheus.MustNewConstMetric( |
|
|
|
|
prometheus.NewDesc( |
|
|
|
|
prometheus.BuildFQName("bucket", "objects", "count"), |
|
|
|
|
prometheus.BuildFQName(bucketNamespace, "objects", "count"), |
|
|
|
|
"Total number of objects in a bucket", |
|
|
|
|
[]string{"bucket"}, nil), |
|
|
|
|
prometheus.GaugeValue, |
|
|
|
@ -476,7 +507,7 @@ func bucketUsageMetricsPrometheus(ch chan<- prometheus.Metric) { |
|
|
|
|
for k, v := range usageInfo.ObjectSizesHistogram { |
|
|
|
|
ch <- prometheus.MustNewConstMetric( |
|
|
|
|
prometheus.NewDesc( |
|
|
|
|
prometheus.BuildFQName("bucket", "objects", "histogram"), |
|
|
|
|
prometheus.BuildFQName(bucketNamespace, "objects", "histogram"), |
|
|
|
|
"Total number of objects of different sizes in a bucket", |
|
|
|
|
[]string{"bucket", "object_size"}, nil), |
|
|
|
|
prometheus.GaugeValue, |
|
|
|
@ -507,7 +538,7 @@ func storageMetricsPrometheus(ch chan<- prometheus.Metric) { |
|
|
|
|
// MinIO Offline Disks per node
|
|
|
|
|
ch <- prometheus.MustNewConstMetric( |
|
|
|
|
prometheus.NewDesc( |
|
|
|
|
prometheus.BuildFQName("minio", "disks", "offline"), |
|
|
|
|
prometheus.BuildFQName(minioNamespace, "disks", "offline"), |
|
|
|
|
"Total number of offline disks in current MinIO server instance", |
|
|
|
|
nil, nil), |
|
|
|
|
prometheus.GaugeValue, |
|
|
|
@ -517,7 +548,7 @@ func storageMetricsPrometheus(ch chan<- prometheus.Metric) { |
|
|
|
|
// MinIO Total Disks per node
|
|
|
|
|
ch <- prometheus.MustNewConstMetric( |
|
|
|
|
prometheus.NewDesc( |
|
|
|
|
prometheus.BuildFQName("minio", "disks", "total"), |
|
|
|
|
prometheus.BuildFQName(minioNamespace, "disks", "total"), |
|
|
|
|
"Total number of disks for current MinIO server instance", |
|
|
|
|
nil, nil), |
|
|
|
|
prometheus.GaugeValue, |
|
|
|
@ -528,7 +559,7 @@ func storageMetricsPrometheus(ch chan<- prometheus.Metric) { |
|
|
|
|
// Total disk usage by the disk
|
|
|
|
|
ch <- prometheus.MustNewConstMetric( |
|
|
|
|
prometheus.NewDesc( |
|
|
|
|
prometheus.BuildFQName("disk", "storage", "used"), |
|
|
|
|
prometheus.BuildFQName(diskNamespace, "storage", "used"), |
|
|
|
|
"Total disk storage used on the disk", |
|
|
|
|
[]string{"disk"}, nil), |
|
|
|
|
prometheus.GaugeValue, |
|
|
|
@ -539,7 +570,7 @@ func storageMetricsPrometheus(ch chan<- prometheus.Metric) { |
|
|
|
|
// Total available space in the disk
|
|
|
|
|
ch <- prometheus.MustNewConstMetric( |
|
|
|
|
prometheus.NewDesc( |
|
|
|
|
prometheus.BuildFQName("disk", "storage", "available"), |
|
|
|
|
prometheus.BuildFQName(diskNamespace, "storage", "available"), |
|
|
|
|
"Total available space left on the disk", |
|
|
|
|
[]string{"disk"}, nil), |
|
|
|
|
prometheus.GaugeValue, |
|
|
|
@ -550,7 +581,7 @@ func storageMetricsPrometheus(ch chan<- prometheus.Metric) { |
|
|
|
|
// Total storage space of the disk
|
|
|
|
|
ch <- prometheus.MustNewConstMetric( |
|
|
|
|
prometheus.NewDesc( |
|
|
|
|
prometheus.BuildFQName("disk", "storage", "total"), |
|
|
|
|
prometheus.BuildFQName(diskNamespace, "storage", "total"), |
|
|
|
|
"Total space on the disk", |
|
|
|
|
[]string{"disk"}, nil), |
|
|
|
|
prometheus.GaugeValue, |
|
|
|
|