Merge branch 'issue2695' into develop

This commit is contained in:
nicolargo 2024-03-09 16:37:39 +01:00
commit d1a7f61cce
7 changed files with 242 additions and 203 deletions

View File

@ -71,6 +71,9 @@ load_critical=500
disable=False disable=False
# Default refresh rate is 60 seconds # Default refresh rate is 60 seconds
#refresh=60 #refresh=60
# System information to display (a string where {key} will be replaced by the value)
# Available information are: hostname, os_name, os_version, os_arch, linux_distro, platform
#system_info_msg=({linux_distro} {platform} / {os_name} {os_version})
[cpu] [cpu]
disable=False disable=False

View File

@ -71,6 +71,9 @@ load_critical=500
disable=False disable=False
# Default refresh rate is 60 seconds # Default refresh rate is 60 seconds
#refresh=60 #refresh=60
# System information to display (a string where {key} will be replaced by the value)
# Available information are: hostname, os_name, os_version, os_arch, linux_distro, platform
#system_info_msg=({linux_distro} {platform} / {os_name} {os_version})
[cpu] [cpu]
disable=False disable=False

View File

@ -11,6 +11,16 @@ Additionally, on GNU/Linux, it also shows the kernel version.
In client mode, the server connection status is also displayed. In client mode, the server connection status is also displayed.
The system information message can be configured in the configuration file
(for the moment, it only work for the Curses interface):
.. code-block:: ini
[system]
system_info_msg=({linux_distro} {platform} / {os_name} {os_version})
**NOTE:** Available information are: hostname, os_name, os_version, os_arch,
linux_distro, platform (use mustache syntax).
It is possible to disable or define time interval to be used for refreshing the It is possible to disable or define time interval to be used for refreshing the
public IP address (default is 300 seconds) from the configuration public IP address (default is 300 seconds) from the configuration
file under the ``[ip]`` section: file under the ``[ip]`` section:

View File

@ -109,16 +109,16 @@ GET alert
Get plugin stats:: Get plugin stats::
# curl http://localhost:61208/api/4/alert # curl http://localhost:61208/api/4/alert
[{"avg": 70.51750423548678, [{"avg": 71.2451657049995,
"begin": 1707665810.0, "begin": 1709998558.0,
"count": 1, "count": 1,
"desc": "", "desc": "",
"end": -1, "end": -1,
"max": 70.51750423548678, "max": 71.2451657049995,
"min": 70.51750423548678, "min": 71.2451657049995,
"sort": "memory_percent", "sort": "memory_percent",
"state": "WARNING", "state": "WARNING",
"sum": 70.51750423548678, "sum": 71.2451657049995,
"top": [], "top": [],
"type": "MEM"}] "type": "MEM"}]
@ -140,21 +140,21 @@ Fields descriptions:
Get a specific field:: Get a specific field::
# curl http://localhost:61208/api/4/alert/begin # curl http://localhost:61208/api/4/alert/begin
{"begin": [1707665810.0]} {"begin": [1709998558.0]}
Get a specific item when field matches the given value:: Get a specific item when field matches the given value::
# curl http://localhost:61208/api/4/alert/begin/1707665810.0 # curl http://localhost:61208/api/4/alert/begin/1709998558.0
{"1707665810.0": [{"avg": 70.51750423548678, {"1709998558.0": [{"avg": 71.2451657049995,
"begin": 1707665810.0, "begin": 1709998558.0,
"count": 1, "count": 1,
"desc": "", "desc": "",
"end": -1, "end": -1,
"max": 70.51750423548678, "max": 71.2451657049995,
"min": 70.51750423548678, "min": 71.2451657049995,
"sort": "memory_percent", "sort": "memory_percent",
"state": "WARNING", "state": "WARNING",
"sum": 70.51750423548678, "sum": 71.2451657049995,
"top": [], "top": [],
"type": "MEM"}]} "type": "MEM"}]}
@ -172,7 +172,7 @@ Get plugin stats::
"refresh": 3.0, "refresh": 3.0,
"regex": True, "regex": True,
"result": None, "result": None,
"timer": 0.9168691635131836}, "timer": 1.0396952629089355},
{"count": 0, {"count": 0,
"countmax": 20.0, "countmax": 20.0,
"countmin": None, "countmin": None,
@ -181,7 +181,7 @@ Get plugin stats::
"refresh": 3.0, "refresh": 3.0,
"regex": True, "regex": True,
"result": None, "result": None,
"timer": 0.9165229797363281}] "timer": 1.0393435955047607}]
Fields descriptions: Fields descriptions:
@ -209,7 +209,7 @@ Get a specific item when field matches the given value::
"refresh": 3.0, "refresh": 3.0,
"regex": True, "regex": True,
"result": None, "result": None,
"timer": 0.9168691635131836}]} "timer": 1.0396952629089355}]}
GET cloud GET cloud
--------- ---------
@ -257,18 +257,18 @@ Get plugin stats::
"engine": "docker", "engine": "docker",
"id": "3abd51c615968482d9ccff5afc629f267f6dda113ed68b75b432615fae3b49fb", "id": "3abd51c615968482d9ccff5afc629f267f6dda113ed68b75b432615fae3b49fb",
"image": ["portainer/portainer-ce:2.9.3"], "image": ["portainer/portainer-ce:2.9.3"],
"io": {"cumulative_ior": 37814272, "cumulative_iow": 3383296}, "io": {"cumulative_ior": 163840, "cumulative_iow": 876544},
"key": "name", "key": "name",
"memory": {"cache": None, "memory": {"cache": None,
"limit": 7823572992, "limit": 7823568896,
"max_usage": None, "max_usage": None,
"rss": None, "rss": None,
"usage": 31096832}, "usage": 14024704},
"memory_usage": 31096832, "memory_usage": 14024704,
"name": "portainer", "name": "portainer",
"network": {"cumulative_rx": 397434, "cumulative_tx": 0}, "network": {"cumulative_rx": 1966554, "cumulative_tx": 0},
"status": "running", "status": "running",
"uptime": "an hour"}] "uptime": "5 days"}]
Fields descriptions: Fields descriptions:
@ -304,18 +304,18 @@ Get a specific item when field matches the given value::
"engine": "docker", "engine": "docker",
"id": "3abd51c615968482d9ccff5afc629f267f6dda113ed68b75b432615fae3b49fb", "id": "3abd51c615968482d9ccff5afc629f267f6dda113ed68b75b432615fae3b49fb",
"image": ["portainer/portainer-ce:2.9.3"], "image": ["portainer/portainer-ce:2.9.3"],
"io": {"cumulative_ior": 37814272, "cumulative_iow": 3383296}, "io": {"cumulative_ior": 163840, "cumulative_iow": 876544},
"key": "name", "key": "name",
"memory": {"cache": None, "memory": {"cache": None,
"limit": 7823572992, "limit": 7823568896,
"max_usage": None, "max_usage": None,
"rss": None, "rss": None,
"usage": 31096832}, "usage": 14024704},
"memory_usage": 31096832, "memory_usage": 14024704,
"name": "portainer", "name": "portainer",
"network": {"cumulative_rx": 397434, "cumulative_tx": 0}, "network": {"cumulative_rx": 1966554, "cumulative_tx": 0},
"status": "running", "status": "running",
"uptime": "an hour"}]} "uptime": "5 days"}]}
GET core GET core
-------- --------
@ -342,19 +342,19 @@ Get plugin stats::
# curl http://localhost:61208/api/4/cpu # curl http://localhost:61208/api/4/cpu
{"cpucore": 4, {"cpucore": 4,
"ctx_switches": 17299194, "ctx_switches": 138547782,
"guest": 0.0, "guest": 0.0,
"idle": 64.0, "idle": 69.9,
"interrupts": 9016401, "interrupts": 76119836,
"iowait": 0.4, "iowait": 2.2,
"irq": 0.0, "irq": 0.0,
"nice": 0.0, "nice": 0.0,
"soft_interrupts": 6148123, "soft_interrupts": 36747624,
"steal": 0.0, "steal": 0.0,
"syscalls": 0, "syscalls": 0,
"system": 5.5, "system": 6.0,
"total": 35.6, "total": 27.9,
"user": 29.9} "user": 21.7}
Fields descriptions: Fields descriptions:
@ -387,7 +387,7 @@ Fields descriptions:
Get a specific field:: Get a specific field::
# curl http://localhost:61208/api/4/cpu/total # curl http://localhost:61208/api/4/cpu/total
{"total": 35.6} {"total": 27.9}
GET diskio GET diskio
---------- ----------
@ -397,16 +397,16 @@ Get plugin stats::
# curl http://localhost:61208/api/4/diskio # curl http://localhost:61208/api/4/diskio
[{"disk_name": "sda", [{"disk_name": "sda",
"key": "disk_name", "key": "disk_name",
"read_bytes": 4754307584, "read_bytes": 39103943168,
"read_count": 182653, "read_count": 994940,
"write_bytes": 2751705088, "write_bytes": 43667841024,
"write_count": 89403}, "write_count": 583159},
{"disk_name": "sda1", {"disk_name": "sda1",
"key": "disk_name", "key": "disk_name",
"read_bytes": 3387392, "read_bytes": 9610240,
"read_count": 91, "read_count": 260,
"write_bytes": 0, "write_bytes": 0,
"write_count": 3}] "write_count": 18}]
Fields descriptions: Fields descriptions:
@ -435,10 +435,10 @@ Get a specific item when field matches the given value::
# curl http://localhost:61208/api/4/diskio/disk_name/sda # curl http://localhost:61208/api/4/diskio/disk_name/sda
{"sda": [{"disk_name": "sda", {"sda": [{"disk_name": "sda",
"key": "disk_name", "key": "disk_name",
"read_bytes": 4754307584, "read_bytes": 39103943168,
"read_count": 182653, "read_count": 994940,
"write_bytes": 2751705088, "write_bytes": 43667841024,
"write_count": 89403}]} "write_count": 583159}]}
GET folders GET folders
----------- -----------
@ -464,15 +464,14 @@ GET fs
Get plugin stats:: Get plugin stats::
# curl http://localhost:61208/api/4/fs # curl http://localhost:61208/api/4/fs
[{"alias": "Root", [{"device_name": "/dev/mapper/ubuntu--gnome--vg-root",
"device_name": "/dev/mapper/ubuntu--gnome--vg-root", "free": 38639939584,
"free": 11497181184,
"fs_type": "ext4", "fs_type": "ext4",
"key": "mnt_point", "key": "mnt_point",
"mnt_point": "/", "mnt_point": "/",
"percent": 95.0, "percent": 83.3,
"size": 243334156288, "size": 243334156288,
"used": 219449520128}, "used": 192306761728},
{"device_name": "zsfpool", {"device_name": "zsfpool",
"free": 31195136, "free": 31195136,
"fs_type": "zfs", "fs_type": "zfs",
@ -500,15 +499,14 @@ Get a specific field::
Get a specific item when field matches the given value:: Get a specific item when field matches the given value::
# curl http://localhost:61208/api/4/fs/mnt_point// # curl http://localhost:61208/api/4/fs/mnt_point//
{"/": [{"alias": "Root", {"/": [{"device_name": "/dev/mapper/ubuntu--gnome--vg-root",
"device_name": "/dev/mapper/ubuntu--gnome--vg-root", "free": 38639939584,
"free": 11497181184,
"fs_type": "ext4", "fs_type": "ext4",
"key": "mnt_point", "key": "mnt_point",
"mnt_point": "/", "mnt_point": "/",
"percent": 95.0, "percent": 83.3,
"size": 243334156288, "size": 243334156288,
"used": 219449520128}]} "used": 192306761728}]}
GET gpu GET gpu
------- -------
@ -582,9 +580,9 @@ Get plugin stats::
# curl http://localhost:61208/api/4/load # curl http://localhost:61208/api/4/load
{"cpucore": 4, {"cpucore": 4,
"min1": 1.64794921875, "min1": 2.92529296875,
"min15": 1.22802734375, "min15": 2.13330078125,
"min5": 0.76611328125} "min5": 2.388671875}
Fields descriptions: Fields descriptions:
@ -596,7 +594,7 @@ Fields descriptions:
Get a specific field:: Get a specific field::
# curl http://localhost:61208/api/4/load/min1 # curl http://localhost:61208/api/4/load/min1
{"min1": 1.64794921875} {"min1": 2.92529296875}
GET mem GET mem
------- -------
@ -604,16 +602,16 @@ GET mem
Get plugin stats:: Get plugin stats::
# curl http://localhost:61208/api/4/mem # curl http://localhost:61208/api/4/mem
{"active": 1361960960, {"active": 2749255680,
"available": 2306584576, "available": 2249654272,
"buffers": 197697536, "buffers": 205594624,
"cached": 2881425408, "cached": 2819403776,
"free": 2306584576, "free": 2249654272,
"inactive": 4967518208, "inactive": 3523612672,
"percent": 70.5, "percent": 71.2,
"shared": 721412096, "shared": 760561664,
"total": 7823572992, "total": 7823568896,
"used": 5516988416} "used": 5573914624}
Fields descriptions: Fields descriptions:
@ -632,7 +630,7 @@ Fields descriptions:
Get a specific field:: Get a specific field::
# curl http://localhost:61208/api/4/mem/total # curl http://localhost:61208/api/4/mem/total
{"total": 7823572992} {"total": 7823568896}
GET memswap GET memswap
----------- -----------
@ -640,13 +638,13 @@ GET memswap
Get plugin stats:: Get plugin stats::
# curl http://localhost:61208/api/4/memswap # curl http://localhost:61208/api/4/memswap
{"free": 7979921408, {"free": 6328528896,
"percent": 1.3, "percent": 21.7,
"sin": 18857984, "sin": 1052286976,
"sout": 118067200, "sout": 2748760064,
"time_since_update": 1, "time_since_update": 1,
"total": 8082419712, "total": 8082419712,
"used": 102498304} "used": 1753890816}
Fields descriptions: Fields descriptions:
@ -671,15 +669,15 @@ Get plugin stats::
# curl http://localhost:61208/api/4/network # curl http://localhost:61208/api/4/network
[{"alias": None, [{"alias": None,
"bytes_all": 0, "bytes_all": 0,
"bytes_all_gauge": 167597511, "bytes_all_gauge": 2908696922,
"bytes_recv": 0, "bytes_recv": 0,
"bytes_recv_gauge": 148823417, "bytes_recv_gauge": 2772689391,
"bytes_sent": 0, "bytes_sent": 0,
"bytes_sent_gauge": 18774094, "bytes_sent_gauge": 136007531,
"interface_name": "wlp2s0", "interface_name": "wlp2s0",
"key": "interface_name", "key": "interface_name",
"speed": 0, "speed": 0,
"time_since_update": 0.6788613796234131}, "time_since_update": 0.7932572364807129},
{"alias": None, {"alias": None,
"bytes_all": 0, "bytes_all": 0,
"bytes_all_gauge": 0, "bytes_all_gauge": 0,
@ -687,10 +685,10 @@ Get plugin stats::
"bytes_recv_gauge": 0, "bytes_recv_gauge": 0,
"bytes_sent": 0, "bytes_sent": 0,
"bytes_sent_gauge": 0, "bytes_sent_gauge": 0,
"interface_name": "br_grafana", "interface_name": "br-40875d2e2716",
"key": "interface_name", "key": "interface_name",
"speed": 0, "speed": 0,
"time_since_update": 0.6788613796234131}] "time_since_update": 0.7932572364807129}]
Fields descriptions: Fields descriptions:
@ -713,27 +711,27 @@ Get a specific field::
# curl http://localhost:61208/api/4/network/interface_name # curl http://localhost:61208/api/4/network/interface_name
{"interface_name": ["wlp2s0", {"interface_name": ["wlp2s0",
"br_grafana",
"br-40875d2e2716", "br-40875d2e2716",
"vethb940339", "br_grafana",
"mpqemubr0", "vethe9e9c35",
"lxdbr0", "lxdbr0",
"veth56613b7f"]} "veth05608da0",
"mpqemubr0"]}
Get a specific item when field matches the given value:: Get a specific item when field matches the given value::
# curl http://localhost:61208/api/4/network/interface_name/wlp2s0 # curl http://localhost:61208/api/4/network/interface_name/wlp2s0
{"wlp2s0": [{"alias": None, {"wlp2s0": [{"alias": None,
"bytes_all": 0, "bytes_all": 0,
"bytes_all_gauge": 167597511, "bytes_all_gauge": 2908696922,
"bytes_recv": 0, "bytes_recv": 0,
"bytes_recv_gauge": 148823417, "bytes_recv_gauge": 2772689391,
"bytes_sent": 0, "bytes_sent": 0,
"bytes_sent_gauge": 18774094, "bytes_sent_gauge": 136007531,
"interface_name": "wlp2s0", "interface_name": "wlp2s0",
"key": "interface_name", "key": "interface_name",
"speed": 0, "speed": 0,
"time_since_update": 0.6788613796234131}]} "time_since_update": 0.7932572364807129}]}
GET now GET now
------- -------
@ -741,7 +739,7 @@ GET now
Get plugin stats:: Get plugin stats::
# curl http://localhost:61208/api/4/now # curl http://localhost:61208/api/4/now
"2024-02-11 16:36:50 CET" "2024-03-09 16:35:58 CET"
GET percpu GET percpu
---------- ----------
@ -752,29 +750,29 @@ Get plugin stats::
[{"cpu_number": 0, [{"cpu_number": 0,
"guest": 0.0, "guest": 0.0,
"guest_nice": 0.0, "guest_nice": 0.0,
"idle": 80.5, "idle": 88.1,
"iowait": 0.0, "iowait": 1.5,
"irq": 0.0, "irq": 0.0,
"key": "cpu_number", "key": "cpu_number",
"nice": 0.0, "nice": 0.0,
"softirq": 0.0, "softirq": 0.0,
"steal": 0.0, "steal": 0.0,
"system": 3.1, "system": 4.4,
"total": 19.5, "total": 11.9,
"user": 16.4}, "user": 5.9},
{"cpu_number": 1, {"cpu_number": 1,
"guest": 0.0, "guest": 0.0,
"guest_nice": 0.0, "guest_nice": 0.0,
"idle": 83.5, "idle": 89.1,
"iowait": 0.8, "iowait": 2.2,
"irq": 0.0, "irq": 0.0,
"key": "cpu_number", "key": "cpu_number",
"nice": 0.0, "nice": 0.0,
"softirq": 0.0, "softirq": 0.0,
"steal": 0.0, "steal": 0.0,
"system": 6.3, "system": 2.9,
"total": 16.5, "total": 10.9,
"user": 9.4}] "user": 5.8}]
Fields descriptions: Fields descriptions:
@ -808,7 +806,7 @@ Get plugin stats::
"port": 0, "port": 0,
"refresh": 30, "refresh": 30,
"rtt_warning": None, "rtt_warning": None,
"status": 0.006275, "status": 0.006268,
"timeout": 3}] "timeout": 3}]
Fields descriptions: Fields descriptions:
@ -836,7 +834,7 @@ Get a specific item when field matches the given value::
"port": 0, "port": 0,
"refresh": 30, "refresh": 30,
"rtt_warning": None, "rtt_warning": None,
"status": 0.006275, "status": 0.006268,
"timeout": 3}]} "timeout": 3}]}
GET processcount GET processcount
@ -845,7 +843,7 @@ GET processcount
Get plugin stats:: Get plugin stats::
# curl http://localhost:61208/api/4/processcount # curl http://localhost:61208/api/4/processcount
{"pid_max": 0, "running": 1, "sleeping": 312, "thread": 1430, "total": 378} {"pid_max": 0, "running": 1, "sleeping": 328, "thread": 1568, "total": 398}
Fields descriptions: Fields descriptions:
@ -858,7 +856,7 @@ Fields descriptions:
Get a specific field:: Get a specific field::
# curl http://localhost:61208/api/4/processcount/total # curl http://localhost:61208/api/4/processcount/total
{"total": 378} {"total": 398}
GET processlist GET processlist
--------------- ---------------
@ -890,7 +888,7 @@ GET psutilversion
Get plugin stats:: Get plugin stats::
# curl http://localhost:61208/api/4/psutilversion # curl http://localhost:61208/api/4/psutilversion
"5.9.7" "5.9.8"
GET quicklook GET quicklook
------------- -------------
@ -898,66 +896,66 @@ GET quicklook
Get plugin stats:: Get plugin stats::
# curl http://localhost:61208/api/4/quicklook # curl http://localhost:61208/api/4/quicklook
{"cpu": 35.6, {"cpu": 27.9,
"cpu_hz": 3000000000.0, "cpu_hz": 2025000000.0,
"cpu_hz_current": 1899561500.0, "cpu_hz_current": 1574065750.0,
"cpu_name": "Intel(R) Core(TM) i7-4500U CPU @ 1.80GHz", "cpu_name": "Intel(R) Core(TM) i7-4500U CPU @ 1.80GHz",
"cpucore": 4, "cpucore": 4,
"load": 30.7, "load": 53.3,
"mem": 70.5, "mem": 71.2,
"percpu": [{"cpu_number": 0, "percpu": [{"cpu_number": 0,
"guest": 0.0, "guest": 0.0,
"guest_nice": 0.0, "guest_nice": 0.0,
"idle": 80.5, "idle": 88.1,
"iowait": 0.0, "iowait": 1.5,
"irq": 0.0, "irq": 0.0,
"key": "cpu_number", "key": "cpu_number",
"nice": 0.0, "nice": 0.0,
"softirq": 0.0, "softirq": 0.0,
"steal": 0.0, "steal": 0.0,
"system": 3.1, "system": 4.4,
"total": 19.5, "total": 11.9,
"user": 16.4}, "user": 5.9},
{"cpu_number": 1, {"cpu_number": 1,
"guest": 0.0, "guest": 0.0,
"guest_nice": 0.0, "guest_nice": 0.0,
"idle": 83.5, "idle": 89.1,
"iowait": 0.8, "iowait": 2.2,
"irq": 0.0, "irq": 0.0,
"key": "cpu_number", "key": "cpu_number",
"nice": 0.0, "nice": 0.0,
"softirq": 0.0, "softirq": 0.0,
"steal": 0.0, "steal": 0.0,
"system": 6.3, "system": 2.9,
"total": 16.5, "total": 10.9,
"user": 9.4}, "user": 5.8},
{"cpu_number": 2, {"cpu_number": 2,
"guest": 0.0, "guest": 0.0,
"guest_nice": 0.0, "guest_nice": 0.0,
"idle": 72.2, "idle": 87.6,
"iowait": 0.0, "iowait": 0.0,
"irq": 0.0, "irq": 0.0,
"key": "cpu_number", "key": "cpu_number",
"nice": 0.0, "nice": 0.0,
"softirq": 0.0, "softirq": 0.7,
"steal": 0.0, "steal": 0.0,
"system": 4.0, "system": 5.8,
"total": 27.8, "total": 12.4,
"user": 23.8}, "user": 5.8},
{"cpu_number": 3, {"cpu_number": 3,
"guest": 0.0, "guest": 0.0,
"guest_nice": 0.0, "guest_nice": 0.0,
"idle": 23.3, "idle": 15.3,
"iowait": 0.0, "iowait": 4.4,
"irq": 0.0, "irq": 0.0,
"key": "cpu_number", "key": "cpu_number",
"nice": 0.0, "nice": 0.0,
"softirq": 0.0, "softirq": 0.0,
"steal": 0.0, "steal": 0.0,
"system": 8.5, "system": 11.7,
"total": 76.7, "total": 84.7,
"user": 68.2}], "user": 68.6}],
"swap": 1.3} "swap": 21.7}
Fields descriptions: Fields descriptions:
@ -1077,7 +1075,7 @@ GET uptime
Get plugin stats:: Get plugin stats::
# curl http://localhost:61208/api/4/uptime # curl http://localhost:61208/api/4/uptime
"1:44:31" "5 days, 7:35:19"
GET version GET version
----------- -----------
@ -1109,43 +1107,34 @@ GET top n items of a specific plugin
Get top 2 processes of the processlist plugin:: Get top 2 processes of the processlist plugin::
# curl http://localhost:61208/api/4/processlist/top/2 # curl http://localhost:61208/api/4/processlist/top/2
[{"cmdline": ["/usr/share/code/code", [{"cmdline": ["/snap/firefox/3728/usr/lib/firefox/firefox"],
"/home/nicolargo/.vscode/extensions/ms-python.vscode-pylance-2023.12.1/dist/server.bundle.js",
"--cancellationReceive=file:d7a0fb39f92fe0ee1d3327d82a4fde4008056844b4",
"--node-ipc",
"--clientProcessId=10107"],
"cpu_percent": 0.0, "cpu_percent": 0.0,
"cpu_times": {"children_system": 0.46, "cpu_times": {"children_system": 390.08,
"children_user": 3.08, "children_user": 2943.96,
"iowait": 0.0, "iowait": 0.0,
"system": 47.8, "system": 905.87,
"user": 866.73}, "user": 3093.52},
"gids": {"effective": 1000, "real": 1000, "saved": 1000}, "gids": {"effective": 1000, "real": 1000, "saved": 1000},
"io_counters": [58642432, 225280, 0, 0, 0], "io_counters": [2077657088, 3115638784, 0, 0, 0],
"key": "pid", "key": "pid",
"memory_info": {"data": 644775936, "memory_info": {"data": 1273196544,
"dirty": 0, "dirty": 0,
"lib": 0, "lib": 0,
"rss": 472678400, "rss": 501071872,
"shared": 64077824, "shared": 125640704,
"text": 126423040, "text": 839680,
"vms": 1208849498112}, "vms": 13255110656},
"memory_percent": 6.041720330127138, "memory_percent": 6.404645739825796,
"name": "code", "name": "firefox",
"nice": 0, "nice": 0,
"num_threads": 13, "num_threads": 155,
"pid": 10662, "pid": 7992,
"status": "S", "status": "S",
"time_since_update": 1, "time_since_update": 1,
"username": "nicolargo"}, "username": "nicolargo"},
{"cmdline": ["/usr/share/code/code", {"cmdline": ["/usr/share/code/code",
"--type=utility", "--type=renderer",
"--utility-sub-type=node.mojom.NodeService", "--crashpad-handler-pid=35523",
"--lang=en-US",
"--service-sandbox-type=none",
"--dns-result-order=ipv4first",
"--inspect-port=0",
"--crashpad-handler-pid=9999",
"--enable-crash-reporter=721e05a9-6035-4dcb-bd58-68097aa48dd0,no_channel", "--enable-crash-reporter=721e05a9-6035-4dcb-bd58-68097aa48dd0,no_channel",
"--user-data-dir=/home/nicolargo/.config/Code", "--user-data-dir=/home/nicolargo/.config/Code",
"--standard-schemes=vscode-webview,vscode-file", "--standard-schemes=vscode-webview,vscode-file",
@ -1155,30 +1144,41 @@ Get top 2 processes of the processlist plugin::
"--fetch-schemes=vscode-webview,vscode-file", "--fetch-schemes=vscode-webview,vscode-file",
"--service-worker-schemes=vscode-webview", "--service-worker-schemes=vscode-webview",
"--code-cache-schemes=vscode-webview,vscode-file", "--code-cache-schemes=vscode-webview,vscode-file",
"--app-path=/usr/share/code/resources/app",
"--enable-sandbox",
"--enable-blink-features=HighlightAPI",
"--first-renderer-process",
"--lang=en-US",
"--num-raster-threads=2",
"--enable-main-frame-before-activation",
"--renderer-client-id=4",
"--time-ticks-at-unix-epoch=-1709539275787032",
"--launch-time-ticks=3773104105",
"--shared-files=v8_context_snapshot_data:100", "--shared-files=v8_context_snapshot_data:100",
"--field-trial-handle=0,i,2640807530851263011,11607298494020871589,262144", "--field-trial-handle=0,i,2992833077465328896,17440056338018087593,262144",
"--disable-features=CalculateNativeWinOcclusion,SpareRendererForSitePerProcess"], "--disable-features=CalculateNativeWinOcclusion,SpareRendererForSitePerProcess",
"--vscode-window-config=vscode:0a3f42ef-a12c-453d-8061-6c7b57ac6b4f"],
"cpu_percent": 0.0, "cpu_percent": 0.0,
"cpu_times": {"children_system": 53.26, "cpu_times": {"children_system": 0.0,
"children_user": 57.13, "children_user": 0.0,
"iowait": 0.0, "iowait": 0.0,
"system": 77.23, "system": 126.26,
"user": 508.27}, "user": 1371.14},
"gids": {"effective": 1000, "real": 1000, "saved": 1000}, "gids": {"effective": 1000, "real": 1000, "saved": 1000},
"io_counters": [191717376, 80580608, 0, 0, 0], "io_counters": [166678528, 3162112, 0, 0, 0],
"key": "pid", "key": "pid",
"memory_info": {"data": 710406144, "memory_info": {"data": 827932672,
"dirty": 0, "dirty": 0,
"lib": 0, "lib": 0,
"rss": 447778816, "rss": 401375232,
"shared": 76165120, "shared": 55939072,
"text": 126423040, "text": 126423040,
"vms": 1213157191680}, "vms": 1221789167616},
"memory_percent": 5.723456743586039, "memory_percent": 5.130334216206792,
"name": "code", "name": "code",
"nice": 0, "nice": 0,
"num_threads": 18, "num_threads": 14,
"pid": 10107, "pid": 35570,
"status": "S", "status": "S",
"time_since_update": 1, "time_since_update": 1,
"username": "nicolargo"}] "username": "nicolargo"}]
@ -1209,34 +1209,34 @@ GET stats history
History of a plugin:: History of a plugin::
# curl http://localhost:61208/api/4/cpu/history # curl http://localhost:61208/api/4/cpu/history
{"system": [["2024-02-11T16:36:52.810030", 5.5], {"system": [["2024-03-09T16:36:00.151536", 5.2],
["2024-02-11T16:36:53.853074", 2.7], ["2024-03-09T16:36:01.196104", 5.2],
["2024-02-11T16:36:55.228137", 2.7]], ["2024-03-09T16:36:02.610015", 2.7]],
"user": [["2024-02-11T16:36:52.810007", 29.9], "user": [["2024-03-09T16:36:00.151516", 16.8],
["2024-02-11T16:36:53.853055", 11.0], ["2024-03-09T16:36:01.196073", 16.8],
["2024-02-11T16:36:55.228110", 11.0]]} ["2024-03-09T16:36:02.609997", 6.7]]}
Limit history to last 2 values:: Limit history to last 2 values::
# curl http://localhost:61208/api/4/cpu/history/2 # curl http://localhost:61208/api/4/cpu/history/2
{"system": [["2024-02-11T16:36:53.853074", 2.7], {"system": [["2024-03-09T16:36:01.196104", 5.2],
["2024-02-11T16:36:55.228137", 2.7]], ["2024-03-09T16:36:02.610015", 2.7]],
"user": [["2024-02-11T16:36:53.853055", 11.0], "user": [["2024-03-09T16:36:01.196073", 16.8],
["2024-02-11T16:36:55.228110", 11.0]]} ["2024-03-09T16:36:02.609997", 6.7]]}
History for a specific field:: History for a specific field::
# curl http://localhost:61208/api/4/cpu/system/history # curl http://localhost:61208/api/4/cpu/system/history
{"system": [["2024-02-11T16:36:50.851412", 5.5], {"system": [["2024-03-09T16:35:58.120989", 6.0],
["2024-02-11T16:36:52.810030", 5.5], ["2024-03-09T16:36:00.151536", 5.2],
["2024-02-11T16:36:53.853074", 2.7], ["2024-03-09T16:36:01.196104", 5.2],
["2024-02-11T16:36:55.228137", 2.7]]} ["2024-03-09T16:36:02.610015", 2.7]]}
Limit history for a specific field to last 2 values:: Limit history for a specific field to last 2 values::
# curl http://localhost:61208/api/4/cpu/system/history # curl http://localhost:61208/api/4/cpu/system/history
{"system": [["2024-02-11T16:36:53.853074", 2.7], {"system": [["2024-03-09T16:36:01.196104", 5.2],
["2024-02-11T16:36:55.228137", 2.7]]} ["2024-03-09T16:36:02.610015", 2.7]]}
GET limits (used for thresholds) GET limits (used for thresholds)
-------------------------------- --------------------------------
@ -1278,8 +1278,7 @@ All limits/thresholds::
"diskio_hide": ["loop.*", "/dev/loop.*"], "diskio_hide": ["loop.*", "/dev/loop.*"],
"history_size": 1200.0}, "history_size": 1200.0},
"folders": {"folders_disable": ["False"], "history_size": 1200.0}, "folders": {"folders_disable": ["False"], "history_size": 1200.0},
"fs": {"fs_alias": ["/:Root"], "fs": {"fs_careful": 50.0,
"fs_careful": 50.0,
"fs_critical": 90.0, "fs_critical": 90.0,
"fs_disable": ["False"], "fs_disable": ["False"],
"fs_hide": ["/boot.*", "/snap.*"], "fs_hide": ["/boot.*", "/snap.*"],

View File

@ -27,7 +27,7 @@ level margin: \\n[rst2man-indent\\n[rst2man-indent-level]]
.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] .\" new: \\n[rst2man-indent\\n[rst2man-indent-level]]
.in \\n[rst2man-indent\\n[rst2man-indent-level]]u .in \\n[rst2man-indent\\n[rst2man-indent-level]]u
.. ..
.TH "GLANCES" "1" "Feb 11, 2024" "4.0.0_beta01" "Glances" .TH "GLANCES" "1" "Mar 09, 2024" "4.0.0_beta01" "Glances"
.SH NAME .SH NAME
glances \- An eye on your system glances \- An eye on your system
.SH SYNOPSIS .SH SYNOPSIS
@ -313,6 +313,11 @@ display FS free space instead of used
.UNINDENT .UNINDENT
.INDENT 0.0 .INDENT 0.0
.TP .TP
.B \-\-theme\-white
optimize display colors for a white background
.UNINDENT
.INDENT 0.0
.TP
.B \-\-disable\-check\-update .B \-\-disable\-check\-update
disable online Glances version check disable online Glances version check
.UNINDENT .UNINDENT
@ -498,6 +503,9 @@ Enable/disable the top menu (QuickLook, CPU, MEM, SWAP, and LOAD)
.B \fB6\fP .B \fB6\fP
Enable/disable mean GPU mode Enable/disable mean GPU mode
.TP .TP
.B \fB9\fP
Switch UI theme between black and white
.TP
.B \fB/\fP .B \fB/\fP
Switch between process command line or command name Switch between process command line or command name
.TP .TP

View File

@ -26,6 +26,9 @@ export default {
}; };
}, },
computed: { computed: {
config() {
return this.store.config || {};
},
stats() { stats() {
return this.data.stats['system']; return this.data.stats['system'];
}, },
@ -49,6 +52,14 @@ export default {
}, },
isDisconnected() { isDisconnected() {
return this.store.status === 'FAILURE'; return this.store.status === 'FAILURE';
},
systemInfoMsg() {
return this.config.system !== undefined
? this.config.system.system_info_msg
: undefined;
},
isSystemInfoMsg() {
return this.systemInfoMsg !== undefined;
} }
} }
}; };

View File

@ -14,6 +14,7 @@ import platform
import re import re
from io import open from io import open
from glances.logger import logger
from glances.globals import iteritems from glances.globals import iteritems
from glances.plugins.plugin.model import GlancesPluginModel from glances.plugins.plugin.model import GlancesPluginModel
@ -68,7 +69,7 @@ snmp_oid = {
# http://msdn.microsoft.com/en-us/library/windows/desktop/ms724832%28v=vs.85%29.aspx # http://msdn.microsoft.com/en-us/library/windows/desktop/ms724832%28v=vs.85%29.aspx
snmp_to_human = { snmp_to_human = {
'windows': { 'windows': {
'Windows Version 10.0': 'Windows 10 or Server 2016', 'Windows Version 10.0': 'Windows 10|11 or Server 2016|2019|2022',
'Windows Version 6.3': 'Windows 8.1 or Server 2012R2', 'Windows Version 6.3': 'Windows 8.1 or Server 2012R2',
'Windows Version 6.2': 'Windows 8 or Server 2012', 'Windows Version 6.2': 'Windows 8 or Server 2012',
'Windows Version 6.1': 'Windows 7 or Server 2008R2', 'Windows Version 6.1': 'Windows 7 or Server 2008R2',
@ -118,7 +119,8 @@ class PluginModel(GlancesPluginModel):
def __init__(self, args=None, config=None): def __init__(self, args=None, config=None):
"""Init the plugin.""" """Init the plugin."""
super(PluginModel, self).__init__( super(PluginModel, self).__init__(
args=args, config=config, args=args,
config=config,
fields_description=fields_description fields_description=fields_description
) )
@ -129,6 +131,9 @@ class PluginModel(GlancesPluginModel):
if self.get_refresh(): if self.get_refresh():
self.set_refresh(60) self.set_refresh(60)
# Get the default message (if defined)
self.system_info_msg = config.get_value('system', 'system_info_msg')
@GlancesPluginModel._check_decorator @GlancesPluginModel._check_decorator
@GlancesPluginModel._log_result_decorator @GlancesPluginModel._log_result_decorator
def update(self): def update(self):
@ -222,16 +227,16 @@ class PluginModel(GlancesPluginModel):
# Hostname is mandatory # Hostname is mandatory
msg = self.stats['hostname'] msg = self.stats['hostname']
ret.append(self.curse_add_line(msg, "TITLE")) ret.append(self.curse_add_line(msg, "TITLE"))
# System info # System info
if self.stats['os_name'] == "Linux" and self.stats['linux_distro']: if self.system_info_msg:
msg = ' ({} {} / {} {})'.format( msg = ' ' + self.system_info_msg.format(**self.stats)
self.stats['linux_distro'], self.stats['platform'], self.stats['os_name'], self.stats['os_version'] elif self.stats['os_name'] == "Linux" and 'linux_distro' in self.stats:
) msg = ' ({linux_distro} {platform} / {os_name} {os_version})'.format(**self.stats)
elif 'os_version' in self.stats and 'platform' in self.stats:
msg = ' ({os_name} {os_version} {platform})'.format(**self.stats)
else: else:
try: msg = ' ({os_name})'.format(**self.stats)
msg = ' ({} {} {})'.format(self.stats['os_name'], self.stats['os_version'], self.stats['platform'])
except Exception:
msg = ' ({})'.format(self.stats['os_name'])
ret.append(self.curse_add_line(msg, optional=True)) ret.append(self.curse_add_line(msg, optional=True))
# Return the message with decoration # Return the message with decoration