mirror of https://github.com/nicolargo/glances
Improve the QuickLookplugin by adding hardware CPU info (issue #673)
parent
e068f41908
commit
2507941951
3
NEWS
3
NEWS
|
@ -11,8 +11,9 @@ Enhancements and new features:
|
||||||
* Docker plugin shows IO and network bitrate (issue #520)
|
* Docker plugin shows IO and network bitrate (issue #520)
|
||||||
* Server password configuration for the browser mode (issue #500)
|
* Server password configuration for the browser mode (issue #500)
|
||||||
* Add support for OpenTSDB export (issue #638)
|
* Add support for OpenTSDB export (issue #638)
|
||||||
* Add additional stats (iowait, steal) to the perCPU plugin (issue #672)
|
* Add additional stats (iowait, steal) to the perCPU plugin (issue #672)
|
||||||
* Support Fahrenheit unit in the sensor plugin using the --fahrenheit command line option (issue #620)
|
* Support Fahrenheit unit in the sensor plugin using the --fahrenheit command line option (issue #620)
|
||||||
|
* Improve the QuickLookplugin by adding hardware CPU info (issue #673)
|
||||||
* WebUI display a message if server is not available (issue #564)
|
* WebUI display a message if server is not available (issue #564)
|
||||||
* Display an error if export is not used in the standalone/client mode (issue #614)
|
* Display an error if export is not used in the standalone/client mode (issue #614)
|
||||||
* New --disable-quicklook, --disable-cpu, --disable-mem, --disable-swap, --disable-load tags (issue #631)
|
* New --disable-quicklook, --disable-cpu, --disable-mem, --disable-swap, --disable-load tags (issue #631)
|
||||||
|
|
|
@ -25,6 +25,12 @@ from glances.plugins.glances_plugin import GlancesPlugin
|
||||||
from glances.core.glances_logging import logger
|
from glances.core.glances_logging import logger
|
||||||
|
|
||||||
import psutil
|
import psutil
|
||||||
|
try:
|
||||||
|
from cpuinfo import cpuinfo
|
||||||
|
except ImportError:
|
||||||
|
cpuinfo_tag = False
|
||||||
|
else:
|
||||||
|
cpuinfo_tag = True
|
||||||
|
|
||||||
|
|
||||||
class Plugin(GlancesPlugin):
|
class Plugin(GlancesPlugin):
|
||||||
|
@ -66,6 +72,14 @@ class Plugin(GlancesPlugin):
|
||||||
# Not available
|
# Not available
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
# Optionnaly, get the CPU name/frequency
|
||||||
|
# thanks to the cpuinfo lib: https://github.com/workhorsy/py-cpuinfo
|
||||||
|
if cpuinfo_tag:
|
||||||
|
cpu_info = cpuinfo.get_cpu_info()
|
||||||
|
self.stats['cpu_name'] = cpu_info['brand']
|
||||||
|
self.stats['cpu_hz_current'] = cpu_info['hz_actual_raw'][0]
|
||||||
|
self.stats['cpu_hz'] = cpu_info['hz_advertised_raw'][0]
|
||||||
|
|
||||||
# Update the view
|
# Update the view
|
||||||
self.update_views()
|
self.update_views()
|
||||||
|
|
||||||
|
@ -95,6 +109,13 @@ class Plugin(GlancesPlugin):
|
||||||
bar = Bar(max_width)
|
bar = Bar(max_width)
|
||||||
|
|
||||||
# Build the string message
|
# Build the string message
|
||||||
|
if 'cpu_name' in self.stats:
|
||||||
|
msg = '{0} - {1:.2f}/{2:.2f}GHz'.format(self.stats['cpu_name'],
|
||||||
|
self._hz_to_ghz(self.stats['cpu_hz_current']),
|
||||||
|
self._hz_to_ghz(self.stats['cpu_hz']))
|
||||||
|
if len(msg) - 6 <= max_width:
|
||||||
|
ret.append(self.curse_add_line(msg))
|
||||||
|
ret.append(self.curse_new_line())
|
||||||
for key in ['cpu', 'mem', 'swap']:
|
for key in ['cpu', 'mem', 'swap']:
|
||||||
if key == 'cpu' and args.percpu:
|
if key == 'cpu' and args.percpu:
|
||||||
for cpu in self.stats['percpu']:
|
for cpu in self.stats['percpu']:
|
||||||
|
@ -129,3 +150,7 @@ class Plugin(GlancesPlugin):
|
||||||
|
|
||||||
# Return the message with decoration
|
# Return the message with decoration
|
||||||
return ret
|
return ret
|
||||||
|
|
||||||
|
def _hz_to_ghz(self, hz):
|
||||||
|
"""Convert Hz to Ghz"""
|
||||||
|
return hz / 1000000000.0
|
||||||
|
|
3
setup.py
3
setup.py
|
@ -54,7 +54,8 @@ setup(
|
||||||
'RAID': ['pymdstat'],
|
'RAID': ['pymdstat'],
|
||||||
'DOCKER': ['docker-py'],
|
'DOCKER': ['docker-py'],
|
||||||
'EXPORT': ['influxdb>=1.0.0', 'statsd', 'pika'],
|
'EXPORT': ['influxdb>=1.0.0', 'statsd', 'pika'],
|
||||||
'ACTION': ['pystache']
|
'ACTION': ['pystache'],
|
||||||
|
'CPUINFO': ['py-cpuinfo']
|
||||||
},
|
},
|
||||||
packages=['glances'],
|
packages=['glances'],
|
||||||
include_package_data=True,
|
include_package_data=True,
|
||||||
|
|
Loading…
Reference in New Issue