Storj Terminal Dashboard

No no, this is not my log this is the message from your script. It can’t handle
my time setting in the log with “T” and then throwing this error message…

I had to make couple more changes, here’s the diff:

$ diff storj-dashboard.orig.py storj-dashboard.py
147c147,148
<                       summed_estimated_total += float(node.estimated_total)
---
>                       if len(node.estimated_total) > 0:
>                               summed_estimated_total += float(node.estimated_total)
294c295,296
<                       self.earnings = subprocess.run(['python3', earningsCalculator, dbPath], capture_output=True, text=True)
---
>                       python = next(path for path in [sys.executable, 'python3'] if len(path) > 0)
>                       self.earnings = subprocess.run([python, earningsCalculator, dbPath], capture_output=True, text=True)
300d301
<
302a304
>               n = 0
306a309
>                               n += 1
309a313
>                               n += 1
312a317
>                               n += 1
315a321
>                               n += 1
318c324,330
<
---
>                               n += 1
>               if (n < 5):
>                       sys.stdout.write("ERROR: Couldn't parse earnings calculator's output: \n----------\n")
>                       sys.stdout.write(self.earnings.stdout)
>                       sys.stdout.write(self.earnings.stderr)
>                       sys.stdout.write("\n----------\n\n")
>                       sys.stdout.flush()

It brought me to:

[ OK ] Reading log of The Node ... 18.6 MB read
[ OK ] Running earnings calculator for The Node
ERROR: Couldn't parse earnings calculator's output:
----------
June 2024 (Version: 14.0.0)                                             [snapshot: 2024-06-26 05:41:18Z]
REPORTED BY     TYPE      METRIC                PRICE                     DISK  BANDWIDTH        PAYOUT
Node            Ingress   Upload                -not paid-                        1.83 TB
Node            Ingress   Upload Repair         -not paid-                        4.53 GB
Node            Egress    Download              $  2.00 / TB (avg)                5.71 GB       $  0.01
Node            Egress    Download Repair       $  2.00 / TB (avg)              302.81 MB       $  0.00
Node            Egress    Download Audit        $  2.00 / TB (avg)              251.14 KB       $  0.00
Node            Storage   Disk Current Total    -not paid-           605.14 GB
Traceback (most recent call last):
  File "D:\storj-scripts\earnings.py", line 527, in <module>
    print("Node\t\tStorage\t             \u251c Blobs\t-not paid-\t     {}".format(formatSize(sum(disk))))
  File "C:\Users\<...>\AppData\Local\Programs\Python\Python312\Lib\encodings\cp1252.py", line 19, in encode
    return codecs.charmap_encode(input,self.errors,encoding_table)[0]
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
UnicodeEncodeError: 'charmap' codec can't encode character '\u251c' in position 27: character maps to <undefined>

----------

Could you add the ability to run it for different sets of nodes? So that its not run for every node every time? Not sure how that would work with the json file tho. Allow a list of names as a parameter to the command?

You are absolutly right. My initial version was only supporting Linux. I pushed a new version to github, which should work with Windows now. I would appreciate it, if you could test it now, as I don’t have Storj running on Windows and canÄt test it myself.

1 Like

I just added exactly that feature. Thanks for your input.
The script now takes an optional path to a json config file. This way you can have multiple different json config files. If no path is given it searches for the default storj-dashboard.json file.

1 Like

Could you please post the last 10 line of your log, so I can take a look at it? I need to see how they are formatted.

Hahah I just finished making a bash script to grep for an array in a “full” json and make a json on the fly with what i listed. Thanks for working so fast!

2 Likes

A bit better, but not quite there yet. Got

An unexpected error occurred: could not convert string to float: ''

That patch would probably print more diagnostics.

$ tail "/mnt/c/Program Files/Storj/Storage Node/storagenode.log"
2024-06-27T01:08:32+04:00       INFO    piecestore      download started        {"Piece ID": "TUOVGNSNJ2BBCJNIS6NWEZTJARG3WHR56KOZT6UAA7UHZPLVYEWA", "Satellite ID": "12L9ZFwhzVpuEKMUNUqkaTLGzwY9G24tbiigLiXpmZWKwmcNDDs", "Action": "GET", "Offset": 49664, "Size": 2560, "Remote Address": "79.127.226.101:58164"}
2024-06-27T01:08:32+04:00       INFO    piecestore      downloaded      {"Piece ID": "TUOVGNSNJ2BBCJNIS6NWEZTJARG3WHR56KOZT6UAA7UHZPLVYEWA", "Satellite ID": "12L9ZFwhzVpuEKMUNUqkaTLGzwY9G24tbiigLiXpmZWKwmcNDDs", "Action": "GET", "Offset": 49664, "Size": 2560, "Remote Address": "79.127.226.101:58164"}
2024-06-27T01:08:32+04:00       INFO    piecestore      download started        {"Piece ID": "TUOVGNSNJ2BBCJNIS6NWEZTJARG3WHR56KOZT6UAA7UHZPLVYEWA", "Satellite ID": "12L9ZFwhzVpuEKMUNUqkaTLGzwY9G24tbiigLiXpmZWKwmcNDDs", "Action": "GET", "Offset": 72448, "Size": 2304, "Remote Address": "79.127.226.101:58164"}
2024-06-27T01:08:33+04:00       INFO    piecestore      downloaded      {"Piece ID": "TUOVGNSNJ2BBCJNIS6NWEZTJARG3WHR56KOZT6UAA7UHZPLVYEWA", "Satellite ID": "12L9ZFwhzVpuEKMUNUqkaTLGzwY9G24tbiigLiXpmZWKwmcNDDs", "Action": "GET", "Offset": 72448, "Size": 2304, "Remote Address": "79.127.226.101:58164"}
2024-06-27T01:08:33+04:00       INFO    piecestore      download started        {"Piece ID": "TUOVGNSNJ2BBCJNIS6NWEZTJARG3WHR56KOZT6UAA7UHZPLVYEWA", "Satellite ID": "12L9ZFwhzVpuEKMUNUqkaTLGzwY9G24tbiigLiXpmZWKwmcNDDs", "Action": "GET", "Offset": 81408, "Size": 2560, "Remote Address": "79.127.226.101:58164"}
2024-06-27T01:08:33+04:00       INFO    piecestore      downloaded      {"Piece ID": "TUOVGNSNJ2BBCJNIS6NWEZTJARG3WHR56KOZT6UAA7UHZPLVYEWA", "Satellite ID": "12L9ZFwhzVpuEKMUNUqkaTLGzwY9G24tbiigLiXpmZWKwmcNDDs", "Action": "GET", "Offset": 81408, "Size": 2560, "Remote Address": "79.127.226.101:58164"}
2024-06-27T01:08:33+04:00       INFO    piecestore      download started        {"Piece ID": "TUOVGNSNJ2BBCJNIS6NWEZTJARG3WHR56KOZT6UAA7UHZPLVYEWA", "Satellite ID": "12L9ZFwhzVpuEKMUNUqkaTLGzwY9G24tbiigLiXpmZWKwmcNDDs", "Action": "GET", "Offset": 83712, "Size": 2560, "Remote Address": "79.127.226.101:58164"}
2024-06-27T01:08:33+04:00       INFO    piecestore      downloaded      {"Piece ID": "TUOVGNSNJ2BBCJNIS6NWEZTJARG3WHR56KOZT6UAA7UHZPLVYEWA", "Satellite ID": "12L9ZFwhzVpuEKMUNUqkaTLGzwY9G24tbiigLiXpmZWKwmcNDDs", "Action": "GET", "Offset": 83712, "Size": 2560, "Remote Address": "79.127.226.101:58164"}
2024-06-27T01:09:22+04:00       INFO    piecestore      download started        {"Piece ID": "TUOVGNSNJ2BBCJNIS6NWEZTJARG3WHR56KOZT6UAA7UHZPLVYEWA", "Satellite ID": "12L9ZFwhzVpuEKMUNUqkaTLGzwY9G24tbiigLiXpmZWKwmcNDDs", "Action": "GET", "Offset": 0, "Size": 181248, "Remote Address": "79.127.226.99:58202"}
2024-06-27T01:09:23+04:00       INFO    piecestore      downloaded      {"Piece ID": "TUOVGNSNJ2BBCJNIS6NWEZTJARG3WHR56KOZT6UAA7UHZPLVYEWA", "Satellite ID": "12L9ZFwhzVpuEKMUNUqkaTLGzwY9G24tbiigLiXpmZWKwmcNDDs", "Action": "GET", "Offset": 0, "Size": 181248, "Remote Address": "79.127.226.99:58202"}

Please run my version of the script again and post your error message. It is now compatible with Windows.
I will not troubleshoot foreign scripts.

Sure and that’s exactly what I did, ran your script and got

[ OK ] Reading log of The Node ... 19.9 MB read
[ OK ] Running earnings calculator for The Node


═══ The Node - Detailed information

┌───── NODE MAIN STATS ─────┐┌─────────────── FILEWALKER ────────────────┐
│                           ││                                           │
│ Current Total:          $ ││       GARBAGE     TRASH       USED SPACE  │
│ Estimated Total:        $ ││       COLLECTOR   CLEANUP     FILEWALKER  │
│                           ││                                           │
│ Disk Used:      605.14 GB ││   SL  unknown     0d 7h ago   running     │
│ Unpaid Data:              ││  AP1  unknown     0d 7h ago   unknown     │
│                           ││  EU1  unknown     0d 7h ago   unknown     │
│                           ││  US1  unknown     0d 7h ago   unknown     │
│                           ││                                           │
└───────────────────────────┘└───────────────────────────────────────────┘
An unexpected error occurred: could not convert string to float: ''

I didn’t mean you to troubleshoot foreign scripts. I only advised that you could get better output if you handled the error similarly to how I did in the code I posted. If you don’t need that it’s totally up to you.

It seems like the earnings script cannot be read successfully. Have you checked if everything is fine with the output, if you run the earnings script standalone?

I surely did:

D:\storj-scripts>run-earnings.bat

D:\storj-scripts>"C:\Users\<...>\AppData\Local\Programs\Python\Python312\python.exe" D:\storj-scripts\earnings.py D:\storj-data
June 2024 (Version: 14.0.0)                                             [snapshot: 2024-06-28 14:23:05Z]
REPORTED BY     TYPE      METRIC                PRICE                     DISK  BANDWIDTH        PAYOUT
Node            Ingress   Upload                -not paid-                        1.83 TB
Node            Ingress   Upload Repair         -not paid-                        4.53 GB
Node            Egress    Download              $  2.00 / TB (avg)                6.03 GB       $  0.01
Node            Egress    Download Repair       $  2.00 / TB (avg)              412.29 MB       $  0.00
Node            Egress    Download Audit        $  2.00 / TB (avg)              337.15 KB       $  0.00
. . .

The output of the earning script is truncated before it is fully displayed. This explains why “Disk Used:” is displayed in the dashboard, but the rest is not. “Disk Used” is still in the visible portion of the script, while all other values are getting truncated.
Make sure, that the whole output of the earnings script is getting printed properly and my dashboard should be working fine for you.

The whole output should look something like this:

June 2024 (Version: 14.0.0)                                             [snapshot: 2024-06-28 15:17:09Z]
REPORTED BY     TYPE      METRIC                PRICE                     DISK  BANDWIDTH        PAYOUT
Node            Ingress   Upload                -not paid-                       28.22 TB
Node            Ingress   Upload Repair         -not paid-                      203.13 GB
Node            Egress    Download              $  2.00 / TB (avg)              450.01 GB       $  0.90
Node            Egress    Download Repair       $  2.00 / TB (avg)               76.05 GB       $  0.15
Node            Egress    Download Audit        $  2.00 / TB (avg)               11.86 MB       $  0.00
Node            Storage   Disk Current Total    -not paid-            14.96 TB
Node            Storage              ├ Blobs    -not paid-            14.71 TB
Node            Storage              └ Trash  ┐ -not paid-           247.85 GB
Node+Sat. Calc. Storage   Uncollected Garbage ┤ -not paid-             3.15 TB
Node+Sat. Calc. Storage   Total Unpaid Data <─┘ -not paid-             3.40 TB
Satellite       Storage   Disk Last Report      -not paid-            11.56 TB
Satellite       Storage   Disk Average So Far   -not paid-             4.54 TB
Satellite       Storage   Disk Usage Month      $  1.49 / TBm (avg)    4.01 TBm                 $  5.97
________________________________________________________________________________________________________+
Total                                                                  4.01 TBm  28.95 TB       $  7.02
Estimated total by end of month                                        4.54 TBm  31.43 TB       $  7.90

Payout and held amount by satellite:
┌────────────────────────────────┬─────────────┬──────────────────────────┬─────────────────────────────────────────────────────────────┐
│ SATELLITE                      │ HELD AMOUNT │        REPUTATION        │                       PAYOUT THIS MONTH                     │
│              Joined     Month  │      Total  │    Disq    Susp    Down  │    Storage      Egress  Repair/Aud        Held      Payout  │
├────────────────────────────────┼─────────────┼──────────────────────────┼─────────────────────────────────────────────────────────────┤
│ ap1.storj.io:7777 (OK)         │             │                          │  $  1.49/TBm $  2.00/TB  $  2.00/TB       25%         75%   │
│              2023-12-17     7  │   $   0.09  │   0.00%   0.00%   1.04%  │  $  0.0582   $  0.0138   $  0.0160  -$  0.0220   $  0.0660  │
├────────────────────────────────┼─────────────┼──────────────────────────┼─────────────────────────────────────────────────────────────┤
│ eu1.storj.io:7777 (OK)         │             │                          │  $  1.49/TBm $  2.00/TB  $  2.00/TB       25%         75%   │
│              2023-12-17     7  │   $   1.16  │   0.00%   0.00%   1.32%  │  $  0.5901   $  0.0981   $  0.0342  -$  0.1806   $  0.5418  │
├────────────────────────────────┼─────────────┼──────────────────────────┼─────────────────────────────────────────────────────────────┤
│ saltlake.tardigrade.io:7777 (OK)             │                          │  $  1.49/TBm $  2.00/TB  $  2.00/TB       25%         75%   │
│              2023-12-17     7  │   $   0.10  │   0.00%   0.00%   2.00%  │  $  3.5478   $  0.0007   $  0.0203  -$  0.8922   $  2.6766  │
├────────────────────────────────┼─────────────┼──────────────────────────┼─────────────────────────────────────────────────────────────┤
│ us1.storj.io:7777 (OK)         │             │                          │  $  1.49/TBm $  2.00/TB  $  2.00/TB       25%         75%   │
│              2023-12-17     7  │   $   1.58  │   0.00%   0.00%   1.05%  │  $  1.7749   $  0.7874   $  0.0817  -$  0.6610   $  1.9830  │
├────────────────────────────────┼─────────────┼──────────────────────────┼─────────────────────────────────────────────────────────────┤ +
│ TOTAL                          │   $   2.93  │                          │  $  5.9709   $  0.9000   $  0.1521  -$  1.7558   $  5.2673  │
│ ESTIMATED END OF MONTH TOTAL   │   $   4.83  │                          │  $  6.7599   $  0.9770   $  0.1651  -$  1.9755   $  5.9265  │
│                                │             │                          │                 POSTPONED PAYOUT PREVIOUS MONTHS $  0.8393  │
└────────────────────────────────┴─────────────┴──────────────────────────┴─────────────────────────────────────────────────────────────┘

That’s me just cutting the output to not post the whole thing. The output is complete.

I reworked the way the timestamps get parsed slightly. Maybe this also fixed your problem. Give it a try and keep me updated.

1 Like

I’m afraid it made no difference and printing the same An unexpected error occurred: could not convert string to float: '' error.
This try and error approach might be great though I don’t understand it. But still wouldn’t it be better to make this change and let the app itself show why it’s not working?

I guess it’s a “foreign code” but if it improves your app why wouldn’t you use it?

Hallo - awesome work!

i am trying to get it working on windows.
this is my setup:

and this is my output from terminal:

i get empty data.
the earnings script works
anyone know why?

Most likely the same issue I reported 9 days ago:

But I’m having a hard time with the author not getting even to the point when this issue is visible.

Yea it seems like it - let me know if you find a solution :slight_smile:

I’m sure it’s not difficult to fix at all. But the question is – what’s next? With the author not accepting proposed fixes and calling suggested contributions “foreign scripts” are we going to keep exchanging patch snippets? Fork the code? This is ridiculous for a few hundred lines long script.