glances
glances copied to clipboard
Export while in server mode
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
For the moment, export is only available in standalone or client mode...
Where does server mode save recorded data? In memory?
Yes in memory. You can configure the buffer size here: https://github.com/nicolargo/glances/blob/develop/conf/glances.conf#L8-L10
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.
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.
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?
@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.
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
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!
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