mirror of
https://github.com/nicolargo/glances.git
synced 2024-12-24 09:44:48 +03:00
version 1.3.1
This commit is contained in:
parent
cb07b4a8b3
commit
549bca1b86
6
NEWS
6
NEWS
@ -1,3 +1,9 @@
|
||||
Version 1.3.1
|
||||
=============
|
||||
|
||||
* Add alert on load (depend on number of CPU core)
|
||||
* Fix bug when the FS list is very long
|
||||
|
||||
Version 1.3
|
||||
===========
|
||||
|
||||
|
6
README
6
README
@ -14,12 +14,12 @@ Glances is developed in Python and uses the python-statgrab lib.
|
||||
|
||||
Get the latest version:
|
||||
|
||||
$ wget https://github.com/downloads/nicolargo/glances/glances-1.3.tar.gz
|
||||
$ wget https://github.com/downloads/nicolargo/glances/glances-1.3.1.tar.gz
|
||||
|
||||
Glances use a standard GNU style installer:
|
||||
|
||||
$ tar zxvf glances-1.3.tar.gz
|
||||
$ cd glances-1.3
|
||||
$ tar zxvf glances-1.3.1.tar.gz
|
||||
$ cd glances-1.3.1
|
||||
$ ./configure
|
||||
$ make
|
||||
$ sudo make install
|
||||
|
84
README.md
84
README.md
@ -1,84 +0,0 @@
|
||||
Glances -- Eye on your system
|
||||
=============================
|
||||
|
||||
## Description
|
||||
|
||||
Glances is a CLI curses based monitoring tool for both GNU/Linux and BSD.
|
||||
|
||||
Glances uses the libstatgrab library to get information from your system.
|
||||
Glances is developed in Python and uses the python-statgrab lib.
|
||||
|
||||
![screenshot](https://github.com/nicolargo/glances/raw/master/screenshot.png)
|
||||
|
||||
## Installation
|
||||
|
||||
Get the latest version:
|
||||
|
||||
$ wget https://github.com/downloads/nicolargo/glances/glances-1.3.tar.gz
|
||||
|
||||
Glances use a standard GNU style installer:
|
||||
|
||||
$ tar zxvf glances-1.3.tar.gz
|
||||
$ cd glances-1.3
|
||||
$ ./configure
|
||||
$ make
|
||||
$ sudo make install
|
||||
|
||||
Pre-requisites:
|
||||
|
||||
* Python 2.6+ (not tested with Python 3+)
|
||||
* python-statgrab 0.5+ (did not work with python-statgrab 0.4)
|
||||
|
||||
Notes: The Debian Squeeze repos only include the python-statgrab 0.4.
|
||||
You had to install the version 0.5 using the following commands:
|
||||
|
||||
$ sudo apt-get install libstatgrab-dev pkg-config python-dev make
|
||||
$ wget http://ftp.uk.i-scream.org/sites/ftp.i-scream.org/pub/i-scream/pystatgrab/pystatgrab-0.5.tar.gz
|
||||
$ tar zxvf pystatgrab-0.5.tar.gz
|
||||
$ cd pystatgrab-0.5/
|
||||
$ ./setup.py build
|
||||
$ sudo ./setup.py install
|
||||
|
||||
Notes: Ubuntu 10.04 and 10.10.
|
||||
The instruction to install the version 0.5 are here: https://github.com/nicolargo/glances/issues/5#issuecomment-3033194
|
||||
|
||||
## Running
|
||||
|
||||
Easy:
|
||||
|
||||
$ glances.py
|
||||
|
||||
## User guide
|
||||
|
||||
By default, stats are refrsh every second, to change this setting, you can
|
||||
use the -t option. For exemple to set the refrech rate to 5 seconds:
|
||||
|
||||
$ glances.py -t 5
|
||||
|
||||
Importants stats are colored:
|
||||
|
||||
* GREEN: stat counter is < 50%
|
||||
* BLUE: stat counter is > 50% and < 70%
|
||||
* MAGENTA: stat counter is > 70% and < 90%
|
||||
* RED: stat counter is > 90%
|
||||
|
||||
When Glances is running, you can press:
|
||||
|
||||
* 'a' to set the automatic mode. The process list is sorted automatically
|
||||
|
||||
If CPU > 70%, sort by process CPU consomption
|
||||
|
||||
If MEM > 70%, sort by process size
|
||||
|
||||
* 'c' the processes list is sorted by CPU consomption
|
||||
* 'm' the processes list is sorted by process size
|
||||
* 'q' Exit
|
||||
|
||||
## Todo
|
||||
|
||||
You are welcome to contribute to this software.
|
||||
|
||||
* Packaging for Debian, Ubuntu, Fedora, Redhat, BSD...
|
||||
* Check the needed Python library in the configure.ac
|
||||
* Add file system stats when the python-statgrab is corrected
|
||||
* Add a user guide window
|
@ -1,7 +1,7 @@
|
||||
dnl Process this file with autoconf to produce a configure script.
|
||||
dnl Created by Anjuta application wizard.
|
||||
|
||||
AC_INIT(Glances, 1.3, , glances)
|
||||
AC_INIT(Glances, 1.3.1, , glances)
|
||||
|
||||
AC_CONFIG_HEADERS([config.h])
|
||||
|
||||
|
2
setup.py
2
setup.py
@ -11,7 +11,7 @@ def read(fname):
|
||||
return open(os.path.join(os.path.dirname(__file__), fname)).read()
|
||||
|
||||
setup( name='Glances',
|
||||
version='1.3',
|
||||
version='1.3.1',
|
||||
description='CLI curses-based monitoring tool',
|
||||
author='Nicolas Hennion',
|
||||
author_email='nicolas@nicolargo.com',
|
||||
|
@ -27,13 +27,14 @@ import time
|
||||
import datetime
|
||||
import curses
|
||||
import statgrab
|
||||
import multiprocessing
|
||||
|
||||
|
||||
# Globals variables
|
||||
#==================
|
||||
|
||||
# The glances version id
|
||||
__version__ = "1.3"
|
||||
__version__ = "1.3.1"
|
||||
|
||||
# Class
|
||||
#======
|
||||
@ -68,7 +69,7 @@ class glancesGrabFs():
|
||||
self.fs_list = []
|
||||
|
||||
# Ignore the following fs
|
||||
ignore_fsname = ('none', 'gvfs-fuse-daemon', 'fusectl')
|
||||
ignore_fsname = ('none', 'gvfs-fuse-daemon', 'fusectl', 'cgroup')
|
||||
ignore_fstype = ('binfmt_misc', 'devpts', 'iso9660', 'none', 'proc', 'sysfs', 'usbfs')
|
||||
|
||||
# Open the current mounted FS
|
||||
@ -89,7 +90,7 @@ class glancesGrabFs():
|
||||
fs_current['avail'] = float(fs_stats.f_bfree) * long(fs_stats.f_frsize)
|
||||
self.fs_list.append(fs_current)
|
||||
mtab.close()
|
||||
|
||||
|
||||
|
||||
def __getmount__(self, path):
|
||||
"""
|
||||
@ -148,7 +149,11 @@ class glancesStats():
|
||||
self.fs = self.glancesgrabfs.get()
|
||||
self.processcount = statgrab.sg_get_process_count()
|
||||
self.process = statgrab.sg_get_process_stats()
|
||||
self.now = datetime.datetime.now()
|
||||
self.now = datetime.datetime.now()
|
||||
|
||||
# Get the number of core (CPU)
|
||||
# Used to display load alerts
|
||||
self.core_number = multiprocessing.cpu_count()
|
||||
|
||||
|
||||
def end(self):
|
||||
@ -172,6 +177,10 @@ class glancesStats():
|
||||
def getCpu(self):
|
||||
return self.cpu
|
||||
|
||||
|
||||
def getCore(self):
|
||||
return self.core_number
|
||||
|
||||
|
||||
def getLoad(self):
|
||||
return self.load
|
||||
@ -347,6 +356,35 @@ class glancesScreen():
|
||||
else:
|
||||
return 0
|
||||
|
||||
|
||||
def __getLoadColor(self, current = 0, core = 1):
|
||||
# core is the number of CPU core
|
||||
# If current > 0.7*core then color = self.if50pc_color / A_DIM
|
||||
# If current > 1.0*core then color = self.if70pc_color / A_BOLD
|
||||
# If current > 5.0*core then color = self.if90pc_color / A_REVERSE
|
||||
# By default: color = self.default_color / 0
|
||||
|
||||
if current > (5.0 * core):
|
||||
if self.hascolors:
|
||||
return self.if90pc_color
|
||||
else:
|
||||
return curses.A_REVERSE
|
||||
elif current > (1.0 * core):
|
||||
if self.hascolors:
|
||||
return self.if70pc_color
|
||||
else:
|
||||
return curses.A_BOLD
|
||||
elif current > (0.7 * core):
|
||||
if self.hascolors:
|
||||
return self.if50pc_color
|
||||
else:
|
||||
return curses.A_DIM
|
||||
else:
|
||||
if self.hascolors:
|
||||
return self.default_color
|
||||
else:
|
||||
return 0
|
||||
|
||||
|
||||
def __catchKey(self):
|
||||
# Get key
|
||||
@ -383,7 +421,7 @@ class glancesScreen():
|
||||
screen.displayHost(stats.getHost())
|
||||
screen.displaySystem(stats.getSystem())
|
||||
screen.displayCpu(stats.getCpu())
|
||||
screen.displayLoad(stats.getLoad())
|
||||
screen.displayLoad(stats.getLoad(), stats.getCore())
|
||||
screen.displayMem(stats.getMem(), stats.getMemSwap())
|
||||
net_count = screen.displayNetwork(stats.getNetwork())
|
||||
disk_count = screen.displayDiskIO(stats.getDiskIO(), net_count)
|
||||
@ -455,20 +493,20 @@ class glancesScreen():
|
||||
self.term_window.addnstr(self.cpu_y+4, self.cpu_x+10, "%.1f" % cpu['idle'], 8)
|
||||
|
||||
|
||||
def displayLoad(self, load):
|
||||
def displayLoad(self, load, core):
|
||||
# Load %
|
||||
screen_x = self.screen.getmaxyx()[1]
|
||||
screen_y = self.screen.getmaxyx()[0]
|
||||
if ((screen_y > self.load_y+5)
|
||||
and (screen_x > self.load_x+18)):
|
||||
self.term_window.addnstr(self.load_y, self.load_x, "Load", 8, self.title_color if self.hascolors else curses.A_UNDERLINE)
|
||||
self.term_window.addnstr(self.load_y, self.load_x+10,"", 8)
|
||||
self.term_window.addnstr(self.load_y, self.load_x, "Load", 8, self.title_color if self.hascolors else curses.A_UNDERLINE)
|
||||
self.term_window.addnstr(self.load_y, self.load_x+10, str(core)+"-Core", 8)
|
||||
self.term_window.addnstr(self.load_y+1, self.load_x, "1 min:", 8)
|
||||
self.term_window.addnstr(self.load_y+2, self.load_x, "5 mins:", 8)
|
||||
self.term_window.addnstr(self.load_y+3, self.load_x, "15 mins:", 8)
|
||||
self.term_window.addnstr(self.load_y+1, self.load_x+10, str(load['min1']), 8)
|
||||
self.term_window.addnstr(self.load_y+2, self.load_x+10, str(load['min5']), 8)
|
||||
self.term_window.addnstr(self.load_y+3, self.load_x+10, str(load['min15']), 8)
|
||||
self.term_window.addnstr(self.load_y+2, self.load_x+10, str(load['min5']), 8, self.__getLoadColor(load['min5'], core))
|
||||
self.term_window.addnstr(self.load_y+3, self.load_x+10, str(load['min15']), 8, self.__getLoadColor(load['min15'], core))
|
||||
|
||||
|
||||
def displayMem(self, mem, memswap):
|
||||
@ -511,7 +549,7 @@ class glancesScreen():
|
||||
self.term_window.addnstr(self.network_y, self.network_x+20, "Tx/ps", 8)
|
||||
# Adapt the maximum interface to the screen
|
||||
interface = 0
|
||||
for interface in range(0, min(12+(screen_y-self.term_h), len(network))):
|
||||
for interface in range(0, min(screen_y-self.term_h, len(network))):
|
||||
elapsed_time = max (1, network[interface]['systime'])
|
||||
self.term_window.addnstr(self.network_y+1+interface, self.network_x, network[interface]['interface_name']+':', 8)
|
||||
self.term_window.addnstr(self.network_y+1+interface, self.network_x+10, self.__autoUnit(network[interface]['rx']/elapsed_time*8) + "b", 8)
|
||||
@ -532,7 +570,7 @@ class glancesScreen():
|
||||
self.term_window.addnstr(self.diskio_y, self.diskio_x+20, "Out/ps", 8)
|
||||
# Adapt the maximum disk to the screen
|
||||
disk = 0
|
||||
for disk in range(0, min(11+(screen_y-self.term_h), len(diskio))):
|
||||
for disk in range(0, min(screen_y-self.term_h, len(diskio))):
|
||||
elapsed_time = max(1, diskio[disk]['systime'])
|
||||
self.term_window.addnstr(self.diskio_y+1+disk, self.diskio_x, diskio[disk]['disk_name']+':', 8)
|
||||
self.term_window.addnstr(self.diskio_y+1+disk, self.diskio_x+10, self.__autoUnit(diskio[disk]['write_bytes']/elapsed_time) + "B", 8)
|
||||
@ -553,7 +591,7 @@ class glancesScreen():
|
||||
self.term_window.addnstr(self.fs_y, self.fs_x+20, "Used", 8)
|
||||
# Adapt the maximum disk to the screen
|
||||
mounted = 0
|
||||
for mounted in range(0, min(11+(screen_y-self.term_h), len(fs))):
|
||||
for mounted in range(0, min(screen_y-self.term_h, len(fs))):
|
||||
self.term_window.addnstr(self.fs_y+1+mounted, self.fs_x, fs[mounted]['mnt_point'], 8)
|
||||
self.term_window.addnstr(self.fs_y+1+mounted, self.fs_x+10, self.__autoUnit(fs[mounted]['size']), 8)
|
||||
self.term_window.addnstr(self.fs_y+1+mounted, self.fs_x+20, self.__autoUnit(fs[mounted]['used']), 8, self.__getColor(fs[mounted]['used'], fs[mounted]['size']))
|
||||
|
Loading…
Reference in New Issue
Block a user