Page MenuHomePhabricator
Paste P10678

32-bit signed binary int on node_directory_size_bytes
ActivePublic

Authored by JHedden on Tue, Mar 10, 3:12 PM.
```
$ curl -s -G --data-urlencode 'query=topk(10, node_directory_size_bytes{name="tools_home"})' http://localhost:9900/ops/api/v1/query | jq '.data | .result[] | (.metric.directory+" "+.value[1])' | head -n 20
"/exp/project/tools/home/computermacgyver 2147483647"
"/exp/project/tools/home/bovlb 2147483647"
"/exp/project/tools/home/blahma 2147483647"
"/exp/project/tools/home/baku 2147483647"
"/exp/project/tools/home/bgelley 2147483647"
"/exp/project/tools/home/arnab777as3uj 2147483647"
"/exp/project/tools/home/ashwinpp 2147483647"
```
Should be
```
$ du --block-size=1 --summarize /srv/tools/shared/tools/home/computermacgyver/
6963625984 /srv/tools/shared/tools/home/computermacgyver/
```
Proposed fix
```
$ du --block-size=1 --summarize /exp/project/tools/home/computermacgyver | awk -v name="${1}" '{ printf("node_directory_size_bytes{directory=\"%s\",name=\"%s\"} %.0f\n", $2, name, $1); }'
node_directory_size_bytes{directory="/exp/project/tools/home/computermacgyver",name=""} 6963625984
```

Event Timeline

JHedden created this paste.Tue, Mar 10, 3:12 PM
JHedden edited the content of this paste. (Show Details)Tue, Mar 10, 3:50 PM