mirror of
https://github.com/prometheus/node_exporter.git
synced 2024-11-09 23:24:09 -08:00
Rearrange fixtures to match "real" proc and sys.
And add some missing fixtures for default collectors, even if they're not read by tests yet.
This commit is contained in:
parent
85eb47197f
commit
788ac9a859
|
@ -18,7 +18,7 @@ import (
|
|||
)
|
||||
|
||||
func TestBonding(t *testing.T) {
|
||||
bondingStats, err := readBondingStats("fixtures/bonding")
|
||||
bondingStats, err := readBondingStats("fixtures/sys/class/net")
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
|
|
|
@ -19,7 +19,7 @@ import (
|
|||
)
|
||||
|
||||
func TestDiskStats(t *testing.T) {
|
||||
file, err := os.Open("fixtures/diskstats")
|
||||
file, err := os.Open("fixtures/proc/diskstats")
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
|
|
|
@ -19,7 +19,7 @@ import (
|
|||
)
|
||||
|
||||
func TestFileFDStats(t *testing.T) {
|
||||
file, err := os.Open("fixtures/file-nr")
|
||||
file, err := os.Open("fixtures/proc/sys/fs/file-nr")
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
|
|
1
collector/fixtures/proc/loadavg
Normal file
1
collector/fixtures/proc/loadavg
Normal file
|
@ -0,0 +1 @@
|
|||
0.21 0.37 0.39 1/719 19737
|
30
collector/fixtures/proc/mounts
Normal file
30
collector/fixtures/proc/mounts
Normal file
|
@ -0,0 +1,30 @@
|
|||
rootfs / rootfs rw 0 0
|
||||
sysfs /sys sysfs rw,nosuid,nodev,noexec,relatime 0 0
|
||||
proc /proc proc rw,nosuid,nodev,noexec,relatime 0 0
|
||||
udev /dev devtmpfs rw,relatime,size=10240k,nr_inodes=1008585,mode=755 0 0
|
||||
devpts /dev/pts devpts rw,nosuid,noexec,relatime,gid=5,mode=620,ptmxmode=000 0 0
|
||||
tmpfs /run tmpfs rw,nosuid,relatime,size=1617716k,mode=755 0 0
|
||||
/dev/dm-2 / ext4 rw,relatime,errors=remount-ro,data=ordered 0 0
|
||||
securityfs /sys/kernel/security securityfs rw,nosuid,nodev,noexec,relatime 0 0
|
||||
tmpfs /dev/shm tmpfs rw,nosuid,nodev 0 0
|
||||
tmpfs /run/lock tmpfs rw,nosuid,nodev,noexec,relatime,size=5120k 0 0
|
||||
tmpfs /sys/fs/cgroup tmpfs ro,nosuid,nodev,noexec,mode=755 0 0
|
||||
cgroup /sys/fs/cgroup/systemd cgroup rw,nosuid,nodev,noexec,relatime,xattr,release_agent=/lib/systemd/systemd-cgroups-agent,name=systemd 0 0
|
||||
pstore /sys/fs/pstore pstore rw,nosuid,nodev,noexec,relatime 0 0
|
||||
cgroup /sys/fs/cgroup/cpuset cgroup rw,nosuid,nodev,noexec,relatime,cpuset 0 0
|
||||
cgroup /sys/fs/cgroup/cpu,cpuacct cgroup rw,nosuid,nodev,noexec,relatime,cpu,cpuacct 0 0
|
||||
cgroup /sys/fs/cgroup/devices cgroup rw,nosuid,nodev,noexec,relatime,devices 0 0
|
||||
cgroup /sys/fs/cgroup/freezer cgroup rw,nosuid,nodev,noexec,relatime,freezer 0 0
|
||||
cgroup /sys/fs/cgroup/net_cls,net_prio cgroup rw,nosuid,nodev,noexec,relatime,net_cls,net_prio 0 0
|
||||
cgroup /sys/fs/cgroup/blkio cgroup rw,nosuid,nodev,noexec,relatime,blkio 0 0
|
||||
cgroup /sys/fs/cgroup/perf_event cgroup rw,nosuid,nodev,noexec,relatime,perf_event 0 0
|
||||
systemd-1 /proc/sys/fs/binfmt_misc autofs rw,relatime,fd=22,pgrp=1,timeout=300,minproto=5,maxproto=5,direct 0 0
|
||||
mqueue /dev/mqueue mqueue rw,relatime 0 0
|
||||
debugfs /sys/kernel/debug debugfs rw,relatime 0 0
|
||||
hugetlbfs /dev/hugepages hugetlbfs rw,relatime 0 0
|
||||
fusectl /sys/fs/fuse/connections fusectl rw,relatime 0 0
|
||||
/dev/sda3 /boot ext2 rw,relatime 0 0
|
||||
rpc_pipefs /run/rpc_pipefs rpc_pipefs rw,relatime 0 0
|
||||
binfmt_misc /proc/sys/fs/binfmt_misc binfmt_misc rw,relatime 0 0
|
||||
tmpfs /run/user/1000 tmpfs rw,nosuid,nodev,relatime,size=808860k,mode=700,uid=1000,gid=1000 0 0
|
||||
gvfsd-fuse /run/user/1000/gvfs fuse.gvfsd-fuse rw,nosuid,nodev,relatime,user_id=1000,group_id=1000 0 0
|
12
collector/fixtures/proc/net/snmp
Normal file
12
collector/fixtures/proc/net/snmp
Normal file
|
@ -0,0 +1,12 @@
|
|||
Ip: Forwarding DefaultTTL InReceives InHdrErrors InAddrErrors ForwDatagrams InUnknownProtos InDiscards InDelivers OutRequests OutDiscards OutNoRoutes ReasmTimeout ReasmReqds ReasmOKs ReasmFails FragOKs FragFails FragCreates
|
||||
Ip: 1 64 57740232 0 25 397750 0 0 57340175 55365537 0 54 0 0 0 0 0 0 0
|
||||
Icmp: InMsgs InErrors InCsumErrors InDestUnreachs InTimeExcds InParmProbs InSrcQuenchs InRedirects InEchos InEchoReps InTimestamps InTimestampReps InAddrMasks InAddrMaskReps OutMsgs OutErrors OutDestUnreachs OutTimeExcds OutParmProbs OutSrcQuenchs OutRedirects OutEchos OutEchoReps OutTimestamps OutTimestampReps OutAddrMasks OutAddrMaskReps
|
||||
Icmp: 104 0 0 104 0 0 0 0 0 0 0 0 0 0 120 0 120 0 0 0 0 0 0 0 0 0 0
|
||||
IcmpMsg: InType3 OutType3
|
||||
IcmpMsg: 104 120
|
||||
Tcp: RtoAlgorithm RtoMin RtoMax MaxConn ActiveOpens PassiveOpens AttemptFails EstabResets CurrEstab InSegs OutSegs RetransSegs InErrs OutRsts InCsumErrors
|
||||
Tcp: 1 200 120000 -1 3556 230 341 161 0 57252008 54915039 227 5 1003 0
|
||||
Udp: InDatagrams NoPorts InErrors OutDatagrams RcvbufErrors SndbufErrors InCsumErrors
|
||||
Udp: 88542 120 0 53028 0 0 0
|
||||
UdpLite: InDatagrams NoPorts InErrors OutDatagrams RcvbufErrors SndbufErrors InCsumErrors
|
||||
UdpLite: 0 0 0 0 0 0 0
|
16
collector/fixtures/proc/stat
Normal file
16
collector/fixtures/proc/stat
Normal file
|
@ -0,0 +1,16 @@
|
|||
cpu 301854 612 111922 8979004 3552 2 3944 0 0 0
|
||||
cpu0 44490 19 21045 1087069 220 1 3410 0 0 0
|
||||
cpu1 47869 23 16474 1110787 591 0 46 0 0 0
|
||||
cpu2 46504 36 15916 1112321 441 0 326 0 0 0
|
||||
cpu3 47054 102 15683 1113230 533 0 60 0 0 0
|
||||
cpu4 28413 25 10776 1140321 217 0 8 0 0 0
|
||||
cpu5 29271 101 11586 1136270 672 0 30 0 0 0
|
||||
cpu6 29152 36 10276 1139721 319 0 29 0 0 0
|
||||
cpu7 29098 268 10164 1139282 555 0 31 0 0 0
|
||||
intr 8885917 17 0 0 0 0 0 0 0 1 79281 0 0 0 0 0 0 0 231237 0 0 0 0 250586 103 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 223424 190745 13 906 1283803 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
|
||||
ctxt 38014093
|
||||
btime 1418183276
|
||||
processes 26442
|
||||
procs_running 2
|
||||
procs_blocked 0
|
||||
softirq 5057579 250191 1481983 1647 211099 186066 0 1783454 622196 12499 508444
|
|
@ -19,7 +19,7 @@ import (
|
|||
)
|
||||
|
||||
func TestInterrupts(t *testing.T) {
|
||||
file, err := os.Open("fixtures/interrupts")
|
||||
file, err := os.Open("fixtures/proc/interrupts")
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
|
|
|
@ -120,7 +120,7 @@ var (
|
|||
)
|
||||
|
||||
func TestIPVSCollector(t *testing.T) {
|
||||
if err := flag.Set("collector.procfs", "fixtures"); err != nil {
|
||||
if err := flag.Set("collector.procfs", "fixtures/proc"); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
collector, err := newIPVSCollector()
|
||||
|
@ -182,7 +182,7 @@ func (c miniCollector) Describe(ch chan<- *prometheus.Desc) {
|
|||
}
|
||||
|
||||
func TestIPVSCollectorResponse(t *testing.T) {
|
||||
if err := flag.Set("collector.procfs", "fixtures"); err != nil {
|
||||
if err := flag.Set("collector.procfs", "fixtures/proc"); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
collector, err := NewIPVSCollector()
|
||||
|
@ -194,7 +194,7 @@ func TestIPVSCollectorResponse(t *testing.T) {
|
|||
rw := httptest.NewRecorder()
|
||||
prometheus.Handler().ServeHTTP(rw, &http.Request{})
|
||||
|
||||
metricsFile := "fixtures/net/ip_vs_result.txt"
|
||||
metricsFile := "fixtures/ip_vs_result.txt"
|
||||
wantMetrics, err := ioutil.ReadFile(metricsFile)
|
||||
if err != nil {
|
||||
t.Fatalf("unable to read input test file %s: %s", metricsFile, err)
|
||||
|
|
|
@ -18,7 +18,7 @@ import (
|
|||
)
|
||||
|
||||
func TestMdadm(t *testing.T) {
|
||||
mdStates, err := parseMdstat("fixtures/mdstat")
|
||||
mdStates, err := parseMdstat("fixtures/proc/mdstat")
|
||||
|
||||
if err != nil {
|
||||
t.Fatalf("parsing of reference-file failed entirely: %s", err)
|
||||
|
|
|
@ -19,7 +19,7 @@ import (
|
|||
)
|
||||
|
||||
func TestMemInfo(t *testing.T) {
|
||||
file, err := os.Open("fixtures/meminfo")
|
||||
file, err := os.Open("fixtures/proc/meminfo")
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
|
|
|
@ -20,7 +20,7 @@ import (
|
|||
)
|
||||
|
||||
func TestNetDevStats(t *testing.T) {
|
||||
file, err := os.Open("fixtures/net-dev")
|
||||
file, err := os.Open("fixtures/proc/net/dev")
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
|
|
|
@ -18,7 +18,7 @@ import (
|
|||
"testing"
|
||||
)
|
||||
|
||||
var fileName = "fixtures/netstat"
|
||||
var fileName = "fixtures/proc/net/netstat"
|
||||
|
||||
func TestNetStats(t *testing.T) {
|
||||
file, err := os.Open(fileName)
|
||||
|
|
|
@ -20,7 +20,7 @@ import (
|
|||
)
|
||||
|
||||
func TestSockStats(t *testing.T) {
|
||||
file, err := os.Open("fixtures/sockstat")
|
||||
file, err := os.Open("fixtures/proc/net/sockstat")
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
|
|
|
@ -19,7 +19,7 @@ import (
|
|||
)
|
||||
|
||||
func TestTCPStat(t *testing.T) {
|
||||
file, err := os.Open("fixtures/tcpstat")
|
||||
file, err := os.Open("fixtures/proc/net/tcpstat")
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue