Skip to content
This repository
Browse code

version 1.3.1

  • Loading branch information...
commit 549bca1b8618ae7da19322a690c9b7e7d3318cf9 1 parent cb07b4a
nicolargo authored
6 NEWS
... ... @@ -1,3 +1,9 @@
  1 +Version 1.3.1
  2 +=============
  3 +
  4 + * Add alert on load (depend on number of CPU core)
  5 + * Fix bug when the FS list is very long
  6 +
1 7 Version 1.3
2 8 ===========
3 9
6 README
@@ -14,12 +14,12 @@ Glances is developed in Python and uses the python-statgrab lib.
14 14
15 15 Get the latest version:
16 16
17   - $ wget https://github.com/downloads/nicolargo/glances/glances-1.3.tar.gz
  17 + $ wget https://github.com/downloads/nicolargo/glances/glances-1.3.1.tar.gz
18 18
19 19 Glances use a standard GNU style installer:
20 20
21   - $ tar zxvf glances-1.3.tar.gz
22   - $ cd glances-1.3
  21 + $ tar zxvf glances-1.3.1.tar.gz
  22 + $ cd glances-1.3.1
23 23 $ ./configure
24 24 $ make
25 25 $ sudo make install
84 README.md
Source Rendered
... ... @@ -1,84 +0,0 @@
1   -Glances -- Eye on your system
2   -=============================
3   -
4   -## Description
5   -
6   -Glances is a CLI curses based monitoring tool for both GNU/Linux and BSD.
7   -
8   -Glances uses the libstatgrab library to get information from your system.
9   -Glances is developed in Python and uses the python-statgrab lib.
10   -
11   -![screenshot](https://github.com/nicolargo/glances/raw/master/screenshot.png)
12   -
13   -## Installation
14   -
15   -Get the latest version:
16   -
17   - $ wget https://github.com/downloads/nicolargo/glances/glances-1.3.tar.gz
18   -
19   -Glances use a standard GNU style installer:
20   -
21   - $ tar zxvf glances-1.3.tar.gz
22   - $ cd glances-1.3
23   - $ ./configure
24   - $ make
25   - $ sudo make install
26   -
27   -Pre-requisites:
28   -
29   -* Python 2.6+ (not tested with Python 3+)
30   -* python-statgrab 0.5+ (did not work with python-statgrab 0.4)
31   -
32   -Notes: The Debian Squeeze repos only include the python-statgrab 0.4.
33   -You had to install the version 0.5 using the following commands:
34   -
35   - $ sudo apt-get install libstatgrab-dev pkg-config python-dev make
36   - $ wget http://ftp.uk.i-scream.org/sites/ftp.i-scream.org/pub/i-scream/pystatgrab/pystatgrab-0.5.tar.gz
37   - $ tar zxvf pystatgrab-0.5.tar.gz
38   - $ cd pystatgrab-0.5/
39   - $ ./setup.py build
40   - $ sudo ./setup.py install
41   -
42   -Notes: Ubuntu 10.04 and 10.10.
43   -The instruction to install the version 0.5 are here: https://github.com/nicolargo/glances/issues/5#issuecomment-3033194
44   -
45   -## Running
46   -
47   -Easy:
48   -
49   - $ glances.py
50   -
51   -## User guide
52   -
53   -By default, stats are refrsh every second, to change this setting, you can
54   -use the -t option. For exemple to set the refrech rate to 5 seconds:
55   -
56   - $ glances.py -t 5
57   -
58   -Importants stats are colored:
59   -
60   -* GREEN: stat counter is < 50%
61   -* BLUE: stat counter is > 50% and < 70%
62   -* MAGENTA: stat counter is > 70% and < 90%
63   -* RED: stat counter is > 90%
64   -
65   -When Glances is running, you can press:
66   -
67   -* 'a' to set the automatic mode. The process list is sorted automatically
68   -
69   - If CPU > 70%, sort by process CPU consomption
70   -
71   - If MEM > 70%, sort by process size
72   -
73   -* 'c' the processes list is sorted by CPU consomption
74   -* 'm' the processes list is sorted by process size
75   -* 'q' Exit
76   -
77   -## Todo
78   -
79   -You are welcome to contribute to this software.
80   -
81   -* Packaging for Debian, Ubuntu, Fedora, Redhat, BSD...
82   -* Check the needed Python library in the configure.ac
83   -* Add file system stats when the python-statgrab is corrected
84   -* Add a user guide window
1  README.md
Source Rendered
2  configure.ac
... ... @@ -1,7 +1,7 @@
1 1 dnl Process this file with autoconf to produce a configure script.
2 2 dnl Created by Anjuta application wizard.
3 3
4   -AC_INIT(Glances, 1.3, , glances)
  4 +AC_INIT(Glances, 1.3.1, , glances)
5 5
6 6 AC_CONFIG_HEADERS([config.h])
7 7
2  setup.py
@@ -11,7 +11,7 @@ def read(fname):
11 11 return open(os.path.join(os.path.dirname(__file__), fname)).read()
12 12
13 13 setup( name='Glances',
14   - version='1.3',
  14 + version='1.3.1',
15 15 description='CLI curses-based monitoring tool',
16 16 author='Nicolas Hennion',
17 17 author_email='nicolas@nicolargo.com',
64 src/glances.py
@@ -27,13 +27,14 @@
27 27 import datetime
28 28 import curses
29 29 import statgrab
  30 +import multiprocessing
30 31
31 32
32 33 # Globals variables
33 34 #==================
34 35
35 36 # The glances version id
36   -__version__ = "1.3"
  37 +__version__ = "1.3.1"
37 38
38 39 # Class
39 40 #======
@@ -68,7 +69,7 @@ def __update__(self):
68 69 self.fs_list = []
69 70
70 71 # Ignore the following fs
71   - ignore_fsname = ('none', 'gvfs-fuse-daemon', 'fusectl')
  72 + ignore_fsname = ('none', 'gvfs-fuse-daemon', 'fusectl', 'cgroup')
72 73 ignore_fstype = ('binfmt_misc', 'devpts', 'iso9660', 'none', 'proc', 'sysfs', 'usbfs')
73 74
74 75 # Open the current mounted FS
@@ -89,7 +90,7 @@ def __update__(self):
89 90 fs_current['avail'] = float(fs_stats.f_bfree) * long(fs_stats.f_frsize)
90 91 self.fs_list.append(fs_current)
91 92 mtab.close()
92   -
  93 +
93 94
94 95 def __getmount__(self, path):
95 96 """
@@ -148,7 +149,11 @@ def __update__(self):
148 149 self.fs = self.glancesgrabfs.get()
149 150 self.processcount = statgrab.sg_get_process_count()
150 151 self.process = statgrab.sg_get_process_stats()
151   - self.now = datetime.datetime.now()
  152 + self.now = datetime.datetime.now()
  153 +
  154 + # Get the number of core (CPU)
  155 + # Used to display load alerts
  156 + self.core_number = multiprocessing.cpu_count()
152 157
153 158
154 159 def end(self):
@@ -172,6 +177,10 @@ def getSystem(self):
172 177 def getCpu(self):
173 178 return self.cpu
174 179
  180 +
  181 + def getCore(self):
  182 + return self.core_number
  183 +
175 184
176 185 def getLoad(self):
177 186 return self.load
@@ -347,6 +356,35 @@ def __getColor(self, current = 0, max = 100):
347 356 else:
348 357 return 0
349 358
  359 +
  360 + def __getLoadColor(self, current = 0, core = 1):
  361 + # core is the number of CPU core
  362 + # If current > 0.7*core then color = self.if50pc_color / A_DIM
  363 + # If current > 1.0*core then color = self.if70pc_color / A_BOLD
  364 + # If current > 5.0*core then color = self.if90pc_color / A_REVERSE
  365 + # By default: color = self.default_color / 0
  366 +
  367 + if current > (5.0 * core):
  368 + if self.hascolors:
  369 + return self.if90pc_color
  370 + else:
  371 + return curses.A_REVERSE
  372 + elif current > (1.0 * core):
  373 + if self.hascolors:
  374 + return self.if70pc_color
  375 + else:
  376 + return curses.A_BOLD
  377 + elif current > (0.7 * core):
  378 + if self.hascolors:
  379 + return self.if50pc_color
  380 + else:
  381 + return curses.A_DIM
  382 + else:
  383 + if self.hascolors:
  384 + return self.default_color
  385 + else:
  386 + return 0
  387 +
350 388
351 389 def __catchKey(self):
352 390 # Get key
@@ -383,7 +421,7 @@ def display(self, stats):
383 421 screen.displayHost(stats.getHost())
384 422 screen.displaySystem(stats.getSystem())
385 423 screen.displayCpu(stats.getCpu())
386   - screen.displayLoad(stats.getLoad())
  424 + screen.displayLoad(stats.getLoad(), stats.getCore())
387 425 screen.displayMem(stats.getMem(), stats.getMemSwap())
388 426 net_count = screen.displayNetwork(stats.getNetwork())
389 427 disk_count = screen.displayDiskIO(stats.getDiskIO(), net_count)
@@ -455,20 +493,20 @@ def displayCpu(self, cpu):
455 493 self.term_window.addnstr(self.cpu_y+4, self.cpu_x+10, "%.1f" % cpu['idle'], 8)
456 494
457 495
458   - def displayLoad(self, load):
  496 + def displayLoad(self, load, core):
459 497 # Load %
460 498 screen_x = self.screen.getmaxyx()[1]
461 499 screen_y = self.screen.getmaxyx()[0]
462 500 if ((screen_y > self.load_y+5)
463 501 and (screen_x > self.load_x+18)):
464   - self.term_window.addnstr(self.load_y, self.load_x, "Load", 8, self.title_color if self.hascolors else curses.A_UNDERLINE)
465   - self.term_window.addnstr(self.load_y, self.load_x+10,"", 8)
  502 + self.term_window.addnstr(self.load_y, self.load_x, "Load", 8, self.title_color if self.hascolors else curses.A_UNDERLINE)
  503 + self.term_window.addnstr(self.load_y, self.load_x+10, str(core)+"-Core", 8)
466 504 self.term_window.addnstr(self.load_y+1, self.load_x, "1 min:", 8)
467 505 self.term_window.addnstr(self.load_y+2, self.load_x, "5 mins:", 8)
468 506 self.term_window.addnstr(self.load_y+3, self.load_x, "15 mins:", 8)
469 507 self.term_window.addnstr(self.load_y+1, self.load_x+10, str(load['min1']), 8)
470   - self.term_window.addnstr(self.load_y+2, self.load_x+10, str(load['min5']), 8)
471   - self.term_window.addnstr(self.load_y+3, self.load_x+10, str(load['min15']), 8)
  508 + self.term_window.addnstr(self.load_y+2, self.load_x+10, str(load['min5']), 8, self.__getLoadColor(load['min5'], core))
  509 + self.term_window.addnstr(self.load_y+3, self.load_x+10, str(load['min15']), 8, self.__getLoadColor(load['min15'], core))
472 510
473 511
474 512 def displayMem(self, mem, memswap):
@@ -511,7 +549,7 @@ def displayNetwork(self, network):
511 549 self.term_window.addnstr(self.network_y, self.network_x+20, "Tx/ps", 8)
512 550 # Adapt the maximum interface to the screen
513 551 interface = 0
514   - for interface in range(0, min(12+(screen_y-self.term_h), len(network))):
  552 + for interface in range(0, min(screen_y-self.term_h, len(network))):
515 553 elapsed_time = max (1, network[interface]['systime'])
516 554 self.term_window.addnstr(self.network_y+1+interface, self.network_x, network[interface]['interface_name']+':', 8)
517 555 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 @@ def displayDiskIO(self, diskio, offset_y = 0):
532 570 self.term_window.addnstr(self.diskio_y, self.diskio_x+20, "Out/ps", 8)
533 571 # Adapt the maximum disk to the screen
534 572 disk = 0
535   - for disk in range(0, min(11+(screen_y-self.term_h), len(diskio))):
  573 + for disk in range(0, min(screen_y-self.term_h, len(diskio))):
536 574 elapsed_time = max(1, diskio[disk]['systime'])
537 575 self.term_window.addnstr(self.diskio_y+1+disk, self.diskio_x, diskio[disk]['disk_name']+':', 8)
538 576 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 @@ def displayFs(self, fs, offset_y = 0):
553 591 self.term_window.addnstr(self.fs_y, self.fs_x+20, "Used", 8)
554 592 # Adapt the maximum disk to the screen
555 593 mounted = 0
556   - for mounted in range(0, min(11+(screen_y-self.term_h), len(fs))):
  594 + for mounted in range(0, min(screen_y-self.term_h, len(fs))):
557 595 self.term_window.addnstr(self.fs_y+1+mounted, self.fs_x, fs[mounted]['mnt_point'], 8)
558 596 self.term_window.addnstr(self.fs_y+1+mounted, self.fs_x+10, self.__autoUnit(fs[mounted]['size']), 8)
559 597 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']))

0 comments on commit 549bca1

Please sign in to comment.
Something went wrong with that request. Please try again.