nicolargo / glances

Glances an Eye on your system. A top/htop alternative for GNU/Linux, BSD, Mac OS and Windows operating systems.
http://nicolargo.github.io/glances/
Other
26.25k stars 1.49k forks source link

Running both server and webserver at the same time #995

Open Amxx opened 7 years ago

Amxx commented 7 years ago

Hello,

I'd like to run both glances server (-s) and webserver (-w) on the same machine. As the server option run on port 61209 (default) and webserver on port 61208 (default) I guessed it would not cause issues.

The idea is to use the same subdomain for both (nginx reverse proxy) so that system.mydomain.com:80 → redirection to localhost:61209 for glances -c connection system.mydomain.com:443 → redirection to localhost:61208 for web access

It's not perfect but it would suit me well.

The thing is I'd like to run only on glance and have it handle both ... maybe I ask for to much, but still I tried "glances -s -w --password" ... and what do I get ?

Glances server is running on 0.0.0.0:61208

What the actual fuck ? It only starts the classical server (which I can understand if it doesn't support running both at the same time) but on the webserver port ! This is confusing ...

Is there a way to run both server using a single glances instance ? Why do the port get mixed up like that (maybe that needs a fix) ?


Glances v2.7.1 with psutil v5.0.1 Linux Maia 4.9.0-1-ARCH #1 SMP Mon Dec 12 20:18:28 MST 2016 armv7l GNU/Linux

nicolargo commented 7 years ago

Hi @Amxx , if i understand your need, you want to serve both XML/RCP and HTTP/Restful API from one Glances server. It is not possible for the current version (and will not be possible with the next 2.8 release). Nevertheless, it is an interesting enhance request. We need to refactor the server to do that.

As a workaround you can run two Glances server one with the -s and another one with the -w... It is not perfect but it should work with your NGinx reverse proxy...

Ackis commented 6 years ago

I'm not sure if I missed something in the documentation, but I just spent the last hour or so trying to get -w and -s to work together.

My assumption/understanding was that the -w parameter allows me to access glances status through a browser, and the -s parameter allows a central server to gather glances data from multiple machines that are running in client mode. This understanding is/was wrong.

cult-hero13 commented 5 years ago

Was this ever implemented? I’m running version 3.1.0 and observe the same behavior as Amxx describes.

CallMarl commented 4 years ago

run this commande line : nohup glances -s &| nohup glances -w &

tcpdump

tcp        0      0 0.0.0.0:61208           0.0.0.0:*               LISTEN      629319/python3
tcp        0      0 0.0.0.0:61209           0.0.0.0:*               LISTEN      629276/python3
martadinata666 commented 1 year ago

So im transfered from https://github.com/nicolargo/glances/issues/2020 , when whis talking about -s -w, I'm looking on -C -w combo. That enable central monitoring via web, when my current workaround is using wetty with openssh to manually execute glances -C --browse. Also alike https://github.com/nicolargo/glances/discussions/2292.

Thanks.

nicolargo commented 1 year ago

One way to respond to the need is to run two sub-processes, one for the XML Server and another one for the REST Server. Both sub-processes will consume/expose the same stats.

Also keep in mind this another need during the implementation: https://github.com/nicolargo/glances/issues/1527

RazCrimson commented 1 year ago

@nicolargo

Was there any specific reason we stick with XML-RPC for the glances server?

Were there any problem with JSON-RPC options?

nicolargo commented 1 year ago

@RazCrimson Very good point. I think it will be nice if only one interface protocol will be used for both client/server and WebServer.

What about only use REST/JSON interface ?

It's a big refactor for the client/server and client/browser mode.

What's your opinion ?