From 9221cf1d2ac05d1df9c892ab780c197a7b320f46 Mon Sep 17 00:00:00 2001 From: Alessio Sergi Date: Sun, 19 Jan 2014 16:19:14 +0100 Subject: Closing issue #318 --- glances/glances.py | 56 ++++++++++++++++-------------------------------------- 1 file changed, 16 insertions(+), 40 deletions(-) diff --git a/glances/glances.py b/glances/glances.py index de7df822..e1b4f99f 100644 --- a/glances/glances.py +++ b/glances/glances.py @@ -4438,6 +4438,9 @@ class GlancesClient(): def client_init(self): try: client_version = self.client.init() + except socket.error as err: + print(_("Couldn't create socket: %s") % err) + sys.exit(-1) except ProtocolError as err: if str(err).find(" 401 ") > 0: print(_("Error: Connection to server failed. Bad password.")) @@ -4610,32 +4613,18 @@ def main(): username = "glances" password = "" - # Manage args + # Manage options/arguments try: opts, args = getopt.getopt(sys.argv[1:], "B:bdeymnho:f:t:vsc:p:C:P:zr1", ["bind", "bytepersec", "diskio", "mount", - "sensors", "hddtemp", "netrate", "help", "output", - "file", "time", "version", "server", - "client", "port", "config", "password", - "nobold", "noproc", "percpu"]) + "sensors", "hddtemp", "netrate", "help", + "output", "file", "time", "version", + "server", "client", "port", "config", + "password", "nobold", "noproc", "percpu"]) except getopt.GetoptError as err: - # Print help information and exit: - if (err.opt == 'P') and ('requires argument' in err.msg): - print(_("Error: -P flag need an argument (password)")) - elif (err.opt == 'B') and ('requires argument' in err.msg): - print(_("Error: -B flag need an argument (bind IP address)")) - elif (err.opt == 'c') and ('requires argument' in err.msg): - print(_("Error: -c flag need an argument (server IP address/name)")) - elif (err.opt == 'p') and ('requires argument' in err.msg): - print(_("Error: -p flag need an argument (port number)")) - elif (err.opt == 'o') and ('requires argument' in err.msg): - print(_("Error: -o flag need an argument (HTML or CSV)")) - elif (err.opt == 't') and ('requires argument' in err.msg): - print(_("Error: -t flag need an argument (refresh time)")) - else: - print(str(err)) - print - printSyntax() + # Print help information and exit + print(str(err)) + print(_("Try 'glances -h' for more information.")) sys.exit(2) for opt, arg in opts: if opt in ("-v", "--version"): @@ -4661,32 +4650,20 @@ def main(): elif arg.lower() == "csv": csv_tag = True else: - print(_("Error: Unknown output %s" % arg)) + print(_("Error: Unknown output %s") % arg) sys.exit(2) elif opt in ("-e", "--sensors"): - if is_Linux: - if not sensors_lib_tag: - print(_("Error: PySensors library not found")) - sys.exit(2) - else: - sensors_tag = True - else: - print(_("Error: Sensors module is only available on Linux")) - sys.exit(2) + sensors_tag = True elif opt in ("-y", "--hddtemp"): hddtemp_tag = True elif opt in ("-f", "--file"): output_file = arg output_folder = arg elif opt in ("-t", "--time"): - try: - refresh_time = int(arg) - except: - print("Error: Invalid refresh time (%s)" % arg) - sys.exit(2) - if (refresh_time < 1): + if not (arg.isdigit() and int(arg) > 0): print(_("Error: Refresh time should be a positive integer")) sys.exit(2) + refresh_time = int(arg) elif opt in ("-d", "--diskio"): diskio_tag = False elif opt in ("-m", "--mount"): @@ -4729,7 +4706,7 @@ def main(): sys.exit(2) if conf_file_tag: print(_("Error: Cannot use both -c and -C flag")) - print(_(" Limits are set based on the server ones")) + print(_("Limits are set based on the server ones")) sys.exit(2) if password_prompt: password = get_password(description=_("Enter the Glances server password"), confirm=False) @@ -4737,7 +4714,6 @@ def main(): if html_tag: if not html_lib_tag: print(_("Error: Need Jinja2 library to export into HTML")) - print(_("Try to install the python-jinja2 package")) sys.exit(2) try: output_folder -- cgit v1.2.3 From d8f76cb6dc4ef3972738cdc34e63910d775f6819 Mon Sep 17 00:00:00 2001 From: Alessio Sergi Date: Sun, 19 Jan 2014 18:59:59 +0100 Subject: Update README.rst Distinguish between mandatory and optional dependencies. Linux: Add Void Linux https://github.com/voidlinux/xbps-packages/tree/master/srcpkgs/glances FreeBSD: Add installation instructions for pkgng. --- README.rst | 42 ++++++++++++++++++++++++++++-------------- 1 file changed, 28 insertions(+), 14 deletions(-) diff --git a/README.rst b/README.rst index bdbcf29c..f1fa6f28 100644 --- a/README.rst +++ b/README.rst @@ -14,10 +14,9 @@ Glances - An eye on your system :target: https://pypi.python.org/pypi/Glances/ :alt: Downloads .. image:: https://d2weczhvl823v0.cloudfront.net/nicolargo/glances/trend.png - :target: https://bitdeli.com/nicolargo + :target: https://bitdeli.com/nicolargo .. image:: https://raw.github.com/nicolargo/glances/master/docs/images/glances-white-256.png :width: 128 - :align: center **Glances** is a cross-platform curses-based monitoring tool written in Python. @@ -30,12 +29,15 @@ Requirements - ``python >= 2.6`` (tested with version 2.6, 2.7, 3.2, 3.3) - ``psutil >= 0.5.1`` (recommended version >= 1.2.1) -- ``jinja`` (optional for HTML output) -- ``pysensors`` (optional for HW monitoring support) [Linux-only] -- ``hddtemp`` (optional for HDD temperature monitoring support) -- ``batinfo`` (optional for battery monitoring support) [Linux-only] - ``setuptools`` +Optional dependencies: + +- ``jinja2`` (for HTML output) +- ``pysensors`` (for HW monitoring support) [Linux-only] +- ``hddtemp`` (for HDD temperature monitoring support) +- ``batinfo`` (for battery monitoring support) [Linux-only] + Installation ============ @@ -57,19 +59,32 @@ To upgrade Glances to the latest version: Linux ----- -At the moment, packages exist for Arch Linux, Gentoo, Fedora/CentOS/RHEL, -Debian (Sid/Testing) and Ubuntu (13.04+), so you should be able to -install it using your favorite package manager. +At the moment, packages exist for the following distributions: + +- Arch Linux +- Debian (Testing/Sid) +- Fedora/CentOS/RHEL +- Gentoo +- Ubuntu (13.04+) +- Void Linux + +So you should be able to install it using your favorite package manager. FreeBSD ------- -To install the precompiled binary package: +To install the binary package: .. code-block:: console # pkg_add -r py27-glances +Using pkgng: + +.. code-block:: console + + # pkg install py27-glances + To install Glances from ports: .. code-block:: console @@ -101,12 +116,11 @@ Windows ------- Glances proposes a Windows client based on the `colorconsole`_ Python library. +Glances version < 1.7.2 only works in server mode. -Glances < 1.7.2 only works in server mode. It will run in server mode automatically. - -Thanks to Nicolas Bourges, Glances can be easily installed using a Windows installer: +Thanks to Nicolas Bourges, a Windows installer is available: -Glances-1.7.2-win32.msi_ (32-bit, MD5: dba4f6cc9f47b6806ffaeb665c093270) +- Glances-1.7.2-win32.msi_ (32-bit, MD5: dba4f6cc9f47b6806ffaeb665c093270) Otherwise, you have to follow these steps: -- cgit v1.2.3 From 6ac9ac6682118dd144a177688b4fa0c51bb5f9d5 Mon Sep 17 00:00:00 2001 From: kaliko Date: Wed, 5 Feb 2014 19:56:34 +0100 Subject: Fix lintian warning from debian packaging --- man/glances.1 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/man/glances.1 b/man/glances.1 index aca27247..b41211a3 100644 --- a/man/glances.1 +++ b/man/glances.1 @@ -3,7 +3,7 @@ glances \- A cross-platform curses-based monitoring tool .SH SYNOPSIS .B glances -[\-bdehmnrsvyz1] [\-B bind] [\-c server] [\-C conffile] [\-p port] [\-P password] [--password] [\-t refresh] [\-f file] [\-o output] +[\-bdehmnrsvyz1] [\-B bind] [\-c server] [\-C conffile] [\-p port] [\-P password] [\-\-password] [\-t refresh] [\-f file] [\-o output] .SH DESCRIPTION Glances is a free (LGPL) cross-platform curses-based monitoring tool which aims to present a maximum of information in a minimum of space, ideally to fit in a classical 80x24 terminal or higher to have additionnal information. -- cgit v1.2.3