PenningLabs / lxconsole

LXD Graphical Web Console
GNU Affero General Public License v3.0
123 stars 15 forks source link

Can't add my LXD-server #2

Closed ingobaab closed 1 year ago

ingobaab commented 1 year ago

Hi Matthew, can you help with this issue - see screenshot? I would like to test your new python based dashboard for LCD/LXC. I added the lxconsole.crt before to my lxd:

ingo@elitebook ~ $ lxc config trust list #add lxconsole.crt
+--------+------------------+--------------------+--------------+------------------------------+------------------------------+
|  TYPE  |       NAME       |    COMMON NAME     | FINGERPRINT  |          ISSUE DATE          |         EXPIRY DATE          |
+--------+------------------+--------------------+--------------+------------------------------+------------------------------+
| client | client_trust.crt | Ingo Baab          | 8f1bb60031b4 | Feb 18, 2023 at 2:43am (UTC) | Feb 17, 2025 at 2:43am (UTC) |
+--------+------------------+--------------------+--------------+------------------------------+------------------------------+
| client | lxconsole.crt    | Client Certificate | 2ac2e443b923 | May 5, 2023 at 4:02am (UTC)  | May 2, 2033 at 4:02am (UTC)  |
+--------+------------------+--------------------+--------------+------------------------------+------------------------------+

What else can or should I provide, - to find 'my installation issue' here?

image

matthewalanpenning commented 1 year ago

I had not yet tried 127.0.0.1 or 0.0.0.0 to see if either of these addresses would work, but I was able to use both to add the host. image

matthewalanpenning commented 1 year ago

I am curious about the 502 error you are now getting. Can you check to see what is in the server table. There should be a database file created in instance/db.sqlite3. Can you find what is in your server table by opening the database and running an select statement to view the records? matthew@matthew-Inspiron-7573:~/penninglabs/lxconsole$ sqlite3 instance/db.sqlite3 sqlite> select * from server; 1|127.0.0.1|8443|matthew-Inspiron-7573||0|0 2|0.0.0.0|8443|matthew-Inspiron-7573||0|0 sqlite> .exit

matthewalanpenning commented 1 year ago

Also, take a look at your lxc config show command to see what your core.https_address value is. image

ingobaab commented 1 year ago

image

ingobaab commented 1 year ago

Hello Metthew, after "trying it simply again", I managed to login, see: image

(I did not find what this former 502-error was, did not change anything, imho - weird..)

I now can visit all menu-items, expect the important one 'containers' (all other menus are working fine!):

image

image Forgive me the lot of screenshots, but maybe it helps? I am really "a big fan" of your software, nice..

ingobaab commented 1 year ago

After commenting out some lines (around line 180) "with something disk", I managed to get the list of containers into my browser.. maybe and hopefully it helps you to find, what goes wrong here - I do not know any python btw :) image

matthewalanpenning commented 1 year ago

I see what I did wrong on the disk issue. I need to change "if disk:" to "if 'disk' in locals(): " I will push an update for that. But will first look to see if I did that same mistake elsewhere in the code too for other variables.

ingobaab commented 1 year ago

Hi Matthew, just to finish that: image And many thanks for all your help - and the great software. I would like "to ask around" more things.. Should I open more tickets (i.e. my snapshot under the container-view shows a size of "-0.00 MB") or I would like to ask how exactly the "CPU" and "Memory" (values in %) "are calculated" / how to interpret this values.. Please advice, (..and close this one). Amazing, what you did and do! Keep it up. -Ingo

matthewalanpenning commented 1 year ago

Thanks! I updated the code similar to what you have. I made sure network and memory also did not have a opportunity to throw an undefined variable as well.

You are right the CPU and memory for containers are different that what I did for LXD Dashboard. Previously I was reading the /proc/stat from within the container to determine CPU usage, but determined this was not correct for containers as within the container it gives the reading for the host, not the container itself. The LXD api provides the container's usage in nanoseconds so I am now retrieving the host's usage from /proc/stat and determining how much CPU time the container used as a percentage of the host. I will be providing a detailed post on this. I do have a comment about this on line 1031 of lxconsole/templates/container.html.

Similar for memory usage, when I was reading the free output this again was giving me the host information while in a container. The percentage now is based on what is reported by the LXD API compared to the host's memory.

Yes, please open tickets are you find problems. Thank you, your testing has already helped a lot.

ingobaab commented 1 year ago

just for reference: image