glances icon indicating copy to clipboard operation
glances copied to clipboard

Add ability to specify custom information extracted from CLI commands or existing files

Open ashrama opened this issue 7 months ago • 4 comments

It would be quite handy to be able to specify custom information fields for a range of things Glances does not currently output. This would almost infinitely expand the range of things Glances can display.

A section in the glances.conf file for custom information that enables the extraction of data from CLI commands using regex to control the output. Refresh would tell glances how often to run the command and display the output. For example:

[custom] Description=VPN WAN IP Command=nordvpn status Regex=(?<=IP:).* Refresh=30

Output displayed would show: "VPN WAN IP: 111.111.111.111"

Rpimonitor (https://github.com/XavierBerger/RPi-Monitor) does something similar but is no longer maintained and doesn't include the detail already in Glances.

ashrama avatar May 08 '25 10:05 ashrama

Hi @ashrama

do you have a look on Glances AMP : https://glances.readthedocs.io/en/develop/aoa/amps.html

Except for the regexp, this plugin do what you want.

Keep me inform.

Nicolas

nicolargo avatar May 11 '25 10:05 nicolargo

Except for the regexp, this plugin do what you want.

Yes, thank you. Can you confirm how the regex option works? It doesn't seem to work on the output of a command specified by the 'command=' option. Does it only apply to running processes? If so, and if there is no other conflict it would be great to have it apply to the command if one is specified since it then doesn't need to check running processes?

In the time being I have used the shell script example and piped the output through grep to extract the IP only.

Also is there a way to change the location an AMP appears on the glances output? Currently it is displaying in between the tasks header line and the running tasks.

Image

ashrama avatar May 11 '25 12:05 ashrama

Nope for the moment it is not possible to change AMP plugin location in the UIs.

nicolargo avatar May 12 '25 16:05 nicolargo

This issue is stale because it has been open for 3 months with no activity.

github-actions[bot] avatar Aug 11 '25 02:08 github-actions[bot]