Skip to content

Instantly share code, notes, and snippets.

@asergi
Last active January 1, 2016 13:19
Show Gist options
  • Save asergi/8150780 to your computer and use it in GitHub Desktop.
Save asergi/8150780 to your computer and use it in GitHub Desktop.
diff --git a/glances/glances.py b/glances/glances.py
index 40450d4..f3d6401 100644
--- a/glances/glances.py
+++ b/glances/glances.py
@@ -3674,78 +3674,92 @@ class glancesScreen:
# display the limits table
limits_table_x = self.help_x
- limits_table_y = self.help_y + 1
- self.term_window.addnstr(limits_table_y, limits_table_x + 18,
- format(_("OK"), '^8'), 8,
- self.default_color)
- self.term_window.addnstr(limits_table_y, limits_table_x + 26,
- format(_("CAREFUL"), '^8'), 8,
+ limits_table_y = self.help_y + 2
+ self.term_window.addnstr(limits_table_y, limits_table_x + 15,
+ format(_("CAREFUL"), '7'), 7,
self.ifCAREFUL_color),
- self.term_window.addnstr(limits_table_y, limits_table_x + 34,
- format(_("WARNING"), '^8'), 8,
+ self.term_window.addnstr(limits_table_y, limits_table_x + 22,
+ format(_("WARNING"), '7'), 7,
self.ifWARNING_color),
- self.term_window.addnstr(limits_table_y, limits_table_x + 42,
- format(_("CRITICAL"), '^8'), 8,
+ self.term_window.addnstr(limits_table_y, limits_table_x + 29,
+ format(_("CRITICAL"), '8'), 8,
self.ifCRITICAL_color),
- # display the stat labels
- stat_labels = [_("CPU user %"), _("CPU system %"),
- _("CPU iowait %"), _("Load"),
- _("RAM memory %"), _("Swap memory %"),
- _("Temp °C"), _("HDD Temp °C"),
- _("Filesystem %"), _("CPU process %"),
- _("MEM process %")]
-
- width = 8
+ # stats labels and limit values (left column)
+ stats_labels_left = [_("CPU user %"), _("CPU system %"),
+ _("CPU iowait %"), _("CPU steal %"),
+ _("Load"), _("RAM memory %")]
limits_table_x = self.help_x + 2
- limits_table_y = self.help_y + 2
- for label in stat_labels:
+ limits_table_y = self.help_y + 3
+ for label in stats_labels_left:
self.term_window.addnstr(limits_table_y, limits_table_x,
- format(label, '<14'), 14)
+ format(label, '<13'), 13)
limits_table_y += 1
- # display the limit values
- limit_values = [[0, limits.getCPUCareful(stat='user'),
- limits.getCPUWarning(stat='user'),
- limits.getCPUCritical(stat='user')],
- [0, limits.getCPUCareful(stat='system'),
- limits.getCPUWarning(stat='system'),
- limits.getCPUCritical(stat='system')],
- [0, limits.getCPUCareful(stat='iowait'),
- limits.getCPUWarning(stat='iowait'),
- limits.getCPUCritical(stat='iowait')],
- [0, limits.getLOADCareful() * core,
- limits.getLOADWarning() * core,
- limits.getLOADCritical() * core],
- [0, limits.getMEMCareful(),
- limits.getMEMWarning(),
- limits.getMEMCritical()],
- [0, limits.getSWAPCareful(),
- limits.getSWAPWarning(),
- limits.getSWAPCritical()],
- [0, limits.getTEMPCareful(),
- limits.getTEMPWarning(),
- limits.getTEMPCritical()],
- [0, limits.getHDDTEMPCareful(),
- limits.getHDDTEMPWarning(),
- limits.getHDDTEMPCritical()],
- [0, limits.getFSCareful(),
- limits.getFSWarning(),
- limits.getFSCritical()],
- [0, limits.getProcessCareful(stat='CPU', core=core),
- limits.getProcessWarning(stat='CPU', core=core),
- limits.getProcessCritical(stat='CPU', core=core)],
- [0, limits.getProcessCareful(stat='MEM'),
- limits.getProcessWarning(stat='MEM'),
- limits.getProcessCritical(stat='MEM')]]
-
- limits_table_x = self.help_x + 15
- limits_table_y = self.help_y + 2
- for value in limit_values:
+ limit_values_left = [[limits.getCPUCareful(stat='user'),
+ limits.getCPUWarning(stat='user'),
+ limits.getCPUCritical(stat='user')],
+ [limits.getCPUCareful(stat='system'),
+ limits.getCPUWarning(stat='system'),
+ limits.getCPUCritical(stat='system')],
+ [limits.getCPUCareful(stat='iowait'),
+ limits.getCPUWarning(stat='iowait'),
+ limits.getCPUCritical(stat='iowait')],
+ [limits.getCPUCareful(stat='steal'),
+ limits.getCPUWarning(stat='steal'),
+ limits.getCPUCritical(stat='steal')],
+ [limits.getLOADCareful() * core,
+ limits.getLOADWarning() * core,
+ limits.getLOADCritical() * core],
+ [limits.getMEMCareful(),
+ limits.getMEMWarning(),
+ limits.getMEMCritical()]]
+ width = 6
+ limits_table_x = self.help_x + 16
+ limits_table_y = self.help_y + 3
+ for value in limit_values_left:
self.term_window.addnstr(
limits_table_y, limits_table_x,
- '{0:>{width}}{1:>{width}}{2:>{width}}{3:>{width}}'.format(
- *value, width=width), 32)
+ '{0:>{width}}{1:>{width}}{2:>{width}}'.format(
+ *value, width=width), 18)
+ limits_table_y += 1
+
+ # stats labels and limit values (right column)
+ stats_labels_right = [_("Swap memory %"), _("Temp °C"),
+ _("HDD Temp °C"), _("Filesystem %"),
+ _("CPU process %"), _("MEM process %")]
+ limits_table_x = self.help_x + 38
+ limits_table_y = self.help_y + 3
+ for label in stats_labels_right:
+ self.term_window.addnstr(limits_table_y, limits_table_x,
+ format(label, '<13'), 13)
+ limits_table_y += 1
+
+ limit_values_right = [[limits.getSWAPCareful(),
+ limits.getSWAPWarning(),
+ limits.getSWAPCritical()],
+ [limits.getTEMPCareful(),
+ limits.getTEMPWarning(),
+ limits.getTEMPCritical()],
+ [limits.getHDDTEMPCareful(),
+ limits.getHDDTEMPWarning(),
+ limits.getHDDTEMPCritical()],
+ [limits.getFSCareful(),
+ limits.getFSWarning(),
+ limits.getFSCritical()],
+ [limits.getProcessCareful(stat='CPU', core=core),
+ limits.getProcessWarning(stat='CPU', core=core),
+ limits.getProcessCritical(stat='CPU', core=core)],
+ [limits.getProcessCareful(stat='MEM'),
+ limits.getProcessWarning(stat='MEM'),
+ limits.getProcessCritical(stat='MEM')]]
+ limits_table_x = self.help_x + 53
+ limits_table_y = self.help_y + 3
+ for value in limit_values_right:
+ self.term_window.addnstr(
+ limits_table_y, limits_table_x,
+ '{0:>{width}}{1:>{width}}{2:>{width}}'.format(
+ *value, width=width), 18)
limits_table_y += 1
# key table (left column)
@@ -3759,7 +3773,6 @@ class glancesScreen:
[_("n"), _("Show/hide network stats")],
[_("s"), _("Show/hide sensors stats")],
[_("y"), _("Show/hide hddtemp stats")]]
-
width = 3
key_table_x = self.help_x + 2
key_table_y = limits_table_y + 1
@@ -3769,17 +3782,16 @@ class glancesScreen:
'{0:{width}}{1}'.format(*key, width=width), 38)
key_table_y += 1
- # key table (right column)
- key_col_right = [[_("l"), _("Show/hide logs")],
- [_("b"), _("Bytes or bits for network I/O")],
- [_("w"), _("Delete warning logs")],
- [_("x"), _("Delete warning and critical logs")],
- [_("1"), _("Global CPU or per-CPU stats")],
- [_("h"), _("Show/hide this help screen")],
- [_("t"), _("View network I/O as combination")],
- [_("u"), _("View cumulative network I/O")],
- [_("q"), _("Quit (Esc and Ctrl-C also work)")]]
-
+ # key table (right column)
+ key_col_right = [[_("l"), _("Show/hide logs")],
+ [_("b"), _("Bytes or bits for network I/O")],
+ [_("w"), _("Delete warning logs")],
+ [_("x"), _("Delete warning and critical logs")],
+ [_("1"), _("Global CPU or per-CPU stats")],
+ [_("h"), _("Show/hide this help screen")],
+ [_("t"), _("View network I/O as combination")],
+ [_("u"), _("View cumulative network I/O")],
+ [_("q"), _("Quit (Esc and Ctrl-C also work)")]]
key_table_x = self.help_x + 38
key_table_y = limits_table_y + 1
for key in key_col_right:
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment