mirror of https://github.com/nicolargo/glances.git
Allow containers columns to be selected in config file #2722
This commit is contained in:
commit
01e007deaa
|
|
@ -513,8 +513,11 @@ disable=False
|
|||
; hide=telegraf
|
||||
# Define the maximum docker size name (default is 20 chars)
|
||||
max_name_size=20
|
||||
; cpu_careful=50
|
||||
# List of stats to disable (not display)
|
||||
# Following stats can be disabled: name,status,uptime,cpu,mem,diskio,networkio,command
|
||||
disable_stats=diskio,networkio
|
||||
# Thresholds for CPU and MEM (in %)
|
||||
; cpu_careful=50
|
||||
; cpu_warning=70
|
||||
; cpu_critical=90
|
||||
; mem_careful=20
|
||||
|
|
|
|||
|
|
@ -31,6 +31,9 @@ under the ``[containers]`` section:
|
|||
#show=showthisone,andthose.*
|
||||
# Define the maximum containers size name (default is 20 chars)
|
||||
max_name_size=20
|
||||
# List of stats to disable (not display)
|
||||
# Following stats can be disabled: name,status,uptime,cpu,mem,diskio,networkio,command
|
||||
disable_stats=diskio,networkio
|
||||
# Global containers' thresholds for CPU and MEM (in %)
|
||||
cpu_careful=50
|
||||
cpu_warning=70
|
||||
|
|
|
|||
854
docs/api.rst
854
docs/api.rst
File diff suppressed because it is too large
Load Diff
|
|
@ -27,7 +27,7 @@ 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" "Dec 22, 2024" "4.3.0_dev06" "Glances"
|
||||
.TH "GLANCES" "1" "Dec 23, 2024" "4.3.0_dev06" "Glances"
|
||||
.SH NAME
|
||||
glances \- An eye on your system
|
||||
.SH SYNOPSIS
|
||||
|
|
|
|||
|
|
@ -9,60 +9,61 @@
|
|||
<td scope="col" v-show="showEngine">Engine</td>
|
||||
<td scope="col" v-show="showPod">Pod</td>
|
||||
<td scope="col" :class="['sortable', sorter.column === 'name' && 'sort']"
|
||||
@click="args.sort_processes_key = 'name'">
|
||||
@click="args.sort_processes_key = 'name'" v-show="!getDisableStats().includes('name')">
|
||||
Name
|
||||
</td>
|
||||
<td scope="col">Status</td>
|
||||
<td scope="col">Uptime</td>
|
||||
<td scope="col" v-show="!getDisableStats().includes('status')">Status</td>
|
||||
<td scope="col" v-show="!getDisableStats().includes('uptime')">Uptime</td>
|
||||
<td scope="col" :class="['sortable', sorter.column === 'cpu_percent' && 'sort']"
|
||||
@click="args.sort_processes_key = 'cpu_percent'">
|
||||
@click="args.sort_processes_key = 'cpu_percent'" v-show="!getDisableStats().includes('cpu')">
|
||||
CPU%
|
||||
</td>
|
||||
<td scope="col" :class="['sortable', sorter.column === 'memory_percent' && 'sort']"
|
||||
@click="args.sort_processes_key = 'memory_percent'">
|
||||
@click="args.sort_processes_key = 'memory_percent'" v-show="!getDisableStats().includes('mem')">
|
||||
MEM
|
||||
</td>
|
||||
<td scope="col">/ MAX</td>
|
||||
<td scope="col">IOR/s</td>
|
||||
<td scope="col">IOW/s</td>
|
||||
<td scope="col">RX/s</td>
|
||||
<td scope="col">TX/s</td>
|
||||
<td scope="col">Command</td>
|
||||
<td scope="col" v-show="!getDisableStats().includes('mem')">/ MAX</td>
|
||||
<td scope="col" v-show="!getDisableStats().includes('diskio')">IOR/s</td>
|
||||
<td scope="col" v-show="!getDisableStats().includes('diskio')">IOW/s</td>
|
||||
<td scope="col" v-show="!getDisableStats().includes('networkio')">RX/s</td>
|
||||
<td scope="col" v-show="!getDisableStats().includes('networkio')">TX/s</td>
|
||||
<td scope="col" v-show="!getDisableStats().includes('command')">Command</td>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr v-for="(container, containerId) in containers" :key="containerId">
|
||||
<td scope="row" v-show="showEngine">{{ container.engine }}</td>
|
||||
<td scope="row" v-show="showPod">{{ container.pod_id || '-' }}</td>
|
||||
<td scope="row">{{ container.name }}</td>
|
||||
<td scope="row" :class="container.status == 'Paused' ? 'careful' : 'ok'">
|
||||
<td scope="row" v-show="!getDisableStats().includes('name')">{{ container.name }}</td>
|
||||
<td scope="row" :class="container.status == 'Paused' ? 'careful' : 'ok'"
|
||||
v-show="!getDisableStats().includes('status')">
|
||||
{{ container.status }}
|
||||
</td>
|
||||
<td scope="row">
|
||||
<td scope="row" v-show="!getDisableStats().includes('uptime')">
|
||||
{{ container.uptime }}
|
||||
</td>
|
||||
<td scope="row">
|
||||
<td scope="row" v-show="!getDisableStats().includes('cpu')">
|
||||
{{ $filters.number(container.cpu_percent, 1) }}
|
||||
</td>
|
||||
<td scope="row">
|
||||
<td scope="row" v-show="!getDisableStats().includes('mem')">
|
||||
{{ $filters.bytes(container.memory_usage) }}
|
||||
</td>
|
||||
<td scope="row">
|
||||
<td scope="row" v-show="!getDisableStats().includes('mem')">
|
||||
/ {{ $filters.bytes(container.limit) }}
|
||||
</td>
|
||||
<td scope="row">
|
||||
<td scope="row" v-show="!getDisableStats().includes('iodisk')">
|
||||
{{ $filters.bytes(container.io_rx) }}
|
||||
</td>
|
||||
<td scope="row">
|
||||
<td scope="row" v-show="!getDisableStats().includes('iodisk')">
|
||||
{{ $filters.bytes(container.io_wx) }}
|
||||
</td>
|
||||
<td scope="row">
|
||||
<td scope="row" v-show="!getDisableStats().includes('networkio')">
|
||||
{{ $filters.bits(container.network_rx) }}
|
||||
</td>
|
||||
<td scope="row">
|
||||
<td scope="row" v-show="!getDisableStats().includes('networkio')">
|
||||
{{ $filters.bits(container.network_tx) }}
|
||||
</td>
|
||||
<td scope="row">
|
||||
<td scope="row" v-show="!getDisableStats().includes('command')">
|
||||
{{ container.command }}
|
||||
</td>
|
||||
</tr>
|
||||
|
|
@ -178,6 +179,11 @@ export default {
|
|||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
getDisableStats() {
|
||||
return GlancesHelper.getLimit('containers', 'containers_disable_stats') || [];
|
||||
}
|
||||
}
|
||||
};
|
||||
</script>
|
||||
|
|
|
|||
File diff suppressed because one or more lines are too long
|
|
@ -155,6 +155,9 @@ class PluginModel(GlancesPluginModel):
|
|||
# Sort key
|
||||
self.sort_key = None
|
||||
|
||||
# Set the key's list be disabled in order to only display specific attribute in the container list
|
||||
self.disable_stats = self.get_conf_value('disable_stats')
|
||||
|
||||
# Force a first update because we need two update to have the first stat
|
||||
self.update()
|
||||
self.refresh_timer.set(0)
|
||||
|
|
@ -343,25 +346,35 @@ class PluginModel(GlancesPluginModel):
|
|||
|
||||
ret = self.maybe_add_engine_name_or_pod_line(ret)
|
||||
|
||||
msg = ' {:{width}}'.format('Name', width=name_max_width)
|
||||
ret.append(self.curse_add_line(msg, 'SORT' if self.sort_key == 'name' else 'DEFAULT'))
|
||||
if 'name' not in self.disable_stats:
|
||||
msg = ' {:{width}}'.format('Name', width=name_max_width)
|
||||
ret.append(self.curse_add_line(msg, 'SORT' if self.sort_key == 'name' else 'DEFAULT'))
|
||||
|
||||
msgs = ['{:>10}'.format('Status'), '{:>10}'.format('Uptime')]
|
||||
msgs = []
|
||||
if 'status' not in self.disable_stats:
|
||||
msgs.append('{:>10}'.format('Status'))
|
||||
if 'uptime' not in self.disable_stats:
|
||||
msgs.append('{:>10}'.format('Uptime'))
|
||||
ret = reduce(self.add_msg_to_line, msgs, ret)
|
||||
|
||||
msg = '{:>6}'.format('CPU%')
|
||||
ret.append(self.curse_add_line(msg, 'SORT' if self.sort_key == 'cpu_percent' else 'DEFAULT'))
|
||||
msg = '{:>7}'.format('MEM')
|
||||
ret.append(self.curse_add_line(msg, 'SORT' if self.sort_key == 'memory_usage' else 'DEFAULT'))
|
||||
if 'cpu' not in self.disable_stats:
|
||||
msg = '{:>6}'.format('CPU%')
|
||||
ret.append(self.curse_add_line(msg, 'SORT' if self.sort_key == 'cpu_percent' else 'DEFAULT'))
|
||||
|
||||
msgs = [
|
||||
'/{:<7}'.format('MAX'),
|
||||
'{:>7}'.format('IOR/s'),
|
||||
' {:<7}'.format('IOW/s'),
|
||||
'{:>7}'.format('Rx/s'),
|
||||
' {:<7}'.format('Tx/s'),
|
||||
' {:8}'.format('Command'),
|
||||
]
|
||||
msgs = []
|
||||
if 'mem' not in self.disable_stats:
|
||||
msg = '{:>7}'.format('MEM')
|
||||
ret.append(self.curse_add_line(msg, 'SORT' if self.sort_key == 'memory_usage' else 'DEFAULT'))
|
||||
msgs.append('/{:<7}'.format('MAX'))
|
||||
|
||||
if 'diskio' not in self.disable_stats:
|
||||
msgs.extend(['{:>7}'.format('IOR/s'), ' {:<7}'.format('IOW/s')])
|
||||
|
||||
if 'networkio' not in self.disable_stats:
|
||||
msgs.extend(['{:>7}'.format('Rx/s'), ' {:<7}'.format('Tx/s')])
|
||||
|
||||
if 'command' not in self.disable_stats:
|
||||
msgs.append(' {:8}'.format('Command'))
|
||||
|
||||
return reduce(self.add_msg_to_line, msgs, ret)
|
||||
|
||||
|
|
@ -499,17 +512,23 @@ class PluginModel(GlancesPluginModel):
|
|||
|
||||
def build_container_data(self, name_max_width, args):
|
||||
def build_with_this_params(ret, container):
|
||||
steps = [
|
||||
self.maybe_add_engine_name_or_pod_name,
|
||||
self.build_container_name(name_max_width),
|
||||
self.build_status_name,
|
||||
self.build_uptime_line,
|
||||
self.build_cpu_line,
|
||||
self.build_memory_line,
|
||||
self.build_io_line,
|
||||
self.build_net_line(args),
|
||||
self.build_cmd_line,
|
||||
]
|
||||
steps = [self.maybe_add_engine_name_or_pod_name]
|
||||
if 'name' not in self.disable_stats:
|
||||
steps.append(self.build_container_name(name_max_width))
|
||||
if 'status' not in self.disable_stats:
|
||||
steps.append(self.build_status_name)
|
||||
if 'uptime' not in self.disable_stats:
|
||||
steps.append(self.build_uptime_line)
|
||||
if 'cpu' not in self.disable_stats:
|
||||
steps.append(self.build_cpu_line)
|
||||
if 'mem' not in self.disable_stats:
|
||||
steps.append(self.build_memory_line)
|
||||
if 'diskio' not in self.disable_stats:
|
||||
steps.append(self.build_io_line)
|
||||
if 'networkio' not in self.disable_stats:
|
||||
steps.append(self.build_net_line(args))
|
||||
if 'command' not in self.disable_stats:
|
||||
steps.append(self.build_cmd_line)
|
||||
|
||||
return reduce(lambda ret, step: step(ret, container), steps, ret)
|
||||
|
||||
|
|
|
|||
|
|
@ -99,7 +99,7 @@ class GlancesProcesses:
|
|||
self._max_values = {}
|
||||
self.reset_max_values()
|
||||
|
||||
# Set the key's list be disabled in order to only display specific attribte in the process list
|
||||
# Set the key's list be disabled in order to only display specific attribute in the process list
|
||||
self.disable_stats = []
|
||||
|
||||
def _test_grab(self):
|
||||
|
|
|
|||
Loading…
Reference in New Issue