提交 b7df2051 编写于 作者: N Nicolargo

Alarm for DiskIO plugin

上级 0ab38218
......@@ -14,7 +14,8 @@ Enhancements and news features:
* The Web inteface is now based on BootStarp / RWD grid (issue #417, #366 and #461) Thanks to Nicolas Hart @nclsHart
* Add the RAID plugin (issue #447)
* Add the Docker plugin (issue #440)
* It is possible to define (through teh configuration file) if an alarm should be logged or not (using the _log option) (issue #437)
* It is possible, through the configuration file, to define if an alarm should be logged or not (using the _log option) (issue #437)
* You can now set alarm for Disk IO
Bugs corrected:
......
......@@ -56,7 +56,7 @@ critical=90
# Define the list of hidden network interfaces (comma separeted)
hide=lo
# WLAN0 alias name
#wlan0_alias=Wireless
wlan0_alias=Wireless
# WLAN0 Default limits (in bits per second aka bps) for interface bitrate
wlan0_rx_careful=4000000
wlan0_rx_warning=5000000
......@@ -69,9 +69,19 @@ wlan0_tx_log=True
[diskio]
# Define the list of hidden disks (comma separeted)
hide=sda2,sda5
hide=sda5
# Alias for sda1
#sda1_alias=IntDisk
# SDA1 limits (in bytes per second aka Bps) for interface bitrate
sda2_rx_careful=150000000
sda2_rx_warning=180000000
sda2_rx_critical=200000000
#sda2_rx_log=True
sda2_tx_careful=150000000
sda2_tx_warning=180000000
sda2_tx_critical=200000000
#sda2_tx_log=True
[fs]
# Default limits for free filesytem space in %
......
......@@ -43,7 +43,8 @@ class Plugin(GlancesPlugin):
def __init__(self, args=None):
"""Init the plugin."""
GlancesPlugin.__init__(self, args=args, items_history_list=items_history_list)
GlancesPlugin.__init__(
self, args=args, items_history_list=items_history_list)
# We want to display the stat in the curse interface
self.display_curse = True
......@@ -146,9 +147,10 @@ class Plugin(GlancesPlugin):
if self.is_hide(i['disk_name']):
continue
# Is there an alias for the disk name ?
disk_real_name = i['disk_name']
disk_name = self.has_alias(i['disk_name'])
if disk_name is None:
disk_name = i['disk_name']
disk_name = disk_real_name
# New line
ret.append(self.curse_new_line())
if len(disk_name) > 9:
......@@ -156,11 +158,17 @@ class Plugin(GlancesPlugin):
disk_name = '_' + disk_name[-8:]
msg = '{0:9}'.format(disk_name)
ret.append(self.curse_add_line(msg))
txps = self.auto_unit(int(i['read_bytes'] // i['time_since_update']))
rxps = self.auto_unit(int(i['write_bytes'] // i['time_since_update']))
txps = self.auto_unit(
int(i['read_bytes'] // i['time_since_update']))
rxps = self.auto_unit(
int(i['write_bytes'] // i['time_since_update']))
msg = '{0:>7}'.format(txps)
ret.append(self.curse_add_line(msg))
ret.append(self.curse_add_line(msg,
self.get_alert(int(i['read_bytes'] // i['time_since_update']),
header=disk_real_name + '_rx')))
msg = '{0:>7}'.format(rxps)
ret.append(self.curse_add_line(msg))
ret.append(self.curse_add_line(msg,
self.get_alert(int(i['write_bytes'] // i['time_since_update']),
header=disk_real_name + '_tx')))
return ret
......@@ -236,9 +236,10 @@ class Plugin(GlancesPlugin):
continue
# Format stats
# Is there an alias for the interface name ?
ifrealname = i['interface_name'].split(':')[0]
ifname = self.has_alias(i['interface_name'])
if ifname is None:
ifname = i['interface_name'].split(':')[0]
ifname = ifrealname
if len(ifname) > ifname_max_width:
# Cut interface name if it is too long
ifname = '_' + ifname[-ifname_max_width + 1:]
......@@ -277,10 +278,10 @@ class Plugin(GlancesPlugin):
msg = '{0:>7}'.format(rx)
ret.append(self.curse_add_line(
msg, self.get_alert(int(i['rx'] // i['time_since_update'] * 8),
header=ifname + '_rx')))
header=ifrealname + '_rx')))
msg = '{0:>7}'.format(tx)
ret.append(self.curse_add_line(
msg, self.get_alert(int(i['tx'] // i['time_since_update'] * 8),
header=ifname + '_tx')))
header=ifrealname + '_tx')))
return ret
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册