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.55k stars 1.52k forks source link

Config to disable all plugins by default (or enable an exclusive list #2089

Closed chromakode closed 2 years ago

chromakode commented 2 years ago

Thank you for making glances! It's awesome, and I've been looking into using it in combination with Home Assistant to monitor system stats on my network.

Is your feature request related to a problem? Please describe.

When deploying glances as a JSON API only, I'd like to be able to limit the stats exposed -- monitoring simple stats like CPU and memory are very useful to me, but I would prefer to not expose things like the process list and software versions to the network, since they could aid automated vulnerability finders.

Describe the solution you'd like

It'd be really useful to either be able to disable all plugins by default. For example, support for an argument like --disable-plugin=* or --disable-plugin=all would work well for this. Alternatively, it would be useful to be able to specify a list of plugins like --plugins=cpu,mem and have those be the only plugins loaded.

Describe alternatives you've considered

Currently, the only way I've found to accomplish this is listing the entire set of available plugins via:

--disable-plugin=alert,amps,cloud,connections,core,cpu,diskio,docker,folders,fs,gpu,help,ip,irq,load,mem,memswap,network,now,percpu,ports,processcount,processlist,psutilversion,quicklook,raid,sensors,smart,system,uptime,wifi

This isn't a total solution, because it's possible a future glances update will introduce a new plugin which is default-on.

nicolargo commented 2 years ago

Done in the develop branch.

Example:

glances --disable-plugin all --enable-plugin cpu,mem,load -w --disable-webui

Then:

curl http://localhost:61208/api/3/pluginslist
["mem", "load", "cpu"]

curl http://localhost:61208/api/3/mem
{"total": 7837974528, "available": 3061608448, "percent": 60.9, "used": 4776366080, "free": 3061608448, "active": 2464227328, "inactive": 4274229248, "buffers": 488038400, "cache": 3273900032, "shared": 555122688}

curl http://localhost:61208/api/3/network
ERROR 400: Bad Request

Can you test on your side ?

Nicolas

indigoviolet commented 2 years ago

This is very useful, is there a way to represent this in the config file?

IIIdefconIII commented 11 months ago

This is very useful, is there a way to represent this in the config file?

glances:
container_name: glances
hostname: SkyNet    
image: nicolargo/glances:latest-full
restart: always
pid: host
privileged: true
security_opt:
- no-new-privileges:true
ports:
- 61208:61208
environment:
PUID: $PUID
PGID: $PGID
UMASK: $UMASK
TZ: $TZ
GLANCES_OPT: "-w --disable-plugin=alert,amps,cloud,connections,core,cpu,diskio,docker,folders,fs,gpu,help,ip,irq,load,mem,memswap,network,now,percpu,ports,processcount,processlist,psutilversion,quicklook,raid,sensors,smart,system,uptime,wifi"