README.md 6.9 KB
Newer Older
N
PEP8  
nicolargo 已提交
1 2 3 4 5 6 7 8
[![Flattr this git repo](http://api.flattr.com/button/flattr-badge-large.png)](https://flattr.com/submit/auto?user_id=nicolargo&url=https://github.com/nicolargo/glances&title=Glances&language=&tags=github&category=software)

=============================
Glances -- Eye on your system
=============================

## Description

N
README  
nicolargo 已提交
9
Glances is a CLI curses based monitoring tool for GNU/Linux and BSD OS.
N
PEP8  
nicolargo 已提交
10

N
README  
nicolargo 已提交
11 12 13
Glances uses the PsUtil library to get information from your system.

It is developed in Python.
N
PEP8  
nicolargo 已提交
14 15 16 17 18

![screenshot](https://github.com/nicolargo/glances/raw/master/screenshot.png)

## Installation

N
README  
nicolargo 已提交
19 20 21 22 23 24 25 26 27 28 29 30
### From package manager (very easy way)

Packages exist for Arch, Fedora, Redhat, FreeBSD...

### From PPA (easy way for Ubuntu/Mint...)

Arnaud Hartmann (thanks to him !) maintains a PPA with the latest Glances version:

To install the PPA just enter:

        $ sudo add-apt-repository ppa:arnaud-hartmann/glances-dev
        $ sudo apt-get update
N
PEP8  
nicolargo 已提交
31

N
README  
nicolargo 已提交
32
Then install Glances:
N
PEP8  
nicolargo 已提交
33

N
README  
nicolargo 已提交
34
        $ sudo apt-get install glances
N
PEP8  
nicolargo 已提交
35

N
README  
nicolargo 已提交
36
### From PyPi (easy way)
N
PEP8  
nicolargo 已提交
37

N
README  
nicolargo 已提交
38
PyPi is an official Python package manager.
N
PEP8  
nicolargo 已提交
39

N
README  
nicolargo 已提交
40
You first need to install pypi on your system. For exemple on Debian/Ubuntu:
N
PEP8  
nicolargo 已提交
41

N
README  
nicolargo 已提交
42 43 44 45 46
        $ sudo apt-get install python-pip

Then install the latest Glances version:

        $ sudo pip install glances
N
PEP8  
nicolargo 已提交
47 48 49 50 51

### From source

Get the latest version:

N
README  
nicolargo 已提交
52
	$ wget https://github.com/downloads/nicolargo/glances/glances-1.4.tar.gz
N
PEP8  
nicolargo 已提交
53 54 55

Glances use a standard GNU style installer:

N
README  
nicolargo 已提交
56 57 58
	$ tar zxvf glances-1.4.tar.gz
	$ cd glances-1.4
	$ sudo python setup.py install
N
PEP8  
nicolargo 已提交
59 60 61 62 63 64 65

Pre-requisites:

* Python 2.6+ (not tested with Python 3+)

## Running

N
README  
nicolargo 已提交
66
Easy way (that's all folks !):
N
PEP8  
nicolargo 已提交
67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256

	$ 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
* 'l' Disable or enable the logs
* '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.

### Logs

![screenshot](https://github.com/nicolargo/glances/raw/master/doc/logs.png)

A logs list is displayed in the bottom of the screen if (an only if):

* at least one WARNING or CRITICAL alert was occured.
* space is available in the bottom of the console/terminal

There is one line per alert with the following information:

* start date
* end date
* alert name
* (min/avg/max) values 

### Footer

![screenshot](https://github.com/nicolargo/glances/raw/master/doc/footer.png)

Glances displays a caption and the current time/date.

## Localisation

To generate french locale execute as root or sudo :
i18n_francais_generate.sh

To generate spanish locale execute as root or sudo :
i18n_espanol_generate.sh

## 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