diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/Makefile.am | 11 | ||||
-rw-r--r-- | src/Makefile.in | 423 | ||||
-rw-r--r-- | src/css/default.css | 188 | ||||
-rwxr-xr-x | src/glances.py | 3156 | ||||
-rw-r--r-- | src/html/base.html | 60 | ||||
-rw-r--r-- | src/html/default.html | 231 | ||||
-rw-r--r-- | src/img/bg.png | bin | 0 -> 20623 bytes |
7 files changed, 2496 insertions, 1573 deletions
diff --git a/src/Makefile.am b/src/Makefile.am deleted file mode 100644 index 5801d758..00000000 --- a/src/Makefile.am +++ /dev/null @@ -1,11 +0,0 @@ -## Process this file with automake to produce Makefile.in -## Created by Anjuta - -## The main script -bin_SCRIPTS = glances.py - -## Directory where .class files will be installed -glancesdir = $(pythondir)/glances - -glances_PYTHON = \ - glances.py diff --git a/src/Makefile.in b/src/Makefile.in deleted file mode 100644 index 68cdb078..00000000 --- a/src/Makefile.in +++ /dev/null @@ -1,423 +0,0 @@ -# Makefile.in generated by automake 1.11.1 from Makefile.am. -# @configure_input@ - -# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, -# 2003, 2004, 2005, 2006, 2007, 2008, 2009 Free Software Foundation, -# Inc. -# This Makefile.in is free software; the Free Software Foundation -# gives unlimited permission to copy and/or distribute it, -# with or without modifications, as long as this notice is preserved. - -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY, to the extent permitted by law; without -# even the implied warranty of MERCHANTABILITY or FITNESS FOR A -# PARTICULAR PURPOSE. - -@SET_MAKE@ - -VPATH = @srcdir@ -pkgdatadir = $(datadir)/@PACKAGE@ -pkgincludedir = $(includedir)/@PACKAGE@ -pkglibdir = $(libdir)/@PACKAGE@ -pkglibexecdir = $(libexecdir)/@PACKAGE@ -am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd -install_sh_DATA = $(install_sh) -c -m 644 -install_sh_PROGRAM = $(install_sh) -c -install_sh_SCRIPT = $(install_sh) -c -INSTALL_HEADER = $(INSTALL_DATA) -transform = $(program_transform_name) -NORMAL_INSTALL = : -PRE_INSTALL = : -POST_INSTALL = : -NORMAL_UNINSTALL = : -PRE_UNINSTALL = : -POST_UNINSTALL = : -subdir = src -DIST_COMMON = $(glances_PYTHON) $(srcdir)/Makefile.am \ - $(srcdir)/Makefile.in -ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 -am__aclocal_m4_deps = $(top_srcdir)/configure.ac -am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ - $(ACLOCAL_M4) -mkinstalldirs = $(install_sh) -d -CONFIG_HEADER = $(top_builddir)/config.h -CONFIG_CLEAN_FILES = -CONFIG_CLEAN_VPATH_FILES = -am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; -am__vpath_adj = case $$p in \ - $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ - *) f=$$p;; \ - esac; -am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`; -am__install_max = 40 -am__nobase_strip_setup = \ - srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'` -am__nobase_strip = \ - for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||" -am__nobase_list = $(am__nobase_strip_setup); \ - for p in $$list; do echo "$$p $$p"; done | \ - sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \ - $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \ - if (++n[$$2] == $(am__install_max)) \ - { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \ - END { for (dir in files) print dir, files[dir] }' -am__base_list = \ - sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \ - sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g' -am__installdirs = "$(DESTDIR)$(bindir)" "$(DESTDIR)$(glancesdir)" -SCRIPTS = $(bin_SCRIPTS) -AM_V_GEN = $(am__v_GEN_$(V)) -am__v_GEN_ = $(am__v_GEN_$(AM_DEFAULT_VERBOSITY)) -am__v_GEN_0 = @echo " GEN " $@; -AM_V_at = $(am__v_at_$(V)) -am__v_at_ = $(am__v_at_$(AM_DEFAULT_VERBOSITY)) -am__v_at_0 = @ -SOURCES = -DIST_SOURCES = -py_compile = $(top_srcdir)/py-compile -DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) -ACLOCAL = @ACLOCAL@ -AMTAR = @AMTAR@ -AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ -AUTOCONF = @AUTOCONF@ -AUTOHEADER = @AUTOHEADER@ -AUTOMAKE = @AUTOMAKE@ -AWK = @AWK@ -CYGPATH_W = @CYGPATH_W@ -DEFS = @DEFS@ -ECHO_C = @ECHO_C@ -ECHO_N = @ECHO_N@ -ECHO_T = @ECHO_T@ -INSTALL = @INSTALL@ -INSTALL_DATA = @INSTALL_DATA@ -INSTALL_PROGRAM = @INSTALL_PROGRAM@ -INSTALL_SCRIPT = @INSTALL_SCRIPT@ -INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ -LIBOBJS = @LIBOBJS@ -LIBS = @LIBS@ -LTLIBOBJS = @LTLIBOBJS@ -MAKEINFO = @MAKEINFO@ -MKDIR_P = @MKDIR_P@ -PACKAGE = @PACKAGE@ -PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ -PACKAGE_NAME = @PACKAGE_NAME@ -PACKAGE_STRING = @PACKAGE_STRING@ -PACKAGE_TARNAME = @PACKAGE_TARNAME@ -PACKAGE_URL = @PACKAGE_URL@ -PACKAGE_VERSION = @PACKAGE_VERSION@ -PATH_SEPARATOR = @PATH_SEPARATOR@ -PYTHON = @PYTHON@ -PYTHON_EXEC_PREFIX = @PYTHON_EXEC_PREFIX@ -PYTHON_PLATFORM = @PYTHON_PLATFORM@ -PYTHON_PREFIX = @PYTHON_PREFIX@ -PYTHON_VERSION = @PYTHON_VERSION@ -SET_MAKE = @SET_MAKE@ -SHELL = @SHELL@ -STRIP = @STRIP@ -VERSION = @VERSION@ -abs_builddir = @abs_builddir@ -abs_srcdir = @abs_srcdir@ -abs_top_builddir = @abs_top_builddir@ -abs_top_srcdir = @abs_top_srcdir@ -am__leading_dot = @am__leading_dot@ -am__tar = @am__tar@ -am__untar = @am__untar@ -bindir = @bindir@ -build_alias = @build_alias@ -builddir = @builddir@ -datadir = @datadir@ -datarootdir = @datarootdir@ -docdir = @docdir@ -dvidir = @dvidir@ -exec_prefix = @exec_prefix@ -host_alias = @host_alias@ -htmldir = @htmldir@ -includedir = @includedir@ -infodir = @infodir@ -install_sh = @install_sh@ -libdir = @libdir@ -libexecdir = @libexecdir@ -localedir = @localedir@ -localstatedir = @localstatedir@ -mandir = @mandir@ -mkdir_p = @mkdir_p@ -oldincludedir = @oldincludedir@ -pdfdir = @pdfdir@ -pkgpyexecdir = @pkgpyexecdir@ -pkgpythondir = @pkgpythondir@ -prefix = @prefix@ -program_transform_name = @program_transform_name@ -psdir = @psdir@ -pyexecdir = @pyexecdir@ -pythondir = @pythondir@ -sbindir = @sbindir@ -sharedstatedir = @sharedstatedir@ -srcdir = @srcdir@ -sysconfdir = @sysconfdir@ -target_alias = @target_alias@ -top_build_prefix = @top_build_prefix@ -top_builddir = @top_builddir@ -top_srcdir = @top_srcdir@ -bin_SCRIPTS = glances.py -glancesdir = $(pythondir)/glances -glances_PYTHON = \ - glances.py - -all: all-am - -.SUFFIXES: -$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) - @for dep in $?; do \ - case '$(am__configure_deps)' in \ - *$$dep*) \ - ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ - && { if test -f $@; then exit 0; else break; fi; }; \ - exit 1;; \ - esac; \ - done; \ - echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu src/Makefile'; \ - $(am__cd) $(top_srcdir) && \ - $(AUTOMAKE) --gnu src/Makefile -.PRECIOUS: Makefile -Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status - @case '$?' in \ - *config.status*) \ - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ - *) \ - echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ - cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ - esac; - -$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh - -$(top_srcdir)/configure: $(am__configure_deps) - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh -$(ACLOCAL_M4): $(am__aclocal_m4_deps) - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh -$(am__aclocal_m4_deps): -install-binSCRIPTS: $(bin_SCRIPTS) - @$(NORMAL_INSTALL) - test -z "$(bindir)" || $(MKDIR_P) "$(DESTDIR)$(bindir)" - @list='$(bin_SCRIPTS)'; test -n "$(bindir)" || list=; \ - for p in $$list; do \ - if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ - if test -f "$$d$$p"; then echo "$$d$$p"; echo "$$p"; else :; fi; \ - done | \ - sed -e 'p;s,.*/,,;n' \ - -e 'h;s|.*|.|' \ - -e 'p;x;s,.*/,,;$(transform)' | sed 'N;N;N;s,\n, ,g' | \ - $(AWK) 'BEGIN { files["."] = ""; dirs["."] = 1; } \ - { d=$$3; if (dirs[d] != 1) { print "d", d; dirs[d] = 1 } \ - if ($$2 == $$4) { files[d] = files[d] " " $$1; \ - if (++n[d] == $(am__install_max)) { \ - print "f", d, files[d]; n[d] = 0; files[d] = "" } } \ - else { print "f", d "/" $$4, $$1 } } \ - END { for (d in files) print "f", d, files[d] }' | \ - while read type dir files; do \ - if test "$$dir" = .; then dir=; else dir=/$$dir; fi; \ - test -z "$$files" || { \ - echo " $(INSTALL_SCRIPT) $$files '$(DESTDIR)$(bindir)$$dir'"; \ - $(INSTALL_SCRIPT) $$files "$(DESTDIR)$(bindir)$$dir" || exit $$?; \ - } \ - ; done - -uninstall-binSCRIPTS: - @$(NORMAL_UNINSTALL) - @list='$(bin_SCRIPTS)'; test -n "$(bindir)" || exit 0; \ - files=`for p in $$list; do echo "$$p"; done | \ - sed -e 's,.*/,,;$(transform)'`; \ - test -n "$$list" || exit 0; \ - echo " ( cd '$(DESTDIR)$(bindir)' && rm -f" $$files ")"; \ - cd "$(DESTDIR)$(bindir)" && rm -f $$files -install-glancesPYTHON: $(glances_PYTHON) - @$(NORMAL_INSTALL) - test -z "$(glancesdir)" || $(MKDIR_P) "$(DESTDIR)$(glancesdir)" - @list='$(glances_PYTHON)'; dlist=; list2=; test -n "$(glancesdir)" || list=; \ - for p in $$list; do \ - if test -f "$$p"; then b=; else b="$(srcdir)/"; fi; \ - if test -f $$b$$p; then \ - $(am__strip_dir) \ - dlist="$$dlist $$f"; \ - list2="$$list2 $$b$$p"; \ - else :; fi; \ - done; \ - for file in $$list2; do echo $$file; done | $(am__base_list) | \ - while read files; do \ - echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(glancesdir)'"; \ - $(INSTALL_DATA) $$files "$(DESTDIR)$(glancesdir)" || exit $$?; \ - done || exit $$?; \ - if test -n "$$dlist"; then \ - if test -z "$(DESTDIR)"; then \ - PYTHON=$(PYTHON) $(py_compile) --basedir "$(glancesdir)" $$dlist; \ - else \ - PYTHON=$(PYTHON) $(py_compile) --destdir "$(DESTDIR)" --basedir "$(glancesdir)" $$dlist; \ - fi; \ - else :; fi - -uninstall-glancesPYTHON: - @$(NORMAL_UNINSTALL) - @list='$(glances_PYTHON)'; test -n "$(glancesdir)" || list=; \ - files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \ - test -n "$$files" || exit 0; \ - filesc=`echo "$$files" | sed 's|$$|c|'`; \ - fileso=`echo "$$files" | sed 's|$$|o|'`; \ - echo " ( cd '$(DESTDIR)$(glancesdir)' && rm -f" $$files ")"; \ - cd "$(DESTDIR)$(glancesdir)" && rm -f $$files || exit $$?; \ - echo " ( cd '$(DESTDIR)$(glancesdir)' && rm -f" $$filesc ")"; \ - cd "$(DESTDIR)$(glancesdir)" && rm -f $$filesc || exit $$?; \ - echo " ( cd '$(DESTDIR)$(glancesdir)' && rm -f" $$fileso ")"; \ - cd "$(DESTDIR)$(glancesdir)" && rm -f $$fileso -tags: TAGS -TAGS: - -ctags: CTAGS -CTAGS: - - -distdir: $(DISTFILES) - @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ - topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ - list='$(DISTFILES)'; \ - dist_files=`for file in $$list; do echo $$file; done | \ - sed -e "s|^$$srcdirstrip/||;t" \ - -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ - case $$dist_files in \ - */*) $(MKDIR_P) `echo "$$dist_files" | \ - sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ - sort -u` ;; \ - esac; \ - for file in $$dist_files; do \ - if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ - if test -d $$d/$$file; then \ - dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ - if test -d "$(distdir)/$$file"; then \ - find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ - fi; \ - if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ - cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ - find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ - fi; \ - cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ - else \ - test -f "$(distdir)/$$file" \ - || cp -p $$d/$$file "$(distdir)/$$file" \ - || exit 1; \ - fi; \ - done -check-am: all-am -check: check-am -all-am: Makefile $(SCRIPTS) -installdirs: - for dir in "$(DESTDIR)$(bindir)" "$(DESTDIR)$(glancesdir)"; do \ - test -z "$$dir" || $(MKDIR_P) "$$dir"; \ - done -install: install-am -install-exec: install-exec-am -install-data: install-data-am -uninstall: uninstall-am - -install-am: all-am - @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am - -installcheck: installcheck-am -install-strip: - $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ - install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ - `test -z '$(STRIP)' || \ - echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install -mostlyclean-generic: - -clean-generic: - -distclean-generic: - -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) - -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) - -maintainer-clean-generic: - @echo "This command is intended for maintainers to use" - @echo "it deletes files that may require special tools to rebuild." -clean: clean-am - -clean-am: clean-generic mostlyclean-am - -distclean: distclean-am - -rm -f Makefile -distclean-am: clean-am distclean-generic - -dvi: dvi-am - -dvi-am: - -html: html-am - -html-am: - -info: info-am - -info-am: - -install-data-am: install-glancesPYTHON - -install-dvi: install-dvi-am - -install-dvi-am: - -install-exec-am: install-binSCRIPTS - -install-html: install-html-am - -install-html-am: - -install-info: install-info-am - -install-info-am: - -install-man: - -install-pdf: install-pdf-am - -install-pdf-am: - -install-ps: install-ps-am - -install-ps-am: - -installcheck-am: - -maintainer-clean: maintainer-clean-am - -rm -f Makefile -maintainer-clean-am: distclean-am maintainer-clean-generic - -mostlyclean: mostlyclean-am - -mostlyclean-am: mostlyclean-generic - -pdf: pdf-am - -pdf-am: - -ps: ps-am - -ps-am: - -uninstall-am: uninstall-binSCRIPTS uninstall-glancesPYTHON - -.MAKE: install-am install-strip - -.PHONY: all all-am check check-am clean clean-generic distclean \ - distclean-generic distdir dvi dvi-am html html-am info info-am \ - install install-am install-binSCRIPTS install-data \ - install-data-am install-dvi install-dvi-am install-exec \ - install-exec-am install-glancesPYTHON install-html \ - install-html-am install-info install-info-am install-man \ - install-pdf install-pdf-am install-ps install-ps-am \ - install-strip installcheck installcheck-am installdirs \ - maintainer-clean maintainer-clean-generic mostlyclean \ - mostlyclean-generic pdf pdf-am ps ps-am uninstall uninstall-am \ - uninstall-binSCRIPTS uninstall-glancesPYTHON - - -# Tell versions [3.59,3.63) of GNU make to not export all variables. -# Otherwise a system limit (for SysV at least) may be exceeded. -.NOEXPORT: diff --git a/src/css/default.css b/src/css/default.css new file mode 100644 index 00000000..7f4ac371 --- /dev/null +++ b/src/css/default.css @@ -0,0 +1,188 @@ +/* +Reset the sheet +*/ + +* { margin: 0; padding: 0; } +article, aside, details, figcaption, figure, footer, header, hgroup, nav, section { display: block; } +[hidden] { display: none; } + +/* +Colors table +* bg: background color +* fg: foreground color +*/ + +.bgmain { background: transparent; } +.fgmain { color: #FFFFFF; } + +.bghost { background: transparent; } +.fghost { color: #E3D7BF; font-size: 50px; text-shadow: 1px 1px 1px #e88860, 2px 2px 1px #e88860, 3px 3px 1px #e88860, 3px 3px 1px #0c0d0d, 4px 4px 3px #0c0d0d;} + +.bgsystem { background: transparent; } +.fgsystem { color: #E88860; text-shadow: 1px 1px 1px #000; } + +.bgcpu { background: transparent; } +.fgcpu { color: #3C8AAD; } + +.bgload { background: transparent; } +.fgload { color: #3C8AAD; } + +.bgmem { background: transparent; } +.fgmem { color: #3C8AAD; } + +.bgnet { background: transparent; } +.fgnet { color: #3C8AAD; } + +.bgdiskio { background: transparent; } +.fgdiskio { color: #3C8AAD; } + +.bgfs { background: transparent; } +.fgfs { color: #3C8AAD; } + +.bgproc { background: transparent; } +.fgproc { color: #3C8AAD; } + +.bgcdefault { background: transparent; } +.fgcdefault { color: #FFFFFF; } +.bgcok { background: #60AC39; } +.fgcok { color: #FFFFFF; } +.bgccareful { background: #6039AC; } +.fgccareful { color: #FFFFFF; } +.bgcwarning { background: #FFAA00; } +.fgcwarning { color: #FFFFFF; } +.bgcritical { background: #D92626; } +.fgcritical { color: #FFFFFF; } + +/* +Main +*/ + +html { + background-image: url('../img/bg.png'); + font-size: 100%; -webkit-text-size-adjust: 100%; -ms-text-size-adjust: 100%; +} +html, button, input, select, textarea { font-family: sans-serif; } +body { margin: 0; font-size: 1em; line-height: 1.4; } +::-moz-selection { background: #fe57a1; color: #fff; text-shadow: none; } +::selection { background: #fe57a1; color: #fff; text-shadow: none; } + +/* Tables */ + +table{ + font-family: 'Trebuchet MS', sans-serif; + font-size: 14px; + font-weight: bold; + font-style: normal; + border-collapse: separate; +} + +thead th{ + padding:5px; + border:1px solid #3C8AAD; + -webkit-border-top-left-radius:5px; + -webkit-border-top-right-radius:5px; + -moz-border-radius:5px 5px 0px 0px; + border-top-left-radius:5px; + border-top-right-radius:5px; +} + +thead th:empty{ + background:transparent; + border:none; +} + +tfoot td{ + font-size:16px; + text-align:center; + padding:10px 0px; +} + +tfoot th{ +} + +tbody td{ + width:80px; + padding:5px; + text-align:center; + border:1px solid #3C8AAD; + -moz-border-radius:2px; + -webkit-border-radius:2px; + border-radius:2px; +} + +#item{ + width:60px; + border:none; + text-align:right; + color: #8cf; +} + +#command{ + width:240px; + font-size:11px; + text-align:left; + color: #8cf; +} + +/* Header */ + +header { + text-align: center; + margin-bottom: 25px; +} + +/* Main */ + +#main { + text-align: center; +} + +#firstline, #secondline { + margin: 0 auto; +} + +#secondline { + display: inline-block; + vertical-align: top; + margin-top: 20px; +} + +#sideleft { + width: 310px; + float: left; + margin-right: 25px; +} + +#sideright { + width: 550px; + float: left; +} + +#cpu, #load, #mem, #net, #diskio, #fs { + display: inline-block; + vertical-align: middle; +} + +#cpu, #load { + margin-right: 50px; +} + +#diskio, #fs { + margin-top: 25px; +} + +#proclist { + margin-top: 50px; +} + +/* Footer */ + +footer { + clear: both; + margin: 20px 0px 10px 0px; + text-align: center; +} + +footer a { + color: white; +} diff --git a/src/glances.py b/src/glances.py index 8ff0b818..4d005c03 100755 --- a/src/glances.py +++ b/src/glances.py @@ -1,1188 +1,2066 @@ #!/usr/bin/env python # -# Glances is a simple CLI monitoring tool based on libstatgrab +# Glances is a simple textual monitoring tool # -# Pre-requisites: python-statgrab 0.5 or > +# Pre-requisites: Python 2.6+ and PsUtil 0.4.0+ (for full functions) # # Copyright (C) Nicolargo 2012 <nicolas@nicolargo.com> -# +# # under the terms of the GNU Lesser General Public License as published # by the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. -# +# # Glances is distributed in the hope that it will be useful, but # WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. # See the GNU Lesser General Public License for more details. -# +# # 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/>."; # from __future__ import generators -try: - import os - import getopt - import sys - import signal - import time - import datetime - import multiprocessing - import gettext -except KeyboardInterrupt: - pass - - -# i18n -#===== +__appname__ = 'glances' +__version__ = "1.4" +__author__ = "Nicolas Hennion <nicolas@nicolargo.com>" +__licence__ = "LGPL" + +# Libraries +#========== -application = 'glances' -__version__ = "1.3.7" -gettext.install(application) +import os +import sys +import platform +import getopt +import signal +import time +from datetime import datetime, timedelta +import gettext + +# International +#============== + +gettext.install(__appname__) + +# Test methods +#============= try: - import statgrab -except: - print _('Statgrab initialization failed, Glances cannot start.') - print - sys.exit(1) + import curses + import curses.panel +except ImportError: + print _('Curses module not found. Glances cannot start.') + print _('Glances requires at least Python 2.6 or higher.') + print + sys.exit(1) try: - import curses - import curses.panel -except: - print _('Textmode GUI initialization failed, Glances cannot start.') + import psutil +except ImportError: + print _('PsUtil module not found. Glances cannot start.') + print + print _('On Ubuntu 12.04 or higher:') + print _('$ sudo apt-get install python-psutil') + print + print _('To install PsUtil using pip (as root):') + print _('# pip install psutil') print sys.exit(1) +try: + # get_cpu_percent method only available with PsUtil 0.2.0+ + psutil.Process(os.getpid()).get_cpu_percent(interval=0) +except Exception: + psutil_get_cpu_percent_tag = False +else: + psutil_get_cpu_percent_tag = True + +try: + # (phy|virt)mem_usage methods only available with PsUtil 0.3.0+ + psutil.phymem_usage() + psutil.virtmem_usage() +except Exception: + psutil_mem_usage_tag = False +else: + psutil_mem_usage_tag = True + +try: + # disk_(partitions|usage) methods only available with PsUtil 0.3.0+ + psutil.disk_partitions() + psutil.disk_usage('/') +except Exception: + psutil_fs_usage_tag = False +else: + psutil_fs_usage_tag = True + +try: + # disk_io_counters method only available with PsUtil 0.4.0+ + psutil.disk_io_counters() +except Exception: + psutil_disk_io_tag = False +else: + psutil_disk_io_tag = True + +try: + # network_io_counters method only available with PsUtil 0.4.0+ + psutil.network_io_counters() +except Exception: + psutil_network_io_tag = False +else: + psutil_network_io_tag = True + +try: + # HTML output + import jinja2 +except ImportError: + jinja_tag = False +else: + jinja_tag = True + +try: + # CSV output + import csv +except ImportError: + csvlib_tag = False +else: + csvlib_tag = True + # Classes #======== -class Timer(): - """ - The timer class - """ - - def __init__(self, duration): - self.started(duration) - - def started(self, duration): - self.target = time.time() + duration - - def finished(self): - return time.time() > self.target - - -class glancesLimits(): - """ - Manage the limit OK,CAREFUL,WARNING,CRITICAL for each stats - """ - - # The limit list is stored in an hash table: - # limits_list[STAT] = [ CAREFUL , WARNING , CRITICAL ] - # Exemple: - # limits_list['STD'] = [ 50, 70 , 90 ] - - __limits_list = { # CAREFUL WARNING CRITICAL - 'STD': [50, 70, 90], - 'LOAD': [0.7, 1.0, 5.0] - } - - def getSTDCareful(self): - return self.__limits_list['STD'][0] - - def getSTDWarning(self): - return self.__limits_list['STD'][1] - - def getSTDCritical(self): - return self.__limits_list['STD'][2] - - def getLOADCareful(self, core = 1): - return self.__limits_list['LOAD'][0] * core - - def getLOADWarning(self, core = 1): - return self.__limits_list['LOAD'][1] * core - - def getLOADCritical(self, core = 1): - return self.__limits_list['LOAD'][2] * core - - -class glancesLogs(): - """ - The main class to manage logs inside the Glances software - Logs is a list of list: - [["begin", "end", "WARNING|CRITICAL", "CPU|LOAD|MEM", MAX, AVG, MIN, SUM, COUNT],...] - """ - - def __init__(self): - """ - Init the logs classe - """ - # Maximum size of the logs list - self.logs_max = 10 - - # Init the logs list - self.logs_list = [] - - def get(self): - """ - Return the logs list (RAW) - """ - return self.logs_list - - def len(self): - """ - Return the number of item in the log list - """ - return self.logs_list.__len__() - - def __itemexist__(self, item_type): - """ - An item exist in the list if: - * end is < 0 - * item_type is matching - """ - for i in range(self.len()): - if ((self.logs_list[i][1] < 0) and - (self.logs_list[i][3] == item_type)): - return i - return -1 - - def add(self, item_state, item_type, item_value): - """ - item_state = "OK|CAREFUL|WARNING|CRITICAL" - item_type = "CPU|LOAD|MEM" - item_value = value - Item is defined by: - ["begin", "end", "WARNING|CRITICAL", "CPU|LOAD|MEM", MAX, AVG, MIN, SUM, COUNT] - If item is a 'new one': - Add the new item at the beginning of the logs list - Else: - Update the existing item - """ - item_index = self.__itemexist__(item_type) - if (item_index < 0): - # Item did not exist, add if WARNING or CRITICAL - if ((item_state == "WARNING") or - (item_state == "CRITICAL")): - # Time is stored in Epoch format - # Epoch -> DMYHMS = datetime.datetime.fromtimestamp(epoch) - item = [] - item.append(time.mktime(datetime.datetime.now().timetuple())) - item.append(-1) - item.append(item_state) # STATE: WARNING|CRITICAL - item.append(item_type) # TYPE: CPU, LOAD, MEM... - item.append(item_value) # MAX - item.append(item_value) # AVG - item.append(item_value) # MIN - item.append(item_value) # SUM - item.append(1) # COUNT - self.logs_list.insert(0, item) - if (self.len() > self.logs_max): - self.logs_list.pop() - else: - # Item exist, update - if ((item_state == "OK") or - (item_state == "CAREFUL")): - # Close the item - self.logs_list[item_index][1] = time.mktime(datetime.datetime.now().timetuple()) - else: - # Update the item - # State - if (item_state == "CRITICAL"): - self.logs_list[item_index][2] = item_state - # Value - if (item_value > self.logs_list[item_index][4]): - # MAX - self.logs_list[item_index][4] = item_value - elif (item_value < self.logs_list[item_index][6]): - # MIN - self.logs_list[item_index][6] = item_value - # AVG - self.logs_list[item_index][7] += item_value - self.logs_list[item_index][8] += 1 - self.logs_list[item_index][5] = self.logs_list[item_index][7] / self.logs_list[item_index][8] - return self.len() - - -class glancesGrabFs(): - """ - Get FS stats: idem as structure http://www.i-scream.org/libstatgrab/docs/sg_get_fs_stats.3.html - """ - - def __init__(self): - self.__update__() - - - def __update__(self): - """ - Update the stats - """ - - # Reset the list - self.fs_list = [] - - # Ignore the following fs - ignore_fsname = ('none', 'gvfs-fuse-daemon', 'fusectl', 'cgroup') - ignore_fstype = ('binfmt_misc', 'devpts', 'iso9660', 'none', 'proc', 'sysfs', 'usbfs') - - # Open the current mounted FS - mtab = open("/etc/mtab", "r") - for line in mtab.readlines(): - if line.split()[0] in ignore_fsname: continue - if line.split()[2] in ignore_fstype: continue - # Get FS stats - fs_current = {} - fs_name = self.__getmount__(line.split()[1]) - fs_stats = os.statvfs(fs_name) - # Build the list - fs_current['device_name'] = str(line.split()[0]) - fs_current['fs_type'] = str(line.split()[2]) - fs_current['mnt_point'] = str(fs_name) - fs_current['size'] = float(fs_stats.f_blocks) * long(fs_stats.f_frsize) - fs_current['used'] = float(fs_stats.f_blocks - fs_stats.f_bfree) * long(fs_stats.f_frsize) - fs_current['avail'] = float(fs_stats.f_bfree) * long(fs_stats.f_frsize) - self.fs_list.append(fs_current) - mtab.close() - - - def __getmount__(self, path): - """ - Return the real root path of a file - Exemple: /home/nicolargo can return /home or / - """ - path = os.path.realpath(os.path.abspath(path)) - while path != os.path.sep: - if os.path.ismount(path): - return path - path = os.path.abspath(os.path.join(path, os.pardir)) - return path - - - def get(self): - self.__update__() - return self.fs_list - - -class glancesStats(): - """ - This class store, update and give the libstatgrab stats - """ - - def __init__(self): - """ - Init the libstatgrab and process to the first update - """ - - # Init libstatgrab - if not statgrab.sg_init(): - print _("Error: Can not init the libstatgrab library.\n") - - # Init the fs stats - try: - self.glancesgrabfs = glancesGrabFs() - except: - self.glancesgrabfs = {} - - # Do the first update - self.__update__() - - def __update__(self): - """ - Update the stats - """ - - # Get informations from libstatgrab and others... - try: - self.host = statgrab.sg_get_host_info() - except: - self.host = {} - self.system = self.host - try: - self.cpu = statgrab.sg_get_cpu_percents() - except: - self.cpu = {} - try: - self.load = statgrab.sg_get_load_stats() - except: - self.load = {} |