summaryrefslogtreecommitdiffstats
path: root/glances
diff options
context:
space:
mode:
Diffstat (limited to 'glances')
-rw-r--r--glances/README.txt52
-rw-r--r--glances/__init__.py34
-rw-r--r--glances/__main__.py4
-rw-r--r--glances/actions.py (renamed from glances/core/glances_actions.py)16
-rw-r--r--glances/autodiscover.py (renamed from glances/core/glances_autodiscover.py)12
-rw-r--r--glances/client.py (renamed from glances/core/glances_client.py)29
-rw-r--r--glances/client_browser.py (renamed from glances/core/glances_client_browser.py)31
-rw-r--r--glances/compat.py127
-rw-r--r--glances/config.py (renamed from glances/core/glances_config.py)39
-rw-r--r--glances/core/__init__.py0
-rw-r--r--glances/cpu_percent.py (renamed from glances/core/glances_cpu_percent.py)2
-rw-r--r--glances/exports/glances_csv.py26
-rw-r--r--glances/exports/glances_elasticsearch.py117
-rw-r--r--glances/exports/glances_export.py40
-rw-r--r--glances/exports/glances_history.py11
-rw-r--r--glances/exports/glances_influxdb.py41
-rw-r--r--glances/exports/glances_opentsdb.py25
-rw-r--r--glances/exports/glances_rabbitmq.py13
-rw-r--r--glances/exports/glances_statsd.py13
-rw-r--r--glances/folder_list.py192
-rw-r--r--glances/globals.py (renamed from glances/core/glances_globals.py)23
-rw-r--r--glances/logger.py (renamed from glances/core/glances_logging.py)22
-rw-r--r--glances/logs.py (renamed from glances/core/glances_logs.py)5
-rw-r--r--glances/main.py (renamed from glances/core/glances_main.py)106
-rw-r--r--glances/monitor_list.py (renamed from glances/core/glances_monitor_list.py)31
-rw-r--r--glances/outputs/glances_bars.py10
-rw-r--r--glances/outputs/glances_bottle.py61
-rw-r--r--glances/outputs/glances_colorconsole.py10
-rw-r--r--glances/outputs/glances_curses.py258
-rw-r--r--glances/outputs/static/css/style.css3
-rw-r--r--glances/outputs/static/html/help.html16
-rw-r--r--glances/outputs/static/html/index.html10
-rw-r--r--glances/outputs/static/html/plugins/diskio.html16
-rw-r--r--glances/outputs/static/html/plugins/folders.html8
-rw-r--r--glances/outputs/static/html/plugins/fs.html10
-rw-r--r--glances/outputs/static/html/plugins/network.html32
-rw-r--r--glances/outputs/static/html/plugins/processlist.html12
-rw-r--r--glances/outputs/static/html/plugins/quicklook.html4
-rw-r--r--glances/outputs/static/html/stats.html43
-rw-r--r--glances/outputs/static/js/app.js25
-rw-r--r--glances/outputs/static/js/directives.js2
-rw-r--r--glances/outputs/static/js/services/core/glances_stats.js6
-rw-r--r--glances/outputs/static/js/services/plugins/glances_alert.js9
-rw-r--r--glances/outputs/static/js/services/plugins/glances_diskio.js14
-rw-r--r--glances/outputs/static/js/services/plugins/glances_folders.js30
-rw-r--r--glances/outputs/static/js/services/plugins/glances_processcount.js10
-rw-r--r--glances/outputs/static/js/services/plugins/glances_processlist.js10
-rw-r--r--glances/outputs/static/js/stats_controller.js132
-rw-r--r--glances/outputs/static/js/variables.js2
-rw-r--r--glances/outputs/static/js/vendors/angular-route.js991
-rw-r--r--glances/outputs/static/js/vendors/angular-route.min.js15
-rw-r--r--glances/outputs/static/js/vendors/angular-route.min.js.map8
-rw-r--r--glances/outputs/static/js/vendors/angular.js29657
-rw-r--r--glances/outputs/static/js/vendors/angular.min.js218
-rw-r--r--glances/outputs/static/js/vendors/angular.min.js.map8
-rw-r--r--glances/outputs/static/js/vendors/lodash.js12352
-rw-r--r--glances/outputs/static/js/vendors/lodash.min.js137
-rw-r--r--glances/password.py (renamed from glances/core/glances_password.py)37
-rw-r--r--glances/password_list.py (renamed from glances/core/glances_passwordlist.py)7
-rw-r--r--glances/plugins/glances_alert.py8
-rw-r--r--glances/plugins/glances_batpercent.py5
-rw-r--r--glances/plugins/glances_core.py2
-rw-r--r--glances/plugins/glances_cpu.py10
-rw-r--r--glances/plugins/glances_diskio.py86
-rw-r--r--glances/plugins/glances_docker.py23
-rw-r--r--glances/plugins/glances_folders.py121
-rw-r--r--glances/plugins/glances_fs.py10
-rw-r--r--glances/plugins/glances_hddtemp.py17
-rw-r--r--glances/plugins/glances_help.py11
-rw-r--r--glances/plugins/glances_ip.py19
-rw-r--r--glances/plugins/glances_load.py16
-rw-r--r--glances/plugins/glances_mem.py7
-rw-r--r--glances/plugins/glances_memswap.py8
-rw-r--r--glances/plugins/glances_monitor.py20
-rw-r--r--glances/plugins/glances_network.py31
-rw-r--r--glances/plugins/glances_now.py4
-rw-r--r--glances/plugins/glances_percpu.py4
-rw-r--r--glances/plugins/glances_plugin.py64
-rw-r--r--glances/plugins/glances_processcount.py7
-rw-r--r--glances/plugins/glances_processlist.py167
-rw-r--r--glances/plugins/glances_psutilversion.py2
-rw-r--r--glances/plugins/glances_quicklook.py15
-rw-r--r--glances/plugins/glances_raid.py12
-rw-r--r--glances/plugins/glances_sensors.py68
-rw-r--r--glances/plugins/glances_system.py14
-rw-r--r--glances/plugins/glances_uptime.py5
-rw-r--r--glances/processes.py (renamed from glances/core/glances_processes.py)59
-rw-r--r--glances/server.py (renamed from glances/core/glances_server.py)32
-rw-r--r--glances/snmp.py (renamed from glances/core/glances_snmp.py)3
-rw-r--r--glances/standalone.py (renamed from glances/core/glances_standalone.py)11
-rw-r--r--glances/static_list.py (renamed from glances/core/glances_staticlist.py)5
-rw-r--r--glances/stats.py (renamed from glances/core/glances_stats.py)67
-rw-r--r--glances/timer.py (renamed from glances/core/glances_timer.py)0
-rw-r--r--glances/webserver.py (renamed from glances/core/glances_webserver.py)11
94 files changed, 44766 insertions, 1352 deletions
diff --git a/glances/README.txt b/glances/README.txt
index b512e62b..bbf94ebf 100644
--- a/glances/README.txt
+++ b/glances/README.txt
@@ -7,32 +7,44 @@ https://github.com/nicolargo/glances/blob/master/docs/glances-doc.rst
__init__.py Global module init
__main__.py Entry point for Glances module
-core/
- => Glances core folder
- glances_config.py Manage configuration file
- glances_globals.py Share variables upon modules
- glances_limits.py Manage limits
- glances_logs.py Manage logs
- glances_main.py Main script to rule them up...
- glances_client.py Glances client
- glances_server.py Glances server
- glances_standalone.py Glances standalone (with curse interface)
- glances_stats.py The stats manager
- glances_timer.py Manage timer
- ...
-plugins/
+config.py Manage the configuration file
+compat.py Python2/3 compatibility shims module
+globals.py Share variables upon modules
+main.py Main script to rule them up...
+client.py Glances client
+server.py Glances server
+webserver.py Glances web server (Bottle-based)
+autodiscover.py Glances autodiscover module (via zeroconf)
+standalone.py Glances standalone (curses interface)
+password.py Manage password for Glances client/server
+stats.py The stats manager
+timer.py The timer class
+actions.py Manage trigger actions (via mustache)
+snmp.py Glances SNMP client (via pysnmp)
+...
+plugins
=> Glances data providers
glances_plugins.py "Father class" for others plugins
glances_cpu.py Manage CPU stats
- glances_load.py Manage LOAD stats
- glances_mem.py Manage MEM (both RAM and SWAP) stats
+ glances_load.py Manage load stats
+ glances_mem.py Manage RAM stats
+ glances_memswap.py Manage swap stats
+ glances_network.py Manage network stats
+ glances_fs.py Manage file system stats
+ glances_diskio.py Manage disk I/O stats
+ glances_docker.py Glances Docker plugin (via docker-py)
+ glances_raid.py Glances RAID plugin (via pymdstat)
...
-outputs/
+outputs
=> Glances UI
- glances_curse.py The Curse interface
- glances_html.py The HTML interface
+ glances_curses.py The curses interface
+ glances_bottle.py The web interface
...
-exports/
+exports
=> Glances export interfaces
glances_csv.py The CSV export module
+ glances_influxdb.py The InfluxDB export module
+ glances_opentsdb.py The OpenTSDB export module
+ glances_rabbitmq.py The RabbitMQ export module
+ glances_statsd.py The StatsD export module
...
diff --git a/glances/__init__.py b/glances/__init__.py
index 96467d73..c937e820 100644
--- a/glances/__init__.py
+++ b/glances/__init__.py
@@ -16,20 +16,21 @@
#
# You should have received a copy of the GNU Lesser General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
+#
"""Init the Glances software."""
-__appname__ = 'glances'
-__version__ = '2.5.1'
-__author__ = 'Nicolas Hennion <nicolas@nicolargo.com>'
-__license__ = 'LGPL'
-
-# Import system lib
import locale
import platform
import signal
import sys
+# Global name
+__appname__ = 'glances'
+__version__ = '2.6'
+__author__ = 'Nicolas Hennion <nicolas@nicolargo.com>'
+__license__ = 'LGPL'
+
# Import psutil
try:
from psutil import __version__ as __psutil_version
@@ -39,8 +40,8 @@ except ImportError:
# Import Glances libs
# Note: others Glances libs will be imported optionally
-from glances.core.glances_logging import logger
-from glances.core.glances_main import GlancesMain
+from glances.logger import logger
+from glances.main import GlancesMain
try:
locale.setlocale(locale.LC_ALL, '')
@@ -52,6 +53,13 @@ if sys.version_info < (2, 6) or (3, 0) <= sys.version_info < (3, 3):
print('Glances requires at least Python 2.6 or 3.3 to run.')
sys.exit(1)
+if sys.version_info[:2] == (2, 6):
+ import warnings
+ warnings.warn('Python 2.6 support will be dropped. Please switch '
+ 'to at least Python 2.7 or 3.3+ as soon as possible. '
+ 'See http://www.snarky.ca/stop-using-python-2-6 '
+ 'for more information.')
+
# Check PSutil version
psutil_min_version = (2, 0, 0)
psutil_version = tuple([int(num) for num in __psutil_version.split('.')])
@@ -115,7 +123,7 @@ def main():
logger.info("Start standalone mode")
# Import the Glances standalone module
- from glances.core.glances_standalone import GlancesStandalone
+ from glances.standalone import GlancesStandalone
# Init the standalone mode
standalone = GlancesStandalone(config=core.get_config(),
@@ -129,7 +137,7 @@ def main():
logger.info("Start client mode (browser)")
# Import the Glances client browser module
- from glances.core.glances_client_browser import GlancesClientBrowser
+ from glances.client_browser import GlancesClientBrowser
# Init the client
client = GlancesClientBrowser(config=core.get_config(),
@@ -139,7 +147,7 @@ def main():
logger.info("Start client mode")
# Import the Glances client module
- from glances.core.glances_client import GlancesClient
+ from glances.client import GlancesClient
# Init the client
client = GlancesClient(config=core.get_config(),
@@ -160,7 +168,7 @@ def main():
logger.info("Start server mode")
# Import the Glances server module
- from glances.core.glances_server import GlancesServer
+ from glances.server import GlancesServer
args = core.get_args()
@@ -183,7 +191,7 @@ def main():
logger.info("Start web server mode")
# Import the Glances web server module
- from glances.core.glances_webserver import GlancesWebServer
+ from glances.webserver import GlancesWebServer
# Init the web server mode
webserver = GlancesWebServer(config=core.get_config(),
diff --git a/glances/__main__.py b/glances/__main__.py
index 871dea89..0568476d 100644
--- a/glances/__main__.py
+++ b/glances/__main__.py
@@ -30,9 +30,9 @@ if __package__ is None and not hasattr(sys, "frozen"):
# It is a direct call to __main__.py
import os.path
path = os.path.realpath(os.path.abspath(__file__))
- sys.path.append(os.path.dirname(os.path.dirname(path)))
+ sys.path.insert(0, os.path.dirname(os.path.dirname(path)))
-import glances
+import glances # noqa
if __name__ == '__main__':
glances.main()
diff --git a/glances/core/glances_actions.py b/glances/actions.py
index dabcd1ba..4fea8d61 100644
--- a/glances/core/glances_actions.py
+++ b/glances/actions.py
@@ -19,11 +19,10 @@
"""Manage on alert actions."""
-# Import system lib
from subprocess import Popen
-# Import Glances lib
-from glances.core.glances_logging import logger
+from glances.logger import logger
+from glances.timer import Timer
try:
import pystache
@@ -38,7 +37,7 @@ class GlancesActions(object):
"""This class manage action if an alert is reached."""
- def __init__(self):
+ def __init__(self, args=None):
"""Init GlancesActions class."""
# Dict with the criticity status
# - key: stat_name
@@ -46,6 +45,13 @@ class GlancesActions(object):
# Goal: avoid to execute the same command twice
self.status = {}
+ # Add a timer to avoid any trigger when Glances is started (issue#732)
+ # Action can be triggered after refresh * 2 seconds
+ if hasattr(args, 'time'):
+ self.start_timer = Timer(args.time * 2)
+ else:
+ self.start_timer = Timer(3)
+
def get(self, stat_name):
"""Get the stat_name criticity."""
try:
@@ -67,7 +73,7 @@ class GlancesActions(object):
Return True if the commands have been ran.
"""
- if self.get(stat_name) == criticity:
+ if self.get(stat_name) == criticity or not self.start_timer.finished():
# Action already executed => Exit
return False
diff --git a/glances/core/glances_autodiscover.py b/glances/autodiscover.py
index 244aa713..fa1414d4 100644
--- a/glances/core/glances_autodiscover.py
+++ b/glances/autodiscover.py
@@ -19,10 +19,12 @@
"""Manage autodiscover Glances server (thk to the ZeroConf protocol)."""
-# Import system libs
import socket
import sys
+from glances.globals import appname, BSD
+from glances.logger import logger
+
try:
from zeroconf import (
__version__ as __zeroconf_version,
@@ -34,10 +36,6 @@ try:
except ImportError:
zeroconf_tag = False
-# Import Glances libs
-from glances.core.glances_globals import appname, is_freebsd
-from glances.core.glances_logging import logger
-
# Zeroconf 0.17 or higher is needed
if zeroconf_tag:
zeroconf_min_version = (0, 17, 0)
@@ -194,9 +192,9 @@ class GlancesAutoDiscoverClient(object):