Merge branch 'master' of github.com:nicolargo/glances

This commit is contained in:
Nicolas Hennion 2013-08-07 23:11:14 +02:00
commit 10d4068aa2
5 changed files with 108 additions and 89 deletions

View File

@ -3,7 +3,7 @@
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="generator" content="Docutils 0.10: http://docutils.sourceforge.net/" />
<meta name="generator" content="Docutils 0.11: http://docutils.sourceforge.net/" />
<title>Glances</title>
<style type="text/css">
@ -152,7 +152,7 @@ td.option-group {
<li><a class="reference internal" href="#disk-i-o" id="id19">Disk I/O</a></li>
<li><a class="reference internal" href="#file-system" id="id20">File system</a></li>
<li><a class="reference internal" href="#processes-list" id="id21">Processes list</a></li>
<li><a class="reference internal" href="#monitored-processes-list" id="id22">monitored processes list</a></li>
<li><a class="reference internal" href="#monitored-processes-list" id="id22">Monitored processes list</a></li>
<li><a class="reference internal" href="#logs" id="id23">Logs</a></li>
<li><a class="reference internal" href="#footer" id="id24">Footer</a></li>
</ul>
@ -194,13 +194,13 @@ just run on the server:</p>
<pre class="code console literal-block">
<span class="generic output">client$ glances -c &#64;server</span>
</pre>
<p>where <tt class="docutils literal">&#64;server</tt> is the IP address or host name of the server.</p>
<p>where <tt class="docutils literal">&#64;server</tt> is the IP address or hostname of the server.</p>
<p>In server mode, you can set the bind address <tt class="docutils literal"><span class="pre">-B</span> ADDRESS</tt> and listening TCP port <tt class="docutils literal"><span class="pre">-p</span> PORT</tt>.</p>
<p>In client mode, you can set the TCP port of the server <tt class="docutils literal"><span class="pre">-p</span> PORT</tt>.</p>
<p>Default binding address is <tt class="docutils literal">0.0.0.0</tt> (Glances will listen on all the network interfaces) and TCP port is <tt class="docutils literal">61209</tt>.</p>
<p>In client/server mode, limits are set by the server side.</p>
<p>You can also set a password to access to the server <tt class="docutils literal"><span class="pre">-P</span> password</tt>.</p>
<p>Glances is IPv6 compatible: use the <tt class="docutils literal"><span class="pre">-B</span> ::0</tt> option to bind to all IPv6 addresses.</p>
<p>Glances is <tt class="docutils literal">IPv6</tt> compatible. Just use the <tt class="docutils literal"><span class="pre">-B</span> ::1</tt> option to bind to all IPv6 addresses.</p>
</div>
</div>
<div class="section" id="command-reference">
@ -357,7 +357,7 @@ cp /etc/glances/glances.conf $XDG_CONFIG_HOME/glances/</span>
<div class="section" id="header">
<h2><a class="toc-backref" href="#id13">Header</a></h2>
<img alt="images/header.png" src="images/header.png" />
<p>The header shows the OS name, release version, platform architecture and the host name.
<p>The header shows the OS name, release version, platform architecture and the hostname.
On Linux, it shows also the kernel version.</p>
</div>
<div class="section" id="cpu">
@ -377,7 +377,7 @@ The total CPU usage is displayed on the first line.</p>
<div class="line">If user|system|nice CPU is <tt class="docutils literal">&gt;70%</tt>, then status is set to <tt class="docutils literal">&quot;WARNING&quot;</tt></div>
<div class="line">If user|system|nice CPU is <tt class="docutils literal">&gt;90%</tt>, then status is set to <tt class="docutils literal">&quot;CRITICAL&quot;</tt></div>
</div>
<p>Note: limits values can be overwrited in the configuration file ([cpu] section).</p>
<p><em>Note</em>: limit values can be overwritten in the configuration file under the <tt class="docutils literal">[cpu]</tt> section.</p>
</div>
<div class="section" id="load">
<h2><a class="toc-backref" href="#id15">Load</a></h2>
@ -396,7 +396,7 @@ The first line also display the number of CPU core.</p>
<div class="line">If average load is <tt class="docutils literal">&gt;1*core</tt>, then status is set to <tt class="docutils literal">&quot;WARNING&quot;</tt></div>
<div class="line">If average load is <tt class="docutils literal">&gt;5*core</tt>, then status is set to <tt class="docutils literal">&quot;CRITICAL&quot;</tt></div>
</div>
<p>Note: limits values can be overwrited in the configuration file ([load] section).</p>
<p><em>Note</em>: limit values can be overwritten in the configuration file under the <tt class="docutils literal">[load]</tt> section.</p>
</div>
<div class="section" id="memory">
<h2><a class="toc-backref" href="#id16">Memory</a></h2>
@ -411,7 +411,7 @@ The first line also display the number of CPU core.</p>
<div class="line">If memory is <tt class="docutils literal">&gt;70%</tt>, then status is set to <tt class="docutils literal">&quot;WARNING&quot;</tt></div>
<div class="line">If memory is <tt class="docutils literal">&gt;90%</tt>, then status is set to <tt class="docutils literal">&quot;CRITICAL&quot;</tt></div>
</div>
<p>Note: limits values can be overwrited in the configuration file ([memory] and [swap] sections).</p>
<p><em>Note</em>: limit values can be overwritten in the configuration file under the <tt class="docutils literal">[memory]</tt> and <tt class="docutils literal">[swap]</tt> sections.</p>
</div>
<div class="section" id="network">
<h2><a class="toc-backref" href="#id17">Network</a></h2>
@ -432,14 +432,18 @@ if the bit rate is higher than 70 Mbps.</p>
<h2><a class="toc-backref" href="#id18">Sensors</a></h2>
<img alt="images/sensors.png" src="images/sensors.png" />
<p>Glances can displays the sensors informations trough <cite>lm-sensors</cite> (only
available on Linux) and hddtemp daemon.</p>
<p>A filter is processed in order to only display temperature.</p>
<p>You should enable this module using the following command line:</p>
available on Linux) and <cite>hddtemp</cite> daemon.</p>
<p>As of lm-sensors, a filter is processed in order to display temperature only.</p>
<p>To enable the lm-sensors module:</p>
<pre class="code console literal-block">
<span class="generic prompt">$</span> glances -e
</pre>
<p>To enable the hddtemp module:</p>
<pre class="code console literal-block">
<span class="generic prompt">$</span> glances -y
</pre>
<p>There is no alert on this information.</p>
<p>Note: limits values can be overwrited in the configuration file ([temperature] and [hddtemperature] section).</p>
<p><em>Note</em>: limit values can be overwritten in the configuration file under the <tt class="docutils literal">[temperature]</tt> and <tt class="docutils literal">[hddtemperature]</tt> sections.</p>
</div>
<div class="section" id="disk-i-o">
<h2><a class="toc-backref" href="#id19">Disk I/O</a></h2>
@ -459,7 +463,7 @@ adapted dynamically.</p>
<div class="line">If disk used is <tt class="docutils literal">&gt;70%</tt>, then status is set to <tt class="docutils literal">&quot;WARNING&quot;</tt></div>
<div class="line">If disk used is <tt class="docutils literal">&gt;90%</tt>, then status is set to <tt class="docutils literal">&quot;CRITICAL&quot;</tt></div>
</div>
<p>Note: limits values can be overwrited in the configuration file ([filesystem] section).</p>
<p><em>Note</em>: limit values can be overwritten in the configuration file under <tt class="docutils literal">[filesystem]</tt> section.</p>
</div>
<div class="section" id="processes-list">
<h2><a class="toc-backref" href="#id21">Processes list</a></h2>
@ -467,13 +471,15 @@ adapted dynamically.</p>
<img alt="images/processlist.png" src="images/processlist.png" />
<p>Full view:</p>
<img alt="images/processlist-wide.png" src="images/processlist-wide.png" />
<p>Three views are available for processes:
* Processes summary
* Optionnal monitored processes list (new in Glances 1.7)
* Processes list</p>
<p>Three views are available for processes:</p>
<ul class="simple">
<li>Processes summary</li>
<li>Optional monitored processes list (new in 1.7)</li>
<li>Processes list</li>
</ul>
<p>By default, or if you hit the <tt class="docutils literal">a</tt> key, the processes list is automatically
sorted by CPU of memory usage.</p>
<p>Note: limits values can be overwrited in the configuration file ([process] section).</p>
<p><em>Note</em>: limit values can be overwritten in the configuration file under the <tt class="docutils literal">[process]</tt> section.</p>
<p>The number of processes in the list is adapted to the screen size.</p>
<dl class="docutils">
<dt><tt class="docutils literal">VIRT</tt></dt>
@ -516,31 +522,32 @@ sorted by CPU of memory usage.</p>
</dl>
</div>
<div class="section" id="monitored-processes-list">
<h2><a class="toc-backref" href="#id22">monitored processes list</a></h2>
<p>Optionnal and new in version 1.7.</p>
<p>The monitored processes list allows user, through the Glances configuration file, to group processes and quickly show if the number of runing process is not good.</p>
<h2><a class="toc-backref" href="#id22">Monitored processes list</a></h2>
<p>New in version 1.7. Optional.</p>
<p>The monitored processes list allows user, through the configuration file,
to group processes and quickly show if the number of running process is not good.</p>
<p>Each item is defined by:</p>
<ul class="simple">
<li>description: description of the processes (max 16 chars)</li>
<li>regex: regular expression of the processes to monitor</li>
<li>command: (optional) full path to shell command/script for extended stat. Use with caution. Should return a single line string.</li>
<li>countmin: (optional) minimal number of processes. A warning will be displayed if number of process &lt; count</li>
<li>countmax: (optional) maximum number of processes. A warning will be displayed if number of process &gt; count</li>
<li><tt class="docutils literal">description</tt>: description of the processes (max 16 chars).</li>
<li><tt class="docutils literal">regex</tt>: regular expression of the processes to monitor.</li>
<li><tt class="docutils literal">command</tt> (optional): full path to shell command/script for extended stat. Should return a single line string. Use with caution.</li>
<li><tt class="docutils literal">countmin</tt> (optional): minimal number of processes. A warning will be displayed if number of processes &lt; count.</li>
<li><tt class="docutils literal">countmax</tt> (optional): maximum number of processes. A warning will be displayed if number of processes &gt; count.</li>
</ul>
<p>Up to 10 items can be defined.</p>
<p>For exemple, if you want to monitor the NGinx processes on a Web server, the following definition should do the job:</p>
<pre class="literal-block">
[monitor]
list_1_description=NGinx server
<p>For example, if you want to monitor the NGINX processes on a Web server, the following definition should do the job:</p>
<pre class="code console literal-block">
<span class="generic output">[monitor]
list_1_description=NGINX server
list_1_regex=.*nginx.*
list_1_command=nginx -v
list_1_countmin=1
list_1_countmax=4
list_1_countmax=4</span>
</pre>
<p>If you also want to monitor the PHP-FPM daemon processes, you should add another item:</p>
<pre class="literal-block">
[monitor]
list_1_description=NGinx server
<pre class="code console literal-block">
<span class="generic output">[monitor]
list_1_description=NGINX server
list_1_regex=.*nginx.*
list_1_command=nginx -v
list_1_countmin=1
@ -548,7 +555,7 @@ list_1_countmax=4
list_1_description=PHP-FPM
list_1_regex=.*php-fpm.*
list_1_countmin=1
list_1_countmax=20
list_1_countmax=20</span>
</pre>
</div>
<div class="section" id="logs">

View File

@ -58,7 +58,7 @@ and on the client:
client$ glances -c @server
where ``@server`` is the IP address or host name of the server.
where ``@server`` is the IP address or hostname of the server.
In server mode, you can set the bind address ``-B ADDRESS`` and listening TCP port ``-p PORT``.
@ -70,7 +70,7 @@ In client/server mode, limits are set by the server side.
You can also set a password to access to the server ``-P password``.
Glances is IPv6 compatible: use the ``-B ::0`` option to bind to all IPv6 addresses.
Glances is ``IPv6`` compatible. Just use the ``-B ::1`` option to bind to all IPv6 addresses.
Command reference
=================
@ -191,7 +191,7 @@ Header
.. image:: images/header.png
The header shows the OS name, release version, platform architecture and the host name.
The header shows the OS name, release version, platform architecture and the hostname.
On Linux, it shows also the kernel version.
CPU
@ -219,7 +219,7 @@ The total CPU usage is displayed on the first line.
| If user|system|nice CPU is ``>70%``, then status is set to ``"WARNING"``
| If user|system|nice CPU is ``>90%``, then status is set to ``"CRITICAL"``
Note: limits values can be overwrited in the configuration file ([cpu] section).
*Note*: limit values can be overwritten in the configuration file under the ``[cpu]`` section.
Load
----
@ -241,7 +241,7 @@ The first line also display the number of CPU core.
| If average load is ``>1*core``, then status is set to ``"WARNING"``
| If average load is ``>5*core``, then status is set to ``"CRITICAL"``
Note: limits values can be overwrited in the configuration file ([load] section).
*Note*: limit values can be overwritten in the configuration file under the ``[load]`` section.
Memory
------
@ -261,7 +261,7 @@ With Glances, alerts are only set for on used memory and used swap.
| If memory is ``>70%``, then status is set to ``"WARNING"``
| If memory is ``>90%``, then status is set to ``"CRITICAL"``
Note: limits values can be overwrited in the configuration file ([memory] and [swap] sections).
*Note*: limit values can be overwritten in the configuration file under the ``[memory]`` and ``[swap]`` sections.
Network
-------
@ -287,19 +287,25 @@ Sensors
.. image:: images/sensors.png
Glances can displays the sensors informations trough `lm-sensors` (only
available on Linux) and hddtemp daemon.
available on Linux) and `hddtemp` daemon.
A filter is processed in order to only display temperature.
As of lm-sensors, a filter is processed in order to display temperature only.
You should enable this module using the following command line:
To enable the lm-sensors module:
.. code-block:: console
$ glances -e
To enable the hddtemp module:
.. code-block:: console
$ glances -y
There is no alert on this information.
Note: limits values can be overwrited in the configuration file ([temperature] and [hddtemperature] section).
*Note*: limit values can be overwritten in the configuration file under the ``[temperature]`` and ``[hddtemperature]`` sections.
Disk I/O
--------
@ -325,7 +331,7 @@ Alerts are set for used disk space:
| If disk used is ``>70%``, then status is set to ``"WARNING"``
| If disk used is ``>90%``, then status is set to ``"CRITICAL"``
Note: limits values can be overwrited in the configuration file ([filesystem] section).
*Note*: limit values can be overwritten in the configuration file under ``[filesystem]`` section.
Processes list
--------------
@ -339,14 +345,15 @@ Full view:
.. image:: images/processlist-wide.png
Three views are available for processes:
* Processes summary
* Optionnal monitored processes list (new in Glances 1.7)
* Processes summary
* Optional monitored processes list (new in 1.7)
* Processes list
By default, or if you hit the ``a`` key, the processes list is automatically
sorted by CPU of memory usage.
Note: limits values can be overwrited in the configuration file ([process] section).
*Note*: limit values can be overwritten in the configuration file under the ``[process]`` section.
The number of processes in the list is adapted to the screen size.
@ -388,36 +395,41 @@ Process status legend:
``Z``
zombie
monitored processes list
Monitored processes list
------------------------
Optionnal and new in version 1.7.
New in version 1.7. Optional.
The monitored processes list allows user, through the Glances configuration file, to group processes and quickly show if the number of runing process is not good.
The monitored processes list allows user, through the configuration file,
to group processes and quickly show if the number of running process is not good.
Each item is defined by:
* description: description of the processes (max 16 chars)
* regex: regular expression of the processes to monitor
* command: (optional) full path to shell command/script for extended stat. Use with caution. Should return a single line string.
* countmin: (optional) minimal number of processes. A warning will be displayed if number of process < count
* countmax: (optional) maximum number of processes. A warning will be displayed if number of process > count
* ``description``: description of the processes (max 16 chars).
* ``regex``: regular expression of the processes to monitor.
* ``command`` (optional): full path to shell command/script for extended stat. Should return a single line string. Use with caution.
* ``countmin`` (optional): minimal number of processes. A warning will be displayed if number of processes < count.
* ``countmax`` (optional): maximum number of processes. A warning will be displayed if number of processes > count.
Up to 10 items can be defined.
For exemple, if you want to monitor the NGinx processes on a Web server, the following definition should do the job::
For example, if you want to monitor the NGINX processes on a Web server, the following definition should do the job:
.. code-block:: console
[monitor]
list_1_description=NGinx server
list_1_description=NGINX server
list_1_regex=.*nginx.*
list_1_command=nginx -v
list_1_countmin=1
list_1_countmax=4
If you also want to monitor the PHP-FPM daemon processes, you should add another item::
If you also want to monitor the PHP-FPM daemon processes, you should add another item:
.. code-block:: console
[monitor]
list_1_description=NGinx server
list_1_description=NGINX server
list_1_regex=.*nginx.*
list_1_command=nginx -v
list_1_countmin=1

View File

@ -161,22 +161,23 @@ except ImportError:
else:
csv_lib_tag = True
# path definitions
local_path = os.path.dirname(os.path.realpath(__file__))
appname_path = os.path.split(sys.argv[0])[0]
sys_prefix = os.path.dirname(os.path.realpath(appname_path))
# i18n
locale.setlocale(locale.LC_ALL, '')
gettext_domain = __appname__
# get locale directory
base_path = os.path.dirname(os.path.realpath(__file__))
i18n_path = os.path.join(base_path, '..', 'i18n')
path_name = os.path.split(sys.argv[0])[0]
prefix_path = os.path.dirname(os.path.realpath(path_name))
locale_path = os.path.join(prefix_path, 'share', 'locale')
i18n_path = os.path.join(local_path, '..', 'i18n')
sys_i18n_path = os.path.join(sys_prefix, 'share', 'locale')
if os.path.exists(i18n_path):
locale_dir = i18n_path
elif os.path.exists(locale_path):
locale_dir = locale_path
elif os.path.exists(sys_i18n_path):
locale_dir = sys_i18n_path
else:
locale_dir = None
gettext.install(gettext_domain, locale_dir)
@ -248,17 +249,16 @@ class Config:
* /path/to/file (via -C flag)
* /path/to/glances/glances/conf
* user's home directory (per-user settings)
* /etc directory (system-wide settings)
* {/usr/local,}/etc directory (system-wide settings)
"""
base_path = os.path.dirname(os.path.abspath(__file__))
local_path = os.path.join(base_path, 'conf', self.filename)
paths = []
conf_path = os.path.join(local_path, 'conf', self.filename)
if self.location is not None:
paths.append(self.location)
if os.path.exists(local_path):
paths.append(local_path)
if os.path.exists(conf_path):
paths.append(conf_path)
if is_Linux or is_BSD:
paths.append(os.path.join(
@ -271,9 +271,12 @@ class Config:
if is_Linux:
paths.append(os.path.join('/etc', __appname__, self.filename))
elif is_BSD or is_Mac:
elif is_BSD:
paths.append(os.path.join(
sys.prefix, '/etc', __appname__, self.filename))
sys.prefix, 'etc', __appname__, self.filename))
elif is_Mac:
paths.append(os.path.join(
sys_prefix, 'etc', __appname__, self.filename))
return paths
@ -3585,19 +3588,14 @@ class glancesHtml:
* /path/to/glances/glances/data (local)
* {/usr,/usr/local}/share/glances (system-wide)
"""
# get local path
base_path = os.path.dirname(os.path.abspath(__file__))
local_path = os.path.join(base_path, 'data')
# get local and system-wide data paths
data_path = os.path.join(local_path, 'data')
sys_data_path = os.path.join(sys_prefix, 'share', __appname__)
# get system-wide path
path_name = os.path.split(sys.argv[0])[0]
prefix_path = os.path.dirname(os.path.abspath(path_name))
share_path = os.path.join(prefix_path, 'share', __appname__)
if os.path.exists(local_path):
work_path = local_path # running from local directory
elif os.path.exists(share_path):
work_path = share_path # running from system directory
if os.path.exists(data_path):
work_path = data_path
elif os.path.exists(sys_data_path):
work_path = sys_data_path
else:
work_path = ""

View File

@ -17,10 +17,12 @@ data_files = [
('share/man/man1', ['docs/man/glances.1'])
]
if hasattr(sys, 'real_prefix') or (sys.platform in ('bsd', 'darwin')):
if hasattr(sys, 'real_prefix') or 'bsd' in sys.platform:
etc_path = os.path.join(sys.prefix, 'etc', 'glances')
if not hasattr(sys, 'real_prefix') and 'linux' in sys.platform:
etc_path = os.path.join('/etc', 'glances')
elif 'darwin' in sys.platform:
etc_path = os.path.join('/usr/local', 'etc', 'glances')
data_files.append((etc_path, ['glances/conf/glances.conf']))
for mo in glob.glob('i18n/*/LC_MESSAGES/*.mo'):