mirror of
https://github.com/nicolargo/glances.git
synced 2024-12-25 02:02:32 +03:00
version 1.3.5
This commit is contained in:
parent
5dcd6000fa
commit
e592521eed
6
NEWS
6
NEWS
@ -1,3 +1,9 @@
|
||||
Version 1.3.5
|
||||
=============
|
||||
|
||||
* Add an help panel when Glances is running (key: 'h')
|
||||
* Add keys descriptions in the syntax (--help | -h)
|
||||
|
||||
Version 1.3.4
|
||||
=============
|
||||
|
||||
|
7
README
7
README
@ -20,12 +20,12 @@ Packages exist for Arch, Fedora, Redhat ...
|
||||
|
||||
Get the latest version:
|
||||
|
||||
$ wget https://github.com/downloads/nicolargo/glances/glances-1.3.4.tar.gz
|
||||
$ wget https://github.com/downloads/nicolargo/glances/glances-1.3.5.tar.gz
|
||||
|
||||
Glances use a standard GNU style installer:
|
||||
|
||||
$ tar zxvf glances-1.3.4.tar.gz
|
||||
$ cd glances-1.3.4
|
||||
$ tar zxvf glances-1.3.5.tar.gz
|
||||
$ cd glances-1.3.5
|
||||
$ ./configure
|
||||
$ make
|
||||
$ sudo make install
|
||||
@ -72,6 +72,7 @@ Importants stats are colored:
|
||||
|
||||
When Glances is running, you can press:
|
||||
|
||||
* 'h' to display an help message whith the keys you can press
|
||||
* 'a' to set the automatic mode. The processes are sorted automatically
|
||||
|
||||
If CPU > 70%, sort by process "CPU consumption"
|
||||
|
@ -27,14 +27,14 @@ Le projet Glances est hébergé sur GitHUB: https://github.com/nicolargo/glances
|
||||
Pour l'installer, il suffit de suivre les instructions suivantes depuis un
|
||||
terminal.
|
||||
|
||||
Récupération de la dernière version (1.3.4):
|
||||
Récupération de la dernière version (1.3.5):
|
||||
|
||||
$ wget https://github.com/downloads/nicolargo/glances/glances-1.3.4.tar.gz
|
||||
$ wget https://github.com/downloads/nicolargo/glances/glances-1.3.5.tar.gz
|
||||
|
||||
Procédez ensuite à l'installation:
|
||||
|
||||
$ tar zxvf glances-1.3.4.tar.gz
|
||||
$ cd glances-1.3.4
|
||||
$ tar zxvf glances-1.3.5.tar.gz
|
||||
$ cd glances-1.3.5
|
||||
$ ./configure
|
||||
$ make
|
||||
$ sudo make install
|
||||
|
221
README.md
Normal file
221
README.md
Normal file
@ -0,0 +1,221 @@
|
||||
Glances -- Eye on your system
|
||||
=============================
|
||||
|
||||
## Description
|
||||
|
||||
Glances is a CLI curses based monitoring tool for GNU/Linux or BSD OS.
|
||||
|
||||
Glances uses the libstatgrab library to get information from your system.
|
||||
It is developed in Python and uses the python-statgrab lib.
|
||||
|
||||
![screenshot](https://github.com/nicolargo/glances/raw/master/screenshot.png)
|
||||
|
||||
## Installation
|
||||
|
||||
### From package manager
|
||||
|
||||
Packages exist for Arch, Fedora, Redhat ...
|
||||
|
||||
### From source
|
||||
|
||||
Get the latest version:
|
||||
|
||||
$ wget https://github.com/downloads/nicolargo/glances/glances-1.3.5.tar.gz
|
||||
|
||||
Glances use a standard GNU style installer:
|
||||
|
||||
$ tar zxvf glances-1.3.5.tar.gz
|
||||
$ cd glances-1.3.5
|
||||
$ ./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: For Debian.
|
||||
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: For 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 refreshed 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 "OK"
|
||||
* BLUE: stat counter is "CAREFUL"
|
||||
* MAGENTA: stat counter is "WARNING"
|
||||
* RED: stat counter is "CRITICAL"
|
||||
|
||||
When Glances is running, you can press:
|
||||
|
||||
* 'h' to display an help message whith the keys you can press
|
||||
* 'a' to set the automatic mode. The processes are sorted automatically
|
||||
|
||||
If CPU > 70%, sort by process "CPU consumption"
|
||||
|
||||
If MEM > 70%, sort by process "memory size"
|
||||
|
||||
* 'c' to sort the processes list by CPU consumption
|
||||
* 'd' Disable or enable the disk IO stats
|
||||
* 'f' Disable or enable the file system stats
|
||||
* 'm' to sort the processes list by process size
|
||||
* 'n' Disable or enable the network interfaces stats
|
||||
* 'q' Exit
|
||||
|
||||
### Header
|
||||
|
||||
![screenshot](https://github.com/nicolargo/glances/raw/master/doc/header.png)
|
||||
|
||||
The header shows the Glances version, the host name and the operating
|
||||
system name, version and architecture.
|
||||
|
||||
### CPU
|
||||
|
||||
![screenshot](https://github.com/nicolargo/glances/raw/master/doc/cpu.png)
|
||||
|
||||
The CPU states are shown as a percentage and for the configured refresh
|
||||
time.
|
||||
|
||||
If user|kernel|nice CPU is < 50%, then status is set to "OK".
|
||||
|
||||
If user|kernel|nice CPU is > 50%, then status is set to "CAREFUL".
|
||||
|
||||
If user|kernel|nice CPU is > 70%, then status is set to "WARNING".
|
||||
|
||||
If user|kernel|nice CPU is > 90%, then status is set to "CRITICAL".
|
||||
|
||||
### Load
|
||||
|
||||
![screenshot](https://github.com/nicolargo/glances/raw/master/doc/load.png)
|
||||
|
||||
On the Nosheep blog, Zach defines the average load: "In short it is the
|
||||
average sum of the number of processes waiting in the run-queue plus the
|
||||
number currently executing over 1, 5, and 15 minute time periods."
|
||||
|
||||
Glances gets the number of CPU cores to adapt the alerts. With Glances,
|
||||
alerts on average load are only set on 5 and 15 mins.
|
||||
|
||||
If average load is < O.7*Core, then status is set to "OK".
|
||||
|
||||
If average load is > O.7*Core, then status is set to "CAREFUL".
|
||||
|
||||
If average load is > 1*Core, then status is set to "WARNING".
|
||||
|
||||
If average load is > 5*Core, then status is set to "CRITICAL".
|
||||
|
||||
### Memory
|
||||
|
||||
![screenshot](https://github.com/nicolargo/glances/raw/master/doc/mem.png)
|
||||
|
||||
Glances uses tree columns: memory (RAM), swap and "real".
|
||||
|
||||
Real used memory is: used - cache.
|
||||
|
||||
Real free memory is: free + cache.
|
||||
|
||||
With Glances, alerts are only set for on used swap and real memory.
|
||||
|
||||
If memory is < 50%, then status is set to "OK".
|
||||
|
||||
If memory is > 50%, then status is set to "CAREFUL".
|
||||
|
||||
If memory is > 70%, then status is set to "WARNING".
|
||||
|
||||
If memory is > 90%, then status is set to "CRITICAL".
|
||||
|
||||
### Network bit rate
|
||||
|
||||
![screenshot](https://github.com/nicolargo/glances/raw/master/doc/network.png)
|
||||
|
||||
Glances display the network interface bit rate. The unit is adapted
|
||||
dynamicaly (bits per second, Kbits per second, Mbits per second...).
|
||||
|
||||
Alerts are set only if the network interface maximum speed is available.
|
||||
|
||||
If bitrate is < 50%, then status is set to "OK".
|
||||
|
||||
If bitrate is > 50%, then status is set to "CAREFUL".
|
||||
|
||||
If bitrate is > 70%, then status is set to "WARNING".
|
||||
|
||||
If bitrate is > 90%, then status is set to "CRITICAL".
|
||||
|
||||
For exemple, on a 100 Mbps Ethernet interface, the warning status is set
|
||||
if the bit rate is higher than 70 Mbps.
|
||||
|
||||
### Disk I/O
|
||||
|
||||
![screenshot](https://github.com/nicolargo/glances/raw/master/doc/diskio.png)
|
||||
|
||||
Glances display the disk I/O throughput. The unit is adapted dynamicaly
|
||||
(bytes per second, Kbytes per second, Mbytes per second...).
|
||||
|
||||
There is no alert on this information.
|
||||
|
||||
### Filesystem
|
||||
|
||||
![screenshot](https://github.com/nicolargo/glances/raw/master/doc/fs.png)
|
||||
|
||||
Glances display the total and used filesytem disk space. The unit is
|
||||
adapted dynamicaly (bytes per second, Kbytes per second, Mbytes per
|
||||
second...).
|
||||
|
||||
Alerts are set for used disk space:
|
||||
|
||||
If disk used is < 50%, then status is set to "OK".
|
||||
|
||||
If disk used is > 50%, then status is set to "CAREFUL".
|
||||
|
||||
If disk used is > 70%, then status is set to "WARNING".
|
||||
|
||||
If disk used is > 90%, then status is set to "CRITICAL".
|
||||
|
||||
### Processes
|
||||
|
||||
![screenshot](https://github.com/nicolargo/glances/raw/master/doc/processlist.png)
|
||||
|
||||
Glances displays a summary and a list of processes.
|
||||
|
||||
By default (or if you hit the 'a' key) the process list is automaticaly
|
||||
sorted by CPU of memory consumption.
|
||||
|
||||
The number of processes in the list is adapted to the screen size.
|
||||
|
||||
### Footer
|
||||
|
||||
![screenshot](https://github.com/nicolargo/glances/raw/master/doc/footer.png)
|
||||
|
||||
Glances displays a caption and the current time/date.
|
||||
|
||||
## Todo
|
||||
|
||||
You are welcome to contribute to this software.
|
||||
|
||||
* Packaging for Debian, Ubuntu, 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
|
3
TODO
3
TODO
@ -1,3 +1,2 @@
|
||||
- Packaging for .deb Linux distributions (contributors are welcome)
|
||||
- Packaging for .deb (Debian|Ubuntu|Mint) Linux distributions (contributors are welcomes)
|
||||
- Test/coding for xBSD
|
||||
- Help (with a curses.paneli object)
|
||||
|
@ -30,7 +30,7 @@ include-site-packages = false
|
||||
allowed-eggs-from-site-packages = false
|
||||
|
||||
[config]
|
||||
glances_version = 1.3.4
|
||||
glances_version = 1.3.5
|
||||
pystatgrab_version = 0.5
|
||||
pystatgrab_download_url = http://ftp.uk.i-scream.org/sites/ftp.i-scream.org/pub/i-scream/pystatgrab
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
.TH glances 1 "December 25, 2011" "version 1.3.4" "USER COMMANDS"
|
||||
.TH glances 1 "January, 2012" "version 1.3.5" "USER COMMANDS"
|
||||
.SH NAME
|
||||
glances \- CLI curses based monitoring tool
|
||||
.SH SYNOPSIS
|
||||
@ -20,6 +20,8 @@ You can use the following keys to sort the processesi list:
|
||||
'd' Disable or enable the disk IO stats
|
||||
.PP
|
||||
'f' Disable or enable the file system stats
|
||||
.PP
|
||||
'h' Hide or show the help message
|
||||
.PP
|
||||
'm' the processes list is sorted by process size
|
||||
.PP
|
||||
|
4
setup.py
4
setup.py
@ -11,8 +11,8 @@ def read(fname):
|
||||
return open(os.path.join(os.path.dirname(__file__), fname)).read()
|
||||
|
||||
setup( name='Glances',
|
||||
version='1.3.4',
|
||||
download_url='https://github.com/downloads/nicolargo/glances/glances-1.3.4.tar.gz',
|
||||
version='1.3.5',
|
||||
download_url='https://github.com/downloads/nicolargo/glances/glances-1.3.5.tar.gz',
|
||||
url='https://github.com/nicolargo/glances',
|
||||
description='CLI curses-based monitoring tool',
|
||||
author='Nicolas Hennion',
|
||||
|
112
src/glances.py
112
src/glances.py
@ -25,16 +25,22 @@ import sys
|
||||
import signal
|
||||
import time
|
||||
import datetime
|
||||
import curses
|
||||
import statgrab
|
||||
import multiprocessing
|
||||
|
||||
try:
|
||||
import curses
|
||||
import curses.panel
|
||||
except:
|
||||
print 'Textmode GUI initialization failed, Glances cannot start.'
|
||||
print
|
||||
sys.exit(1)
|
||||
|
||||
# Globals variables
|
||||
#==================
|
||||
|
||||
# The glances version id
|
||||
__version__ = "1.3.4"
|
||||
__version__ = "1.3.5"
|
||||
|
||||
# Class
|
||||
#======
|
||||
@ -283,7 +289,7 @@ class glancesScreen():
|
||||
self.__version = __version__
|
||||
|
||||
# Init windows positions
|
||||
self.term_h = 24 ; self.term_w = 80
|
||||
self.term_w = 80 ; self.term_h = 24
|
||||
self.host_x = 0 ; self.host_y = 0
|
||||
self.system_x = 0 ; self.system_y = 1
|
||||
self.cpu_x = 0 ; self.cpu_y = 3
|
||||
@ -293,6 +299,7 @@ class glancesScreen():
|
||||
self.diskio_x = 0 ; self.diskio_y = -1
|
||||
self.fs_x = 0 ; self.fs_y = -1
|
||||
self.process_x = 30; self.process_y = 9
|
||||
self.help_x = 30; self.help_y = 12
|
||||
self.now_x = 79; self.now_y = 3
|
||||
self.caption_x = 0 ; self.caption_y = 3
|
||||
|
||||
@ -308,8 +315,8 @@ class glancesScreen():
|
||||
self.hascolors = False
|
||||
if curses.has_colors():
|
||||
self.hascolors = True
|
||||
#Init FG color BG color
|
||||
curses.init_pair(1, curses.COLOR_WHITE, curses.COLOR_BLACK)
|
||||
# Init FG color BG color
|
||||
curses.init_pair(1, curses.COLOR_WHITE, -1)
|
||||
curses.init_pair(2, curses.COLOR_WHITE, curses.COLOR_RED)
|
||||
curses.init_pair(3, curses.COLOR_WHITE, curses.COLOR_GREEN)
|
||||
curses.init_pair(4, curses.COLOR_WHITE, curses.COLOR_BLUE)
|
||||
@ -319,6 +326,7 @@ class glancesScreen():
|
||||
|
||||
# Text colors/styles
|
||||
self.title_color = curses.A_BOLD|curses.A_UNDERLINE
|
||||
self.help_color = curses.A_BOLD
|
||||
self.no_color = curses.color_pair(1)
|
||||
self.default_color = curses.color_pair(3)|curses.A_BOLD
|
||||
self.if50pc_color = curses.color_pair(4)|curses.A_BOLD
|
||||
@ -330,9 +338,14 @@ class glancesScreen():
|
||||
self.diskio_tag = True
|
||||
self.fs_tag = True
|
||||
|
||||
# Init window
|
||||
# Init main window
|
||||
self.term_window = self.screen.subwin(0, 0)
|
||||
|
||||
# Init help panel
|
||||
term_help = self.screen.subwin(self.term_h-self.help_y-2, self.term_w-self.help_x, self.help_y, self.help_x)
|
||||
self.panel_help = curses.panel.new_panel(term_help)
|
||||
self.hideHelp()
|
||||
|
||||
# Init refresh time
|
||||
self.__refresh_time = refresh_time
|
||||
|
||||
@ -452,6 +465,12 @@ class glancesScreen():
|
||||
elif (self.pressedkey == 102):
|
||||
# 'n' > Enable/Disable fs stats
|
||||
self.fs_tag = not self.fs_tag
|
||||
elif (self.pressedkey == 104):
|
||||
# 'h' > Enable/Disable help
|
||||
if (self.panel_help.hidden()):
|
||||
self.showHelp()
|
||||
else:
|
||||
self.hideHelp()
|
||||
elif (self.pressedkey == 109):
|
||||
# 'm' > Sort process list by Mem usage
|
||||
self.setProcessSortedBy('proc_size')
|
||||
@ -470,29 +489,38 @@ class glancesScreen():
|
||||
|
||||
|
||||
def display(self, stats):
|
||||
# Display all
|
||||
screen.displayHost(stats.getHost())
|
||||
screen.displaySystem(stats.getSystem())
|
||||
screen.displayCpu(stats.getCpu())
|
||||
screen.displayLoad(stats.getLoad(), stats.getCore())
|
||||
screen.displayMem(stats.getMem(), stats.getMemSwap())
|
||||
network_count = screen.displayNetwork(stats.getNetwork(), stats.getNetworkInterface())
|
||||
diskio_count = screen.displayDiskIO(stats.getDiskIO(), self.network_y + network_count)
|
||||
screen.displayFs(stats.getFs(), self.network_y + network_count + diskio_count)
|
||||
screen.displayProcess(stats.getProcessCount(), stats.getProcessList(screen.getProcessSortedBy()))
|
||||
screen.displayCaption()
|
||||
screen.displayNow(stats.getNow())
|
||||
# Display stats
|
||||
self.displayHost(stats.getHost())
|
||||
self.displaySystem(stats.getSystem())
|
||||
self.displayCpu(stats.getCpu())
|
||||
self.displayLoad(stats.getLoad(), stats.getCore())
|
||||
self.displayMem(stats.getMem(), stats.getMemSwap())
|
||||
network_count = self.displayNetwork(stats.getNetwork(), stats.getNetworkInterface())
|
||||
diskio_count = self.displayDiskIO(stats.getDiskIO(), self.network_y + network_count)
|
||||
self.displayFs(stats.getFs(), self.network_y + network_count + diskio_count)
|
||||
self.displayProcess(stats.getProcessCount(), stats.getProcessList(screen.getProcessSortedBy()))
|
||||
self.displayCaption()
|
||||
self.displayNow(stats.getNow())
|
||||
|
||||
# Display help panel
|
||||
if (not self.panel_help.hidden()):
|
||||
self.displayHelp()
|
||||
|
||||
def erase(self):
|
||||
# Erase the content of the screen
|
||||
self.term_window.erase()
|
||||
|
||||
|
||||
def update(self, stats):
|
||||
# Erase and display
|
||||
def flush(self, stats):
|
||||
# Flush display
|
||||
self.erase()
|
||||
self.display(stats)
|
||||
#curses.panel.update_panels()
|
||||
#curses.doupdate()
|
||||
|
||||
def update(self, stats):
|
||||
# flush display
|
||||
self.flush(stats)
|
||||
|
||||
# Wait
|
||||
countdown = Timer(self.__refresh_time)
|
||||
@ -501,13 +529,49 @@ class glancesScreen():
|
||||
self.term_window.refresh()
|
||||
# Getkey
|
||||
if (self.__catchKey() > -1):
|
||||
# Erase and display
|
||||
self.erase()
|
||||
self.display(stats)
|
||||
# flush display
|
||||
self.flush(stats)
|
||||
# Wait 100ms...
|
||||
curses.napms(100)
|
||||
|
||||
|
||||
def displayHelp(self):
|
||||
"""
|
||||
Display the help panel (active| desactive with the 'h' key)
|
||||
"""
|
||||
screen_x = self.screen.getmaxyx()[1]
|
||||
screen_y = self.screen.getmaxyx()[0]
|
||||
if ((screen_y > 23)
|
||||
and (screen_x > 79)):
|
||||
helpWindow = self.panel_help.window()
|
||||
helpWindow.resize(self.term_h-self.help_y-2, self.term_w-self.help_x)
|
||||
helpWindow.clear()
|
||||
msg = "Glances help (press 'h' to hide)"
|
||||
helpWindow.addnstr(1, 2, "'h'\tto display|hide this help message", self.term_w-self.help_x-4, self.help_color if self.hascolors else 0)
|
||||
helpWindow.addnstr(2, 2, "'a'\tto sort processes automatically", self.term_w-self.help_x-4, self.help_color if self.hascolors else 0)
|
||||
helpWindow.addnstr(3, 2, "'c'\tto sort processes by CPU consumption", self.term_w-self.help_x-4, self.help_color if self.hascolors else 0)
|
||||
helpWindow.addnstr(4, 2, "'d'\tto disable|enable the disk IO stats", self.term_w-self.help_x-4, self.help_color if self.hascolors else 0)
|
||||
helpWindow.addnstr(5, 2, "'f'\tto disable|enable the file system stats", self.term_w-self.help_x-4, self.help_color if self.hascolors else 0)
|
||||
helpWindow.addnstr(6, 2, "'m'\tto sort processes by process size", self.term_w-self.help_x-4, self.help_color if self.hascolors else 0)
|
||||
helpWindow.addnstr(7, 2, "'n'\tto disable|enable the network interfaces stats", self.term_w-self.help_x-4, self.help_color if self.hascolors else 0)
|
||||
helpWindow.addnstr(8, 2, "'q'\tto exit Glances", self.term_w-self.help_x-4, self.help_color if self.hascolors else 0)
|
||||
helpWindow.box()
|
||||
|
||||
|
||||
def showHelp(self):
|
||||
"""
|
||||
Show the help panel
|
||||
"""
|
||||
self.panel_help.show()
|
||||
|
||||
|
||||
def hideHelp(self):
|
||||
"""
|
||||
Hide the help panel
|
||||
"""
|
||||
self.panel_help.hide()
|
||||
|
||||
|
||||
def displayHost(self, host):
|
||||
# Host information
|
||||
if (not host):
|
||||
@ -776,9 +840,11 @@ def printSyntax():
|
||||
print "'c' to sort the processes list by CPU consumption"
|
||||
print "'d' to disable or enable the disk IO stats"
|
||||
print "'f' to disable or enable the file system stats"
|
||||
print "'h' to hide or show the help message"
|
||||
print "'m' to sort the processes list by process size"
|
||||
print "'n' to disable or enable the network interfaces stats"
|
||||
print "'q' to exit"
|
||||
print ""
|
||||
|
||||
|
||||
def init():
|
||||
|
Loading…
Reference in New Issue
Block a user