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

Export while in server mode #1527

Open
mitar opened this issue Aug 5, 2019 · 10 comments
Open

Export while in server mode #1527

mitar opened this issue Aug 5, 2019 · 10 comments

Comments

@mitar
Copy link

mitar commented Aug 5, 2019

Description

It looks like it is not possible to export data when running in server mode? That is surprising because when I read it in documentation I though that is the main use case. That you can run a server daemon and configure it so that it exports everything recorded to a file for preservation. And then you can connect with a client to see current state.

It seems you have to connect with a client to export recorded data, but why couldn't just server do that as well? So then there would be no need for me to periodically connect and export.

Versions

  • Glances & psutil (glances -V): Glances v3.1.1 with psutil v5.6.3
  • Operating System (lsb_release -a): Ubuntu 18.04.2 LTS
@nicolargo
Copy link
Owner

For the moment, export is only available in standalone or client mode...

@mitar
Copy link
Author

mitar commented Aug 7, 2019

Where does server mode save recorded data? In memory?

@nicolargo
Copy link
Owner

Yes in memory. You can configure the buffer size here: https://github.com/nicolargo/glances/blob/develop/conf/glances.conf#L8-L10

@mitar
Copy link
Author

mitar commented Aug 7, 2019

Yes, I have seen that you can configure it.

I really thought that all integration with CSV and InfluxDB and stuff like that can work on the server, that you can export all this data in real-time into those and then use them.

@nicolargo
Copy link
Owner

By design, Glances server has a very low CPU footprint because it grab data only when a client ask for it (not every 3 seconds). If we allows user to serve and export i have to change this behavior on server side.

But i hear your need. I am going to think to a new mode to mix server and export mode...

Any ideas are welcomes.

@nicolargo nicolargo added this to the Next releases milestone Aug 13, 2019
@nicolargo nicolargo modified the milestones: Next releases, 3.1.3 Aug 27, 2019
@nicolargo nicolargo changed the title Export to CSV while in server mode Export while in server mode Feb 5, 2020
@nicolargo nicolargo modified the milestones: Next releases, Glances 4.0 Mar 11, 2020
@MetallicAchu
Copy link

MetallicAchu commented Jun 16, 2021

Is it possible to create 2 systemd services, for example glances.webserver and glances.exporter and use each of them according to the respective examples on https://github.com/nicolargo/glances/wiki/Start-Glances-through-Systemd ?

Are there any limitations to potentially running two instances while one is the webserver?

Thanks!!

EDIT:
Tried to run glances --export prometheus while webserver is running in background as daemon, and using "top" command I got 15-20% CPU usage per second from the export service.
Anyone can replicate?

@nicolargo
Copy link
Owner

@MetallicAchu Yes it is possible to run two Glances instances.

For the CPU consumption, it is strange, on my system i am around 7% not 20%.... Try to disable the sensors plugin.

@MetallicAchu
Copy link

MetallicAchu commented Jun 22, 2021

I made 2 services, one for web server and one for export to prometheus every 10 seconds
I tested it with ps aux | grep glances --- because ps aux gives the average CPU consumption over the running time.

Tested for almost 20 minutes:
16060 10.2 1.5 1373528 62524 ? Ssl 12:10 18:57 /usr/bin/python3 /usr/bin/glances -t 10 --quiet --export prometheus

Where 10.2 is CPU % over time run.

I'll let it run for a while more and update again :)

EDIT: After 3 hours CPU is steady at 10% average.
I’m running 2 x intel 2.5ghz

I wouldn’t consider it much of a problem if only Glances could act both as a webserver and an exporter at the same time

@MetallicAchu
Copy link

I wanted to update that with glances v3.2.0 I'm experiencing 2.5% CPU on average, so the change is most welcomed!
Thank you!

@crile
Copy link

crile commented Sep 17, 2021

Same use case here, I start the server and the client for the export. I think it do the job

glances --config glances.conf --server
glances --config glances.conf --client localhost --export csv --export-csv-file export.csv

However I noticed that with the option --quiet, glances use 100% of CPU load.
The client use 70% and server instance use the rest.

So I replace the client command by :

glances --config glances.conf --client localhost --export csv --export-csv-file export.csv > /dev/null

I can't try with client instance on another machine.

Glances v3.2.3.1 with PsUtil v5.8.0

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