提交 2e3f4565 编写于 作者: N nicolargo

Merge branch 'issue947' into develop

......@@ -28,6 +28,7 @@ Bugs corrected:
* Glances RAID plugin Traceback (issue #927)
* Default AMP crashes when 'command' given (issue #933)
* Default AMP ignores `enable` setting (issue #932)
* /proc/interrupts not found in an OpenVZ container (issue #947)
Version 2.7.1
=============
......
......@@ -8,6 +8,8 @@ IRQ
Glances displays the top 5 interrupts rate. This plugin is only available on
GNU/Linux machine (stats are grabbed from the /proc/interrupts file).
Note: /proc/interrupts file did not exist inside OpenVZ containers.
How to read the informations:
* The first Column is the IRQ number / name
......
.\" Man page generated from reStructuredText.
.
.TH "GLANCES" "1" "Oct 22, 2016" "2.8_DEVELOP" "Glances"
.TH "GLANCES" "1" "Oct 30, 2016" "2.8_DEVELOP" "Glances"
.SH NAME
glances \- An eye on your system
.
......
......@@ -2,7 +2,7 @@
#
# This file is part of Glances.
#
# Copyright (C) 2015 Angelo Poerio <angelo.poerio@gmail.com>
# Copyright (C) 2016 Angelo Poerio <angelo.poerio@gmail.com>
#
# Glances is free software; you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public License as published by
......@@ -19,7 +19,9 @@
"""IRQ plugin."""
import os
import operator
from glances.globals import LINUX
from glances.timer import getTimeSinceLastUpdate
from glances.plugins.glances_plugin import GlancesPlugin
......@@ -32,6 +34,8 @@ class Plugin(GlancesPlugin):
stats is a list
"""
IRQ_FILE = '/proc/interrupts'
def __init__(self, args=None):
"""Init the plugin."""
super(Plugin, self).__init__(args=args)
......@@ -63,11 +67,14 @@ class Plugin(GlancesPlugin):
self.reset()
# IRQ plugin only available on GNU/Linux
if not LINUX or (self.args is not None and self.args.disable_irq):
# Correct issue #947: IRQ file do not exist on OpenVZ container
if not LINUX \
or (self.args is not None and self.args.disable_irq) \
or not os.path.exists(self.IRQ_FILE):
return self.stats
if self.input_method == 'local':
with open('/proc/interrupts') as irq_proc:
with open(self.IRQ_FILE) as irq_proc:
time_since_update = getTimeSinceLastUpdate('irq')
irq_proc.readline() # skip header line
for irq_line in irq_proc.readlines():
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册