Add inodes to /metrics endpoint

This commit is contained in:
Micah Hausler 2016-08-23 16:36:56 -04:00
parent cd360d66e2
commit a9bb292b52
3 changed files with 32 additions and 0 deletions

View File

@ -228,6 +228,26 @@ func NewPrometheusCollector(i infoProvider, f ContainerLabelsFunc) *PrometheusCo
}, },
} }
}, },
}, {
name: "container_fs_inodes_free",
help: "Number of available Inodes",
valueType: prometheus.GaugeValue,
extraLabels: []string{"device"},
getValues: func(s *info.ContainerStats) metricValues {
return fsValues(s.Filesystem, func(fs *info.FsStats) float64 {
return float64(fs.InodesFree)
})
},
}, {
name: "container_fs_inodes_total",
help: "Number of Inodes",
valueType: prometheus.GaugeValue,
extraLabels: []string{"device"},
getValues: func(s *info.ContainerStats) metricValues {
return fsValues(s.Filesystem, func(fs *info.FsStats) float64 {
return float64(fs.Inodes)
})
},
}, { }, {
name: "container_fs_limit_bytes", name: "container_fs_limit_bytes",
help: "Number of bytes that can be consumed by the container on this filesystem.", help: "Number of bytes that can be consumed by the container on this filesystem.",

View File

@ -130,6 +130,8 @@ func (p testSubcontainersInfoProvider) SubcontainersInfo(string, *info.Container
Filesystem: []info.FsStats{ Filesystem: []info.FsStats{
{ {
Device: "sda1", Device: "sda1",
InodesFree: 524288,
Inodes: 2097152,
Limit: 22, Limit: 22,
Usage: 23, Usage: 23,
ReadsCompleted: 24, ReadsCompleted: 24,
@ -146,6 +148,8 @@ func (p testSubcontainersInfoProvider) SubcontainersInfo(string, *info.Container
}, },
{ {
Device: "sda2", Device: "sda2",
InodesFree: 262144,
Inodes: 2097152,
Limit: 37, Limit: 37,
Usage: 38, Usage: 38,
ReadsCompleted: 39, ReadsCompleted: 39,

View File

@ -22,6 +22,14 @@ container_cpu_usage_seconds_total{container_env_foo_env="prod",container_label_f
# HELP container_cpu_user_seconds_total Cumulative user cpu time consumed in seconds. # HELP container_cpu_user_seconds_total Cumulative user cpu time consumed in seconds.
# TYPE container_cpu_user_seconds_total counter # TYPE container_cpu_user_seconds_total counter
container_cpu_user_seconds_total{container_env_foo_env="prod",container_label_foo_label="bar",id="testcontainer",image="test",name="testcontaineralias",zone_name="hello"} 6e-09 container_cpu_user_seconds_total{container_env_foo_env="prod",container_label_foo_label="bar",id="testcontainer",image="test",name="testcontaineralias",zone_name="hello"} 6e-09
# HELP container_fs_inodes_free Number of available Inodes
# TYPE container_fs_inodes_free gauge
container_fs_inodes_free{container_env_foo_env="prod",container_label_foo_label="bar",device="sda1",id="testcontainer",image="test",name="testcontaineralias",zone_name="hello"} 524288
container_fs_inodes_free{container_env_foo_env="prod",container_label_foo_label="bar",device="sda2",id="testcontainer",image="test",name="testcontaineralias",zone_name="hello"} 262144
# HELP container_fs_inodes_total Number of Inodes
# TYPE container_fs_inodes_total gauge
container_fs_inodes_total{container_env_foo_env="prod",container_label_foo_label="bar",device="sda1",id="testcontainer",image="test",name="testcontaineralias",zone_name="hello"} 2.097152e+06
container_fs_inodes_total{container_env_foo_env="prod",container_label_foo_label="bar",device="sda2",id="testcontainer",image="test",name="testcontaineralias",zone_name="hello"} 2.097152e+06
# HELP container_fs_io_current Number of I/Os currently in progress # HELP container_fs_io_current Number of I/Os currently in progress
# TYPE container_fs_io_current gauge # TYPE container_fs_io_current gauge
container_fs_io_current{container_env_foo_env="prod",container_label_foo_label="bar",device="sda1",id="testcontainer",image="test",name="testcontaineralias",zone_name="hello"} 42 container_fs_io_current{container_env_foo_env="prod",container_label_foo_label="bar",device="sda1",id="testcontainer",image="test",name="testcontaineralias",zone_name="hello"} 42