sensu / system-profile-linux

A Sensu plugin for collecting system resource metrics from the procfile system, with the aim to provide a Sensu-native alternative to Collectd's built-in system resource telemetry.
MIT License
3 stars 3 forks source link

At centos7 vm - metric value is invalid, second argument must be a float: |bytes #11

Open daswars opened 4 years ago

daswars commented 4 years ago

Hello on all my Centos7 VMs I have the following error message in journald

Dez 18 14:46:03 test-server sensu-agent[100325]: {"check":"system-profile-linux","component":"agent","error":"unable to extract metric from check output","level":"error","line":60,"msg":"metric value is invalid, second argument must be a float: |bytes","namespace":"default","time":"2019-12-18T14:46:03+01:00"}
Dez 18 14:46:03 test-server sensu-agent[100325]: {"check":"system-profile-linux","component":"agent","error":"unable to extract metric from check output","level":"error","line":61,"msg":"metric value is invalid, second argument must be a float: packets","namespace":"default","time":"2019-12-18T14:46:03+01:00"}
Dez 18 14:46:03 test-server sensu-agent[100325]: {"check":"system-profile-linux","component":"agent","error":"unable to extract metric from check output","level":"error","line":62,"msg":"metric value is invalid, second argument must be a float: errs","namespace":"default","time":"2019-12-18T14:46:03+01:00"}
Dez 18 14:46:03 test-server sensu-agent[100325]: {"check":"system-profile-linux","component":"agent","error":"unable to extract metric from check output","level":"error","line":63,"msg":"metric value is invalid, second argument must be a float: drop","namespace":"default","time":"2019-12-18T14:46:03+01:00"}
Dez 18 14:46:03 test-server sensu-agent[100325]: {"check":"system-profile-linux","component":"agent","error":"unable to extract metric from check output","level":"error","line":64,"msg":"metric value is invalid, second argument must be a float: fifo","namespace":"default","time":"2019-12-18T14:46:03+01:00"}
Dez 18 14:46:03 test-server sensu-agent[100325]: {"check":"system-profile-linux","component":"agent","error":"unable to extract metric from check output","level":"error","line":65,"msg":"metric value is invalid, second argument must be a float: frame","namespace":"default","time":"2019-12-18T14:46:03+01:00"}
Dez 18 14:46:03 test-server sensu-agent[100325]: {"check":"system-profile-linux","component":"agent","error":"unable to extract metric from check output","level":"error","line":66,"msg":"metric value is invalid, second argument must be a float: compressed","namespace":"default","time":"2019-12-18T14:46:03+01:00"}
Dez 18 14:46:03 test-server sensu-agent[100325]: {"check":"system-profile-linux","component":"agent","error":"unable to extract metric from check output","level":"error","line":67,"msg":"metric value is invalid, second argument must be a float: multicast|bytes","namespace":"default","time":"2019-12-18T14:46:03+01:00"}
Dez 18 14:46:03 test-server sensu-agent[100325]: {"check":"system-profile-linux","component":"agent","error":"unable to extract metric from check output","level":"error","line":68,"msg":"metric value is invalid, second argument must be a float: packets","namespace":"default","time":"2019-12-18T14:46:03+01:00"}
Dez 18 14:46:03 test-server sensu-agent[100325]: {"check":"system-profile-linux","component":"agent","error":"unable to extract metric from check output","level":"error","line":69,"msg":"metric value is invalid, second argument must be a float: errs","namespace":"default","time":"2019-12-18T14:46:03+01:00"}
Dez 18 14:46:03 test-server sensu-agent[100325]: {"check":"system-profile-linux","component":"agent","error":"unable to extract metric from check output","level":"error","line":70,"msg":"metric value is invalid, second argument must be a float: drop","namespace":"default","time":"2019-12-18T14:46:03+01:00"}
Dez 18 14:46:03 test-server sensu-agent[100325]: {"check":"system-profile-linux","component":"agent","error":"unable to extract metric from check output","level":"error","line":71,"msg":"metric value is invalid, second argument must be a float: fifo","namespace":"default","time":"2019-12-18T14:46:03+01:00"}
Dez 18 14:46:03 test-server sensu-agent[100325]: {"check":"system-profile-linux","component":"agent","error":"unable to extract metric from check output","level":"error","line":72,"msg":"metric value is invalid, second argument must be a float: colls","namespace":"default","time":"2019-12-18T14:46:03+01:00"}
Dez 18 14:46:03 test-server sensu-agent[100325]: {"check":"system-profile-linux","component":"agent","error":"unable to extract metric from check output","level":"error","line":73,"msg":"metric value is invalid, second argument must be a float: carrier","namespace":"default","time":"2019-12-18T14:46:03+01:00"}
Dez 18 14:46:03 test-server sensu-agent[100325]: {"check":"system-profile-linux","component":"agent","error":"unable to extract metric from check output","level":"error","line":74,"msg":"metric value is invalid, second argument must be a float: compressed","namespace":"default","time":"2019-12-18T14:46:03+01:00"}

When I run ystem-profile-linux I see the following result at the processes

...
swap.swapfree 2033404 1576676872
memory.committed_as 7155608 1576676872
net.face.rxbytes |bytes 1576676872
net.face.rxpackets packets 1576676872
net.face.rxerrors errs 1576676872
net.face.rxdrops drop 1576676872
net.face.rxfifo fifo 1576676872
net.face.rxframe frame 1576676872
net.face.rxcompressed compressed 1576676872
net.face.rxmulticast multicast|bytes 1576676872
net.face.txbytes packets 1576676872
net.face.txpackets errs 1576676872
net.face.txerrors drop 1576676872
net.face.txdrops fifo 1576676872
net.face.txfifo colls 1576676872
net.face.txcolls carrier 1576676872
net.face.txcarrier compressed 1576676872
net.veth139ec3f.rxbytes 0 1576676872
net.veth139ec3f.rxpackets 0 1576676872
...

So I think I found the problem. system-profile-linux does not ignore the title/headers (two lines)

cat /proc/net/dev
Inter-|   Receive                                                |  Transmit
 face |bytes    packets errs drop fifo frame compressed multicast|bytes    packets errs drop fifo colls carrier compressed
veth139ec3f:       0       0    0    0    0     0          0         0      824      12    0    0    0     0       0          0
ens192: 9782404142 26256251    0    0    0     0          0         0 4548183803 5588931    0    0    0     0       0          0
veth1f9c1ea:   13505     173    0    0    0     0          0         0    92831     197    0    0    0     0       0          0
vethaf70773:       0       0    0    0    0     0          0         0      824      12    0    0    0     0       0          0
veth9c37a8a:       0       0    0    0    0     0          0         0      824      12    0    0    0     0       0          0
vetha58f5bf:       0       0    0    0    0     0          0         0      824      12    0    0    0     0       0          0
    lo: 1012372503 9835674    0    0    0     0          0         0 1012372503 9835674    0    0    0     0       0          0
veth7dbb3cb: 1316434228  267496    0    0    0     0          0         0 2559939789  443745    0    0    0     0       0          0
veth5e74a22:     333       5    0    0    0     0          0         0     1346      16    0    0    0     0       0          0
veth956b88b: 8017225    7061    0    0    0     0          0         0  4276670    6227    0    0    0     0       0          0
docker_gwbridge: 1948604898 1908852    0    0    0     0          0         0 2836756437 2097889    0    0    0     0       0          0
docker0:       0       0    0    0    0     0          0         0        0       0    0    0    0     0       0          0

Here the first two lines must be ignored.