Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

New Feature - Web Based browser function #1121

Open
mrmcox opened this issue Jul 6, 2017 · 17 comments
Open

New Feature - Web Based browser function #1121

mrmcox opened this issue Jul 6, 2017 · 17 comments

Comments

@mrmcox
Copy link

mrmcox commented Jul 6, 2017

To be able to view the glances --browser window via a web page like when using glances -w. This would allow for a central point, web based, to monitor all glances servers from a single point eg I can see all my servers from my windows desktop in a remote office via a web browser page.

Thanks

@nicolargo nicolargo added this to the Glances 3.0 milestone Jul 7, 2017
@nicolargo
Copy link
Owner

For developers, two actions to implement this new feature:

  • Glances core: add a new --browser for the -w mode (add to wait the refactor of the code ==> Glances 3.x)
  • Glances core (API): add a new entry point in the Web API to be able to retrieve server list
  • Glances Web GUI: add a new page to display server list + link

@mrmcox
Copy link
Author

mrmcox commented Jul 7, 2017

Thanks @nicolargo

Not a developer myself unfortunately but hopefully one of the more skilled than me can get this going. I reckon it will be a popular feature for sure!

@nicolargo
Copy link
Owner

@mrmcox You are not the first one asking this feature.

I will try to implement it in the next release (aka Glances 2.11) without waiting for the code refactoring. Is @nclsHart or @notFloran available to implement the Web GUI parts ?

@nicolargo nicolargo changed the title New Feature/Enhancement Suggestion - Web Based browser function New Feature - Web Based browser function Jul 8, 2017
@nicolargo
Copy link
Owner

nicolargo commented Jul 8, 2017

@notFloran / @nclsHart : I just push a new branch (https://github.com/nicolargo/glances/tree/issue1121) with the Glances core update. The API now give the servers list:

$ glances -w --browser

$  curl http://0.0.0.0:61208/api/2/serverslist
[{"username": "glances", "status": "ONLINE", "mem_percent": 50.6, "name": "localhost", "cpu_percent": "3.9", "ip": "127.0.0.1", "load_min5": "0.17", "alias": "My local PC", "key": "localhost:61209", "password": "", "type": "STATIC", "port": "61209", "hr_name": "Ubuntu 16.04 64bit"}, {"username": "glances", "status": "OFFLINE", "name": "localhost", "ip": "127.0.0.1", "alias": null, "key": "localhost:61235", "password": "", "type": "STATIC", "port": "61235"}, {"username": "glances", "status": "OFFLINE", "name": "192.168.0.17", "ip": "192.168.0.17", "alias": "Another PC on my network", "key": "192.168.0.17:61209", "password": "", "type": "STATIC", "port": "61209"}, {"username": "glances", "status": "ONLINE", "mem_percent": 50.6, "ip": "192.168.0.48", "load_min5": "0.17", "key": "XPS13-9333:61209._glances._tcp.local.", "password": "", "port": 61209, "name": "XPS13-9333", "cpu_percent": "3.9", "type": "DYNAMIC", "hr_name": "Ubuntu 16.04 64bit"}]

You need to create a new page (for example index_browser.html) and display the previous list in a fancy way (have a look on http://glances.readthedocs.io/en/stable/quickstart.html#central-client). When a user click on a server on the list it should be redirected to the Glances web server page (on another tab ?).

@nicolargo nicolargo modified the milestones: Glances 2.11, Glances 3.0 Jul 8, 2017
@nicolargo
Copy link
Owner

@notFloran Do you have some availability to work on this new feature ?

@notFloran
Copy link
Collaborator

@nicolargo I will try to do it at the beginning of next week

@notFloran
Copy link
Collaborator

@nicolargo I made a first draft of the feature if you want to test: https://github.com/notFloran/glances/tree/issue1121-webui

@mrmcox
Copy link
Author

mrmcox commented Jul 18, 2017

@nicolargo @notFloran Hi, I have updated my glances code with your first draft, how do I now set glances and then access the browser page?

@notFloran
Copy link
Collaborator

I use the following command: LANGUAGE=en_US.utf8 ~/glances-venv/bin/python -m glances -w --browser -C ~/glances.conf

You must change the args to match your needs.

And the browser page is available at the following URL: http://0.0.0.0:61208/browser

@mrmcox
Copy link
Author

mrmcox commented Jul 18, 2017

Thanks.
Whats the -m switch doing?

When I run the following command "glances -w --browser" and go to the url you quoted from a browser on the local glances box I get unable to connect message. Any tips?

@notFloran
Copy link
Collaborator

@nicolargo
Copy link
Owner

Hi all,

@notFloran your implementation should work:

selection_334

but i made a mistake on my side...

The result returned by the API give the list of XML-RPC server, not the list of WEB Server, so when i click on the connected server (green one), i have this message:

selection_335

So i need to refactor my code to only provide the WEB server list and its relative stats:
[ ] Add zeroconf to the Webserver part
[ ] Modify the API to give the Web server list (and not the XML-RPC list). Check if servers (static or dynamix respond to the Restful API)

@notFloran Can you pull request your code to this remote branch: https://github.com/nicolargo/glances/tree/issue1121

I will try to implement my part as soon as possible (probably this week-end) and came back to you to finalise the WebUI side.

@nicolargo
Copy link
Owner

Another issue... The current version of Glances generate the server list with both static and dynamic RPC server but not dynamic Web server. So i have to change the way the list is build and add a dynamic message (different from the RPC one) when the Web server is started. Last but not list i have to change the way that stats are updated in the web server list (replace XML RPC request by Restful API)...

I know now why i postpone this enhancement, the current Glances version is not designed to implement easily this feature. Sorry but i have to postpone it in Glances 3.0.

Has a workaround you can write a external peace of code to display a Glances server list and ask stats via the Restful API...

@notFloran Sorry for your time but keep the code in a branch, we will reuse it in Glances 3.0.

@nicolargo nicolargo modified the milestones: Glances 3.0, Glances 2.11 Jul 22, 2017
@mrmcox
Copy link
Author

mrmcox commented Jul 24, 2017

Ah, very sad times. I was looking forward to seeing this sooner rather than later. IT would be great for our current environment.

Hopefully glaces 3.0 wont be too far off?

Thanks to @nicolargo and @notFloran for all the work so far, great job guys.

@nicolargo
Copy link
Owner

Note a sad new, just an hope for the version 3.0 (not scheduled but perhaps in beginning of 2018).

@nicolargo
Copy link
Owner

Sorry but no time to work on this issue...

Looking for a contributor to take the control of the Glances browser function.

@tpcforever
Copy link

A little up for this feature ?
Still possible in Glances 3.X ?
Thanks a lot in advance, it's very good idea

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants