mirror of https://github.com/nicolargo/glances
Handle no-permission when checking IRQs on Alpine Linux (#962)
parent
4e3ce5ef42
commit
c24cca191d
|
@ -194,25 +194,28 @@ class GlancesIRQ(object):
|
|||
# Correct issue #947: IRQ file do not exist on OpenVZ container
|
||||
return self.stats
|
||||
|
||||
with open(self.IRQ_FILE) as irq_proc:
|
||||
time_since_update = getTimeSinceLastUpdate('irq')
|
||||
# Read the header
|
||||
self.__header(irq_proc.readline())
|
||||
# Read the rest of the lines (one line per IRQ)
|
||||
for line in irq_proc.readlines():
|
||||
irq_line = self.__humanname(line)
|
||||
current_irqs = self.__sum(line)
|
||||
irq_rate = int(
|
||||
current_irqs -
|
||||
self.lasts.get(irq_line) if self.lasts.get(irq_line) else 0 //
|
||||
time_since_update)
|
||||
irq_current = {
|
||||
'irq_line': irq_line,
|
||||
'irq_rate': irq_rate,
|
||||
'key': self.get_key(),
|
||||
'time_since_update': time_since_update
|
||||
}
|
||||
self.stats.append(irq_current)
|
||||
self.lasts[irq_line] = current_irqs
|
||||
try:
|
||||
with open(self.IRQ_FILE) as irq_proc:
|
||||
time_since_update = getTimeSinceLastUpdate('irq')
|
||||
# Read the header
|
||||
self.__header(irq_proc.readline())
|
||||
# Read the rest of the lines (one line per IRQ)
|
||||
for line in irq_proc.readlines():
|
||||
irq_line = self.__humanname(line)
|
||||
current_irqs = self.__sum(line)
|
||||
irq_rate = int(
|
||||
current_irqs - self.lasts.get(irq_line)
|
||||
if self.lasts.get(irq_line)
|
||||
else 0 // time_since_update)
|
||||
irq_current = {
|
||||
'irq_line': irq_line,
|
||||
'irq_rate': irq_rate,
|
||||
'key': self.get_key(),
|
||||
'time_since_update': time_since_update
|
||||
}
|
||||
self.stats.append(irq_current)
|
||||
self.lasts[irq_line] = current_irqs
|
||||
except (OSError, IOError):
|
||||
pass
|
||||
|
||||
return self.stats
|
||||
|
|
Loading…
Reference in New Issue