mirror of
https://github.com/nicolargo/glances.git
synced 2024-11-28 05:42:57 +03:00
/proc/interrupts not found when running Glances in an OpenVZ container #947
This commit is contained in:
parent
6eb21d745a
commit
540e840bbb
1
NEWS
1
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
|
||||
=============
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
.
|
||||
|
@ -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():
|
||||
|
Loading…
Reference in New Issue
Block a user