Namespace the system metrics
This commit is contained in:
parent
1c3e649098
commit
f0675e52c3
|
@ -52,9 +52,9 @@ func (s *SystemStats) Gather(acc plugins.Accumulator) error {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
acc.Add("load1", lv.Load1, nil)
|
acc.Add("system.load1", lv.Load1, nil)
|
||||||
acc.Add("load5", lv.Load5, nil)
|
acc.Add("system.load5", lv.Load5, nil)
|
||||||
acc.Add("load15", lv.Load15, nil)
|
acc.Add("system.load15", lv.Load15, nil)
|
||||||
|
|
||||||
times, err := s.ps.CPUTimes()
|
times, err := s.ps.CPUTimes()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@ -66,17 +66,17 @@ func (s *SystemStats) Gather(acc plugins.Accumulator) error {
|
||||||
"cpu": cts.CPU,
|
"cpu": cts.CPU,
|
||||||
}
|
}
|
||||||
|
|
||||||
s.add(acc, "user", cts.User, tags)
|
s.add(acc, "cpu.user", cts.User, tags)
|
||||||
s.add(acc, "system", cts.System, tags)
|
s.add(acc, "cpu.system", cts.System, tags)
|
||||||
s.add(acc, "idle", cts.Idle, tags)
|
s.add(acc, "cpu.idle", cts.Idle, tags)
|
||||||
s.add(acc, "nice", cts.Nice, tags)
|
s.add(acc, "cpu.nice", cts.Nice, tags)
|
||||||
s.add(acc, "iowait", cts.Iowait, tags)
|
s.add(acc, "cpu.iowait", cts.Iowait, tags)
|
||||||
s.add(acc, "irq", cts.Irq, tags)
|
s.add(acc, "cpu.irq", cts.Irq, tags)
|
||||||
s.add(acc, "softirq", cts.Softirq, tags)
|
s.add(acc, "cpu.softirq", cts.Softirq, tags)
|
||||||
s.add(acc, "steal", cts.Steal, tags)
|
s.add(acc, "cpu.steal", cts.Steal, tags)
|
||||||
s.add(acc, "guest", cts.Guest, tags)
|
s.add(acc, "cpu.guest", cts.Guest, tags)
|
||||||
s.add(acc, "guestNice", cts.GuestNice, tags)
|
s.add(acc, "cpu.guestNice", cts.GuestNice, tags)
|
||||||
s.add(acc, "stolen", cts.Stolen, tags)
|
s.add(acc, "cpu.stolen", cts.Stolen, tags)
|
||||||
}
|
}
|
||||||
|
|
||||||
disks, err := s.ps.DiskUsage()
|
disks, err := s.ps.DiskUsage()
|
||||||
|
@ -89,12 +89,12 @@ func (s *SystemStats) Gather(acc plugins.Accumulator) error {
|
||||||
"path": du.Path,
|
"path": du.Path,
|
||||||
}
|
}
|
||||||
|
|
||||||
acc.Add("total", du.Total, tags)
|
acc.Add("disk.total", du.Total, tags)
|
||||||
acc.Add("free", du.Free, tags)
|
acc.Add("disk.free", du.Free, tags)
|
||||||
acc.Add("used", du.Total-du.Free, tags)
|
acc.Add("disk.used", du.Total-du.Free, tags)
|
||||||
acc.Add("inodes_total", du.InodesTotal, tags)
|
acc.Add("disk.inodes_total", du.InodesTotal, tags)
|
||||||
acc.Add("inodes_free", du.InodesFree, tags)
|
acc.Add("disk.inodes_free", du.InodesFree, tags)
|
||||||
acc.Add("inodes_used", du.InodesTotal-du.InodesFree, tags)
|
acc.Add("disk.inodes_used", du.InodesTotal-du.InodesFree, tags)
|
||||||
}
|
}
|
||||||
|
|
||||||
diskio, err := s.ps.DiskIO()
|
diskio, err := s.ps.DiskIO()
|
||||||
|
@ -108,13 +108,13 @@ func (s *SystemStats) Gather(acc plugins.Accumulator) error {
|
||||||
"serial": io.SerialNumber,
|
"serial": io.SerialNumber,
|
||||||
}
|
}
|
||||||
|
|
||||||
acc.Add("reads", io.ReadCount, tags)
|
acc.Add("io.reads", io.ReadCount, tags)
|
||||||
acc.Add("writes", io.WriteCount, tags)
|
acc.Add("io.writes", io.WriteCount, tags)
|
||||||
acc.Add("read_bytes", io.ReadBytes, tags)
|
acc.Add("io.read_bytes", io.ReadBytes, tags)
|
||||||
acc.Add("write_bytes", io.WriteBytes, tags)
|
acc.Add("io.write_bytes", io.WriteBytes, tags)
|
||||||
acc.Add("read_time", io.ReadTime, tags)
|
acc.Add("io.read_time", io.ReadTime, tags)
|
||||||
acc.Add("write_time", io.WriteTime, tags)
|
acc.Add("io.write_time", io.WriteTime, tags)
|
||||||
acc.Add("io_time", io.IoTime, tags)
|
acc.Add("io.io_time", io.IoTime, tags)
|
||||||
}
|
}
|
||||||
|
|
||||||
netio, err := s.ps.NetIO()
|
netio, err := s.ps.NetIO()
|
||||||
|
@ -127,14 +127,14 @@ func (s *SystemStats) Gather(acc plugins.Accumulator) error {
|
||||||
"interface": io.Name,
|
"interface": io.Name,
|
||||||
}
|
}
|
||||||
|
|
||||||
acc.Add("bytes_sent", io.BytesSent, tags)
|
acc.Add("net.bytes_sent", io.BytesSent, tags)
|
||||||
acc.Add("bytes_recv", io.BytesRecv, tags)
|
acc.Add("net.bytes_recv", io.BytesRecv, tags)
|
||||||
acc.Add("packets_sent", io.PacketsSent, tags)
|
acc.Add("net.packets_sent", io.PacketsSent, tags)
|
||||||
acc.Add("packets_recv", io.PacketsRecv, tags)
|
acc.Add("net.packets_recv", io.PacketsRecv, tags)
|
||||||
acc.Add("err_in", io.Errin, tags)
|
acc.Add("net.err_in", io.Errin, tags)
|
||||||
acc.Add("err_out", io.Errout, tags)
|
acc.Add("net.err_out", io.Errout, tags)
|
||||||
acc.Add("drop_in", io.Dropin, tags)
|
acc.Add("net.drop_in", io.Dropin, tags)
|
||||||
acc.Add("drop_out", io.Dropout, tags)
|
acc.Add("net.drop_out", io.Dropout, tags)
|
||||||
}
|
}
|
||||||
|
|
||||||
vm, err := s.ps.VMStat()
|
vm, err := s.ps.VMStat()
|
||||||
|
@ -142,37 +142,33 @@ func (s *SystemStats) Gather(acc plugins.Accumulator) error {
|
||||||
return fmt.Errorf("error getting virtual memory info: %s", err)
|
return fmt.Errorf("error getting virtual memory info: %s", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
vmtags := map[string]string{
|
vmtags := map[string]string(nil)
|
||||||
"memory": "virtual",
|
|
||||||
}
|
|
||||||
|
|
||||||
acc.Add("total", vm.Total, vmtags)
|
acc.Add("mem.total", vm.Total, vmtags)
|
||||||
acc.Add("available", vm.Available, vmtags)
|
acc.Add("mem.available", vm.Available, vmtags)
|
||||||
acc.Add("used", vm.Used, vmtags)
|
acc.Add("mem.used", vm.Used, vmtags)
|
||||||
acc.Add("used_prec", vm.UsedPercent, vmtags)
|
acc.Add("mem.used_prec", vm.UsedPercent, vmtags)
|
||||||
acc.Add("free", vm.Free, vmtags)
|
acc.Add("mem.free", vm.Free, vmtags)
|
||||||
acc.Add("active", vm.Active, vmtags)
|
acc.Add("mem.active", vm.Active, vmtags)
|
||||||
acc.Add("inactive", vm.Inactive, vmtags)
|
acc.Add("mem.inactive", vm.Inactive, vmtags)
|
||||||
acc.Add("buffers", vm.Buffers, vmtags)
|
acc.Add("mem.buffers", vm.Buffers, vmtags)
|
||||||
acc.Add("cached", vm.Cached, vmtags)
|
acc.Add("mem.cached", vm.Cached, vmtags)
|
||||||
acc.Add("wired", vm.Wired, vmtags)
|
acc.Add("mem.wired", vm.Wired, vmtags)
|
||||||
acc.Add("shared", vm.Shared, vmtags)
|
acc.Add("mem.shared", vm.Shared, vmtags)
|
||||||
|
|
||||||
swap, err := s.ps.SwapStat()
|
swap, err := s.ps.SwapStat()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return fmt.Errorf("error getting swap memory info: %s", err)
|
return fmt.Errorf("error getting swap memory info: %s", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
swaptags := map[string]string{
|
swaptags := map[string]string(nil)
|
||||||
"memory": "swap",
|
|
||||||
}
|
|
||||||
|
|
||||||
acc.Add("total", swap.Total, swaptags)
|
acc.Add("swap.total", swap.Total, swaptags)
|
||||||
acc.Add("used", swap.Used, swaptags)
|
acc.Add("swap.used", swap.Used, swaptags)
|
||||||
acc.Add("free", swap.Free, swaptags)
|
acc.Add("swap.free", swap.Free, swaptags)
|
||||||
acc.Add("used_perc", swap.UsedPercent, swaptags)
|
acc.Add("swap.used_perc", swap.UsedPercent, swaptags)
|
||||||
acc.Add("swap_in", swap.Sin, swaptags)
|
acc.Add("swap.swap_in", swap.Sin, swaptags)
|
||||||
acc.Add("swap_out", swap.Sout, swaptags)
|
acc.Add("swap.swap_out", swap.Sout, swaptags)
|
||||||
|
|
||||||
containers, err := s.ps.DockerStat()
|
containers, err := s.ps.DockerStat()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@ -181,52 +177,52 @@ func (s *SystemStats) Gather(acc plugins.Accumulator) error {
|
||||||
|
|
||||||
for _, cont := range containers {
|
for _, cont := range containers {
|
||||||
tags := map[string]string{
|
tags := map[string]string{
|
||||||
"docker": cont.Id,
|
"id": cont.Id,
|
||||||
"name": cont.Name,
|
"name": cont.Name,
|
||||||
"command": cont.Command,
|
"command": cont.Command,
|
||||||
}
|
}
|
||||||
|
|
||||||
cts := cont.CPU
|
cts := cont.CPU
|
||||||
|
|
||||||
acc.Add("user", cts.User, tags)
|
acc.Add("docker.user", cts.User, tags)
|
||||||
acc.Add("system", cts.System, tags)
|
acc.Add("docker.system", cts.System, tags)
|
||||||
acc.Add("idle", cts.Idle, tags)
|
acc.Add("docker.idle", cts.Idle, tags)
|
||||||
acc.Add("nice", cts.Nice, tags)
|
acc.Add("docker.nice", cts.Nice, tags)
|
||||||
acc.Add("iowait", cts.Iowait, tags)
|
acc.Add("docker.iowait", cts.Iowait, tags)
|
||||||
acc.Add("irq", cts.Irq, tags)
|
acc.Add("docker.irq", cts.Irq, tags)
|
||||||
acc.Add("softirq", cts.Softirq, tags)
|
acc.Add("docker.softirq", cts.Softirq, tags)
|
||||||
acc.Add("steal", cts.Steal, tags)
|
acc.Add("docker.steal", cts.Steal, tags)
|
||||||
acc.Add("guest", cts.Guest, tags)
|
acc.Add("docker.guest", cts.Guest, tags)
|
||||||
acc.Add("guestNice", cts.GuestNice, tags)
|
acc.Add("docker.guestNice", cts.GuestNice, tags)
|
||||||
acc.Add("stolen", cts.Stolen, tags)
|
acc.Add("docker.stolen", cts.Stolen, tags)
|
||||||
|
|
||||||
acc.Add("cache", cont.Mem.Cache, tags)
|
acc.Add("docker.cache", cont.Mem.Cache, tags)
|
||||||
acc.Add("rss", cont.Mem.RSS, tags)
|
acc.Add("docker.rss", cont.Mem.RSS, tags)
|
||||||
acc.Add("rss_huge", cont.Mem.RSSHuge, tags)
|
acc.Add("docker.rss_huge", cont.Mem.RSSHuge, tags)
|
||||||
acc.Add("mapped_file", cont.Mem.MappedFile, tags)
|
acc.Add("docker.mapped_file", cont.Mem.MappedFile, tags)
|
||||||
acc.Add("swap_in", cont.Mem.Pgpgin, tags)
|
acc.Add("docker.swap_in", cont.Mem.Pgpgin, tags)
|
||||||
acc.Add("swap_out", cont.Mem.Pgpgout, tags)
|
acc.Add("docker.swap_out", cont.Mem.Pgpgout, tags)
|
||||||
acc.Add("page_fault", cont.Mem.Pgfault, tags)
|
acc.Add("docker.page_fault", cont.Mem.Pgfault, tags)
|
||||||
acc.Add("page_major_fault", cont.Mem.Pgmajfault, tags)
|
acc.Add("docker.page_major_fault", cont.Mem.Pgmajfault, tags)
|
||||||
acc.Add("inactive_anon", cont.Mem.InactiveAnon, tags)
|
acc.Add("docker.inactive_anon", cont.Mem.InactiveAnon, tags)
|
||||||
acc.Add("active_anon", cont.Mem.ActiveAnon, tags)
|
acc.Add("docker.active_anon", cont.Mem.ActiveAnon, tags)
|
||||||
acc.Add("inactive_file", cont.Mem.InactiveFile, tags)
|
acc.Add("docker.inactive_file", cont.Mem.InactiveFile, tags)
|
||||||
acc.Add("active_file", cont.Mem.ActiveFile, tags)
|
acc.Add("docker.active_file", cont.Mem.ActiveFile, tags)
|
||||||
acc.Add("unevictable", cont.Mem.Unevictable, tags)
|
acc.Add("docker.unevictable", cont.Mem.Unevictable, tags)
|
||||||
acc.Add("memory_limit", cont.Mem.HierarchicalMemoryLimit, tags)
|
acc.Add("docker.memory_limit", cont.Mem.HierarchicalMemoryLimit, tags)
|
||||||
acc.Add("total_cache", cont.Mem.TotalCache, tags)
|
acc.Add("docker.total_cache", cont.Mem.TotalCache, tags)
|
||||||
acc.Add("total_rss", cont.Mem.TotalRSS, tags)
|
acc.Add("docker.total_rss", cont.Mem.TotalRSS, tags)
|
||||||
acc.Add("total_rss_huge", cont.Mem.TotalRSSHuge, tags)
|
acc.Add("docker.total_rss_huge", cont.Mem.TotalRSSHuge, tags)
|
||||||
acc.Add("total_mapped_file", cont.Mem.TotalMappedFile, tags)
|
acc.Add("docker.total_mapped_file", cont.Mem.TotalMappedFile, tags)
|
||||||
acc.Add("total_swap_in", cont.Mem.TotalPgpgIn, tags)
|
acc.Add("docker.total_swap_in", cont.Mem.TotalPgpgIn, tags)
|
||||||
acc.Add("total_swap_out", cont.Mem.TotalPgpgOut, tags)
|
acc.Add("docker.total_swap_out", cont.Mem.TotalPgpgOut, tags)
|
||||||
acc.Add("total_page_fault", cont.Mem.TotalPgFault, tags)
|
acc.Add("docker.total_page_fault", cont.Mem.TotalPgFault, tags)
|
||||||
acc.Add("total_page_major_fault", cont.Mem.TotalPgMajFault, tags)
|
acc.Add("docker.total_page_major_fault", cont.Mem.TotalPgMajFault, tags)
|
||||||
acc.Add("total_inactive_anon", cont.Mem.TotalInactiveAnon, tags)
|
acc.Add("docker.total_inactive_anon", cont.Mem.TotalInactiveAnon, tags)
|
||||||
acc.Add("total_active_anon", cont.Mem.TotalActiveAnon, tags)
|
acc.Add("docker.total_active_anon", cont.Mem.TotalActiveAnon, tags)
|
||||||
acc.Add("total_inactive_file", cont.Mem.TotalInactiveFile, tags)
|
acc.Add("docker.total_inactive_file", cont.Mem.TotalInactiveFile, tags)
|
||||||
acc.Add("total_active_file", cont.Mem.TotalActiveFile, tags)
|
acc.Add("docker.total_active_file", cont.Mem.TotalActiveFile, tags)
|
||||||
acc.Add("total_unevictable", cont.Mem.TotalUnevictable, tags)
|
acc.Add("docker.total_unevictable", cont.Mem.TotalUnevictable, tags)
|
||||||
}
|
}
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
|
|
|
@ -32,7 +32,7 @@ func TestSystemStats_GenerateStats(t *testing.T) {
|
||||||
mps.On("LoadAvg").Return(lv, nil)
|
mps.On("LoadAvg").Return(lv, nil)
|
||||||
|
|
||||||
cts := cpu.CPUTimesStat{
|
cts := cpu.CPUTimesStat{
|
||||||
CPU: "all",
|
CPU: "cpu0",
|
||||||
User: 3.1,
|
User: 3.1,
|
||||||
System: 8.2,
|
System: 8.2,
|
||||||
Idle: 80.1,
|
Idle: 80.1,
|
||||||
|
@ -166,131 +166,127 @@ func TestSystemStats_GenerateStats(t *testing.T) {
|
||||||
err := ss.Gather(&acc)
|
err := ss.Gather(&acc)
|
||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
|
|
||||||
assert.True(t, acc.CheckValue("load1", 0.3))
|
assert.True(t, acc.CheckValue("system.load1", 0.3))
|
||||||
assert.True(t, acc.CheckValue("load5", 1.5))
|
assert.True(t, acc.CheckValue("system.load5", 1.5))
|
||||||
assert.True(t, acc.CheckValue("load15", 0.8))
|
assert.True(t, acc.CheckValue("system.load15", 0.8))
|
||||||
|
|
||||||
cputags := map[string]string{
|
cputags := map[string]string{
|
||||||
"cpu": "all",
|
"cpu": "cpu0",
|
||||||
}
|
}
|
||||||
|
|
||||||
assert.True(t, acc.CheckTaggedValue("user", 3.1, cputags))
|
assert.True(t, acc.CheckTaggedValue("cpu.user", 3.1, cputags))
|
||||||
assert.True(t, acc.CheckTaggedValue("system", 8.2, cputags))
|
assert.True(t, acc.CheckTaggedValue("cpu.system", 8.2, cputags))
|
||||||
assert.True(t, acc.CheckTaggedValue("idle", 80.1, cputags))
|
assert.True(t, acc.CheckTaggedValue("cpu.idle", 80.1, cputags))
|
||||||
assert.True(t, acc.CheckTaggedValue("nice", 1.3, cputags))
|
assert.True(t, acc.CheckTaggedValue("cpu.nice", 1.3, cputags))
|
||||||
assert.True(t, acc.CheckTaggedValue("iowait", 0.2, cputags))
|
assert.True(t, acc.CheckTaggedValue("cpu.iowait", 0.2, cputags))
|
||||||
assert.True(t, acc.CheckTaggedValue("irq", 0.1, cputags))
|
assert.True(t, acc.CheckTaggedValue("cpu.irq", 0.1, cputags))
|
||||||
assert.True(t, acc.CheckTaggedValue("softirq", 0.11, cputags))
|
assert.True(t, acc.CheckTaggedValue("cpu.softirq", 0.11, cputags))
|
||||||
assert.True(t, acc.CheckTaggedValue("steal", 0.0001, cputags))
|
assert.True(t, acc.CheckTaggedValue("cpu.steal", 0.0001, cputags))
|
||||||
assert.True(t, acc.CheckTaggedValue("guest", 8.1, cputags))
|
assert.True(t, acc.CheckTaggedValue("cpu.guest", 8.1, cputags))
|
||||||
assert.True(t, acc.CheckTaggedValue("guestNice", 0.324, cputags))
|
assert.True(t, acc.CheckTaggedValue("cpu.guestNice", 0.324, cputags))
|
||||||
assert.True(t, acc.CheckTaggedValue("stolen", 0.051, cputags))
|
assert.True(t, acc.CheckTaggedValue("cpu.stolen", 0.051, cputags))
|
||||||
|
|
||||||
tags := map[string]string{
|
tags := map[string]string{
|
||||||
"path": "/",
|
"path": "/",
|
||||||
}
|
}
|
||||||
|
|
||||||
assert.True(t, acc.CheckTaggedValue("total", uint64(128), tags))
|
assert.True(t, acc.CheckTaggedValue("disk.total", uint64(128), tags))
|
||||||
assert.True(t, acc.CheckTaggedValue("used", uint64(105), tags))
|
assert.True(t, acc.CheckTaggedValue("disk.used", uint64(105), tags))
|
||||||
assert.True(t, acc.CheckTaggedValue("free", uint64(23), tags))
|
assert.True(t, acc.CheckTaggedValue("disk.free", uint64(23), tags))
|
||||||
assert.True(t, acc.CheckTaggedValue("inodes_total", uint64(1234), tags))
|
assert.True(t, acc.CheckTaggedValue("disk.inodes_total", uint64(1234), tags))
|
||||||
assert.True(t, acc.CheckTaggedValue("inodes_free", uint64(234), tags))
|
assert.True(t, acc.CheckTaggedValue("disk.inodes_free", uint64(234), tags))
|
||||||
assert.True(t, acc.CheckTaggedValue("inodes_used", uint64(1000), tags))
|
assert.True(t, acc.CheckTaggedValue("disk.inodes_used", uint64(1000), tags))
|
||||||
|
|
||||||
ntags := map[string]string{
|
ntags := map[string]string{
|
||||||
"interface": "eth0",
|
"interface": "eth0",
|
||||||
}
|
}
|
||||||
|
|
||||||
assert.True(t, acc.CheckTaggedValue("bytes_sent", uint64(1123), ntags))
|
assert.True(t, acc.CheckTaggedValue("net.bytes_sent", uint64(1123), ntags))
|
||||||
assert.True(t, acc.CheckTaggedValue("bytes_recv", uint64(8734422), ntags))
|
assert.True(t, acc.CheckTaggedValue("net.bytes_recv", uint64(8734422), ntags))
|
||||||
assert.True(t, acc.CheckTaggedValue("packets_sent", uint64(781), ntags))
|
assert.True(t, acc.CheckTaggedValue("net.packets_sent", uint64(781), ntags))
|
||||||
assert.True(t, acc.CheckTaggedValue("packets_recv", uint64(23456), ntags))
|
assert.True(t, acc.CheckTaggedValue("net.packets_recv", uint64(23456), ntags))
|
||||||
assert.True(t, acc.CheckTaggedValue("err_in", uint64(832), ntags))
|
assert.True(t, acc.CheckTaggedValue("net.err_in", uint64(832), ntags))
|
||||||
assert.True(t, acc.CheckTaggedValue("err_out", uint64(8), ntags))
|
assert.True(t, acc.CheckTaggedValue("net.err_out", uint64(8), ntags))
|
||||||
assert.True(t, acc.CheckTaggedValue("drop_in", uint64(7), ntags))
|
assert.True(t, acc.CheckTaggedValue("net.drop_in", uint64(7), ntags))
|
||||||
assert.True(t, acc.CheckTaggedValue("drop_out", uint64(1), ntags))
|
assert.True(t, acc.CheckTaggedValue("net.drop_out", uint64(1), ntags))
|
||||||
|
|
||||||
dtags := map[string]string{
|
dtags := map[string]string{
|
||||||
"name": "sda1",
|
"name": "sda1",
|
||||||
"serial": "ab-123-ad",
|
"serial": "ab-123-ad",
|
||||||
}
|
}
|
||||||
|
|
||||||
assert.True(t, acc.CheckTaggedValue("reads", uint64(888), dtags))
|
assert.True(t, acc.CheckTaggedValue("io.reads", uint64(888), dtags))
|
||||||
assert.True(t, acc.CheckTaggedValue("writes", uint64(5341), dtags))
|
assert.True(t, acc.CheckTaggedValue("io.writes", uint64(5341), dtags))
|
||||||
assert.True(t, acc.CheckTaggedValue("read_bytes", uint64(100000), dtags))
|
assert.True(t, acc.CheckTaggedValue("io.read_bytes", uint64(100000), dtags))
|
||||||
assert.True(t, acc.CheckTaggedValue("write_bytes", uint64(200000), dtags))
|
assert.True(t, acc.CheckTaggedValue("io.write_bytes", uint64(200000), dtags))
|
||||||
assert.True(t, acc.CheckTaggedValue("read_time", uint64(7123), dtags))
|
assert.True(t, acc.CheckTaggedValue("io.read_time", uint64(7123), dtags))
|
||||||
assert.True(t, acc.CheckTaggedValue("write_time", uint64(9087), dtags))
|
assert.True(t, acc.CheckTaggedValue("io.write_time", uint64(9087), dtags))
|
||||||
assert.True(t, acc.CheckTaggedValue("io_time", uint64(123552), dtags))
|
assert.True(t, acc.CheckTaggedValue("io.io_time", uint64(123552), dtags))
|
||||||
|
|
||||||
vmtags := map[string]string{
|
vmtags := map[string]string(nil)
|
||||||
"memory": "virtual",
|
|
||||||
}
|
|
||||||
|
|
||||||
assert.True(t, acc.CheckTaggedValue("total", uint64(12400), vmtags))
|
assert.True(t, acc.CheckTaggedValue("mem.total", uint64(12400), vmtags))
|
||||||
assert.True(t, acc.CheckTaggedValue("available", uint64(7600), vmtags))
|
assert.True(t, acc.CheckTaggedValue("mem.available", uint64(7600), vmtags))
|
||||||
assert.True(t, acc.CheckTaggedValue("used", uint64(5000), vmtags))
|
assert.True(t, acc.CheckTaggedValue("mem.used", uint64(5000), vmtags))
|
||||||
assert.True(t, acc.CheckTaggedValue("used_prec", float64(47.1), vmtags))
|
assert.True(t, acc.CheckTaggedValue("mem.used_prec", float64(47.1), vmtags))
|
||||||
assert.True(t, acc.CheckTaggedValue("free", uint64(1235), vmtags))
|
assert.True(t, acc.CheckTaggedValue("mem.free", uint64(1235), vmtags))
|
||||||
assert.True(t, acc.CheckTaggedValue("active", uint64(8134), vmtags))
|
assert.True(t, acc.CheckTaggedValue("mem.active", uint64(8134), vmtags))
|
||||||
assert.True(t, acc.CheckTaggedValue("inactive", uint64(1124), vmtags))
|
assert.True(t, acc.CheckTaggedValue("mem.inactive", uint64(1124), vmtags))
|
||||||
assert.True(t, acc.CheckTaggedValue("buffers", uint64(771), vmtags))
|
assert.True(t, acc.CheckTaggedValue("mem.buffers", uint64(771), vmtags))
|
||||||
assert.True(t, acc.CheckTaggedValue("cached", uint64(4312), vmtags))
|
assert.True(t, acc.CheckTaggedValue("mem.cached", uint64(4312), vmtags))
|
||||||
assert.True(t, acc.CheckTaggedValue("wired", uint64(134), vmtags))
|
assert.True(t, acc.CheckTaggedValue("mem.wired", uint64(134), vmtags))
|
||||||
assert.True(t, acc.CheckTaggedValue("shared", uint64(2142), vmtags))
|
assert.True(t, acc.CheckTaggedValue("mem.shared", uint64(2142), vmtags))
|
||||||
|
|
||||||
swaptags := map[string]string{
|
swaptags := map[string]string(nil)
|
||||||
"memory": "swap",
|
|
||||||
}
|
|
||||||
|
|
||||||
assert.True(t, acc.CheckTaggedValue("total", uint64(8123), swaptags))
|
assert.True(t, acc.CheckTaggedValue("swap.total", uint64(8123), swaptags))
|
||||||
assert.True(t, acc.CheckTaggedValue("used", uint64(1232), swaptags))
|
assert.True(t, acc.CheckTaggedValue("swap.used", uint64(1232), swaptags))
|
||||||
assert.True(t, acc.CheckTaggedValue("used_perc", float64(12.2), swaptags))
|
assert.True(t, acc.CheckTaggedValue("swap.used_perc", float64(12.2), swaptags))
|
||||||
assert.True(t, acc.CheckTaggedValue("free", uint64(6412), swaptags))
|
assert.True(t, acc.CheckTaggedValue("swap.free", uint64(6412), swaptags))
|
||||||
assert.True(t, acc.CheckTaggedValue("swap_in", uint64(7), swaptags))
|
assert.True(t, acc.CheckTaggedValue("swap.swap_in", uint64(7), swaptags))
|
||||||
assert.True(t, acc.CheckTaggedValue("swap_out", uint64(830), swaptags))
|
assert.True(t, acc.CheckTaggedValue("swap.swap_out", uint64(830), swaptags))
|
||||||
|
|
||||||
dockertags := map[string]string{
|
dockertags := map[string]string{
|
||||||
"docker": "blah",
|
"id": "blah",
|
||||||
}
|
}
|
||||||
|
|
||||||
assert.True(t, acc.CheckTaggedValue("user", 3.1, dockertags))
|
assert.True(t, acc.CheckTaggedValue("docker.user", 3.1, dockertags))
|
||||||
assert.True(t, acc.CheckTaggedValue("system", 8.2, dockertags))
|
assert.True(t, acc.CheckTaggedValue("docker.system", 8.2, dockertags))
|
||||||
assert.True(t, acc.CheckTaggedValue("idle", 80.1, dockertags))
|
assert.True(t, acc.CheckTaggedValue("docker.idle", 80.1, dockertags))
|
||||||
assert.True(t, acc.CheckTaggedValue("nice", 1.3, dockertags))
|
assert.True(t, acc.CheckTaggedValue("docker.nice", 1.3, dockertags))
|
||||||
assert.True(t, acc.CheckTaggedValue("iowait", 0.2, dockertags))
|
assert.True(t, acc.CheckTaggedValue("docker.iowait", 0.2, dockertags))
|
||||||
assert.True(t, acc.CheckTaggedValue("irq", 0.1, dockertags))
|
assert.True(t, acc.CheckTaggedValue("docker.irq", 0.1, dockertags))
|
||||||
assert.True(t, acc.CheckTaggedValue("softirq", 0.11, dockertags))
|
assert.True(t, acc.CheckTaggedValue("docker.softirq", 0.11, dockertags))
|
||||||
assert.True(t, acc.CheckTaggedValue("steal", 0.0001, dockertags))
|
assert.True(t, acc.CheckTaggedValue("docker.steal", 0.0001, dockertags))
|
||||||
assert.True(t, acc.CheckTaggedValue("guest", 8.1, dockertags))
|
assert.True(t, acc.CheckTaggedValue("docker.guest", 8.1, dockertags))
|
||||||
assert.True(t, acc.CheckTaggedValue("guestNice", 0.324, dockertags))
|
assert.True(t, acc.CheckTaggedValue("docker.guestNice", 0.324, dockertags))
|
||||||
assert.True(t, acc.CheckTaggedValue("stolen", 0.051, dockertags))
|
assert.True(t, acc.CheckTaggedValue("docker.stolen", 0.051, dockertags))
|
||||||
|
|
||||||
assert.True(t, acc.CheckTaggedValue("cache", uint64(1), dockertags))
|
assert.True(t, acc.CheckTaggedValue("docker.cache", uint64(1), dockertags))
|
||||||
assert.True(t, acc.CheckTaggedValue("rss", uint64(2), dockertags))
|
assert.True(t, acc.CheckTaggedValue("docker.rss", uint64(2), dockertags))
|
||||||
assert.True(t, acc.CheckTaggedValue("rss_huge", uint64(3), dockertags))
|
assert.True(t, acc.CheckTaggedValue("docker.rss_huge", uint64(3), dockertags))
|
||||||
assert.True(t, acc.CheckTaggedValue("mapped_file", uint64(4), dockertags))
|
assert.True(t, acc.CheckTaggedValue("docker.mapped_file", uint64(4), dockertags))
|
||||||
assert.True(t, acc.CheckTaggedValue("swap_in", uint64(5), dockertags))
|
assert.True(t, acc.CheckTaggedValue("docker.swap_in", uint64(5), dockertags))
|
||||||
assert.True(t, acc.CheckTaggedValue("swap_out", uint64(6), dockertags))
|
assert.True(t, acc.CheckTaggedValue("docker.swap_out", uint64(6), dockertags))
|
||||||
assert.True(t, acc.CheckTaggedValue("page_fault", uint64(7), dockertags))
|
assert.True(t, acc.CheckTaggedValue("docker.page_fault", uint64(7), dockertags))
|
||||||
assert.True(t, acc.CheckTaggedValue("page_major_fault", uint64(8), dockertags))
|
assert.True(t, acc.CheckTaggedValue("docker.page_major_fault", uint64(8), dockertags))
|
||||||
assert.True(t, acc.CheckTaggedValue("inactive_anon", uint64(9), dockertags))
|
assert.True(t, acc.CheckTaggedValue("docker.inactive_anon", uint64(9), dockertags))
|
||||||
assert.True(t, acc.CheckTaggedValue("active_anon", uint64(10), dockertags))
|
assert.True(t, acc.CheckTaggedValue("docker.active_anon", uint64(10), dockertags))
|
||||||
assert.True(t, acc.CheckTaggedValue("inactive_file", uint64(11), dockertags))
|
assert.True(t, acc.CheckTaggedValue("docker.inactive_file", uint64(11), dockertags))
|
||||||
assert.True(t, acc.CheckTaggedValue("active_file", uint64(12), dockertags))
|
assert.True(t, acc.CheckTaggedValue("docker.active_file", uint64(12), dockertags))
|
||||||
assert.True(t, acc.CheckTaggedValue("unevictable", uint64(13), dockertags))
|
assert.True(t, acc.CheckTaggedValue("docker.unevictable", uint64(13), dockertags))
|
||||||
assert.True(t, acc.CheckTaggedValue("memory_limit", uint64(14), dockertags))
|
assert.True(t, acc.CheckTaggedValue("docker.memory_limit", uint64(14), dockertags))
|
||||||
assert.True(t, acc.CheckTaggedValue("total_cache", uint64(15), dockertags))
|
assert.True(t, acc.CheckTaggedValue("docker.total_cache", uint64(15), dockertags))
|
||||||
assert.True(t, acc.CheckTaggedValue("total_rss", uint64(16), dockertags))
|
assert.True(t, acc.CheckTaggedValue("docker.total_rss", uint64(16), dockertags))
|
||||||
assert.True(t, acc.CheckTaggedValue("total_rss_huge", uint64(17), dockertags))
|
assert.True(t, acc.CheckTaggedValue("docker.total_rss_huge", uint64(17), dockertags))
|
||||||
assert.True(t, acc.CheckTaggedValue("total_mapped_file", uint64(18), dockertags))
|
assert.True(t, acc.CheckTaggedValue("docker.total_mapped_file", uint64(18), dockertags))
|
||||||
assert.True(t, acc.CheckTaggedValue("total_swap_in", uint64(19), dockertags))
|
assert.True(t, acc.CheckTaggedValue("docker.total_swap_in", uint64(19), dockertags))
|
||||||
assert.True(t, acc.CheckTaggedValue("total_swap_out", uint64(20), dockertags))
|
assert.True(t, acc.CheckTaggedValue("docker.total_swap_out", uint64(20), dockertags))
|
||||||
assert.True(t, acc.CheckTaggedValue("total_page_fault", uint64(21), dockertags))
|
assert.True(t, acc.CheckTaggedValue("docker.total_page_fault", uint64(21), dockertags))
|
||||||
assert.True(t, acc.CheckTaggedValue("total_page_major_fault", uint64(22), dockertags))
|
assert.True(t, acc.CheckTaggedValue("docker.total_page_major_fault", uint64(22), dockertags))
|
||||||
assert.True(t, acc.CheckTaggedValue("total_inactive_anon", uint64(23), dockertags))
|
assert.True(t, acc.CheckTaggedValue("docker.total_inactive_anon", uint64(23), dockertags))
|
||||||
assert.True(t, acc.CheckTaggedValue("total_active_anon", uint64(24), dockertags))
|
assert.True(t, acc.CheckTaggedValue("docker.total_active_anon", uint64(24), dockertags))
|
||||||
assert.True(t, acc.CheckTaggedValue("total_inactive_file", uint64(25), dockertags))
|
assert.True(t, acc.CheckTaggedValue("docker.total_inactive_file", uint64(25), dockertags))
|
||||||
assert.True(t, acc.CheckTaggedValue("total_active_file", uint64(26), dockertags))
|
assert.True(t, acc.CheckTaggedValue("docker.total_active_file", uint64(26), dockertags))
|
||||||
assert.True(t, acc.CheckTaggedValue("total_unevictable", uint64(27), dockertags))
|
assert.True(t, acc.CheckTaggedValue("docker.total_unevictable", uint64(27), dockertags))
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue