Storage node dashboard API (v0.19.0)

I didn’t remember exactly what Alpine Linux image contains; I was wrong it has wget, I got confused with curl

It’s easy to test what it has executing

docker run --rm {arch}/alpine {command}

For example:

storj ➜  docker run --rm amd64/alpine wget -h                                                                                                                git:(master)  
Unable to find image 'amd64/alpine:latest' locally
latest: Pulling from amd64/alpine
9d48c3bd43c5: Pull complete 
Digest: sha256:acd3ca9941a85e8ed16515bfc5328e4e2f8c128caa72959a58a127b7801ee01f
Status: Downloaded newer image for amd64/alpine:latest
wget: unrecognized option: h
BusyBox v1.30.1 (2019-06-12 17:51:55 UTC) multi-call binary.

Usage: wget [-c|--continue] [--spider] [-q|--quiet] [-O|--output-document FILE]
        [--header 'header: value'] [-Y|--proxy on/off] [-P DIR]
        [-S|--server-response] [-U|--user-agent AGENT] [-T SEC] URL...

Retrieve files via HTTP or FTP

        --spider        Only check URL existence: $? is 0 if exists
        -c              Continue retrieval of aborted transfer
        -q              Quiet
        -P DIR          Save to DIR (default .)
        -S              Show server response
        -T SEC          Network read timeout is SEC seconds
        -O FILE         Save to FILE ('-' for stdout)
        -U STR          Use STR for User-Agent header
        -Y on/off       Use proxy

storj ➜  docker run --rm amd64/alpine bash                                                                                                                   git:(master)  
docker: Error response from daemon: OCI runtime create failed: container_linux.go:345: starting container process caused "exec: \"bash\": executable file not found in $PATH": unknown.
ERRO[0001] error waiting for container: context canceled

storj ➜  docker run --rm amd64/alpine curl                                                                                                                   git:(master)  
docker: Error response from daemon: OCI runtime create failed: container_linux.go:345: starting container process caused "exec: \"curl\": executable file not found in $PATH": unknown.
ERRO[0001] error waiting for container: context canceled
``
1 Like

What does the “.data.upToDate” value returned on the API /dashboard endpoint refer to?

Node software version is Last. Node updated.

Hey Krey, love your PS script about Storj monitoring. Can you elaborate what you are trying to say ?

This was reply for julez

My scripts work In progress now on stage writing usage documentation and spliting config from code.
Storj3Monitior almost done, Storj3LogMeasure needs work with input parameters, FailoverMonitor waits config and docs.
More on github

2 Likes

Oh I see. Next time click the REPLY button so your post automatically shows whom you are replying to. As you will see with my post :slight_smile:

EDIT: Odd I tried to view my own post and it didn’t show “(reply icon) followed by username” to my post :’(

Yeah me too. Im sure that i clicked reply.

Works for me :smiley:

Well nope. I guess it is disabled in this part of the forum. @jocelyn can you correct that?

Thanks @Krey. Does that mean that the software version installed is currently up to date\the latest? Or that the info returned by the API is up to date?

Since everyone’s doing it, here is the monitoring script I hacked together. Run it with $ monitor ./satwatch to get it to update every couple seconds.

dashboard api requests:

  1. use bytes for all values and let the json consumer decide how to format it. Having bandwidth usage in GB and ingress/egress in bytes is confusing.
  2. add fields for “Last contact” and “Uptime”
#!/bin/bash

api() { curl -s 127.0.0.1:14002/api/$1; } 
DASHDATA=`api "dashboard"`

printf "node id : %s \n" `echo $DASHDATA | jq -r .data.nodeID`
printf "version : %s.%s.%s \n" `echo $DASHDATA | jq -r .data.version.major` `echo $DASHDATA | jq -r .data.version.minor` `echo $DASHDATA | jq -r .data.version.patch`
printf "upToDate: %s \n" `echo $DASHDATA | jq -r .data.upToDate`
printf "\n"

printf "bandwidth avail: %8.3fGB used: %-5.3fGB  ingress: %4.1fMB  egress: %4.1fMB \n" `echo $DASHDATA | jq -r '.data.bandwidth.available'; echo $DASHDATA | jq -r '.data.bandwidth.used'; echo $DASHDATA | jq -r '.data.bandwidth.ingress.usage / 1024 / 1024'; echo $DASHDATA | jq -r '.data.bandwidth.egress.usage / 1024 / 1024'`
printf "     disk avail: %8.3fGB used: %-5.3fGB \n" `echo $DASHDATA | jq -r .data.diskSpace.available` `echo $DASHDATA | jq -r .data.diskSpace.used`
printf "\n"

FMT='%-6s %-9s %-8s %-9s %-8s\n'
printf "$FMT" sat-id audits score uptime score

DATAFMT='%-6s %-4d/%-4d %-7.6f %4d/%-4d %-7.6f \n'
for sat in `echo $DASHDATA | jq -r '.data.satellites | sort[]'`
do
  SATDATA=`api "satellite/$sat"`
  printf "$DATAFMT" `echo $sat | cut -c1-6 ; echo $SATDATA| jq -r '.data.audit.totalCount'; echo $SATDATA| jq -r '.data.audit.successCount'; echo $SATDATA| jq -r '.data.audit.score'; echo $SATDATA| jq -r '.data.uptime.totalCount'; echo $SATDATA| jq -r '.data.uptime.successCount'; echo $SATDATA| jq -r '.data.uptime.score'  ` 
done

output

node id : 128...
version : 0.20.1 
upToDate: true 

bandwidth avail: 2000.000GB used: 1.108GB  ingress: 881.5MB  egress: 175.0MB 
     disk avail:  900.000GB used: 0.399GB 

sat-id audits    score    uptime    score   
118UWp 0   /0    1.000000 1356/968  0.960633 
121RTS 0   /0    1.000000 1855/1415 0.986169 
12EayR 0   /0    1.000000 1508/1093 0.970801 
12L9ZF 0   /0    1.000000 1749/1242 0.977497


What is the atRestTotal and why it sways from plus to minus and vice versa?
Why audit in egress and absent in ingress?
Why bandwidthDaily may decrease not in start of a day?

the reply works for me :upside_down_face:

but not the way it is working in other treads.

It does work the same for me

The button works, but it doesn’t show who you are responding to in the resulting reply like it does elsewhere.

1 Like

How to check about this on Docker for Windows?

Is this usable on Windows?

Just use a browser to go the the urls in the commands. You’ll get a bit more data and it won’t be laid out as pretty, but it’ll get the job done.

You can also install curl and jq on windows.
https://curl.haxx.se/windows/

Both are just binaries without any installer. Create a folder on your C drive. Maybe call it “Tools”. Add this folder to the windows path variable and than you are ready to execute the same commands from the command line.

Can’t connect the url in browser
Is there anything wrong?
Thanks