Display IOWait on the PerCpu view

pull/160/head
Nicolas Hennion 2013-01-11 09:46:52 +01:00
parent 00bd5aad2b
commit 68e84d435f
3 changed files with 46 additions and 37 deletions

3
NEWS
View File

@ -5,7 +5,8 @@ Version 1.6
* Display limits in the help screen
* Add per process IO (read and write) rate in B per second
IO rate only available on Linux from a root account
* If CPU iowait alert then sort by processes by IO rate
* If CPU iowait alert then sort by processes by IO rate
* Per CPU display IOwait (if data is available)
* Process column style auto (underline) or manual (bold)
* Display a sort indicator (is space is available)
* Change the table key in the help screen

View File

@ -1,10 +1,3 @@
[global]
# Defaults limits for all the stats in %
# Defaults values if not defined: 50/70/90
careful=50
warning=70
critical=90
[cpu]
# Limits values for CPU user in %
# Defaults values if not defined: 50/70/90
@ -17,18 +10,20 @@ system_careful=50
system_warning=70
system_critical=90
# Limits values for CPU iowait in %
# Defaults values if not defined: TO BE DONE
# If your I/O wait percentage is greater than (1/# of CPU cores)
# then your CPUs are waiting a significant amount of time for the
# disk subsystem to catch up.
# Defaults values if not defined: 40/60/80
# Not easy to tweek...
# Source: http://blog.scoutapp.com/articles/2011/02/10/understanding-disk-i-o-when-should-you-be-worried
iowait_careful=15
iowait_warning=25
iowait_critical=35
# http://blog.logicmonitor.com/2011/04/20/troubleshooting-server-performance-and-application-monitoring-a-real-example/
# http://blog.developpeur-neurasthenique.fr/auto-hebergement-iowait-ma-tuer-1-2-vmstat-mpstat-atop-pidstat.html (FR)
iowait_careful=40
iowait_warning=60
iowait_critical=80
[load]
# Value * Core
# Defaults values if not defined: 0.7/1.0/5.0 per Core
# Defaults values if not defined: 0.7/1.0/5.0 per Core
# Source: http://blog.scoutapp.com/articles/2009/07/31/understanding-load-averages
# http://www.linuxjournal.com/article/9001
careful=0.7
warning=1.0
critical=5.0

View File

@ -313,6 +313,7 @@ class glancesLimits:
def getCritical(self, stat):
return self.__limits_list[stat][2]
# TO BE DELETED AFTER THE HTML output refactoring
def getSTDCareful(self):
return self.getCareful('STD')
@ -321,6 +322,7 @@ class glancesLimits:
def getSTDCritical(self):
return self.getCritical('STD')
# /TO BE DELETED AFTER THE HTML output refactoring
def getCPUCareful(self, stat):
return self.getCareful('CPU_' + stat.upper())
@ -904,6 +906,15 @@ class GlancesStats:
if hasattr(self.percputime_new[i], 'nice'):
cpu['nice'] = (self.percputime_new[i].nice -
self.percputime_old[i].nice) * perpercent[i]
if hasattr(self.percputime_new[i], 'iowait'):
cpu['iowait'] = (self.percputime_new[i].iowait -
self.percputime_old[i].iowait) * perpercent[i]
if hasattr(self.percputime_new[i], 'irq'):
cpu['irq'] = (self.percputime_new[i].irq -
self.percputime_old[i].irq) * perpercent[i]
if hasattr(self.percputime_new[i], 'softirq'):
cpu['softirq'] = (self.percputime_new[i].softirq -
self.percputime_old[i].softirq) * perpercent[i]
self.percpu.append(cpu)
self.percputime_old = self.percputime_new
self.percputime_total_old = self.percputime_total_new
@ -1827,11 +1838,15 @@ class glancesScreen:
return 0
self.term_window.addnstr(self.cpu_y + 1, self.cpu_x,
_("user:"), 5)
_("user:"), 7)
self.term_window.addnstr(self.cpu_y + 2, self.cpu_x,
_("system:"), 7)
self.term_window.addnstr(self.cpu_y + 3, self.cpu_x,
_("idle:"), 5)
if 'iowait' in percpu[0]:
self.term_window.addnstr(self.cpu_y + 3, self.cpu_x,
_("iowait:"), 7)
else:
self.term_window.addnstr(self.cpu_y + 3, self.cpu_x,
_("idle:"), 7)
for i in range(len(percpu)):
# percentage of usage
@ -1851,10 +1866,18 @@ class glancesScreen:
format(percpu[i]['system'] / 100, '>6.1%'), 6,
self.__getCpuColor2(percpu[i]['system'], stat = 'system'))
# idle
self.term_window.addnstr(
self.cpu_y + 3, self.cpu_x + 8 + i * 8,
format(percpu[i]['idle'] / 100, '>6.1%'), 6)
if 'iowait' in percpu[i]:
# iowait
self.term_window.addnstr(
self.cpu_y + 3, self.cpu_x + 8 + i * 8,
format(percpu[i]['iowait'] / 100, '>6.1%'), 6,
self.__getCpuColor2(percpu[i]['iowait'], stat = 'iowait'))
else:
# idle
self.term_window.addnstr(
self.cpu_y + 3, self.cpu_x + 8 + i * 8,
format(percpu[i]['idle'] / 100, '>6.1%'), 6)
elif screen_y > self.cpu_y + 5 and screen_x > self.cpu_x + 18:
# display CPU summary information
@ -2704,16 +2727,7 @@ class glancesScreen:
_("WARNING "), 8, self.ifWARNING_color)
self.term_window.addnstr(limits_table_y, limits_table_x + 42,
_("CRITICAL"), 8, self.ifCRITICAL_color)
#~ limits_table_y += 1
#~ self.term_window.addnstr(
#~ limits_table_y, limits_table_x,
#~ "{0:16} {1:^{width}}{2:^{width}}{3:^{width}}{4:^{width}}".format(
#~ _("Default %"),
#~ '0',
#~ limits.getSTDCareful(),
#~ limits.getSTDWarning(),
#~ limits.getSTDCritical(),
#~ width=width), 79)
limits_table_y += 1
self.term_window.addnstr(
limits_table_y, limits_table_x,
@ -3274,10 +3288,10 @@ def printVersion():
def printSyntax():
printVersion()
print(_("Usage: glances [-f file] [-o output] [-t sec] [-h] [-v] ..."))
print("")
print(_("Usage: glances [opt]"))
print(_(" with opt:"))
print(_("\t-b\t\tDisplay network rate in Byte per second"))
print(_("\t-B IP|NAME\tBind server to the given IP or host NAME"))
print(_("\t-B @IP|host\tBind server to the given IP or host NAME"))
print(_("\t-c @IP|host\tConnect to a Glances server"))
print(_("\t-C file\t\tPath to the configuration file (default: %s)") %
default_conf_file)
@ -3299,7 +3313,6 @@ def printSyntax():
def end():
if server_tag:
# Stop the server loop
#~ print(_("Stop Glances server"))
server.server_close()
else:
if client_tag: