summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authornicolargo <nicolas@nicolargo.com>2016-10-30 14:07:07 +0100
committernicolargo <nicolas@nicolargo.com>2016-10-30 14:07:07 +0100
commit540e840bbb07762275c3ac3a8987cc10651f6c06 (patch)
tree1bc3fca951e59633daebde25f49d3645e08b2104
parent6eb21d745a14839dcad8da327ec6877a19b340fc (diff)
/proc/interrupts not found when running Glances in an OpenVZ container #947
-rw-r--r--NEWS1
-rw-r--r--docs/aoa/irq.rst2
-rw-r--r--docs/man/glances.12
-rw-r--r--glances/plugins/glances_irq.py13
4 files changed, 14 insertions, 4 deletions
diff --git a/NEWS b/NEWS
index 7f28b57a..7baeb0a5 100644
--- a/NEWS
+++ b/NEWS
@@ -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
=============
diff --git a/docs/aoa/irq.rst b/docs/aoa/irq.rst
index 8df73c1e..6969bdc6 100644
--- a/docs/aoa/irq.rst
+++ b/docs/aoa/irq.rst
@@ -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
diff --git a/docs/man/glances.1 b/docs/man/glances.1
index a18df5b9..366b7a98 100644
--- a/docs/man/glances.1
+++ b/docs/man/glances.1
@@ -1,6 +1,6 @@
.\" 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
.
diff --git a/glances/plugins/glances_irq.py b/glances/plugins/glances_irq.py
index ae3019ab..b17198b0 100644
--- a/glances/plugins/glances_irq.py
+++ b/glances/plugins/glances_irq.py
@@ -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():