提交 259dcd6d 编写于 作者: N nicolargo

Nice Process Priority Configuration #1218

上级 141999bb
......@@ -18,6 +18,7 @@ Enhancements and new features:
* Add a code of conduct for Glances project's participants #1211
* Context switches bottleneck identification #1212
* Take advantage of the PSUtil issue #1025 (Add process_iter(attrs, ad_value)) #1105
* Nice Process Priority Configuration #1218
Bugs corrected:
......@@ -56,6 +57,20 @@ News command line options:
News configuration keys in the glances.conf file:
Processes list Nice value:
[processlist]
# Nice priorities range from -20 to 19.
# Configure nice levels using a comma separated list.
#
# Nice: Example 1, non-zero is warning (default behavior)
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
#
# Nice: Example 2, low priority processes escalate from careful to critical
#nice_careful=1,2,3,4,5,6,7,8,9
#nice_warning=10,11,12,13,14
#nice_critical=15,16,17,18,19
Docker plugin (related to #1152)
[docker]
......
......@@ -210,6 +210,17 @@ cpu_critical=90
mem_careful=50
mem_warning=70
mem_critical=90
#
# Nice priorities range from -20 to 19.
# Configure nice levels using a comma separated list.
#
# Nice: Example 1, non-zero is warning (default behavior)
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
#
# Nice: Example 2, low priority processes escalate from careful to critical
#nice_careful=1,2,3,4,5,6,7,8,9
#nice_warning=10,11,12,13,14
#nice_critical=15,16,17,18,19
[ports]
# Ports scanner plugin configuration
......
......@@ -122,5 +122,7 @@ The extended stats feature can be enabled using the
(curses interface).
.. note::
Limit values can be overwritten in the configuration file under
the ``[process]`` section.
Limit for CPU and MEM percent values can be overwritten in the
configuration file under the ``[processlist]`` section. It is also
possible to define limit for Nice values (comma separated list).
For example: nice_warning=-20,-19,-18
.\" Man page generated from reStructuredText.
.
.TH "GLANCES" "1" "Dec 29, 2017" "3.0_DEV" "Glances"
.TH "GLANCES" "1" "Jan 17, 2018" "3.0_DEV" "Glances"
.SH NAME
glances \- An eye on your system
.
......@@ -847,6 +847,6 @@ $ glances \-\-browser
.sp
Nicolas Hennion aka Nicolargo <\fI\%contact@nicolargo.com\fP>
.SH COPYRIGHT
2017, Nicolas Hennion
2018, Nicolas Hennion
.\" Generated by docutils manpage writer.
.
......@@ -202,6 +202,26 @@ class Plugin(GlancesPlugin):
return child_data
def get_nice_alert(self, value):
"""Return the alert relative to the Nice configuration list"""
value = str(value)
try:
if value in self.get_limit('nice_critical'):
return 'CRITICAL'
except KeyError:
pass
try:
if value in self.get_limit('nice_warning'):
return 'WARNING'
except KeyError:
pass
try:
if value in self.get_limit('nice_careful'):
return 'CAREFUL'
except KeyError:
pass
return 'DEFAULT'
def get_process_curses_data(self, p, first, args):
"""Get curses data to display for a process.
......@@ -264,11 +284,8 @@ class Plugin(GlancesPlugin):
if nice is None:
nice = '?'
msg = '{:>5}'.format(nice)
if isinstance(nice, int) and ((WINDOWS and nice != 32) or
(not WINDOWS and nice != 0)):
ret.append(self.curse_add_line(msg, decoration='NICE'))
else:
ret.append(self.curse_add_line(msg))
ret.append(self.curse_add_line(msg,
decoration=self.get_nice_alert(nice)))
else:
msg = '{:>5}'.format('?')
ret.append(self.curse_add_line(msg))
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册