From 4d50e8cb5756755cf019cef1f45cd569bef708fc Mon Sep 17 00:00:00 2001 From: nicolargo Date: Sun, 22 May 2022 16:27:46 +0200 Subject: [PATCH] Create a Show option in the configuration file to only show some stats #2052 --- conf/glances.conf | 8 + docs/aoa/diskio.rst | 8 + docs/aoa/docker.rst | 2 + docs/aoa/fs.rst | 5 +- docs/aoa/network.rst | 2 + docs/aoa/wifi.rst | 1 + docs/api.rst | 1865 ++++++++++++++-------------- docs/man/glances.1 | 6 +- glances/plugins/glances_diskio.py | 5 +- glances/plugins/glances_docker.py | 8 +- glances/plugins/glances_fs.py | 6 +- glances/plugins/glances_network.py | 4 +- glances/plugins/glances_plugin.py | 13 +- glances/plugins/glances_sensors.py | 2 +- glances/plugins/glances_wifi.py | 2 +- 15 files changed, 985 insertions(+), 952 deletions(-) diff --git a/conf/glances.conf b/conf/glances.conf index 57478e28..1d9ce3e0 100644 --- a/conf/glances.conf +++ b/conf/glances.conf @@ -158,6 +158,8 @@ tx_warning=80 tx_critical=90 # Define the list of hidden network interfaces (comma-separated regexp) #hide=docker.*,lo +# Define the list of wireless network interfaces to be show (comma-separated) +#show=docker.* # WLAN 0 alias #wlan0_alias=Wireless # It is possible to overwrite the bitrate thresholds per interface @@ -187,6 +189,8 @@ nf_conntrack_percent_critical=90 disable=True # Define the list of hidden wireless network interfaces (comma-separated regexp) hide=lo,docker.* +# Define the list of wireless network interfaces to be show (comma-separated) +#show=docker.* # Define SIGNAL thresholds in db (lower is better...) # Based on: http://serverfault.com/questions/501025/industry-standard-for-minimum-wifi-signal-strength careful=-65 @@ -198,6 +202,8 @@ disable=False # Define the list of hidden disks (comma-separated regexp) #hide=sda2,sda5,loop.* hide=loop.*,/dev/loop* +# Define the list of disks to be show (comma-separated) +#show=sda.* # Alias for sda1 #sda1_alias=InternalDisk @@ -205,6 +211,8 @@ hide=loop.*,/dev/loop* disable=False # Define the list of hidden file system (comma-separated regexp) hide=/boot.*,/snap.* +# Define the list of file system to be show (comma-separated) +#show=/,/srv # Define filesystem space thresholds in % # Default values if not defined: 50/70/90 # It is also possible to define per mount point value diff --git a/docs/aoa/diskio.rst b/docs/aoa/diskio.rst index f6d03ffe..6ae77207 100644 --- a/docs/aoa/diskio.rst +++ b/docs/aoa/diskio.rst @@ -17,6 +17,7 @@ There is no alert on this information. It's possible to define: +- a list of disk to show (white list) - a list of disks to hide - aliases for disk name @@ -29,3 +30,10 @@ and the specific ``sda5`` partition: [diskio] hide=sda5,loop.* + +or another example: + +.. code-block:: ini + + [diskio] + show=sda.* diff --git a/docs/aoa/docker.rst b/docs/aoa/docker.rst index c21dc850..2c5b951d 100644 --- a/docs/aoa/docker.rst +++ b/docs/aoa/docker.rst @@ -25,6 +25,8 @@ under the ``[docker]`` section: show=thiscontainer,andthisone,andthoseones.* # Hide some containers (comma separeted list of container name or regular expression) hide=donotshowthisone,andthose.* + # Show only specific containers (comma separeted list of container name or regular expression) + #show=showthisone,andthose.* # Define the maximum docker size name (default is 20 chars) max_name_size=20 # Global containers' thresholds for CPU and MEM (in %) diff --git a/docs/aoa/fs.rst b/docs/aoa/fs.rst index 92428555..1b3b7155 100644 --- a/docs/aoa/fs.rst +++ b/docs/aoa/fs.rst @@ -46,9 +46,10 @@ To hide all mount points starting with /boot and /snap: Filtering are also applied on device name (Glances 3.1.4 or higher). -Example to hide all /dev/sdb mount points: +It is also possible to configure a white list of devices to display: +Example to only show /dev/sdb mount points: .. code-block:: ini [fs] - hide=/dev/sdb.* + show=/dev/sdb.* diff --git a/docs/aoa/network.rst b/docs/aoa/network.rst index 2c5bd719..27ad1581 100644 --- a/docs/aoa/network.rst +++ b/docs/aoa/network.rst @@ -39,6 +39,8 @@ virtual docker interface (docker0, docker1, ...): tx_critical=90 # Define the list of hidden network interfaces (comma-separated regexp) hide=docker.*,lo + # Define the list of network interfaces to show (comma-separated regexp) + #show=eth0,eth1 # WLAN 0 alias wlan0_alias=Wireless IF # It is possible to overwrite the bitrate thresholds per interface diff --git a/docs/aoa/wifi.rst b/docs/aoa/wifi.rst index deb71fbc..ca279655 100644 --- a/docs/aoa/wifi.rst +++ b/docs/aoa/wifi.rst @@ -27,6 +27,7 @@ hide the loopback interface (lo) and all the virtual docker interfaces: [wifi] hide=lo,docker.* + #show=wlp2s0 # Define SIGNAL thresholds in dBm (lower is better...) careful=-65 warning=-75 diff --git a/docs/api.rst b/docs/api.rst index cf45dc46..826deb89 100644 --- a/docs/api.rst +++ b/docs/api.rst @@ -20,7 +20,7 @@ It will return nothing but a 200 return code if everythin is OK. Get the Rest API status:: # curl -I http://localhost:61208/api/3/status - 'HTTP/1.0 200 OK' + "HTTP/1.0 200 OK" GET plugins list ---------------- @@ -28,56 +28,37 @@ GET plugins list Get the plugins list:: # curl http://localhost:61208/api/3/pluginslist - ['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'] - -GET alert ---------- - -Get plugin stats:: - - # curl http://localhost:61208/api/3/alert - [[1649600032.0, - -1, - 'WARNING', - 'MEM', - 87.2703077870435, - 87.2703077870435, - 87.2703077870435, - 87.2703077870435, - 1, - [], - '', - 'memory_percent']] + ["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"] GET amps -------- @@ -85,42 +66,42 @@ GET amps Get plugin stats:: # curl http://localhost:61208/api/3/amps - [{'count': 0, - 'countmax': None, - 'countmin': 1.0, - 'key': 'name', - 'name': 'Dropbox', - 'refresh': 3.0, - 'regex': True, - 'result': None, - 'timer': 0.14095854759216309}, - {'count': 0, - 'countmax': 20.0, - 'countmin': None, - 'key': 'name', - 'name': 'Python', - 'refresh': 3.0, - 'regex': True, - 'result': None, - 'timer': 0.14076852798461914}] + [{"count": 0, + "countmax": None, + "countmin": 1.0, + "key": "name", + "name": "Dropbox", + "refresh": 3.0, + "regex": True, + "result": None, + "timer": 0.9064404964447021}, + {"count": 0, + "countmax": 20.0, + "countmin": None, + "key": "name", + "name": "Python", + "refresh": 3.0, + "regex": True, + "result": None, + "timer": 0.9063467979431152}] Get a specific field:: # curl http://localhost:61208/api/3/amps/name - {'name': ['Dropbox', 'Python', 'Conntrack', 'Nginx', 'Systemd', 'SystemV']} + {"name": ["Dropbox", "Python", "Conntrack", "Nginx", "Systemd", "SystemV"]} Get a specific item when field matchs the given value:: # curl http://localhost:61208/api/3/amps/name/Dropbox - {'Dropbox': [{'count': 0, - 'countmax': None, - 'countmin': 1.0, - 'key': 'name', - 'name': 'Dropbox', - 'refresh': 3.0, - 'regex': True, - 'result': None, - 'timer': 0.14095854759216309}]} + {"Dropbox": [{"count": 0, + "countmax": None, + "countmin": 1.0, + "key": "name", + "name": "Dropbox", + "refresh": 3.0, + "regex": True, + "result": None, + "timer": 0.9064404964447021}]} GET core -------- @@ -128,7 +109,7 @@ GET core Get plugin stats:: # curl http://localhost:61208/api/3/core - {'log': 4, 'phys': 2} + {"log": 4, "phys": 2} Fields descriptions: @@ -138,7 +119,7 @@ Fields descriptions: Get a specific field:: # curl http://localhost:61208/api/3/core/phys - {'phys': 2} + {"phys": 2} GET cpu ------- @@ -146,23 +127,23 @@ GET cpu Get plugin stats:: # curl http://localhost:61208/api/3/cpu - {'cpucore': 4, - 'ctx_switches': 0, - 'guest': 0.0, - 'guest_nice': 0.0, - 'idle': 59.6, - 'interrupts': 0, - 'iowait': 0.2, - 'irq': 0.0, - 'nice': 0.7, - 'soft_interrupts': 0, - 'softirq': 0.9, - 'steal': 0.0, - 'syscalls': 0, - 'system': 10.1, - 'time_since_update': 1, - 'total': 38.8, - 'user': 28.5} + {"cpucore": 4, + "ctx_switches": 0, + "guest": 0.0, + "guest_nice": 0.0, + "idle": 31.9, + "interrupts": 0, + "iowait": 0.2, + "irq": 0.0, + "nice": 0.0, + "soft_interrupts": 0, + "softirq": 0.0, + "steal": 0.0, + "syscalls": 0, + "system": 5.5, + "time_since_update": 1, + "total": 64.3, + "user": 62.4} Fields descriptions: @@ -184,7 +165,7 @@ Fields descriptions: Get a specific field:: # curl http://localhost:61208/api/3/cpu/total - {'total': 38.8} + {"total": 64.3} GET diskio ---------- @@ -192,36 +173,71 @@ GET diskio Get plugin stats:: # curl http://localhost:61208/api/3/diskio - [{'disk_name': 'sda', - 'key': 'disk_name', - 'read_bytes': 0, - 'read_count': 0, - 'time_since_update': 1, - 'write_bytes': 0, - 'write_count': 0}, - {'disk_name': 'sda1', - 'key': 'disk_name', - 'read_bytes': 0, - 'read_count': 0, - 'time_since_update': 1, - 'write_bytes': 0, - 'write_count': 0}] + [{"disk_name": "sda", + "key": "disk_name", + "read_bytes": 0, + "read_count": 0, + "time_since_update": 1, + "write_bytes": 0, + "write_count": 0}, + {"disk_name": "sda1", + "key": "disk_name", + "read_bytes": 0, + "read_count": 0, + "time_since_update": 1, + "write_bytes": 0, + "write_count": 0}] Get a specific field:: # curl http://localhost:61208/api/3/diskio/disk_name - {'disk_name': ['sda', 'sda1', 'sda2', 'sda5', 'dm-0', 'dm-1']} + {"disk_name": ["sda", "sda1", "sda2", "sda5", "dm-0", "dm-1"]} Get a specific item when field matchs the given value:: # curl http://localhost:61208/api/3/diskio/disk_name/sda - {'sda': [{'disk_name': 'sda', - 'key': 'disk_name', - 'read_bytes': 0, - 'read_count': 0, - 'time_since_update': 1, - 'write_bytes': 0, - 'write_count': 0}]} + {"sda": [{"disk_name": "sda", + "key": "disk_name", + "read_bytes": 0, + "read_count": 0, + "time_since_update": 1, + "write_bytes": 0, + "write_count": 0}]} + +GET docker +---------- + +Get plugin stats:: + + # curl http://localhost:61208/api/3/docker + [{"Command": ["/entrypoint.sh", "telegraf"], + "Id": "9230f84acadbb7bc8c087d0827389c9a87bb7c7022a1a299dcf4a5f3a441f1d3", + "Image": ["telegraf:latest"], + "Names": ["telegraf"], + "Status": "running", + "Uptime": "1 weeks", + "cpu_percent": 0.0, + "io_r": None, + "io_w": None, + "key": "name", + "memory_usage": 48050176, + "name": "telegraf", + "network_rx": None, + "network_tx": None}, + {"Command": ["/run.sh"], + "Id": "09d96704c3e6b6cb21657d990e3c8ae1e44bac779ded141efb8fed899563dd66", + "Image": ["grafana/grafana:latest"], + "Names": ["grafana"], + "Status": "running", + "Uptime": "1 weeks", + "cpu_percent": 0.0, + "io_r": None, + "io_w": None, + "key": "name", + "memory_usage": None, + "name": "grafana", + "network_rx": None, + "network_tx": None}] GET fs ------ @@ -229,31 +245,31 @@ GET fs Get plugin stats:: # curl http://localhost:61208/api/3/fs - [{'device_name': '/dev/mapper/ubuntu--gnome--vg-root', - 'free': 79632797696, - 'fs_type': 'ext4', - 'key': 'mnt_point', - 'mnt_point': '/', - 'percent': 65.5, - 'size': 243396149248, - 'used': 151375896576}] + [{"device_name": "/dev/mapper/ubuntu--gnome--vg-root", + "free": 106242338816, + "fs_type": "ext4", + "key": "mnt_point", + "mnt_point": "/", + "percent": 54.0, + "size": 243396149248, + "used": 124766355456}] Get a specific field:: # curl http://localhost:61208/api/3/fs/mnt_point - {'mnt_point': ['/']} + {"mnt_point": ["/"]} Get a specific item when field matchs the given value:: # curl http://localhost:61208/api/3/fs/mnt_point// - {'/': [{'device_name': '/dev/mapper/ubuntu--gnome--vg-root', - 'free': 79632797696, - 'fs_type': 'ext4', - 'key': 'mnt_point', - 'mnt_point': '/', - 'percent': 65.5, - 'size': 243396149248, - 'used': 151375896576}]} + {"/": [{"device_name": "/dev/mapper/ubuntu--gnome--vg-root", + "free": 106242338816, + "fs_type": "ext4", + "key": "mnt_point", + "mnt_point": "/", + "percent": 54.0, + "size": 243396149248, + "used": 124766355456}]} GET ip ------ @@ -261,16 +277,16 @@ GET ip Get plugin stats:: # curl http://localhost:61208/api/3/ip - {'address': '192.168.0.49', - 'gateway': '192.168.0.254', - 'mask': '255.255.255.0', - 'mask_cidr': 24, - 'public_address': '88.165.169.242'} + {"address": "192.168.0.33", + "gateway": "192.168.0.254", + "mask": "255.255.255.0", + "mask_cidr": 24, + "public_address": "91.166.228.228"} Get a specific field:: # curl http://localhost:61208/api/3/ip/address - {'address': '192.168.0.49'} + {"address": "192.168.0.33"} GET load -------- @@ -278,7 +294,10 @@ GET load Get plugin stats:: # curl http://localhost:61208/api/3/load - {'cpucore': 4, 'min1': 1.76, 'min15': 1.61, 'min5': 1.69} + {"cpucore": 4, + "min1": 2.14453125, + "min15": 0.71728515625, + "min5": 1.24462890625} Fields descriptions: @@ -290,7 +309,7 @@ Fields descriptions: Get a specific field:: # curl http://localhost:61208/api/3/load/min1 - {'min1': 1.76} + {"min1": 2.14453125} GET mem ------- @@ -298,16 +317,16 @@ GET mem Get plugin stats:: # curl http://localhost:61208/api/3/mem - {'active': 3452456960, - 'available': 999153664, - 'buffers': 112189440, - 'cached': 1540894720, - 'free': 999153664, - 'inactive': 1303179264, - 'percent': 87.3, - 'shared': 497025024, - 'total': 7849000960, - 'used': 6849847296} + {"active": 2638856192, + "available": 2748903424, + "buffers": 271753216, + "cached": 3217653760, + "free": 2748903424, + "inactive": 4105572352, + "percent": 64.9, + "shared": 640585728, + "total": 7837945856, + "used": 5089042432} Fields descriptions: @@ -326,7 +345,7 @@ Fields descriptions: Get a specific field:: # curl http://localhost:61208/api/3/mem/total - {'total': 7849000960} + {"total": 7837945856} GET memswap ----------- @@ -334,13 +353,13 @@ GET memswap Get plugin stats:: # curl http://localhost:61208/api/3/memswap - {'free': 7769960448, - 'percent': 3.9, - 'sin': 21983232, - 'sout': 333402112, - 'time_since_update': 1, - 'total': 8082419712, - 'used': 312459264} + {"free": 7083606016, + "percent": 12.4, + "sin": 413794304, + "sout": 1457811456, + "time_since_update": 1, + "total": 8082419712, + "used": 998813696} Fields descriptions: @@ -355,7 +374,7 @@ Fields descriptions: Get a specific field:: # curl http://localhost:61208/api/3/memswap/total - {'total': 8082419712} + {"total": 8082419712} GET network ----------- @@ -363,30 +382,30 @@ GET network Get plugin stats:: # curl http://localhost:61208/api/3/network - [{'alias': None, - 'cumulative_cx': 243100, - 'cumulative_rx': 6357, - 'cumulative_tx': 236743, - 'cx': 0, - 'interface_name': 'docker0', - 'is_up': False, - 'key': 'interface_name', - 'rx': 0, - 'speed': 0, - 'time_since_update': 1, - 'tx': 0}, - {'alias': None, - 'cumulative_cx': 183333, - 'cumulative_rx': 0, - 'cumulative_tx': 183333, - 'cx': 0, - 'interface_name': 'vboxnet0', - 'is_up': True, - 'key': 'interface_name', - 'rx': 0, - 'speed': 10485760, - 'time_since_update': 1, - 'tx': 0}] + [{"alias": None, + "cumulative_cx": 102971498, + "cumulative_rx": 51485749, + "cumulative_tx": 51485749, + "cx": 4922, + "interface_name": "lo", + "is_up": True, + "key": "interface_name", + "rx": 2461, + "speed": 0, + "time_since_update": 1, + "tx": 2461}, + {"alias": None, + "cumulative_cx": 3379334650, + "cumulative_rx": 3170582491, + "cumulative_tx": 208752159, + "cx": 27167, + "interface_name": "wlp2s0", + "is_up": True, + "key": "interface_name", + "rx": 20882, + "speed": 0, + "time_since_update": 1, + "tx": 6285}] Fields descriptions: @@ -403,30 +422,32 @@ Fields descriptions: Get a specific field:: # curl http://localhost:61208/api/3/network/interface_name - {'interface_name': ['docker0', - 'vboxnet0', - 'br-87386b77b676', - 'lo', - 'br-119e6ee04e05', - 'br_grafana', - 'mpqemubr0', - 'wlp2s0']} + {"interface_name": ["lo", + "wlp2s0", + "mpqemubr0", + "br-87386b77b676", + "br_grafana", + "docker0", + "br-119e6ee04e05", + "vethfbde85e", + "veth33a86dc", + "veth5ebe4bf"]} Get a specific item when field matchs the given value:: - # curl http://localhost:61208/api/3/network/interface_name/docker0 - {'docker0': [{'alias': None, - 'cumulative_cx': 243100, - 'cumulative_rx': 6357, - 'cumulative_tx': 236743, - 'cx': 0, - 'interface_name': 'docker0', - 'is_up': False, - 'key': 'interface_name', - 'rx': 0, - 'speed': 0, - 'time_since_update': 1, - 'tx': 0}]} + # curl http://localhost:61208/api/3/network/interface_name/lo + {"lo": [{"alias": None, + "cumulative_cx": 102971498, + "cumulative_rx": 51485749, + "cumulative_tx": 51485749, + "cx": 4922, + "interface_name": "lo", + "is_up": True, + "key": "interface_name", + "rx": 2461, + "speed": 0, + "time_since_update": 1, + "tx": 2461}]} GET now ------- @@ -434,7 +455,7 @@ GET now Get plugin stats:: # curl http://localhost:61208/api/3/now - '2022-04-10 16:13:52 CEST' + "2022-05-22 16:21:44 CEST" GET percpu ---------- @@ -442,37 +463,37 @@ GET percpu Get plugin stats:: # curl http://localhost:61208/api/3/percpu - [{'cpu_number': 0, - 'guest': 0.0, - 'guest_nice': 0.0, - 'idle': 78.0, - 'iowait': 0.0, - 'irq': 0.0, - 'key': 'cpu_number', - 'nice': 1.0, - 'softirq': 0.0, - 'steal': 0.0, - 'system': 9.0, - 'total': 22.0, - 'user': 9.0}, - {'cpu_number': 1, - 'guest': 0.0, - 'guest_nice': 0.0, - 'idle': 55.0, - 'iowait': 0.0, - 'irq': 0.0, - 'key': 'cpu_number', - 'nice': 1.0, - 'softirq': 2.0, - 'steal': 0.0, - 'system': 7.0, - 'total': 45.0, - 'user': 32.0}] + [{"cpu_number": 0, + "guest": 0.0, + "guest_nice": 0.0, + "idle": 36.6, + "iowait": 0.0, + "irq": 0.0, + "key": "cpu_number", + "nice": 0.0, + "softirq": 0.0, + "steal": 0.0, + "system": 6.9, + "total": 63.4, + "user": 56.4}, + {"cpu_number": 1, + "guest": 0.0, + "guest_nice": 0.0, + "idle": 34.0, + "iowait": 0.0, + "irq": 0.0, + "key": "cpu_number", + "nice": 0.0, + "softirq": 0.0, + "steal": 0.0, + "system": 3.0, + "total": 66.0, + "user": 62.0}] Get a specific field:: # curl http://localhost:61208/api/3/percpu/cpu_number - {'cpu_number': [0, 1, 2, 3]} + {"cpu_number": [0, 1, 2, 3]} GET ports --------- @@ -480,31 +501,31 @@ GET ports Get plugin stats:: # curl http://localhost:61208/api/3/ports - [{'description': 'DefaultGateway', - 'host': '192.168.0.254', - 'indice': 'port_0', - 'port': 0, - 'refresh': 30, - 'rtt_warning': None, - 'status': 0.007151, - 'timeout': 3}] + [{"description": "DefaultGateway", + "host": "192.168.0.254", + "indice": "port_0", + "port": 0, + "refresh": 30, + "rtt_warning": None, + "status": 0.027759, + "timeout": 3}] Get a specific field:: # curl http://localhost:61208/api/3/ports/host - {'host': ['192.168.0.254']} + {"host": ["192.168.0.254"]} Get a specific item when field matchs the given value:: # curl http://localhost:61208/api/3/ports/host/192.168.0.254 - {'192.168.0.254': [{'description': 'DefaultGateway', - 'host': '192.168.0.254', - 'indice': 'port_0', - 'port': 0, - 'refresh': 30, - 'rtt_warning': None, - 'status': 0.007151, - 'timeout': 3}]} + {"192.168.0.254": [{"description": "DefaultGateway", + "host": "192.168.0.254", + "indice": "port_0", + "port": 0, + "refresh": 30, + "rtt_warning": None, + "status": 0.027759, + "timeout": 3}]} GET processcount ---------------- @@ -512,12 +533,12 @@ GET processcount Get plugin stats:: # curl http://localhost:61208/api/3/processcount - {'pid_max': 0, 'running': 1, 'sleeping': 261, 'thread': 1317, 'total': 319} + {"pid_max": 0, "running": 1, "sleeping": 255, "thread": 1374, "total": 319} Get a specific field:: # curl http://localhost:61208/api/3/processcount/total - {'total': 319} + {"total": 319} GET processlist --------------- @@ -525,233 +546,251 @@ GET processlist Get plugin stats:: # curl http://localhost:61208/api/3/processlist - [{'cmdline': ['/usr/lib/virtualbox/VBoxHeadless', - '--comment', - 'minikube', - '--startvm', - '74869efd-ada3-41eb-98e3-b7d2901c8e39', - '--vrde', - 'config'], - 'cpu_percent': 0.0, - 'cpu_times': pcputimes(user=128.45, system=1415.02, children_user=0.0, children_system=0.0, iowait=0.0), - 'gids': pgids(real=1000, effective=1000, saved=1000), - 'io_counters': [0, 0, 0, 0, 0], - 'key': 'pid', - 'memory_info': pmem(rss=963088384, vms=4204658688, shared=924651520, text=53248, lib=0, data=98004992, dirty=0), - 'memory_percent': 12.270203417072839, - 'name': 'VBoxHeadless', - 'nice': 0, - 'num_threads': 28, - 'pid': 9872, - 'ppid': 9690, - 'status': 'S', - 'time_since_update': 1, - 'username': 'nicolargo'}, - {'cmdline': ['/usr/lib/firefox/firefox', - '-contentproc', - '-childID', - '4', - '-isForBrowser', - '-prefsLen', - '4855', - '-prefMapSize', - '253021', - '-jsInitLen', - '278884', - '-parentBuildID', - '20211215221728', - '-appDir', - '/usr/lib/firefox/browser', - '4964', - 'true', - 'tab'], - 'cpu_percent': 0.0, - 'cpu_times': pcputimes(user=157.91, system=26.98, children_user=0.0, children_system=0.0, iowait=0.03), - 'gids': pgids(real=1000, effective=1000, saved=1000), - 'io_counters': [9154560, 0, 0, 0, 0], - 'key': 'pid', - 'memory_info': pmem(rss=413597696, vms=3211755520, shared=44220416, text=643072, lib=0, data=648302592, dirty=0), - 'memory_percent': 5.269431079289866, - 'name': 'WebExtensions', - 'nice': 0, - 'num_threads': 21, - 'pid': 5235, - 'ppid': 4964, - 'status': 'S', - 'time_since_update': 1, - 'username': 'nicolargo'}] + [{"cmdline": ["/snap/firefox/1300/usr/lib/firefox/firefox"], + "cpu_percent": 0.0, + "cpu_times": pcputimes(user=2407.22, system=913.36, children_user=2160.45, children_system=460.56, iowait=0.0), + "gids": pgids(real=1000, effective=1000, saved=1000), + "io_counters": [1388816384, 3879223296, 0, 0, 0], + "key": "pid", + "memory_info": pmem(rss=517357568, vms=13510344704, shared=131108864, text=643072, lib=0, data=1639305216, dirty=0), + "memory_percent": 6.600678002948429, + "name": "firefox", + "nice": 0, + "num_threads": 123, + "pid": 10259, + "ppid": 2922, + "status": "S", + "time_since_update": 1, + "username": "nicolargo"}, + {"cmdline": ["/snap/firefox/1300/usr/lib/firefox/firefox", + "-contentproc", + "-childID", + "1", + "-isForBrowser", + "-prefsLen", + "628", + "-prefMapSize", + "267733", + "-jsInitLen", + "277212", + "-parentBuildID", + "20220502141216", + "-appDir", + "/snap/firefox/1300/usr/lib/firefox/browser", + "10259", + "true", + "tab"], + "cpu_percent": 0.0, + "cpu_times": pcputimes(user=666.99, system=118.93, children_user=0.0, children_system=0.0, iowait=0.0), + "gids": pgids(real=1000, effective=1000, saved=1000), + "io_counters": [96068608, 0, 0, 0, 0], + "key": "pid", + "memory_info": pmem(rss=439865344, vms=3304181760, shared=77123584, text=643072, lib=0, data=723918848, dirty=0), + "memory_percent": 5.611997736157876, + "name": "WebExtensions", + "nice": 0, + "num_threads": 20, + "pid": 10790, + "ppid": 10259, + "status": "S", + "time_since_update": 1, + "username": "nicolargo"}] Get a specific field:: # curl http://localhost:61208/api/3/processlist/pid - {'pid': [9872, - 5235, - 4964, - 16062, - 5294, - 5305, - 16229, - 15998, - 5894, - 4033, - 15053, - 20039, - 20161, - 15933, - 16038, - 15966, - 5060, - 20727, - 20793, - 20685, - 5648, - 8850, - 16111, - 16075, - 2185, - 22482, - 3875, - 2233, - 15983, - 22458, - 3789, - 16242, - 3846, - 2410, - 7066, - 5563, - 15938, - 1332, - 15937, - 5595, - 4119, - 14247, - 14256, - 9690, - 349, - 1160, - 3787, - 4305, - 4193, - 4094, - 2380, - 4187, - 1315, - 2197, - 1320, - 4192, - 1, - 4088, - 1173, - 1175, - 4627, - 1199, - 5024, - 3531, - 9684, - 4062, - 2189, - 4130, - 2386, - 10484, - 4191, - 14266, - 4232, - 3777, - 4019, - 4194, - 4213, - 4589, - 4167, - 14265, - 15940, - 1039, - 4308, - 1584, - 4188, - 4105, - 4198, - 4064, - 3762, - 1326, - 3824, - 1196, - 1365, - 4057, - 3831, - 1142, - 3900, - 1158, - 3813, - 4276, - 4203, - 9177, - 16135, - 8860, - 1201, - 1195, - 2384, - 3797, - 4190, - 4209, + {"pid": [10259, + 10790, + 10850, + 21025, + 20979, + 10854, + 2922, + 62372, + 21227, + 142824, + 10857, + 149041, + 38204, + 10814, + 20905, + 12436, + 61347, + 157307, + 21039, + 157401, + 158125, + 157876, + 138834, + 52875, + 2820, + 158312, + 2033, + 138954, + 138989, + 20947, + 3251, + 3161, + 11390, + 21107, + 337, + 3279, + 3019, + 21063, + 8716, + 3706, + 10597, + 3347, + 2790, + 3227, + 2109, + 1302, + 3066, + 20965, + 3056, + 21229, + 3065, + 8715, + 2867, + 2999, + 141412, + 3381, + 1133, 1166, - 3855, - 3872, - 2385, - 1192, - 4068, - 4079, - 4102, - 4229, - 4179, - 3988, - 4186, - 4061, - 3791, - 4600, - 3536, - 1186, - 3861, - 3998, - 4301, - 4197, - 3817, - 3836, - 4269, - 4195, - 3842, - 1040, - 383, - 4200, - 1182, - 1168, - 1202, + 3085, + 1601, + 3064, + 3206, + 1147, + 141439, + 2964, + 1265, + 2990, + 2073, + 1, + 2081, + 3259, 1150, - 4013, - 4003, - 4083, + 989, + 1313, + 1990, + 144959, + 1176, + 2900, + 141445, + 3058, + 20916, + 20917, + 3178, + 3077, + 2505, + 2781, + 2831, + 2769, + 3068, + 3062, + 2933, + 8959, + 1271, + 1173, + 1596, + 3004, + 8941, + 1310, + 2794, + 2971, + 3136, + 2944, + 3084, + 3268, + 3034, + 1115, + 10906, + 1171, + 2800, 1151, - 1038, - 1155, - 1446, - 22470, - 16161, - 1230, - 1380, - 4546, - 1143, - 3778, - 22481, - 2062, - 2112, - 2218, - 2201, - 1235, - 2203, - 1015, - 377, - 1153, - 3970, + 3232, + 1132, + 138811, + 2798, + 3059, + 3260, + 2923, + 3079, + 381, + 1139, + 3046, + 138923, + 2960, + 1167, + 138968, + 3226, + 2888, + 3074, + 2977, + 24865, + 990, + 2949, + 3075, + 135946, + 3054, + 1161, + 3129, + 2828, + 2079, + 89061, + 2788, + 1156, + 12458, + 21209, + 1127, + 2805, + 2868, + 2789, + 2080, + 2988, + 21141, + 1178, + 2931, + 2508, + 1123, + 1142, + 1429, + 988, + 1130, + 8757, + 158298, + 997, + 1904, + 1183, + 138894, + 138796, + 138788, + 138767, + 138752, + 138731, + 138901, + 996, + 138745, + 138774, + 1996, + 3274, + 138724, + 1126, + 3528, + 2782, + 20932, + 1116, + 151310, + 158311, + 1914, + 3053, + 2012, + 1186, + 2020, + 1997, + 20919, + 2001, 2, 3, 4, @@ -766,17 +805,18 @@ Get a specific field:: 16, 17, 18, - 21, + 19, + 20, 22, 23, 24, + 25, 26, - 27, 28, 29, 30, + 31, 32, - 33, 34, 35, 36, @@ -786,7 +826,8 @@ Get a specific field:: 40, 41, 42, - 90, + 43, + 44, 91, 92, 93, @@ -795,146 +836,114 @@ Get a specific field:: 96, 97, 98, + 99, 102, - 103, + 104, 105, - 106, - 108, - 110, - 119, - 122, - 137, - 188, - 189, - 191, - 192, - 193, - 194, - 195, - 196, + 107, + 109, + 111, + 116, + 117, + 118, + 128, + 132, + 138, + 160, + 187, + 190, 197, + 198, + 199, + 200, + 201, 202, 203, 204, + 206, 207, - 208, - 238, - 280, - 286, - 289, - 291, - 307, - 363, - 368, - 388, - 396, - 398, - 399, - 400, - 401, - 469, - 495, - 520, - 636, - 766, - 767, - 768, - 769, - 771, - 772, - 773, - 774, - 775, - 776, - 785, - 786, - 881, - 910, - 912, - 913, - 915, - 917, - 922, - 929, - 933, - 935, - 938, - 942, - 945, - 951, - 954, - 956, - 957, - 965, - 969, - 973, - 976, - 978, - 1384, - 1458, - 1459, - 1461, - 1462, - 1464, - 1465, - 1466, - 1467, - 2257, - 2279, - 3847, - 6489, - 6712, - 7008, - 7325, - 7549, - 7739, - 7999, - 9904, - 13281, - 13643, - 13855, - 14128, - 16158, - 16256, - 16973, - 19932, - 20344, - 20572, - 20724, - 21047, - 22267]} + 211, + 212, + 233, + 281, + 282, + 349, + 350, + 369, + 542, + 549, + 569, + 605, + 606, + 607, + 724, + 725, + 726, + 727, + 729, + 730, + 731, + 732, + 733, + 734, + 741, + 742, + 2039, + 2048, + 2049, + 2065, + 2066, + 2067, + 2068, + 2069, + 2070, + 2071, + 2072, + 2822, + 141198, + 149597, + 154332, + 154499, + 154968, + 155349, + 155497, + 155661, + 155809, + 156504, + 156805, + 156862, + 156948, + 156974, + 156975, + 156987, + 157273, + 157774]} Get a specific item when field matchs the given value:: - # curl http://localhost:61208/api/3/processlist/pid/9872 - {'9872': [{'cmdline': ['/usr/lib/virtualbox/VBoxHeadless', - '--comment', - 'minikube', - '--startvm', - '74869efd-ada3-41eb-98e3-b7d2901c8e39', - '--vrde', - 'config'], - 'cpu_percent': 0.0, - 'cpu_times': [128.45, 1415.02, 0.0, 0.0, 0.0], - 'gids': [1000, 1000, 1000], - 'io_counters': [0, 0, 0, 0, 0], - 'key': 'pid', - 'memory_info': [963088384, - 4204658688, - 924651520, - 53248, - 0, - 98004992, - 0], - 'memory_percent': 12.270203417072839, - 'name': 'VBoxHeadless', - 'nice': 0, - 'num_threads': 28, - 'pid': 9872, - 'ppid': 9690, - 'status': 'S', - 'time_since_update': 1, - 'username': 'nicolargo'}]} + # curl http://localhost:61208/api/3/processlist/pid/10259 + {"10259": [{"cmdline": ["/snap/firefox/1300/usr/lib/firefox/firefox"], + "cpu_percent": 0.0, + "cpu_times": [2407.22, 913.36, 2160.45, 460.56, 0.0], + "gids": [1000, 1000, 1000], + "io_counters": [1388816384, 3879223296, 0, 0, 0], + "key": "pid", + "memory_info": [517357568, + 13510344704, + 131108864, + 643072, + 0, + 1639305216, + 0], + "memory_percent": 6.600678002948429, + "name": "firefox", + "nice": 0, + "num_threads": 123, + "pid": 10259, + "ppid": 2922, + "status": "S", + "time_since_update": 1, + "username": "nicolargo"}]} GET psutilversion ----------------- @@ -950,69 +959,69 @@ GET quicklook Get plugin stats:: # curl http://localhost:61208/api/3/quicklook - {'cpu': 38.8, - 'cpu_hz': 3000000000.0, - 'cpu_hz_current': 2543000.0, - 'cpu_name': 'Intel(R) Core(TM) i7-4500U CPU @ 1.80GHz', - 'mem': 87.3, - 'percpu': [{'cpu_number': 0, - 'guest': 0.0, - 'guest_nice': 0.0, - 'idle': 78.0, - 'iowait': 0.0, - 'irq': 0.0, - 'key': 'cpu_number', - 'nice': 1.0, - 'softirq': 0.0, - 'steal': 0.0, - 'system': 9.0, - 'total': 22.0, - 'user': 9.0}, - {'cpu_number': 1, - 'guest': 0.0, - 'guest_nice': 0.0, - 'idle': 55.0, - 'iowait': 0.0, - 'irq': 0.0, - 'key': 'cpu_number', - 'nice': 1.0, - 'softirq': 2.0, - 'steal': 0.0, - 'system': 7.0, - 'total': 45.0, - 'user': 32.0}, - {'cpu_number': 2, - 'guest': 0.0, - 'guest_nice': 0.0, - 'idle': 78.0, - 'iowait': 1.0, - 'irq': 0.0, - 'key': 'cpu_number', - 'nice': 0.0, - 'softirq': 0.0, - 'steal': 0.0, - 'system': 9.0, - 'total': 22.0, - 'user': 10.0}, - {'cpu_number': 3, - 'guest': 0.0, - 'guest_nice': 0.0, - 'idle': 27.0, - 'iowait': 1.0, - 'irq': 0.0, - 'key': 'cpu_number', - 'nice': 0.0, - 'softirq': 1.0, - 'steal': 0.0, - 'system': 3.0, - 'total': 73.0, - 'user': 66.0}], - 'swap': 3.9} + {"cpu": 64.3, + "cpu_hz": 3000000000.0, + "cpu_hz_current": 2432750.0, + "cpu_name": "Intel(R) Core(TM) i7-4500U CPU @ 1.80GHz", + "mem": 64.9, + "percpu": [{"cpu_number": 0, + "guest": 0.0, + "guest_nice": 0.0, + "idle": 36.6, + "iowait": 0.0, + "irq": 0.0, + "key": "cpu_number", + "nice": 0.0, + "softirq": 0.0, + "steal": 0.0, + "system": 6.9, + "total": 63.4, + "user": 56.4}, + {"cpu_number": 1, + "guest": 0.0, + "guest_nice": 0.0, + "idle": 34.0, + "iowait": 0.0, + "irq": 0.0, + "key": "cpu_number", + "nice": 0.0, + "softirq": 0.0, + "steal": 0.0, + "system": 3.0, + "total": 66.0, + "user": 62.0}, + {"cpu_number": 2, + "guest": 0.0, + "guest_nice": 0.0, + "idle": 34.0, + "iowait": 1.0, + "irq": 0.0, + "key": "cpu_number", + "nice": 0.0, + "softirq": 0.0, + "steal": 0.0, + "system": 5.0, + "total": 66.0, + "user": 60.0}, + {"cpu_number": 3, + "guest": 0.0, + "guest_nice": 0.0, + "idle": 35.6, + "iowait": 0.0, + "irq": 0.0, + "key": "cpu_number", + "nice": 0.0, + "softirq": 0.0, + "steal": 0.0, + "system": 6.9, + "total": 64.4, + "user": 57.4}], + "swap": 12.4} Get a specific field:: # curl http://localhost:61208/api/3/quicklook/cpu - {'cpu': 38.8} + {"cpu": 64.3} GET sensors ----------- @@ -1020,44 +1029,44 @@ GET sensors Get plugin stats:: # curl http://localhost:61208/api/3/sensors - [{'critical': 105, - 'key': 'label', - 'label': 'acpitz 1', - 'type': 'temperature_core', - 'unit': 'C', - 'value': 27, - 'warning': 105}, - {'critical': 105, - 'key': 'label', - 'label': 'acpitz 2', - 'type': 'temperature_core', - 'unit': 'C', - 'value': 29, - 'warning': 105}] + [{"critical": 105, + "key": "label", + "label": "acpitz 1", + "type": "temperature_core", + "unit": "C", + "value": 27, + "warning": 105}, + {"critical": 105, + "key": "label", + "label": "acpitz 2", + "type": "temperature_core", + "unit": "C", + "value": 29, + "warning": 105}] Get a specific field:: # curl http://localhost:61208/api/3/sensors/label - {'label': ['acpitz 1', - 'acpitz 2', - 'CPU', - 'Ambient', - 'SODIMM', - 'Package id 0', - 'Core 0', - 'Core 1', - 'BAT BAT0']} + {"label": ["acpitz 1", + "acpitz 2", + "CPU", + "Ambient", + "SODIMM", + "Package id 0", + "Core 0", + "Core 1", + "BAT BAT0"]} Get a specific item when field matchs the given value:: # curl http://localhost:61208/api/3/sensors/label/acpitz 1 - {'acpitz 1': [{'critical': 105, - 'key': 'label', - 'label': 'acpitz 1', - 'type': 'temperature_core', - 'unit': 'C', - 'value': 27, - 'warning': 105}]} + {"acpitz 1": [{"critical": 105, + "key": "label", + "label": "acpitz 1", + "type": "temperature_core", + "unit": "C", + "value": 27, + "warning": 105}]} GET system ---------- @@ -1065,17 +1074,17 @@ GET system Get plugin stats:: # curl http://localhost:61208/api/3/system - {'hostname': 'XPS13-9333', - 'hr_name': 'Ubuntu 20.04 64bit', - 'linux_distro': 'Ubuntu 20.04', - 'os_name': 'Linux', - 'os_version': '5.4.0-91-generic', - 'platform': '64bit'} + {"hostname": "XPS13-9333", + "hr_name": "Ubuntu 22.04 64bit", + "linux_distro": "Ubuntu 22.04", + "os_name": "Linux", + "os_version": "5.15.0-27-generic", + "platform": "64bit"} Get a specific field:: # curl http://localhost:61208/api/3/system/os_name - {'os_name': 'Linux'} + {"os_name": "Linux"} GET uptime ---------- @@ -1083,7 +1092,7 @@ GET uptime Get plugin stats:: # curl http://localhost:61208/api/3/uptime - {'seconds': 199257} + {"seconds": 1213260} GET all stats ------------- @@ -1099,33 +1108,33 @@ GET stats history History of a plugin:: # curl http://localhost:61208/api/3/cpu/history - {'system': [['2022-04-10T16:13:53.155669', 10.1], - ['2022-04-10T16:13:54.194594', 10.1], - ['2022-04-10T16:13:55.280474', 10.9]], - 'user': [['2022-04-10T16:13:53.155662', 28.5], - ['2022-04-10T16:13:54.194590', 28.5], - ['2022-04-10T16:13:55.280470', 4.2]]} + {"system": [["2022-05-22T16:21:45.713614", 5.5], + ["2022-05-22T16:21:46.840520", 5.5], + ["2022-05-22T16:21:47.932966", 4.3]], + "user": [["2022-05-22T16:21:45.713602", 62.4], + ["2022-05-22T16:21:46.840511", 62.4], + ["2022-05-22T16:21:47.932962", 66.0]]} Limit history to last 2 values:: # curl http://localhost:61208/api/3/cpu/history/2 - {'system': [['2022-04-10T16:13:54.194594', 10.1], - ['2022-04-10T16:13:55.280474', 10.9]], - 'user': [['2022-04-10T16:13:54.194590', 28.5], - ['2022-04-10T16:13:55.280470', 4.2]]} + {"system": [["2022-05-22T16:21:46.840520", 5.5], + ["2022-05-22T16:21:47.932966", 4.3]], + "user": [["2022-05-22T16:21:46.840511", 62.4], + ["2022-05-22T16:21:47.932962", 66.0]]} History for a specific field:: # curl http://localhost:61208/api/3/cpu/system/history - {'system': [['2022-04-10T16:13:53.155669', 10.1], - ['2022-04-10T16:13:54.194594', 10.1], - ['2022-04-10T16:13:55.280474', 10.9]]} + {"system": [["2022-05-22T16:21:45.713614", 5.5], + ["2022-05-22T16:21:46.840520", 5.5], + ["2022-05-22T16:21:47.932966", 4.3]]} Limit history for a specific field to last 2 values:: # curl http://localhost:61208/api/3/cpu/system/history - {'system': [['2022-04-10T16:13:54.194594', 10.1], - ['2022-04-10T16:13:55.280474', 10.9]]} + {"system": [["2022-05-22T16:21:46.840520", 5.5], + ["2022-05-22T16:21:47.932966", 4.3]]} GET limits (used for thresholds) -------------------------------- @@ -1133,213 +1142,213 @@ GET limits (used for thresholds) All limits/thresholds:: # curl http://localhost:61208/api/3/all/limits - {'alert': {'history_size': 3600.0}, - 'amps': {'amps_disable': ['False'], 'history_size': 3600.0}, - 'cloud': {'history_size': 3600.0}, - 'connections': {'connections_disable': ['True'], - 'connections_nf_conntrack_percent_careful': 70.0, - 'connections_nf_conntrack_percent_critical': 90.0, - 'connections_nf_conntrack_percent_warning': 80.0, - 'history_size': 3600.0}, - 'core': {'history_size': 3600.0}, - 'cpu': {'cpu_ctx_switches_careful': 160000.0, - 'cpu_ctx_switches_critical': 200000.0, - 'cpu_ctx_switches_warning': 180000.0, - 'cpu_disable': ['False'], - 'cpu_iowait_careful': 20.0, - 'cpu_iowait_critical': 25.0, - 'cpu_iowait_warning': 22.5, - 'cpu_steal_careful': 50.0, - 'cpu_steal_critical': 90.0, - 'cpu_steal_warning': 70.0, - 'cpu_system_careful': 50.0, - 'cpu_system_critical': 90.0, - 'cpu_system_log': ['False'], - 'cpu_system_warning': 70.0, - 'cpu_total_careful': 65.0, - 'cpu_total_critical': 85.0, - 'cpu_total_log': ['True'], - 'cpu_total_warning': 75.0, - 'cpu_user_careful': 50.0, - 'cpu_user_critical': 90.0, - 'cpu_user_log': ['False'], - 'cpu_user_warning': 70.0, - 'history_size': 3600.0}, - 'diskio': {'diskio_disable': ['False'], - 'diskio_hide': ['loop.*', '/dev/loop*'], - 'history_size': 3600.0}, - 'docker': {'docker_all': ['False'], - 'docker_disable': ['False'], - 'docker_max_name_size': 20.0, - 'history_size': 3600.0}, - 'folders': {'folders_disable': ['False'], 'history_size': 3600.0}, - 'fs': {'fs_careful': 50.0, - 'fs_critical': 90.0, - 'fs_disable': ['False'], - 'fs_hide': ['/boot.*', '/snap.*'], - 'fs_warning': 70.0, - 'history_size': 3600.0}, - 'gpu': {'gpu_disable': ['False'], - 'gpu_mem_careful': 50.0, - 'gpu_mem_critical': 90.0, - 'gpu_mem_warning': 70.0, - 'gpu_proc_careful': 50.0, - 'gpu_proc_critical': 90.0, - 'gpu_proc_warning': 70.0, - 'history_size': 3600.0}, - 'help': {'history_size': 3600.0}, - 'ip': {'history_size': 3600.0, 'ip_disable': ['False']}, - 'irq': {'history_size': 3600.0, 'irq_disable': ['True']}, - 'load': {'history_size': 3600.0, - 'load_careful': 0.7, - 'load_critical': 5.0, - 'load_disable': ['False'], - 'load_warning': 1.0}, - 'mem': {'history_size': 3600.0, - 'mem_careful': 50.0, - 'mem_critical': 90.0, - 'mem_disable': ['False'], - 'mem_warning': 70.0}, - 'memswap': {'history_size': 3600.0, - 'memswap_careful': 50.0, - 'memswap_critical': 90.0, - 'memswap_disable': ['False'], - 'memswap_warning': 70.0}, - 'network': {'history_size': 3600.0, - 'network_disable': ['False'], - 'network_rx_careful': 70.0, - 'network_rx_critical': 90.0, - 'network_rx_warning': 80.0, - 'network_tx_careful': 70.0, - 'network_tx_critical': 90.0, - 'network_tx_warning': 80.0}, - 'now': {'history_size': 3600.0}, - 'percpu': {'history_size': 3600.0, - 'percpu_disable': ['False'], - 'percpu_iowait_careful': 50.0, - 'percpu_iowait_critical': 90.0, - 'percpu_iowait_warning': 70.0, - 'percpu_system_careful': 50.0, - 'percpu_system_critical': 90.0, - 'percpu_system_warning': 70.0, - 'percpu_user_careful': 50.0, - 'percpu_user_critical': 90.0, - 'percpu_user_warning': 70.0}, - 'ports': {'history_size': 3600.0, - 'ports_disable': ['False'], - 'ports_port_default_gateway': ['True'], - 'ports_refresh': 30.0, - 'ports_timeout': 3.0}, - 'processcount': {'history_size': 3600.0, 'processcount_disable': ['False']}, - 'processlist': {'history_size': 3600.0, - 'processlist_cpu_careful': 50.0, - 'processlist_cpu_critical': 90.0, - 'processlist_cpu_warning': 70.0, - 'processlist_disable': ['False'], - 'processlist_mem_careful': 50.0, - 'processlist_mem_critical': 90.0, - 'processlist_mem_warning': 70.0, - 'processlist_nice_warning': ['-20', - '-19', - '-18', - '-17', - '-16', - '-15', - '-14', - '-13', - '-12', - '-11', - '-10', - '-9', - '-8', - '-7', - '-6', - '-5', - '-4', - '-3', - '-2', - '-1', - '1', - '2', - '3', - '4', - '5', - '6', - '7', - '8', - '9', - '10', - '11', - '12', - '13', - '14', - '15', - '16', - '17', - '18', - '19']}, - 'psutilversion': {'history_size': 3600.0}, - 'quicklook': {'history_size': 3600.0, - 'quicklook_cpu_careful': 50.0, - 'quicklook_cpu_critical': 90.0, - 'quicklook_cpu_warning': 70.0, - 'quicklook_disable': ['False'], - 'quicklook_mem_careful': 50.0, - 'quicklook_mem_critical': 90.0, - 'quicklook_mem_warning': 70.0, - 'quicklook_percentage_char': ['|'], - 'quicklook_swap_careful': 50.0, - 'quicklook_swap_critical': 90.0, - 'quicklook_swap_warning': 70.0}, - 'raid': {'history_size': 3600.0, 'raid_disable': ['True']}, - 'sensors': {'history_size': 3600.0, - 'sensors_battery_careful': 80.0, - 'sensors_battery_critical': 95.0, - 'sensors_battery_warning': 90.0, - 'sensors_disable': ['False'], - 'sensors_refresh': 4.0, - 'sensors_temperature_core_careful': 60.0, - 'sensors_temperature_core_critical': 80.0, - 'sensors_temperature_core_warning': 70.0, - 'sensors_temperature_hdd_careful': 45.0, - 'sensors_temperature_hdd_critical': 60.0, - 'sensors_temperature_hdd_warning': 52.0}, - 'smart': {'history_size': 3600.0, 'smart_disable': ['True']}, - 'system': {'history_size': 3600.0, - 'system_disable': ['False'], - 'system_refresh': 60}, - 'uptime': {'history_size': 3600.0}, - 'wifi': {'history_size': 3600.0, - 'wifi_careful': -65.0, - 'wifi_critical': -85.0, - 'wifi_disable': ['True'], - 'wifi_hide': ['lo', 'docker.*'], - 'wifi_warning': -75.0}} + {"alert": {"history_size": 3600.0}, + "amps": {"amps_disable": ["False"], "history_size": 3600.0}, + "cloud": {"history_size": 3600.0}, + "connections": {"connections_disable": ["True"], + "connections_nf_conntrack_percent_careful": 70.0, + "connections_nf_conntrack_percent_critical": 90.0, + "connections_nf_conntrack_percent_warning": 80.0, + "history_size": 3600.0}, + "core": {"history_size": 3600.0}, + "cpu": {"cpu_ctx_switches_careful": 160000.0, + "cpu_ctx_switches_critical": 200000.0, + "cpu_ctx_switches_warning": 180000.0, + "cpu_disable": ["False"], + "cpu_iowait_careful": 20.0, + "cpu_iowait_critical": 25.0, + "cpu_iowait_warning": 22.5, + "cpu_steal_careful": 50.0, + "cpu_steal_critical": 90.0, + "cpu_steal_warning": 70.0, + "cpu_system_careful": 50.0, + "cpu_system_critical": 90.0, + "cpu_system_log": ["False"], + "cpu_system_warning": 70.0, + "cpu_total_careful": 65.0, + "cpu_total_critical": 85.0, + "cpu_total_log": ["True"], + "cpu_total_warning": 75.0, + "cpu_user_careful": 50.0, + "cpu_user_critical": 90.0, + "cpu_user_log": ["False"], + "cpu_user_warning": 70.0, + "history_size": 3600.0}, + "diskio": {"diskio_disable": ["False"], + "diskio_hide": ["loop.*", "/dev/loop*"], + "history_size": 3600.0}, + "docker": {"docker_all": ["False"], + "docker_disable": ["False"], + "docker_max_name_size": 20.0, + "history_size": 3600.0}, + "folders": {"folders_disable": ["False"], "history_size": 3600.0}, + "fs": {"fs_careful": 50.0, + "fs_critical": 90.0, + "fs_disable": ["False"], + "fs_hide": ["/boot.*", "/snap.*"], + "fs_warning": 70.0, + "history_size": 3600.0}, + "gpu": {"gpu_disable": ["False"], + "gpu_mem_careful": 50.0, + "gpu_mem_critical": 90.0, + "gpu_mem_warning": 70.0, + "gpu_proc_careful": 50.0, + "gpu_proc_critical": 90.0, + "gpu_proc_warning": 70.0, + "history_size": 3600.0}, + "help": {"history_size": 3600.0}, + "ip": {"history_size": 3600.0, "ip_disable": ["False"]}, + "irq": {"history_size": 3600.0, "irq_disable": ["True"]}, + "load": {"history_size": 3600.0, + "load_careful": 0.7, + "load_critical": 5.0, + "load_disable": ["False"], + "load_warning": 1.0}, + "mem": {"history_size": 3600.0, + "mem_careful": 50.0, + "mem_critical": 90.0, + "mem_disable": ["False"], + "mem_warning": 70.0}, + "memswap": {"history_size": 3600.0, + "memswap_careful": 50.0, + "memswap_critical": 90.0, + "memswap_disable": ["False"], + "memswap_warning": 70.0}, + "network": {"history_size": 3600.0, + "network_disable": ["False"], + "network_rx_careful": 70.0, + "network_rx_critical": 90.0, + "network_rx_warning": 80.0, + "network_tx_careful": 70.0, + "network_tx_critical": 90.0, + "network_tx_warning": 80.0}, + "now": {"history_size": 3600.0}, + "percpu": {"history_size": 3600.0, + "percpu_disable": ["False"], + "percpu_iowait_careful": 50.0, + "percpu_iowait_critical": 90.0, + "percpu_iowait_warning": 70.0, + "percpu_system_careful": 50.0, + "percpu_system_critical": 90.0, + "percpu_system_warning": 70.0, + "percpu_user_careful": 50.0, + "percpu_user_critical": 90.0, + "percpu_user_warning": 70.0}, + "ports": {"history_size": 3600.0, + "ports_disable": ["False"], + "ports_port_default_gateway": ["True"], + "ports_refresh": 30.0, + "ports_timeout": 3.0}, + "processcount": {"history_size": 3600.0, "processcount_disable": ["False"]}, + "processlist": {"history_size": 3600.0, + "processlist_cpu_careful": 50.0, + "processlist_cpu_critical": 90.0, + "processlist_cpu_warning": 70.0, + "processlist_disable": ["False"], + "processlist_mem_careful": 50.0, + "processlist_mem_critical": 90.0, + "processlist_mem_warning": 70.0, + "processlist_nice_warning": ["-20", + "-19", + "-18", + "-17", + "-16", + "-15", + "-14", + "-13", + "-12", + "-11", + "-10", + "-9", + "-8", + "-7", + "-6", + "-5", + "-4", + "-3", + "-2", + "-1", + "1", + "2", + "3", + "4", + "5", + "6", + "7", + "8", + "9", + "10", + "11", + "12", + "13", + "14", + "15", + "16", + "17", + "18", + "19"]}, + "psutilversion": {"history_size": 3600.0}, + "quicklook": {"history_size": 3600.0, + "quicklook_cpu_careful": 50.0, + "quicklook_cpu_critical": 90.0, + "quicklook_cpu_warning": 70.0, + "quicklook_disable": ["False"], + "quicklook_mem_careful": 50.0, + "quicklook_mem_critical": 90.0, + "quicklook_mem_warning": 70.0, + "quicklook_percentage_char": ["|"], + "quicklook_swap_careful": 50.0, + "quicklook_swap_critical": 90.0, + "quicklook_swap_warning": 70.0}, + "raid": {"history_size": 3600.0, "raid_disable": ["True"]}, + "sensors": {"history_size": 3600.0, + "sensors_battery_careful": 80.0, + "sensors_battery_critical": 95.0, + "sensors_battery_warning": 90.0, + "sensors_disable": ["False"], + "sensors_refresh": 4.0, + "sensors_temperature_core_careful": 60.0, + "sensors_temperature_core_critical": 80.0, + "sensors_temperature_core_warning": 70.0, + "sensors_temperature_hdd_careful": 45.0, + "sensors_temperature_hdd_critical": 60.0, + "sensors_temperature_hdd_warning": 52.0}, + "smart": {"history_size": 3600.0, "smart_disable": ["True"]}, + "system": {"history_size": 3600.0, + "system_disable": ["False"], + "system_refresh": 60}, + "uptime": {"history_size": 3600.0}, + "wifi": {"history_size": 3600.0, + "wifi_careful": -65.0, + "wifi_critical": -85.0, + "wifi_disable": ["True"], + "wifi_hide": ["lo", "docker.*"], + "wifi_warning": -75.0}} Limits/thresholds for the cpu plugin:: # curl http://localhost:61208/api/3/cpu/limits - {'cpu_ctx_switches_careful': 160000.0, - 'cpu_ctx_switches_critical': 200000.0, - 'cpu_ctx_switches_warning': 180000.0, - 'cpu_disable': ['False'], - 'cpu_iowait_careful': 20.0, - 'cpu_iowait_critical': 25.0, - 'cpu_iowait_warning': 22.5, - 'cpu_steal_careful': 50.0, - 'cpu_steal_critical': 90.0, - 'cpu_steal_warning': 70.0, - 'cpu_system_careful': 50.0, - 'cpu_system_critical': 90.0, - 'cpu_system_log': ['False'], - 'cpu_system_warning': 70.0, - 'cpu_total_careful': 65.0, - 'cpu_total_critical': 85.0, - 'cpu_total_log': ['True'], - 'cpu_total_warning': 75.0, - 'cpu_user_careful': 50.0, - 'cpu_user_critical': 90.0, - 'cpu_user_log': ['False'], - 'cpu_user_warning': 70.0, - 'history_size': 3600.0} + {"cpu_ctx_switches_careful": 160000.0, + "cpu_ctx_switches_critical": 200000.0, + "cpu_ctx_switches_warning": 180000.0, + "cpu_disable": ["False"], + "cpu_iowait_careful": 20.0, + "cpu_iowait_critical": 25.0, + "cpu_iowait_warning": 22.5, + "cpu_steal_careful": 50.0, + "cpu_steal_critical": 90.0, + "cpu_steal_warning": 70.0, + "cpu_system_careful": 50.0, + "cpu_system_critical": 90.0, + "cpu_system_log": ["False"], + "cpu_system_warning": 70.0, + "cpu_total_careful": 65.0, + "cpu_total_critical": 85.0, + "cpu_total_log": ["True"], + "cpu_total_warning": 75.0, + "cpu_user_careful": 50.0, + "cpu_user_critical": 90.0, + "cpu_user_log": ["False"], + "cpu_user_warning": 70.0, + "history_size": 3600.0} diff --git a/docs/man/glances.1 b/docs/man/glances.1 index 45a41aff..e0a516d0 100644 --- a/docs/man/glances.1 +++ b/docs/man/glances.1 @@ -1,8 +1,5 @@ .\" Man page generated from reStructuredText. . -.TH "GLANCES" "1" "Apr 10, 2022" "3.2.5" "Glances" -.SH NAME -glances \- An eye on your system . .nr rst2man-indent-level 0 . @@ -30,6 +27,9 @@ level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] .\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] .in \\n[rst2man-indent\\n[rst2man-indent-level]]u .. +.TH "GLANCES" "1" "May 22, 2022" "3.2.6_beta01" "Glances" +.SH NAME +glances \- An eye on your system .SH SYNOPSIS .sp \fBglances\fP [OPTIONS] diff --git a/glances/plugins/glances_diskio.py b/glances/plugins/glances_diskio.py index fe349b0e..4fff8a51 100644 --- a/glances/plugins/glances_diskio.py +++ b/glances/plugins/glances_diskio.py @@ -98,8 +98,9 @@ class Plugin(GlancesPlugin): if self.args is not None and not self.args.diskio_show_ramfs and disk.startswith('ram'): continue - # Do not take hide disk into account - if self.is_hide(disk): + # Shall we display the stats ? + logger.info("diskio: %s => %s", disk, self.is_display(disk)) + if not self.is_display(disk): continue # Compute count and bit rate diff --git a/glances/plugins/glances_docker.py b/glances/plugins/glances_docker.py index cab23065..44c1691f 100644 --- a/glances/plugins/glances_docker.py +++ b/glances/plugins/glances_docker.py @@ -236,12 +236,8 @@ class Plugin(GlancesPlugin): # Get stats for all containers stats['containers'] = [] for container in containers: - # Only show specific containers - if not self.is_show(nativestr(container.name)): - continue - - # Do not take hidden container into account - if self.is_hide(nativestr(container.name)): + # Should we display the container stats ? + if not self.is_display(nativestr(container.name)): continue # Init the stats for the current container diff --git a/glances/plugins/glances_fs.py b/glances/plugins/glances_fs.py index 1b08e5d6..4872ce19 100644 --- a/glances/plugins/glances_fs.py +++ b/glances/plugins/glances_fs.py @@ -116,10 +116,10 @@ class Plugin(GlancesPlugin): # Loop over fs for fs in fs_stat: - # Do not take hidden file system into account - # Also check device name (see issue #1606) - if self.is_hide(fs.mountpoint) or self.is_hide(fs.device): + # Shall we display the stats ? + if not self.is_display(fs.mountpoint): continue + # Grab the disk usage try: fs_usage = psutil.disk_usage(fs.mountpoint) diff --git a/glances/plugins/glances_network.py b/glances/plugins/glances_network.py index eab3ac23..f870aef4 100644 --- a/glances/plugins/glances_network.py +++ b/glances/plugins/glances_network.py @@ -156,7 +156,7 @@ class Plugin(GlancesPlugin): for net in network_new: # Do not take hidden interface into account # or KeyError: 'eth0' when interface is not connected #1348 - if self.is_hide(net) or net not in net_status: + if not self.is_display(net) or net not in net_status: continue try: cumulative_rx = network_new[net].bytes_recv @@ -217,7 +217,7 @@ class Plugin(GlancesPlugin): for net in network_new: # Do not take hidden interface into account - if self.is_hide(net): + if not self.is_display(net): continue try: diff --git a/glances/plugins/glances_plugin.py b/glances/plugins/glances_plugin.py index 4bce83ed..8dfb53e3 100644 --- a/glances/plugins/glances_plugin.py +++ b/glances/plugins/glances_plugin.py @@ -883,10 +883,7 @@ class GlancesPlugin(object): show=sda.* """ # @TODO: possible optimisation: create a re.compile list - if self.get_conf_value('show', header=header) == []: - return True - else: - return any(j for j in [re.match(i, value) for i in self.get_conf_value('show', header=header)]) + return any(j for j in [re.match(i, value) for i in self.get_conf_value('show', header=header)]) def is_hide(self, value, header=""): """Return True if the value is in the hide configuration list. @@ -899,6 +896,14 @@ class GlancesPlugin(object): # @TODO: possible optimisation: create a re.compile list return any(j for j in [re.match(i, value) for i in self.get_conf_value('hide', header=header)]) + def is_display(self, value, header=""): + """Return True if the value should be displayed in the UI + """ + if self.get_conf_value('show', header=header) != []: + return self.is_show(value, header=header) + else: + return not self.is_hide(value, header=header) + def has_alias(self, header): """Return the alias name for the relative header it it exists otherwise None.""" try: diff --git a/glances/plugins/glances_sensors.py b/glances/plugins/glances_sensors.py index 65bf0c28..4e698485 100644 --- a/glances/plugins/glances_sensors.py +++ b/glances/plugins/glances_sensors.py @@ -131,7 +131,7 @@ class Plugin(GlancesPlugin): self.stats = self.get_init_value() for stat in stats: # Do not take hide stat into account - if self.is_hide(stat["label"].lower()): + if not self.is_display(stat["label"].lower()): continue # Set the alias for each stat alias = self.has_alias(stat["label"].lower()) diff --git a/glances/plugins/glances_wifi.py b/glances/plugins/glances_wifi.py index fb3fd7e3..54955b9a 100644 --- a/glances/plugins/glances_wifi.py +++ b/glances/plugins/glances_wifi.py @@ -91,7 +91,7 @@ class Plugin(GlancesPlugin): for net in net_io_counters: # Do not take hidden interface into account - if self.is_hide(net): + if not self.is_display(net): continue # Grab the stats using the Wifi Python lib