Resolve merge conflicts

This commit is contained in:
nicolargo 2022-09-08 10:15:16 +02:00
commit 55b063c6b0
182 changed files with 18308 additions and 68903 deletions

21
.flake8 Normal file
View File

@ -0,0 +1,21 @@
[flake8]
ignore =
W504 # line break after binary operator
# --- flake8-bugbear plugin
B007 # Loop control variable 'keyword' not used within the loop body. If this is intended, start the name with an underscore.
B014 # Redundant exception types in `except (IOError, OSError) as err:`. Write `except OSError as err:`, which catches exactly the same exceptions.
B008 # Do not perform function calls in argument defaults.
# --- flake8-blind-except plugin
B902 # blind except Exception: statement
# --- flake8-quotes plugin
Q000 # Double quotes found but single quotes preferred
# --- flake8-quotes naming; disable all except N804 and N805
N801, N802, N803, N806, N807, N811, N812, N813, N814, N815, N816, N817, N818
# lines should not exceed 120 characters
max-line-length = 120

View File

@ -8,7 +8,8 @@ env:
DEFAULT_DOCKER_IMAGE: nicolargo/glances
NODE_ENV: ${{ (contains('refs/heads/master', github.ref) || startsWith(github.ref, 'refs/tags/v')) && 'prod' || 'dev' }}
PUSH_BRANCH: ${{ 'refs/heads/develop' == github.ref || 'refs/heads/master' == github.ref || startsWith(github.ref, 'refs/tags/v') }}
DOCKER_PLATFORMS: linux/amd64,linux/arm/v6,linux/arm/v7,linux/arm64,linux/386
# linux/arm/v6 support following issue #2120
DOCKER_PLATFORMS: linux/amd64,linux/arm/v7,linux/arm64,linux/386
on:
pull_request:

View File

@ -14,35 +14,62 @@ install: ## Open a Web Browser to the installation procedure
venv-python: ## Install Python 3 venv
virtualenv -p /usr/bin/python3 venv
venv-dev: ## Install Python 3 dev dependencies
venv-dev: venv-python ## Install Python 3 dev dependencies
./venv/bin/pip install -r dev-requirements.txt
./venv/bin/pip install -r doc-requirements.txt
venv-dev-upgrade: ## Upgrade Python 3 dev dependencies
venv-dev-upgrade: venv-dev ## Upgrade Python 3 dev dependencies
./venv/bin/pip install --upgrade pip
./venv/bin/pip install --upgrade -r dev-requirements.txt
./venv/bin/pip install --upgrade -r doc-requirements.txt
venv: ## Install Python 3 run-time dependencies
venv: venv-python ## Install Python 3 run-time dependencies
./venv/bin/pip install -r requirements.txt
./venv/bin/pip install -r optional-requirements.txt
venv-upgrade: ## Upgrade Python 3 run-time dependencies
venv-upgrade: venv ## Upgrade Python 3 run-time dependencies
./venv/bin/pip install --upgrade -r dev-requirements.txt
./venv/bin/pip install --upgrade -r requirements.txt
./venv/bin/pip install --upgrade -r optional-requirements.txt
test: venv ## Run unit tests
# ===================================================================
# Tests
# ===================================================================
test: venv-upgrade venv-dev-upgrade ## Run unit tests
./venv/bin/python ./unitest.py
./venv/bin/python ./unitest-restful.py
./venv/bin/python ./unitest-xmlrpc.py
./venv/bin/python -m black ./glances --check --exclude outputs/static
./venv/bin/pyright glances
format: venv ## Format the code
# ===================================================================
# Linters and profilers
# ===================================================================
format: venv-dev-upgrade ## Format the code
@git ls-files '*.py' | xargs ./venv/bin/python -m autopep8 --in-place --jobs 0 --global-config=.flake8
@git ls-files '*.py' | xargs ./venv/bin/python -m autoflake --in-place --remove-all-unused-imports --remove-unused-variables --remove-duplicate-keys --exclude="compat.py,globals.py"
./venv/bin/python -m black ./glances --exclude outputs/static
docs: venv-dev ## Create the documentation
flake8: venv-dev-upgrade ## Run flake8 linter.
@git ls-files '*.py' | xargs ./venv/bin/python -m flake8 --config=.flake8
profiling: ## How to start the profiling of the Glances software
@echo "Please complete and run: sudo ./venv/bin/py-spy record -o ./docs/_static/glances-flame.svg -d 60 -s --pid <GLANCES PID>"
trace-malloc: ## Trace the malloc() calls
@echo "Malloc test is running, please wait ~30 secondes..."
./venv/bin/python -m glances -C ./conf/glances.conf --trace-malloc --stop-after 15 --quiet
memory-leak: ## Profile memory leaks
./venv/bin/python -m glances -C ./conf/glances.conf --memory-leak
# ===================================================================
# Docs
# ===================================================================
docs: venv-dev-upgrade ## Create the documentation
./venv/bin/python -m glances -C ./conf/glances.conf --api-doc > ./docs/api.rst
cd docs && ./build.sh && cd ..
@ -50,12 +77,35 @@ docs-server: docs ## Start a Web server to serve the documentation
(sleep 2 && sensible-browser "http://localhost:$(PORT)") &
cd docs/_build/html/ && ../../../venv/bin/python -m http.server $(PORT)
webui: venv-dev ## Build the Web UI
release-note: ## Generate release note
git --no-pager log $(LASTTAG)..HEAD --first-parent --pretty=format:"* %s"
@echo "\n"
git --no-pager shortlog -s -n $(LASTTAG)..HEAD
# ===================================================================
# WebUI
# ===================================================================
webui: venv-dev-upgrade ## Build the Web UI
cd glances/outputs/static/ && npm ci && npm run build
webui-audit: venv-dev ## Audit the Web UI
webui-audit: venv-dev-upgrade ## Audit the Web UI
cd glances/outputs/static/ && npm audit
# ===================================================================
# Packaging
# ===================================================================
flatpak: venv-dev-upgrade ## Generate FlatPack JSON file
git clone https://github.com/flatpak/flatpak-builder-tools.git
./venv/bin/python ./flatpak-builder-tools/pip/flatpak-pip-generator glances
rm -rf ./flatpak-builder-tools
@echo "Now follow: https://github.com/flathub/flathub/wiki/App-Submission"
# ===================================================================
# Run
# ===================================================================
run: ## Start Glances in console mode (also called standalone)
./venv/bin/python -m glances -C ./conf/glances.conf
@ -83,19 +133,4 @@ show-version: ## Show Glances version number
show-issue: ## Generate output for a new issue
./venv/bin/python -m glances -C ./conf/glances.conf --issue
profiling: ## How to start the profiling of the Glances software
@echo "Please complete and run: sudo ./venv/bin/py-spy record -o ./docs/_static/glances-flame.svg -d 60 -s --pid <GLANCES PID>"
trace-malloc: ## Trace the malloc() calls
@echo "Malloc test is running, please wait ~30 secondes..."
./venv/bin/python -m glances -C ./conf/glances.conf --trace-malloc --stop-after 15 --quiet
memory-leak: ## Profile memory leaks
./venv/bin/python -m glances -C ./conf/glances.conf --memory-leak
release-note: ## Generate release note
git --no-pager log $(LASTTAG)..HEAD --first-parent --pretty=format:"* %s"
@echo "\n"
git --no-pager shortlog -s -n $(LASTTAG)..HEAD
.PHONY: test docs docs-server venv

View File

@ -1,3 +1,7 @@
py-spy
black
pyright
pyright
requirements-parser
flake8
autopep8
autoflake

File diff suppressed because it is too large Load Diff

View File

@ -223,17 +223,17 @@ htmlhelp_basename = 'Glancesdoc'
# -- Options for LaTeX output ---------------------------------------------
latex_elements = {
# The paper size ('letterpaper' or 'a4paper').
#'papersize': 'letterpaper',
# The paper size ('letterpaper' or 'a4paper').
# 'papersize': 'letterpaper',
# The font size ('10pt', '11pt' or '12pt').
#'pointsize': '10pt',
# The font size ('10pt', '11pt' or '12pt').
# 'pointsize': '10pt',
# Additional stuff for the LaTeX preamble.
#'preamble': '',
# Additional stuff for the LaTeX preamble.
# 'preamble': '',
# Latex figure (float) alignment
#'figure_align': 'htbp',
# Latex figure (float) alignment
# 'figure_align': 'htbp',
}
# Grouping the document tree into LaTeX files. List of tuples

View File

@ -93,29 +93,33 @@ and generate the password file (the default login is ``glances``, add the ``--us
.. code-block:: console
glances -s --password
which will prompt you to answer the following questions:
.. code-block:: console
Define the Glances server password (glances username):
Password (confirm):
Define the Glances server password (glances username):
Password (confirm):
Do you want to save the password? [Yes/No]: Yes
after which you will need to kill the process by entering ``CTRL+C`` (potentially twice), before leaving the container:
.. code-block:: console
exit
You will then need to copy the password file to your host machine:
.. code-block:: console
docker cp glances_docker:/root/.config/glances/glances.pwd ./secrets/glances_password
and make it visible to your container by adding it to ``docker-compose.yml`` as a ``secret``:
.. code-block:: yaml
version: '3'
services:
glances:
image: nicolargo/glances:latest
@ -128,7 +132,7 @@ and make it visible to your container by adding it to ``docker-compose.yml`` as
secrets:
- source: glances_password
target: /root/.config/glances/glances.pwd
secrets:
glances_password:
file: ./secrets/glances_password

View File

@ -7,14 +7,14 @@ It's possible to export stats to a CSV file.
.. code-block:: console
$ glances --export csv --export-csv-file /tmp/glances.csv
$ glances --export csv --export-csv-file /tmp/glances.csv --quiet
CSV file description:
- first line: Stats description (header)
- others lines: Stats (data)
By default, data will be append any existing CSV file.
By default, data will be append any existing CSV file (if header are compliant).
If the header did not match with a previous one, an error is logged.
@ -22,4 +22,8 @@ The --export-csv-overwrite tag should be used if you want to delete the existing
It is possible to remove some exported data using the --disable-plugin tag:
$ glances --export csv --export-csv-file /tmp/glances.csv --disable-plugin load,swap
$ glances --export csv --export-csv-file /tmp/glances.csv --disable-plugin load,swap --quiet
or by only enable some plugins:
$ glances --export csv --export-csv-file /tmp/glances.csv --disable-plugin all --enable-plugin cpu,mem,load --quiet

View File

@ -27,7 +27,7 @@ level margin: \\n[rst2man-indent\\n[rst2man-indent-level]]
.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]]
.in \\n[rst2man-indent\\n[rst2man-indent-level]]u
..
.TH "GLANCES" "1" "Aug 08, 2022" "3.3.0_beta1" "Glances"
.TH "GLANCES" "1" "Sep 03, 2022" "3.3.0_beta1" "Glances"
.SH NAME
glances \- An eye on your system
.SH SYNOPSIS

357
glances/compat.py Normal file
View File

@ -0,0 +1,357 @@
# -*- coding: utf-8 -*-
#
# This file is part of Glances.
#
# SPDX-FileCopyrightText: 2022 Nicolas Hennion <nicolas@nicolargo.com>
#
# SPDX-License-Identifier: LGPL-3.0-only
#
# flake8: noqa
# pylint: skip-file
"""Python 2/3 compatibility shims."""
from __future__ import print_function, unicode_literals
import operator
import sys
import unicodedata
import types
import subprocess
import os
from datetime import datetime
from glances.logger import logger
PY3 = sys.version_info[0] == 3
if PY3:
import queue
from configparser import ConfigParser, NoOptionError, NoSectionError
from statistics import mean
from xmlrpc.client import Fault, ProtocolError, ServerProxy, Transport, Server
from xmlrpc.server import SimpleXMLRPCRequestHandler, SimpleXMLRPCServer
from urllib.request import Request, urlopen, base64
from urllib.error import HTTPError, URLError
from urllib.parse import urlparse
# Correct issue #1025 by monkey path the xmlrpc lib
from defusedxml.xmlrpc import monkey_patch
monkey_patch()
input = input
range = range
map = map
text_type = str
binary_type = bytes
bool_type = bool
long = int
PermissionError = OSError
viewkeys = operator.methodcaller('keys')
viewvalues = operator.methodcaller('values')
viewitems = operator.methodcaller('items')
def printandflush(string):
"""Print and flush (used by stdout* outputs modules)"""
print(string, flush=True)
def to_ascii(s):
"""Convert the bytes string to a ASCII string
Useful to remove accent (diacritics)
"""
if isinstance(s, binary_type):
return s.decode()
return s.encode('ascii', 'ignore').decode()
def listitems(d):
return list(d.items())
def listkeys(d):
return list(d.keys())
def listvalues(d):
return list(d.values())
def iteritems(d):
return iter(d.items())
def iterkeys(d):
return iter(d.keys())
def itervalues(d):
return iter(d.values())
def u(s, errors='replace'):
if isinstance(s, text_type):
return s
return s.decode('utf-8', errors=errors)
def b(s, errors='replace'):
if isinstance(s, binary_type):
return s
return s.encode('utf-8', errors=errors)
def n(s):
'''Only in Python 2...
from future.utils import bytes_to_native_str as n
'''
return s
def nativestr(s, errors='replace'):
if isinstance(s, text_type):
return s
elif isinstance(s, (int, float)):
return s.__str__()
else:
return s.decode('utf-8', errors=errors)
def system_exec(command):
"""Execute a system command and return the result as a str"""
try:
res = subprocess.run(command.split(' '), stdout=subprocess.PIPE).stdout.decode('utf-8')
except Exception as e:
logger.debug('Can not evaluate command {} ({})'.format(command, e))
res = ''
return res.rstrip()
else:
from future.utils import bytes_to_native_str as n
import Queue as queue
from itertools import imap as map
from ConfigParser import SafeConfigParser as ConfigParser, NoOptionError, NoSectionError
from SimpleXMLRPCServer import SimpleXMLRPCRequestHandler, SimpleXMLRPCServer
from xmlrpclib import Fault, ProtocolError, ServerProxy, Transport, Server
from urllib2 import Request, urlopen, HTTPError, URLError, base64
from urlparse import urlparse
# Correct issue #1025 by monkey path the xmlrpc lib
from defusedxml.xmlrpc import monkey_patch
monkey_patch()
input = raw_input
range = xrange
ConfigParser.read_file = ConfigParser.readfp
text_type = unicode
binary_type = str
bool_type = types.BooleanType
long = long
PermissionError = OSError
viewkeys = operator.methodcaller('viewkeys')
viewvalues = operator.methodcaller('viewvalues')
viewitems = operator.methodcaller('viewitems')
def printandflush(string):
"""Print and flush (used by stdout* outputs modules)"""
print(string)
sys.stdout.flush()
def mean(numbers):
return float(sum(numbers)) / max(len(numbers), 1)
def to_ascii(s):
"""Convert the unicode 's' to a ASCII string
Useful to remove accent (diacritics)
"""
if isinstance(s, binary_type):
return s
return unicodedata.normalize('NFKD', s).encode('ascii', 'ignore')
def listitems(d):
return d.items()
def listkeys(d):
return d.keys()
def listvalues(d):
return d.values()
def iteritems(d):
return d.iteritems()
def iterkeys(d):
return d.iterkeys()
def itervalues(d):
return d.itervalues()
def u(s, errors='replace'):
if isinstance(s, text_type):
return s.encode('utf-8', errors=errors)
return s.decode('utf-8', errors=errors)
def b(s, errors='replace'):
if isinstance(s, binary_type):
return s
return s.encode('utf-8', errors=errors)
def nativestr(s, errors='replace'):
if isinstance(s, binary_type):
return s
elif isinstance(s, (int, float)):
return s.__str__()
else:
return s.encode('utf-8', errors=errors)
def system_exec(command):
"""Execute a system command and return the resul as a str"""
try:
res = subprocess.check_output(command.split(' '))
except Exception as e:
logger.debug('Can not execute command {} ({})'.format(command, e))
res = ''
return res.rstrip()
# Globals functions for both Python 2 and 3
def subsample(data, sampling):
"""Compute a simple mean subsampling.
Data should be a list of numerical itervalues
:return: a sub-sampled list of sampling length
"""
if len(data) <= sampling:
return data
sampling_length = int(round(len(data) / float(sampling)))
return [mean(data[s * sampling_length : (s + 1) * sampling_length]) for s in range(0, sampling)]
def time_serie_subsample(data, sampling):
"""Compute a simple mean subsampling.
Data should be a list of set (time, value)
:return: a sub-sampled list of sampling length
"""
if len(data) <= sampling:
return data
t = [t[0] for t in data]
v = [t[1] for t in data]
sampling_length = int(round(len(data) / float(sampling)))
t_sub_sampled = [t[s * sampling_length : (s + 1) * sampling_length][0] for s in range(0, sampling)]
v_sub_sampled = [mean(v[s * sampling_length : (s + 1) * sampling_length]) for s in range(0, sampling)]
return list(zip(t_sub_sampled, v_sub_sampled))
def to_fahrenheit(celsius):
"""Convert Celsius to Fahrenheit."""
return celsius * 1.8 + 32
def is_admin():
"""Return if current user is an admin or not
The inner function fails unless you have Windows XP SP2 or higher.
The failure causes a traceback to be printed and this function to return False.
https://stackoverflow.com/a/19719292
:return: True if the current user is an 'Admin' whatever that means (root on Unix), otherwise False.
"""
if os.name == 'nt':
import ctypes
import traceback
# WARNING: requires Windows XP SP2 or higher!
try:
return ctypes.windll.shell32.IsUserAnAdmin()
except Exception as e:
traceback.print_exc()
return False
else:
# Check for root on Posix
return os.getuid() == 0
def key_exist_value_not_none(k, d):
# Return True if:
# - key k exists
# - d[k] is not None
return k in d and d[k] is not None
def key_exist_value_not_none_not_v(k, d, v=''):
# Return True if:
# - key k exists
# - d[k] is not None
# - d[k] != v
return k in d and d[k] is not None and d[k] != v
def disable(class_name, var):
"""Set disable_<var> to True in the class class_name."""
setattr(class_name, 'enable_' + var, False)
setattr(class_name, 'disable_' + var, True)
def enable(class_name, var):
"""Set disable_<var> to False in the class class_name."""
setattr(class_name, 'enable_' + var, True)
setattr(class_name, 'disable_' + var, False)
def pretty_date(time=False):
"""
Get a datetime object or a int() Epoch timestamp and return a
pretty string like 'an hour ago', 'Yesterday', '3 months ago',
'just now', etc
Source: https://stackoverflow.com/questions/1551382/user-friendly-time-format-in-python
"""
now = datetime.now()
if type(time) is int:
diff = now - datetime.fromtimestamp(time)
elif isinstance(time, datetime):
diff = now - time
elif not time:
diff = 0
second_diff = diff.seconds
day_diff = diff.days
if day_diff < 0:
return ''
if day_diff == 0:
if second_diff < 10:
return "just now"
if second_diff < 60:
return str(second_diff) + " secs"
if second_diff < 120:
return "a min"
if second_diff < 3600:
return str(second_diff // 60) + " mins"
if second_diff < 7200:
return "an hour"
if second_diff < 86400:
return str(second_diff // 3600) + " hours"
if day_diff == 1:
return "yesterday"
if day_diff < 7:
return str(day_diff) + " days"
if day_diff < 31:
return str(day_diff // 7) + " weeks"
if day_diff < 365:
return str(day_diff // 30) + " months"
return str(day_diff // 365) + " years"
def urlopen_auth(url, username, password):
"""Open a url with basic auth"""
return urlopen(
Request(
url,
headers={'Authorization': 'Basic ' + base64.b64encode(('%s:%s' % (username, password)).encode()).decode()},
)
)

View File

@ -77,7 +77,7 @@ class Export(GlancesExport):
# Keyspace
try:
session.set_keyspace(self.keyspace)
except InvalidRequest as e:
except InvalidRequest:
logger.info("Create keyspace {} on the Cassandra cluster".format(self.keyspace))
c = "CREATE KEYSPACE %s WITH replication = { 'class': 'SimpleStrategy', 'replication_factor': '%s' }" % (
self.keyspace,

View File

@ -62,7 +62,7 @@ class Export(GlancesExport):
try:
s[self.db]
except Exception as e:
except Exception:
# Database did not exist
# Create it...
s.create(self.db)

View File

@ -16,7 +16,6 @@ from glances.logger import logger
from glances.exports.export import GlancesExport
from elasticsearch import Elasticsearch, helpers
from elasticsearch import __version__ as elk_version
class Export(GlancesExport):
@ -31,7 +30,9 @@ class Export(GlancesExport):
self.index = None
# Load the ES configuration file
self.export_enable = self.load_conf('elasticsearch', mandatories=['scheme', 'host', 'port', 'index'], options=[])
self.export_enable = self.load_conf(
'elasticsearch', mandatories=['scheme', 'host', 'port', 'index'], options=[]
)
if not self.export_enable:
sys.exit(2)
@ -46,20 +47,16 @@ class Export(GlancesExport):
try:
es = Elasticsearch(hosts=['{}://{}:{}'.format(self.scheme, self.host, self.port)])
except Exception as e:
logger.critical("Cannot connect to ElasticSearch server %s://%s:%s (%s)" % (self.scheme,
self.host,
self.port, e))
logger.critical(
"Cannot connect to ElasticSearch server %s://%s:%s (%s)" % (self.scheme, self.host, self.port, e)
)
sys.exit(2)
if not es.ping():
logger.critical("Cannot ping the ElasticSearch server %s://%s:%s" % (self.scheme,
self.host,
self.port))
logger.critical("Cannot ping the ElasticSearch server %s://%s:%s" % (self.scheme, self.host, self.port))
sys.exit(2)
else:
logger.info("Connected to the ElasticSearch server %s://%s:%s" % (self.scheme,
self.host,
self.port))
logger.info("Connected to the ElasticSearch server %s://%s:%s" % (self.scheme, self.host, self.port))
return es

View File

@ -35,7 +35,7 @@ class GlancesExport(object):
'ports',
'processlist',
'psutilversion',
'quicklook'
'quicklook',
]
def __init__(self, config=None, args=None):

View File

@ -51,7 +51,7 @@ class Export(GlancesExport):
# Check if output folder is writeable
try:
tempfile.TemporaryFile(dir=self.path)
except OSError as e:
except OSError:
logger.critical("Graph output folder {} is not writeable".format(self.path))
sys.exit(2)

View File

@ -17,7 +17,6 @@ from glances.exports.export import GlancesExport
from kafka import KafkaProducer
import json
import codecs
class Export(GlancesExport):

View File

@ -9,7 +9,6 @@
"""RESTful interface class."""
import sys
from glances.globals import listkeys
from glances.logger import logger

View File

@ -10,7 +10,6 @@
"""Riemann interface class."""
import socket
import sys
from numbers import Number
from glances.logger import logger

View File

@ -9,7 +9,6 @@
"""Statsd interface class."""
import sys
from numbers import Number
from glances.logger import logger

View File

@ -321,7 +321,8 @@ def json_dumps_dictlist(data, item):
try:
# Source:
# http://stackoverflow.com/questions/4573875/python-get-index-of-dictionary-item-in-list
return json_dumps({item: map(itemgetter(item), data)})
# But https://github.com/nicolargo/glances/issues/1401
return json_dumps({item: list(map(itemgetter(item), data))})
except:
return None
else:

View File

@ -17,7 +17,7 @@ import tempfile
import logging
import logging.config
from glances.globals import BSD, LINUX, MACOS, SUNOS, WINDOWS, WSL, safe_makedirs
from glances.globals import safe_makedirs
# Choose the good place for the log file (see issue #1575)
# Default root path

View File

@ -125,10 +125,7 @@ Examples of use:
help='disable plugin (comma separed list or all). If all is used, then you need to configure --enable-plugin.',
)
parser.add_argument(
'--enable-plugin',
'--enable-plugins',
dest='enable_plugin',
help='enable plugin (comma separed list)'
'--enable-plugin', '--enable-plugins', dest='enable_plugin', help='enable plugin (comma separed list)'
)
parser.add_argument(
'--disable-process',
@ -566,7 +563,9 @@ Examples of use:
logger.critical("'all' key in --disable-plugin needs to be used with --enable-plugin")
sys.exit(2)
else:
logger.info("'all' key in --disable-plugin, only plugins defined with --enable-plugin will be available")
logger.info(
"'all' key in --disable-plugin, only plugins defined with --enable-plugin will be available"
)
if args.disable_plugin is not None:
for p in args.disable_plugin.split(','):
disable(args, p)

View File

@ -23,6 +23,7 @@ from glances.logger import logger
try:
from packaging.version import Version
PACKAGING_IMPORT = True
except Exception as e:
logger.error("Unable to import 'packaging' module ({}). Glances cannot check for updates.".format(e))

View File

@ -169,10 +169,10 @@ class GlancesBottle(object):
self._app.route('/<refresh_time:int>', method=["GET"], callback=self._index)
self._app.route('/<filepath:path>', method="GET", callback=self._resource)
bindmsg = 'Glances Web User Interface started on {}'.format(self.bind_url)
logger.info(bindmsg)
else:
logger.info('The WebUI is disable (--disable-webui)')
bindmsg = 'The WebUI is disable (--disable-webui)'
logger.info(bindmsg)
print(bindmsg)
def start(self, stats):
@ -198,7 +198,6 @@ class GlancesBottle(object):
def end(self):
"""End the bottle."""
pass
def _index(self, refresh_time=None):
"""Bottle callback for index.html (/) file."""

View File

@ -1222,15 +1222,11 @@ class GlancesCursesStandalone(_GlancesCurses):
"""Class for the Glances curse standalone."""
pass
class GlancesCursesClient(_GlancesCurses):
"""Class for the Glances curse client."""
pass
class GlancesTextbox(Textbox, object):
def __init__(self, *args, **kwargs):

View File

@ -9,7 +9,6 @@
"""Curses browser interface class ."""
import sys
import math
import curses
from glances.outputs.glances_curses import _GlancesCurses

View File

@ -12,7 +12,6 @@
from __future__ import unicode_literals
from __future__ import division
import sys
from math import modf
from glances.logger import logger
from glances.globals import nativestr

View File

@ -11,8 +11,12 @@
import time
<<<<<<< HEAD
from glances.logger import logger
from glances.globals import printandflush
=======
from glances.compat import printandflush
>>>>>>> develop
class GlancesStdoutCsv(object):

View File

@ -81,7 +81,7 @@ class GlancesStdoutIssue(object):
try:
# Update the stats
stats._plugins[plugin].update()
except Exception as e:
except Exception:
pass
time.sleep(3)

View File

@ -11,8 +11,12 @@
import time
<<<<<<< HEAD
from glances.logger import logger
from glances.globals import printandflush
=======
from glances.compat import printandflush
>>>>>>> develop
class GlancesStdoutJson(object):

View File

@ -0,0 +1,13 @@
/* eslint-disable */
module.exports = {
env: {
browser: true,
es2021: true
},
extends: ['eslint:recommended', 'plugin:vue/vue3-essential'],
parserOptions: {
ecmaVersion: 'latest',
sourceType: 'module'
},
rules: {}
};

View File

@ -0,0 +1,10 @@
module.exports = {
printWidth: 100,
arrowParens: 'always',
bracketSpacing: true,
semi: true,
singleQuote: true,
tabWidth: 4,
trailingComma: 'none',
useTabs: false
};

View File

@ -0,0 +1,388 @@
<template>
<div v-if="!dataLoaded" class="container-fluid" id="loading-page">
<div class="glances-logo"></div>
<div class="loader">Loading...</div>
</div>
<glances-help v-else-if="args.help_tag"></glances-help>
<div v-else class="container-fluid">
<div class="top-plugin">
<div class="row">
<div class="col-sm-24">
<div class="pull-left">
<glances-plugin-system :data="data"></glances-plugin-system>
</div>
<div class="pull-left" v-if="args.disable_ip">
<glances-plugin-ip :data="data"></glances-plugin-ip>
</div>
<div class="pull-right">
<glances-plugin-uptime :data="data"></glances-plugin-uptime>
</div>
</div>
<div class="row">
<div class="col-sm-24">
<div class="pull-left">
<glances-plugin-cloud :data="data"></glances-plugin-cloud>
</div>
</div>
</div>
</div>
</div>
<div class="row">
<div class="hidden-xs hidden-sm hidden-md col-lg-6" v-if="!args.disable_quicklook">
<glances-plugin-quicklook :data="data"></glances-plugin-quicklook>
</div>
<div class="col-sm-6 col-md-8 col-lg-6" v-if="!args.disable_cpu && !args.percpu">
<glances-plugin-cpu :data="data"></glances-plugin-cpu>
</div>
<div class="col-sm-12 col-md-8 col-lg-6" v-if="!args.disable_cpu && args.percpu">
<glances-plugin-percpu :data="data"></glances-plugin-percpu>
</div>
<div class="col-sm-6 col-md-4 col-lg-3" v-if="!args.disable_gpu && hasGpu">
<glances-plugin-gpu :data="data"></glances-plugin-gpu>
</div>
<div class="col-sm-6 col-md-4 col-lg-3" v-if="!args.disable_mem">
<glances-plugin-mem :data="data"></glances-plugin-mem>
</div>
<div
class="col-sm-6 col-md-4 col-lg-3"
v-if="!args.disable_mem && !(!args.disable_gpu && hasGpu)"
>
<glances-plugin-mem-more :data="data"></glances-plugin-mem-more>
</div>
<div class="col-sm-6 col-md-4 col-lg-3" v-if="!args.disable_memswap">
<glances-plugin-memswap :data="data"></glances-plugin-memswap>
</div>
<div class="col-sm-6 col-md-4 col-lg-3" v-if="!args.disable_load">
<glances-plugin-load :data="data"></glances-plugin-load>
</div>
</div>
<div class="row">
<div class="col-sm-6 sidebar" v-if="!args.disable_left_sidebar">
<div class="table">
<glances-plugin-network
id="plugin-network"
class="plugin table-row-group"
v-if="!args.disable_network"
:data="data"
></glances-plugin-network>
<glances-plugin-connections
id="plugin-connections"
class="plugin table-row-group"
v-if="isLinux && !args.disable_connections"
:data="data"
></glances-plugin-connections>
<glances-plugin-wifi
id="plugin-wifi"
class="plugin table-row-group"
v-if="!args.disable_wifi"
:data="data"
></glances-plugin-wifi>
<glances-plugin-ports
id="plugin-ports"
class="plugin table-row-group"
v-if="!args.disable_ports"
:data="data"
></glances-plugin-ports>
<glances-plugin-diskio
id="plugin-diskio"
class="plugin table-row-group"
v-if="!args.disable_diskio"
:data="data"
></glances-plugin-diskio>
<glances-plugin-fs
id="plugin-fs"
class="plugin table-row-group"
v-if="!args.disable_fs"
:data="data"
></glances-plugin-fs>
<glances-plugin-irq
id="plugin-irq"
class="plugin table-row-group"
v-if="args.enable_irq"
:data="data"
></glances-plugin-irq>
<glances-plugin-folders
id="plugin-folders"
class="plugin table-row-group"
v-if="!args.disable_folders"
:data="data"
></glances-plugin-folders>
<glances-plugin-raid
id="plugin-raid"
class="plugin table-row-group"
v-if="!args.raid"
:data="data"
></glances-plugin-raid>
<glances-plugin-sensors
id="plugin-sensors"
class="plugin table-row-group"
v-if="!args.disable_sensors"
:data="data"
></glances-plugin-sensors>
</div>
</div>
<div class="col-sm-18">
<glances-plugin-docker
v-if="!args.disable_docker"
:data="data"
></glances-plugin-docker>
<glances-plugin-alert
v-if="!args.disable_alert"
:data="data"
></glances-plugin-alert>
<glances-plugin-process :data="data"></glances-plugin-process>
</div>
</div>
</div>
</template>
<script>
import hotkeys from 'hotkeys-js';
import { GlancesStats } from './services.js';
import { store } from './store.js';
import GlancesHelp from './components/help.vue';
import GlancesPluginAlert from './components/plugin-alert.vue';
import GlancesPluginCloud from './components/plugin-cloud.vue';
import GlancesPluginConnections from './components/plugin-connections.vue';
import GlancesPluginCpu from './components/plugin-cpu.vue';
import GlancesPluginDiskio from './components/plugin-diskio.vue';
import GlancesPluginDocker from './components/plugin-docker.vue';
import GlancesPluginFolders from './components/plugin-folders.vue';
import GlancesPluginFs from './components/plugin-fs.vue';
import GlancesPluginGpu from './components/plugin-gpu.vue';
import GlancesPluginIp from './components/plugin-ip.vue';
import GlancesPluginIrq from './components/plugin-irq.vue';
import GlancesPluginLoad from './components/plugin-load.vue';
import GlancesPluginMem from './components/plugin-mem.vue';
import GlancesPluginMemMore from './components/plugin-mem-more.vue';
import GlancesPluginMemswap from './components/plugin-memswap.vue';
import GlancesPluginNetwork from './components/plugin-network.vue';
import GlancesPluginPercpu from './components/plugin-percpu.vue';
import GlancesPluginPorts from './components/plugin-ports.vue';
import GlancesPluginProcess from './components/plugin-process.vue';
import GlancesPluginQuicklook from './components/plugin-quicklook.vue';
import GlancesPluginRaid from './components/plugin-raid.vue';
import GlancesPluginSensors from './components/plugin-sensors.vue';
import GlancesPluginSystem from './components/plugin-system.vue';
import GlancesPluginUptime from './components/plugin-uptime.vue';
import GlancesPluginWifi from './components/plugin-wifi.vue';
export default {
components: {
GlancesHelp,
GlancesPluginAlert,
GlancesPluginCloud,
GlancesPluginConnections,
GlancesPluginCpu,
GlancesPluginDiskio,
GlancesPluginDocker,
GlancesPluginFolders,
GlancesPluginFs,
GlancesPluginGpu,
GlancesPluginIp,
GlancesPluginIrq,
GlancesPluginLoad,
GlancesPluginMem,
GlancesPluginMemMore,
GlancesPluginMemswap,
GlancesPluginNetwork,
GlancesPluginPercpu,
GlancesPluginPorts,
GlancesPluginProcess,
GlancesPluginQuicklook,
GlancesPluginRaid,
GlancesPluginSensors,
GlancesPluginSystem,
GlancesPluginUptime,
GlancesPluginWifi
},
data() {
return {
store
};
},
computed: {
args() {
return this.store.args || {};
},
data() {
return this.store.data || {};
},
dataLoaded() {
return this.store.data !== undefined;
},
hasGpu() {
return this.store.data.stats.gpu.length > 0;
},
isLinux() {
return this.store.data.isLinux;
},
title() {
const { data } = this;
const title = (data.stats && data.stats.system && data.stats.system.hostname) || '';
return title ? `${title} - Glances` : 'Glances';
}
},
watch: {
title() {
if (document) {
document.title = this.title;
}
}
},
methods: {
setupHotKeys() {
// A => Enable/disable AMPs
hotkeys('shift+A', () => {
this.store.args.disable_amps = !this.store.args.disable_amps;
});
// d => Show/hide disk I/O stats
hotkeys('d', () => {
this.store.args.disable_diskio = !this.store.args.disable_diskio;
});
// Q => Show/hide IRQ
hotkeys('shift+Q', () => {
this.store.args.enable_irq = !this.store.args.enable_irq;
});
// f => Show/hide filesystem stats
hotkeys('f', () => {
this.store.args.disable_fs = !this.store.args.disable_fs;
});
// j => Accumulate processes by program
hotkeys('j', () => {
this.store.args.programs = !this.store.args.programs;
});
// k => Show/hide connections stats
hotkeys('k', () => {
this.store.args.disable_connections = !this.store.args.disable_connections;
});
// n => Show/hide network stats
hotkeys('n', () => {
this.store.args.disable_network = !this.store.args.disable_network;
});
// s => Show/hide sensors stats
hotkeys('s', () => {
this.store.args.disable_sensors = !this.store.args.disable_sensors;
});
// 2 => Show/hide left sidebar
hotkeys('2', () => {
this.store.args.disable_left_sidebar = !this.store.args.disable_left_sidebar;
});
// z => Enable/disable processes stats
hotkeys('z', () => {
this.store.args.disable_process = !this.store.args.disable_process;
});
// SLASH => Enable/disable short processes name
hotkeys('/', () => {
this.store.args.process_short_name = !this.store.args.process_short_name;
});
// D => Enable/disable Docker stats
hotkeys('shift+D', () => {
this.store.args.disable_docker = !this.store.args.disable_docker;
});
// b => Bytes or bits for network I/O
hotkeys('b', () => {
this.store.args.byte = !this.store.args.byte;
});
// 'B' => Switch between bit/s and IO/s for Disk IO
hotkeys('shift+B', () => {
this.store.args.diskio_iops = !this.store.args.diskio_iops;
});
// l => Show/hide alert logs
hotkeys('l', () => {
this.store.args.disable_alert = !this.store.args.disable_alert;
});
// 1 => Global CPU or per-CPU stats
hotkeys('1', () => {
this.store.args.percpu = !this.store.args.percpu;
});
// h => Show/hide this help screen
hotkeys('h', () => {
this.store.args.help_tag = !this.store.args.help_tag;
});
// T => View network I/O as combination
hotkeys('shift+T', () => {
this.store.args.network_sum = !this.store.args.network_sum;
});
// U => View cumulative network I/O
hotkeys('shift+U', () => {
this.store.args.network_cumul = !this.store.args.network_cumul;
});
// F => Show filesystem free space
hotkeys('shift+F', () => {
this.store.args.fs_free_space = !this.store.args.fs_free_space;
});
// 3 => Enable/disable quick look plugin
hotkeys('3', () => {
this.store.args.disable_quicklook = !this.store.args.disable_quicklook;
});
// 6 => Enable/disable mean gpu
hotkeys('6', () => {
this.store.args.meangpu = !this.store.args.meangpu;
});
// G => Enable/disable gpu
hotkeys('shift+G', () => {
this.store.args.disable_gpu = !this.store.args.disable_gpu;
});
hotkeys('5', () => {
this.store.args.disable_quicklook = !this.store.args.disable_quicklook;
this.store.args.disable_cpu = !this.store.args.disable_cpu;
this.store.args.disable_mem = !this.store.args.disable_mem;
this.store.args.disable_memswap = !this.store.args.disable_memswap;
this.store.args.disable_load = !this.store.args.disable_load;
this.store.args.disable_gpu = !this.store.args.disable_gpu;
});
// I => Show/hide IP module
hotkeys('shift+I', () => {
this.store.args.disable_ip = !this.store.args.disable_ip;
});
// P => Enable/disable ports module
hotkeys('shift+P', () => {
this.store.args.disable_ports = !this.store.args.disable_ports;
});
// 'W' > Enable/Disable Wifi plugin
hotkeys('shift+W', () => {
this.store.args.disable_wifi = !this.store.args.disable_wifi;
});
}
},
mounted() {
const GLANCES = window.__GLANCES__ || {};
const refreshTime = isFinite(GLANCES['refresh-time'])
? parseInt(GLANCES['refresh-time'], 10)
: undefined;
GlancesStats.init(refreshTime);
this.setupHotKeys();
},
beforeUnmount() {
hotkeys.unbind();
}
};
</script>

View File

@ -1,9 +1,15 @@
/* global module */
if (module.hot) {
module.hot.accept();
}
import "../css/bootstrap.less";
import "../css/style.scss";
import '../css/bootstrap.less';
import '../css/style.scss';
import "./module";
import "./services";
import "./components";
import "./filters";
import "./directives";
import { createApp } from 'vue';
import App from './App.vue';
import * as filters from "./filters.js";
const app = createApp(App);
app.config.globalProperties.$filters = filters;
app.mount('#app');

View File

@ -1,14 +0,0 @@
import angular from "angular";
import GlancesController from "./controller";
import template from "./view.html";
export default angular.module("glancesApp").component("glances", {
controller: GlancesController,
controllerAs: 'vm',
bindings: {
refreshTime: "<"
},
templateUrl: template
});

View File

@ -1,236 +0,0 @@
export default function GlancesController($scope, GlancesStats, hotkeys, ARGUMENTS) {
var vm = this;
vm.dataLoaded = false;
vm.arguments = ARGUMENTS;
vm.$onInit = function () {
GlancesStats.init(vm.refreshTime);
};
$scope.$on('data_refreshed', function (event, data) {
vm.hasGpu = data.stats.gpu.length > 0;
vm.isLinux = data.isLinux;
vm.dataLoaded = true;
});
// A => Enable/disable AMPs
hotkeys.add({
combo: 'A',
callback: function () {
ARGUMENTS.disable_amps = !ARGUMENTS.disable_amps;
}
});
// d => Show/hide disk I/O stats
hotkeys.add({
combo: 'd',
callback: function () {
ARGUMENTS.disable_diskio = !ARGUMENTS.disable_diskio;
}
});
// Q => Show/hide IRQ
hotkeys.add({
combo: 'Q',
callback: function () {
ARGUMENTS.enable_irq = !ARGUMENTS.enable_irq;
}
});
// f => Show/hide filesystem stats
hotkeys.add({
combo: 'f',
callback: function () {
ARGUMENTS.disable_fs = !ARGUMENTS.disable_fs;
}
});
// j => Accumulate processes by program
hotkeys.add({
combo: 'j',
callback: function () {
ARGUMENTS.programs = !ARGUMENTS.programs;
}
});
// k => Show/hide connections stats
hotkeys.add({
combo: 'k',
callback: function () {
ARGUMENTS.disable_connections = !ARGUMENTS.disable_connections;
}
});
// n => Show/hide network stats
hotkeys.add({
combo: 'n',
callback: function () {
ARGUMENTS.disable_network = !ARGUMENTS.disable_network;
}
});
// s => Show/hide sensors stats
hotkeys.add({
combo: 's',
callback: function () {
ARGUMENTS.disable_sensors = !ARGUMENTS.disable_sensors;
}
});
// 2 => Show/hide left sidebar
hotkeys.add({
combo: '2',
callback: function () {
ARGUMENTS.disable_left_sidebar = !ARGUMENTS.disable_left_sidebar;
}
});
// z => Enable/disable processes stats
hotkeys.add({
combo: 'z',
callback: function () {
ARGUMENTS.disable_process = !ARGUMENTS.disable_process;
}
});
// SLASH => Enable/disable short processes name
hotkeys.add({
combo: '/',
callback: function () {
ARGUMENTS.process_short_name = !ARGUMENTS.process_short_name;
}
});
// D => Enable/disable Docker stats
hotkeys.add({
combo: 'D',
callback: function () {
ARGUMENTS.disable_docker = !ARGUMENTS.disable_docker;
}
});
// b => Bytes or bits for network I/O
hotkeys.add({
combo: 'b',
callback: function () {
ARGUMENTS.byte = !ARGUMENTS.byte;
}
});
// 'B' => Switch between bit/s and IO/s for Disk IO
hotkeys.add({
combo: 'B',
callback: function () {
ARGUMENTS.diskio_iops = !ARGUMENTS.diskio_iops;
}
});
// l => Show/hide alert logs
hotkeys.add({
combo: 'l',
callback: function () {
ARGUMENTS.disable_alert = !ARGUMENTS.disable_alert;
}
});
// 1 => Global CPU or per-CPU stats
hotkeys.add({
combo: '1',
callback: function () {
ARGUMENTS.percpu = !ARGUMENTS.percpu;
}
});
// h => Show/hide this help screen
hotkeys.add({
combo: 'h',
callback: function () {
ARGUMENTS.help_tag = !ARGUMENTS.help_tag;
}
});
// T => View network I/O as combination
hotkeys.add({
combo: 'T',
callback: function () {
ARGUMENTS.network_sum = !ARGUMENTS.network_sum;
}
});
// U => View cumulative network I/O
hotkeys.add({
combo: 'U',
callback: function () {
ARGUMENTS.network_cumul = !ARGUMENTS.network_cumul;
}
});
// F => Show filesystem free space
hotkeys.add({
combo: 'F',
callback: function () {
ARGUMENTS.fs_free_space = !ARGUMENTS.fs_free_space;
}
});
// 3 => Enable/disable quick look plugin
hotkeys.add({
combo: '3',
callback: function () {
ARGUMENTS.disable_quicklook = !ARGUMENTS.disable_quicklook;
}
});
// 6 => Enable/disable mean gpu
hotkeys.add({
combo: '6',
callback: function () {
ARGUMENTS.meangpu = !ARGUMENTS.meangpu;
}
});
// G => Enable/disable gpu
hotkeys.add({
combo: 'G',
callback: function () {
ARGUMENTS.disable_gpu = !ARGUMENTS.disable_gpu;
}
});
hotkeys.add({
combo: '5',
callback: function () {
ARGUMENTS.disable_quicklook = !ARGUMENTS.disable_quicklook;
ARGUMENTS.disable_cpu = !ARGUMENTS.disable_cpu;
ARGUMENTS.disable_mem = !ARGUMENTS.disable_mem;
ARGUMENTS.disable_memswap = !ARGUMENTS.disable_memswap;
ARGUMENTS.disable_load = !ARGUMENTS.disable_load;
ARGUMENTS.disable_gpu = !ARGUMENTS.disable_gpu;
}
});
// I => Show/hide IP module
hotkeys.add({
combo: 'I',
callback: function () {
ARGUMENTS.disable_ip = !ARGUMENTS.disable_ip;
}
});
// P => Enable/disable ports module
hotkeys.add({
combo: 'P',
callback: function () {
ARGUMENTS.disable_ports = !ARGUMENTS.disable_ports;
}
});
// 'W' > Enable/Disable Wifi plugin
hotkeys.add({
combo: 'W',
callback: function () {
ARGUMENTS.disable_wifi = !ARGUMENTS.disable_wifi;
}
});
}

View File

@ -1,82 +0,0 @@
<div>
<div ng-if="!vm.dataLoaded" class="container-fluid" id="loading-page">
<div class="glances-logo"></div>
<div class="loader">Loading...</div>
</div>
<glances-help ng-if="vm.arguments.help_tag"></glances-help>
<div ng-if="vm.dataLoaded && !vm.arguments.help_tag" class="container-fluid">
<div class="top-plugin">
<div class="row">
<div class="col-sm-24">
<div class="pull-left">
<glances-plugin-system></glances-plugin-system>
</div>
<div class="pull-left">
<glances-plugin-ip></glances-plugin-ip>
</div>
<div class="pull-right">
<glances-plugin-uptime></glances-plugin-uptime>
</div>
</div>
<div class="row">
<div class="col-sm-24">
<div class="pull-left">
<glances-plugin-cloud></glances-plugin-cloud>
</div>
</div>
</div>
</div>
</div>
<div class="row">
<div class="hidden-xs hidden-sm hidden-md col-lg-6" ng-if="!vm.arguments.disable_quicklook">
<glances-plugin-quicklook></glances-plugin-quicklook>
</div>
<div class="col-sm-6 col-md-8 col-lg-6" ng-if="!vm.arguments.disable_cpu && !vm.arguments.percpu">
<glances-plugin-cpu></glances-plugin-cpu>
</div>
<div class="col-sm-12 col-md-8 col-lg-6" ng-if="!vm.arguments.disable_cpu && vm.arguments.percpu">
<glances-plugin-percpu></glances-plugin-percpu>
</div>
<div class="col-sm-6 col-md-4 col-lg-3" ng-if="!vm.arguments.disable_gpu && vm.hasGpu">
<glances-plugin-gpu></glances-plugin-gpu>
</div>
<div class="col-sm-6 col-md-4 col-lg-3" ng-if="!vm.arguments.disable_mem">
<glances-plugin-mem></glances-plugin-mem>
</div>
<div class="col-sm-6 col-md-4 col-lg-3"
ng-if="!vm.arguments.disable_mem && !(!vm.arguments.disable_gpu && vm.hasGpu)">
<glances-plugin-mem-more></glances-plugin-mem-more>
</div>
<div class="col-sm-6 col-md-4 col-lg-3" ng-if="!vm.arguments.disable_memswap">
<glances-plugin-memswap></glances-plugin-memswap>
</div>
<div class="col-sm-6 col-md-4 col-lg-3" ng-if="!vm.arguments.disable_load">
<glances-plugin-load></glances-plugin-load>
</div>
</div>
<div class="row">
<div class="col-sm-6 sidebar" ng-if="!vm.arguments.disable_left_sidebar">
<div class="table">
<glances-plugin-network id="plugin-network" class="plugin table-row-group" ng-if="!vm.arguments.disable_network"></glances-plugin-network>
<glances-plugin-connections id="plugin-connections" class="plugin table-row-group" ng-if="vm.isLinux && !vm.arguments.disable_connections"></glances-plugin-connections>
<glances-plugin-wifi id="plugin-wifi" class="plugin table-row-group" ng-if="!vm.arguments.disable_wifi"></glances-plugin-wifi>
<glances-plugin-ports id="plugin-ports" class="plugin table-row-group" ng-if="!vm.arguments.disable_ports"></glances-plugin-ports>
<glances-plugin-diskio id="plugin-diskio" class="plugin table-row-group" ng-if="!vm.arguments.disable_diskio"></glances-plugin-diskio>
<glances-plugin-fs id="plugin-fs" class="plugin table-row-group" ng-if="!vm.arguments.disable_fs"></glances-plugin-fs>
<glances-plugin-irq id="plugin-irq" class="plugin table-row-group" ng-if="vm.arguments.enable_irq"></glances-plugin-irq>
<glances-plugin-folders id="plugin-folders" class="plugin table-row-group" ng-if="!vm.arguments.disable_folders"></glances-plugin-folders>
<glances-plugin-raid id="plugin-raid" class="plugin table-row-group" ng-if="!vm.arguments.raid"></glances-plugin-raid>
<glances-plugin-sensors id="plugin-sensors" class="plugin table-row-group" ng-if="!vm.arguments.disable_sensors"></glances-plugin-sensors>
</div>
</div>
<div class="col-sm-18">
<glances-plugin-docker ng-if="!vm.arguments.disable_docker"></glances-plugin-docker>
<glances-plugin-alert ng-if="!vm.arguments.disable_alert"></glances-plugin-alert>
<glances-plugin-process></glances-plugin-process>
</div>
</div>
</div>
</div>

View File

@ -0,0 +1,274 @@
<template>
<div v-if="help">
<div class="container-fluid">
<div class="row">
<div class="col-sm-12 col-lg-24">{{ help.version }} {{ help.psutil_version }}</div>
</div>
<div class="row">&nbsp;</div>
<div class="row">
<div class="col-sm-12 col-lg-24">
{{ help.configuration_file }}
</div>
</div>
<div class="row">&nbsp;</div>
</div>
<div class="divTable" style="width: 100%">
<div class="divTableBody">
<div class="divTableRow">
<div class="divTableHead">
{{ help.header_sort.replace(':', '') }}
</div>
<div class="divTableHead">
{{ help.header_show_hide.replace(':', '') }}
</div>
<div class="divTableHead">
{{ help.header_toggle.replace(':', '') }}
</div>
<div class="divTableHead">
{{ help.header_miscellaneous.replace(':', '') }}
</div>
</div>
<div class="divTableRow">
<div class="divTableCell">
{{ help.sort_auto }}
</div>
<div class="divTableCell">
{{ help.show_hide_application_monitoring }}
</div>
<div class="divTableCell">
{{ help.toggle_bits_bytes }}
</div>
<div class="divTableCell">
{{ help.misc_erase_process_filter }}
</div>
</div>
<div class="divTableRow">
<div class="divTableCell">
{{ help.sort_cpu }}
</div>
<div class="divTableCell">
{{ help.show_hide_diskio }}
</div>
<div class="divTableCell">
{{ help.toggle_count_rate }}
</div>
<div class="divTableCell">
{{ help.misc_generate_history_graphs }}
</div>
</div>
<div class="divTableRow">
<div class="divTableCell">
{{ help.sort_io_rate }}
</div>
<div class="divTableCell">
{{ help.show_hide_docker }}
</div>
<div class="divTableCell">
{{ help.toggle_used_free }}
</div>
<div class="divTableCell">
{{ help.misc_help }}
</div>
</div>
<div class="divTableRow">
<div class="divTableCell">
{{ help.sort_mem }}
</div>
<div class="divTableCell">
{{ help.show_hide_top_extended_stats }}
</div>
<div class="divTableCell">
{{ help.toggle_bar_sparkline }}
</div>
<div class="divTableCell">
{{ help.misc_accumulate_processes_by_program }}
</div>
</div>
<div class="divTableRow">
<div class="divTableCell">
{{ help.sort_process_name }}
</div>
<div class="divTableCell">
{{ help.show_hide_filesystem }}
</div>
<div class="divTableCell">
{{ help.toggle_separate_combined }}
</div>
<div class="divTableCell">
{{ help.misc_kill_process }} - N/A in WebUI
</div>
</div>
<div class="divTableRow">
<div class="divTableCell">
{{ help.sort_cpu_times }}
</div>
<div class="divTableCell">
{{ help.show_hide_gpu }}
</div>
<div class="divTableCell">
{{ help.toggle_live_cumulative }}
</div>
<div class="divTableCell">
{{ help.misc_reset_processes_summary_min_max }}
</div>
</div>
<div class="divTableRow">
<div class="divTableCell">
{{ help.sort_user }}
</div>
<div class="divTableCell">
{{ help.show_hide_ip }}
</div>
<div class="divTableCell">
{{ help.toggle_linux_percentage }}
</div>
<div class="divTableCell">{{ help.misc_quit }}</div>
</div>
<div class="divTableRow">
<div class="divTableCell">&nbsp;</div>
<div class="divTableCell">
{{ help.show_hide_tcp_connection }}
</div>
<div class="divTableCell">
{{ help.toggle_cpu_individual_combined }}
</div>
<div class="divTableCell">
{{ help.misc_reset_history }}
</div>
</div>
<div class="divTableRow">
<div class="divTableCell">&nbsp;</div>
<div class="divTableCell">
{{ help.show_hide_alert }}
</div>
<div class="divTableCell">
{{ help.toggle_gpu_individual_combined }}
</div>
<div class="divTableCell">
{{ help.misc_delete_warning_alerts }}
</div>
</div>
<div class="divTableRow">
<div class="divTableCell">&nbsp;</div>
<div class="divTableCell">
{{ help.show_hide_network }}
</div>
<div class="divTableCell">
{{ help.toggle_short_full }}
</div>
<div class="divTableCell">
{{ help.misc_delete_warning_and_critical_alerts }}
</div>
</div>
<div class="divTableRow">
<div class="divTableCell">&nbsp;</div>
<div class="divTableCell">
{{ help.sort_cpu_times }}
</div>
<div class="divTableCell">&nbsp;</div>
<div class="divTableCell">
{{ help.misc_edit_process_filter_pattern }} - N/A in WebUI
</div>
</div>
<div class="divTableRow">
<div class="divTableCell">&nbsp;</div>
<div class="divTableCell">
{{ help.show_hide_irq }}
</div>
<div class="divTableCell">&nbsp;</div>
<div class="divTableCell">&nbsp;</div>
</div>
<div class="divTableRow">
<div class="divTableCell">&nbsp;</div>
<div class="divTableCell">
{{ help.show_hide_raid_plugin }}
</div>
<div class="divTableCell">&nbsp;</div>
<div class="divTableCell">&nbsp;</div>
</div>
<div class="divTableRow">
<div class="divTableCell">&nbsp;</div>
<div class="divTableCell">
{{ help.show_hide_sensors }}
</div>
<div class="divTableCell">&nbsp;</div>
<div class="divTableCell">&nbsp;</div>
</div>
<div class="divTableRow">
<div class="divTableCell">&nbsp;</div>
<div class="divTableCell">
{{ help.show_hide_wifi_module }}
</div>
<div class="divTableCell">&nbsp;</div>
<div class="divTableCell">&nbsp;</div>
</div>
<div class="divTableRow">
<div class="divTableCell">&nbsp;</div>
<div class="divTableCell">
{{ help.show_hide_processes }}
</div>
<div class="divTableCell">&nbsp;</div>
<div class="divTableCell">&nbsp;</div>
</div>
<div class="divTableRow">
<div class="divTableCell">&nbsp;</div>
<div class="divTableCell">
{{ help.show_hide_left_sidebar }}
</div>
<div class="divTableCell">&nbsp;</div>
<div class="divTableCell">&nbsp;</div>
</div>
<div class="divTableRow">
<div class="divTableCell">&nbsp;</div>
<div class="divTableCell">
{{ help.show_hide_quick_look }}
</div>
<div class="divTableCell">&nbsp;</div>
<div class="divTableCell">&nbsp;</div>
</div>
<div class="divTableRow">
<div class="divTableCell">&nbsp;</div>
<div class="divTableCell">
{{ help.show_hide_cpu_mem_swap }}
</div>
<div class="divTableCell">&nbsp;</div>
<div class="divTableCell">&nbsp;</div>
</div>
<div class="divTableRow">
<div class="divTableCell">&nbsp;</div>
<div class="divTableCell">
{{ help.show_hide_all }}
</div>
<div class="divTableCell">&nbsp;</div>
<div class="divTableCell">&nbsp;</div>
</div>
</div>
</div>
<div>
<p>
For an exhaustive list of key bindings,
<a href="https://glances.readthedocs.io/en/latest/cmds.html#interactive-commands"
>click here</a
>.
</p>
</div>
<div>
<p>Press <b>h</b> to came back to Glances.</p>
</div>
</div>
</template>
<script>
export default {
data() {
return {
help: undefined
};
},
mounted() {
fetch('api/3/help', { method: 'GET' })
.then((response) => response.json())
.then((response) => (this.help = response));
}
};
</script>

View File

@ -1,11 +0,0 @@
import angular from "angular";
import GlancesHelpController from "./controller";
import template from "./view.html";
export default angular.module("glancesApp").component("glancesHelp", {
controller: GlancesHelpController,
controllerAs: 'vm',
templateUrl: template,
});

View File

@ -1,8 +0,0 @@
export default function GlancesHelpController($http) {
var vm = this;
$http.get('api/3/help').then(function (response) {
vm.help = response.data;
});
}

View File

@ -1,149 +0,0 @@
<div class="container-fluid">
<div class="row">
<div class="col-sm-12 col-lg-24">{{ vm.help.version }} {{ vm.help.psutil_version }}</div>
</div>
<div class="row">&nbsp;</div>
<div class="row">
<div class="col-sm-12 col-lg-24">{{ vm.help.configuration_file }}</div>
</div>
<div class="row">&nbsp;</div>
</div>
<div class="divTable" style="width: 100%;" >
<div class="divTableBody">
<div class="divTableRow">
<div class="divTableHead">{{ vm.help.header_sort.replace(':', '') }}</div>
<div class="divTableHead">{{ vm.help.header_show_hide.replace(':', '') }}</div>
<div class="divTableHead">{{ vm.help.header_toggle.replace(':', '') }}</div>
<div class="divTableHead">{{ vm.help.header_miscellaneous.replace(':', '') }}</div>
</div>
<div class="divTableRow">
<div class="divTableCell">{{ vm.help.sort_auto }}</div>
<div class="divTableCell">{{ vm.help.show_hide_application_monitoring }}</div>
<div class="divTableCell">{{ vm.help.toggle_bits_bytes }}</div>
<div class="divTableCell">{{ vm.help.misc_erase_process_filter }}</div>
</div>
<div class="divTableRow">
<div class="divTableCell">{{ vm.help.sort_cpu }}</div>
<div class="divTableCell">{{ vm.help.show_hide_diskio }}</div>
<div class="divTableCell">{{ vm.help.toggle_count_rate }}</div>
<div class="divTableCell">{{ vm.help.misc_generate_history_graphs }}</div>
</div>
<div class="divTableRow">
<div class="divTableCell">{{ vm.help.sort_io_rate }}</div>
<div class="divTableCell">{{ vm.help.show_hide_docker }}</div>
<div class="divTableCell">{{ vm.help.toggle_used_free }}</div>
<div class="divTableCell">{{ vm.help.misc_help }}</div>
</div>
<div class="divTableRow">
<div class="divTableCell">{{ vm.help.sort_mem }}</div>
<div class="divTableCell">{{ vm.help.show_hide_top_extended_stats }}</div>
<div class="divTableCell">{{ vm.help.toggle_bar_sparkline }}</div>
<div class="divTableCell">{{ vm.help.misc_accumulate_processes_by_program }}</div>
</div>
<div class="divTableRow">
<div class="divTableCell">{{ vm.help.sort_process_name }}</div>
<div class="divTableCell">{{ vm.help.show_hide_filesystem }}</div>
<div class="divTableCell">{{ vm.help.toggle_separate_combined }}</div>
<div class="divTableCell">{{ vm.help.misc_kill_process }} - N/A in WebUI</div>
</div>
<div class="divTableRow">
<div class="divTableCell">{{ vm.help.sort_cpu_times }}</div>
<div class="divTableCell">{{ vm.help.show_hide_gpu }}</div>
<div class="divTableCell">{{ vm.help.toggle_live_cumulative }}</div>
<div class="divTableCell">{{ vm.help.misc_reset_processes_summary_min_max }}</div>
</div>
<div class="divTableRow">
<div class="divTableCell">{{ vm.help.sort_user }}</div>
<div class="divTableCell">{{ vm.help.show_hide_ip }}</div>
<div class="divTableCell">{{ vm.help.toggle_linux_percentage }}</div>
<div class="divTableCell">{{ vm.help.misc_quit }}</div>
</div>
<div class="divTableRow">
<div class="divTableCell">&nbsp;</div>
<div class="divTableCell">{{ vm.help.show_hide_tcp_connection }}</div>
<div class="divTableCell">{{ vm.help.toggle_cpu_individual_combined }}</div>
<div class="divTableCell">{{ vm.help.misc_reset_history }}</div>
</div>
<div class="divTableRow">
<div class="divTableCell">&nbsp;</div>
<div class="divTableCell">{{ vm.help.show_hide_alert }}</div>
<div class="divTableCell">{{ vm.help.toggle_gpu_individual_combined }}</div>
<div class="divTableCell">{{ vm.help.misc_delete_warning_alerts }}</div>
</div>
<div class="divTableRow">
<div class="divTableCell">&nbsp;</div>
<div class="divTableCell">{{ vm.help.show_hide_network }}</div>
<div class="divTableCell">{{ vm.help.toggle_short_full }}</div>
<div class="divTableCell">{{ vm.help.misc_delete_warning_and_critical_alerts }}</div>
</div>
<div class="divTableRow">
<div class="divTableCell">&nbsp;</div>
<div class="divTableCell">{{ vm.help.sort_cpu_times }}</div>
<div class="divTableCell">&nbsp;</div>
<div class="divTableCell">{{ vm.help.misc_edit_process_filter_pattern }} - N/A in WebUI</div>
</div>
<div class="divTableRow">
<div class="divTableCell">&nbsp;</div>
<div class="divTableCell">{{ vm.help.show_hide_irq }}</div>
<div class="divTableCell">&nbsp;</div>
<div class="divTableCell">&nbsp;</div>
</div>
<div class="divTableRow">
<div class="divTableCell">&nbsp;</div>
<div class="divTableCell">{{ vm.help.show_hide_raid_plugin }}</div>
<div class="divTableCell">&nbsp;</div>
<div class="divTableCell">&nbsp;</div>
</div>
<div class="divTableRow">
<div class="divTableCell">&nbsp;</div>
<div class="divTableCell">{{ vm.help.show_hide_sensors }}</div>
<div class="divTableCell">&nbsp;</div>
<div class="divTableCell">&nbsp;</div>
</div>
<div class="divTableRow">
<div class="divTableCell">&nbsp;</div>
<div class="divTableCell">{{ vm.help.show_hide_wifi_module }}</div>
<div class="divTableCell">&nbsp;</div>
<div class="divTableCell">&nbsp;</div>
</div>
<div class="divTableRow">
<div class="divTableCell">&nbsp;</div>
<div class="divTableCell">{{ vm.help.show_hide_processes }}</div>
<div class="divTableCell">&nbsp;</div>
<div class="divTableCell">&nbsp;</div>
</div>
<div class="divTableRow">
<div class="divTableCell">&nbsp;</div>
<div class="divTableCell">{{ vm.help.show_hide_left_sidebar }}</div>
<div class="divTableCell">&nbsp;</div>
<div class="divTableCell">&nbsp;</div>
</div>
<div class="divTableRow">
<div class="divTableCell">&nbsp;</div>
<div class="divTableCell">{{ vm.help.show_hide_quick_look }}</div>
<div class="divTableCell">&nbsp;</div>
<div class="divTableCell">&nbsp;</div>
</div>
<div class="divTableRow">
<div class="divTableCell">&nbsp;</div>
<div class="divTableCell">{{ vm.help.show_hide_cpu_mem_swap }}</div>
<div class="divTableCell">&nbsp;</div>
<div class="divTableCell">&nbsp;</div>
</div>
<div class="divTableRow">
<div class="divTableCell">&nbsp;</div>
<div class="divTableCell">{{ vm.help.show_hide_all }}</div>
<div class="divTableCell">&nbsp;</div>
<div class="divTableCell">&nbsp;</div>
</div>
</div>
</div>
<div>
<p>For an exhaustive list of key bindings, <a href="https://glances.readthedocs.io/en/latest/cmds.html#interactive-commands">click here</a>.</p>
</div>
<div>
<p>Press <b>h</b> to came back to Glances.</p>
</div>

View File

@ -1,33 +0,0 @@
// import all components
import "./glances/component";
import "./help/component";
import "./plugin-alert/component";
import "./plugin-amps/component";
import "./plugin-cloud/component";
import "./plugin-connections/component";
import "./plugin-cpu/component";
import "./plugin-diskio/component";
import "./plugin-docker/component";
import "./plugin-folders/component";
import "./plugin-fs/component";
import "./plugin-gpu/component";
import "./plugin-ip/component";
import "./plugin-irq/component";
import "./plugin-load/component";
import "./plugin-mem/component";
import "./plugin-mem-more/component";
import "./plugin-memswap/component";
import "./plugin-network/component";
import "./plugin-percpu/component";
import "./plugin-ports/component";
import "./plugin-process/component";
import "./plugin-processcount/component";
import "./plugin-processlist/component";
import "./plugin-quicklook/component";
import "./plugin-raid/component";
import "./plugin-sensors/component";
import "./plugin-system/component";
import "./plugin-uptime/component";
import "./plugin-wifi/component";

View File

@ -0,0 +1,101 @@
<template>
<div>
<section id="alerts">
<span class="title" v-if="hasAlerts">
Warning or critical alerts (last {{ countAlerts }} entries)
</span>
<span class="title" v-else>No warning or critical alert detected</span>
</section>
<section id="alert" class="plugin">
<div class="table">
<div class="table-row" v-for="(alert, alertId) in alerts" :key="alertId">
<div class="table-cell text-left">
{{ formatDate(alert.begin) }}
({{ alert.ongoing ? 'ongoing' : alert.duration }}) -
<span v-show="!alert.ongoing"> {{ alert.level }} on </span>
<span :class="alert.level.toLowerCase()">
{{ alert.name }}
</span>
({{ $filters.number(alert.max, 1) }})
</div>
</div>
</div>
</section>
</div>
</template>
<script>
import { padStart } from 'lodash';
import { GlancesFavico } from '../services.js';
export default {
props: {
data: {
type: Object
}
},
computed: {
stats() {
return this.data.stats['alert'];
},
alerts() {
return (this.stats || []).map((alertalertStats) => {
const alert = {};
alert.name = alertalertStats[3];
alert.level = alertalertStats[2];
alert.begin = alertalertStats[0] * 1000;
alert.end = alertalertStats[1] * 1000;
alert.ongoing = alertalertStats[1] == -1;
alert.min = alertalertStats[6];
alert.mean = alertalertStats[5];
alert.max = alertalertStats[4];
if (!alert.ongoing) {
const duration = alert.end - alert.begin;
const seconds = parseInt((duration / 1000) % 60),
minutes = parseInt((duration / (1000 * 60)) % 60),
hours = parseInt((duration / (1000 * 60 * 60)) % 24);
alert.duration =
padStart(hours, 2, '0') +
':' +
padStart(minutes, 2, '0') +
':' +
padStart(seconds, 2, '0');
}
return alert;
});
},
hasAlerts() {
return this.countAlerts > 0;
},
countAlerts() {
return this.alerts.length;
},
hasOngoingAlerts() {
return this.countOngoingAlerts > 0;
},
countOngoingAlerts() {
return this.alerts.filter(({ ongoing }) => ongoing).length;
}
},
watch: {
countOngoingAlerts() {
if (this.countOngoingAlerts) {
GlancesFavico.badge(this.countOngoingAlerts);
} else {
GlancesFavico.reset();
}
}
},
methods: {
formatDate(date) {
return new Date(date)
.toISOString()
.slice(0, 19)
.replace(/[^\d-:]/, ' ');
}
}
};
</script>

View File

@ -1,11 +0,0 @@
import angular from "angular";
import GlancesPluginAlertController from "./controller";
import template from "./view.html";
export default angular.module("glancesApp").component("glancesPluginAlert", {
controller: GlancesPluginAlertController,
controllerAs: 'vm',
templateUrl: template,
});

View File

@ -1,64 +0,0 @@
export default function GlancesPluginAlertController($scope, favicoService) {
var vm = this;
var _alerts = [];
$scope.$on('data_refreshed', function (event, data) {
var alertStats = data.stats['alert'];
if (!_.isArray(alertStats)) {
alertStats = [];
}
_alerts = [];
for (var i = 0; i < alertStats.length; i++) {
var alertalertStats = alertStats[i];
var alert = {};
alert.name = alertalertStats[3];
alert.level = alertalertStats[2];
alert.begin = alertalertStats[0] * 1000;
alert.end = alertalertStats[1] * 1000;
alert.ongoing = alertalertStats[1] == -1;
alert.min = alertalertStats[6];
alert.mean = alertalertStats[5];
alert.max = alertalertStats[4];
if (!alert.ongoing) {
var duration = alert.end - alert.begin;
var seconds = parseInt((duration / 1000) % 60)
, minutes = parseInt((duration / (1000 * 60)) % 60)
, hours = parseInt((duration / (1000 * 60 * 60)) % 24);
alert.duration = _.padStart(hours, 2, '0') + ":" + _.padStart(minutes, 2, '0') + ":" + _.padStart(seconds, 2, '0');
}
_alerts.push(alert);
}
if (vm.hasOngoingAlerts()) {
favicoService.badge(vm.countOngoingAlerts());
} else {
favicoService.reset();
}
});
vm.hasAlerts = function () {
return _alerts.length > 0;
};
vm.getAlerts = function () {
return _alerts;
};
vm.count = function () {
return _alerts.length;
};
vm.hasOngoingAlerts = function () {
return _.filter(_alerts, {'ongoing': true}).length > 0;
};
vm.countOngoingAlerts = function () {
return _.filter(_alerts, {'ongoing': true}).length;
}
}

View File

@ -1,15 +0,0 @@
<section id="alerts">
<span class="title" ng-if="!vm.hasAlerts()">No warning or critical alert detected</span>
<span class="title" ng-if="vm.hasAlerts()">Warning or critical alerts (last {{vm.count()}} entries)</span>
</section>
<section id="alert" class="plugin">
<div class="table">
<div class="table-row" ng-repeat="alert in vm.getAlerts()">
<div class="table-cell text-left">
{{alert.begin | date : 'yyyy-MM-dd H:mm:ss'}} ({{ alert.ongoing ? 'ongoing' : alert.duration }}) - <span
ng-hide="alert.ongoing">{{alert.level}} on</span> <span class="{{ alert.level | lowercase }}">{{alert.name}}</span>
({{alert.max| number:1 }})
</div>
</div>
</div>
</section>

View File

@ -0,0 +1,55 @@
<template>
<section id="amps" class="plugin">
<div class="table">
<div class="table-row" v-for="(process, processId) in processes" :key="processId">
<div class="table-cell text-left" :class="getNameDecoration(process)">
{{ process.name }}
</div>
<div class="table-cell text-left" v-if="process.regex">{{ process.count }}</div>
<div
class="table-cell text-left process-result"
v-html="$filters.nl2br(process.result)"
></div>
</div>
</div>
</section>
</template>
<script>
export default {
props: {
data: {
type: Object
}
},
computed: {
stats() {
return this.data.stats['amps'];
},
processes() {
return this.stats.filter((process) => process.result !== null);
}
},
methods: {
getNameDecoration(process) {
const count = process.count;
const countMin = process.countmin;
const countMax = process.countmax;
let decoration = 'ok';
if (count > 0) {
if (
(countMin === null || count >= countMin) &&
(countMax === null || count <= countMax)
) {
decoration = 'ok';
} else {
decoration = 'careful';
}
} else {
decoration = countMin === null ? 'ok' : 'critical';
}
return decoration;
}
}
};
</script>

View File

@ -1,11 +0,0 @@
import angular from "angular";
import GlancesPluginAmpsController from "./controller";
import template from "./view.html";
export default angular.module("glancesApp").component("glancesPluginAmps", {
controller: GlancesPluginAmpsController,
controllerAs: 'vm',
templateUrl: template,
});

View File

@ -1,43 +0,0 @@
export default function GlancesPluginAmpsController($scope, GlancesStats, favicoService) {
var vm = this;
vm.processes = [];
vm.$onInit = function () {
loadData(GlancesStats.getData());
};
$scope.$on('data_refreshed', function (event, data) {
loadData(data);
});
var loadData = function (data) {
var processes = data.stats['amps'];
vm.processes = [];
angular.forEach(processes, function (process) {
if (process.result !== null) {
vm.processes.push(process);
}
}, this);
};
vm.getNameDecoration = function (process) {
var count = process.count;
var countMin = process.countmin;
var countMax = process.countmax;
var decoration = "ok";
if (count > 0) {
if ((countMin === null || count >= countMin) && (countMax === null || count <= countMax)) {
decoration = 'ok';
} else {
decoration = 'careful';
}
} else {
decoration = countMin === null ? 'ok' : 'critical';
}
return decoration;
}
}

View File

@ -1,9 +0,0 @@
<section id="amps" class="plugin">
<div class="table">
<div class="table-row" ng-repeat="process in vm.processes">
<div class="table-cell text-left" ng-class="vm.getNameDecoration(process)">{{ process.name }}</div>
<div class="table-cell text-left" ng-if="process.regex">{{ process.count }}</div>
<div class="table-cell text-left process-result" ng-bind-html="process.result|nl2br"></div>
</div>
</div>
</section>

View File

@ -0,0 +1,29 @@
<template>
<section id="cloud">
<span class="title">{{ provider }}</span> {{ instance }}
</section>
</template>
<script>
export default {
props: {
data: {
type: Object
}
},
computed: {
stats() {
return this.data.stats['cloud'];
},
provider() {
return this.stats['ami-id'] !== undefined ? 'AWS EC2' : null;
},
instance() {
const { stats } = this;
return this.stats['ami-id'] !== undefined
? `${stats['instance-type']} instance ${stats['instance-id']} (${stats['reggion']})`
: null;
}
}
};
</script>

View File

@ -1,11 +0,0 @@
import angular from "angular";
import GlancesPluginCloudController from "./controller";
import template from "./view.html";
export default angular.module("glancesApp").component("glancesPluginCloud", {
controller: GlancesPluginCloudController,
controllerAs: 'vm',
templateUrl: template,
});

View File

@ -1,24 +0,0 @@
export default function GlancesPluginCloudController($scope, GlancesStats) {
var vm = this;
vm.provider = null;
vm.instance = null;
vm.$onInit = function () {
loadData(GlancesStats.getData());
};
$scope.$on('data_refreshed', function (event, data) {
loadData(data);
});
var loadData = function (data) {
var stats = data.stats['cloud'];
if (stats['ami-id'] !== undefined) {
vm.provider = 'AWS EC2';
vm.instance = stats['instance-type'] + ' instance ' + stats['instance-id'] + ' (' + stats['region'] + ')';
}
}
}

View File

@ -1,3 +0,0 @@
<section id="cloud">
<span class="title">{{ vm.provider }}</span> {{ vm.instance }}
</section>

View File

@ -0,0 +1,79 @@
<template>
<section>
<div class="table-row">
<div class="table-cell text-left title">TCP CONNECTIONS</div>
<div class="table-cell"></div>
</div>
<div class="table-row">
<div class="table-cell text-left">Listen</div>
<div class="table-cell"></div>
<div class="table-cell">{{ listen }}</div>
</div>
<div class="table-row">
<div class="table-cell text-left">Initiated</div>
<div class="table-cell"></div>
<div class="table-cell">{{ initiated }}</div>
</div>
<div class="table-row">
<div class="table-cell text-left">Established</div>
<div class="table-cell"></div>
<div class="table-cell">{{ established }}</div>
</div>
<div class="table-row">
<div class="table-cell text-left">Terminated</div>
<div class="table-cell"></div>
<div class="table-cell">{{ terminated }}</div>
</div>
<div class="table-row">
<div class="table-cell text-left">Tracked</div>
<div class="table-cell"></div>
<div class="table-cell" :class="getDecoration('nf_conntrack_percent')">
{{ tracked.count }}/{{ tracked.max }}
</div>
</div>
</section>
</template>
<script>
export default {
props: {
data: {
type: Object
}
},
computed: {
stats() {
return this.data.stats['connections'];
},
view() {
return this.data.views['connections'];
},
listen() {
return this.stats['LISTEN'];
},
initiated() {
return this.stats['initiated'];
},
established() {
return this.stats['ESTABLISHED'];
},
terminated() {
return this.stats['terminated'];
},
tracked() {
return {
count: this.stats['nf_conntrack_count'],
max: this.stats['nf_conntrack_max']
};
}
},
methods: {
getDecoration(value) {
if (this.view[value] === undefined) {
return;
}
return this.view[value].decoration.toLowerCase();
}
}
};
</script>

View File

@ -1,11 +0,0 @@
import angular from "angular";
import GlancesPluginConnectionsController from "./controller";
import template from "./view.html";
export default angular.module("glancesApp").component("glancesPluginConnections", {
controller: GlancesPluginConnectionsController,
controllerAs: "vm",
templateUrl: template,
});

View File

@ -1,41 +0,0 @@
export default function GlancesPluginConnectionsController($scope, GlancesStats) {
var vm = this;
var _view = {};
vm.listen = null;
vm.initiated = null;
vm.established = null;
vm.terminated = null;
vm.tracked = null;
vm.$onInit = function () {
loadData(GlancesStats.getData());
};
$scope.$on('data_refreshed', function (event, data) {
loadData(data);
});
var loadData = function (data) {
var stats = data.stats['connections'];
_view = data.views['connections'];
vm.listen = stats['LISTEN'];
vm.initiated = stats['initiated'];
vm.established = stats['ESTABLISHED'];
vm.terminated = stats['terminated'];
vm.tracked = {
count: stats['nf_conntrack_count'],
max: stats['nf_conntrack_max'],
};
};
vm.getDecoration = function (value) {
if (_view[value] === undefined) {
return;
}
return _view[value].decoration.toLowerCase();
};
}

View File

@ -1,30 +0,0 @@
<div class="table-row">
<div class="table-cell text-left title">TCP CONNECTIONS</div>
<div class="table-cell"></div>
</div>
<div class="table-row">
<div class="table-cell text-left">Listen</div>
<div class="table-cell"></div>
<div class="table-cell">{{vm.listen}}</div>
</div>
<div class="table-row">
<div class="table-cell text-left">Initiated</div>
<div class="table-cell"></div>
<div class="table-cell">{{vm.initiated}}</div>
</div>
<div class="table-row">
<div class="table-cell text-left">Established</div>
<div class="table-cell"></div>
<div class="table-cell">{{vm.established}}</div>
</div>
<div class="table-row">
<div class="table-cell text-left">Terminated</div>
<div class="table-cell"></div>
<div class="table-cell">{{vm.terminated}}</div>
</div>
<div class="table-row">
<div class="table-cell text-left">Tracked</div>
<div class="table-cell"></div>
<div class="table-cell" ng-class="vm.getDecoration('nf_conntrack_percent')">{{vm.tracked.count}}/{{vm.tracked.max}}</div>
</div>

View File

@ -0,0 +1,147 @@
<template>
<section id="cpu" class="plugin">
<div class="row">
<div class="col-sm-24 col-md-12 col-lg-8">
<div class="table">
<div class="table-row">
<div class="table-cell text-left title">CPU</div>
<div class="table-cell">{{ total }}%</div>
</div>
<div class="table-row">
<div class="table-cell text-left">user:</div>
<div class="table-cell" :class="getDecoration('user')">{{ user }}%</div>
</div>
<div class="table-row">
<div class="table-cell text-left">system:</div>
<div class="table-cell" :class="getDecoration('system')">{{ system }}%</div>
</div>
<div class="table-row">
<div class="table-cell text-left">idle:</div>
<div class="table-cell">{{ idle }}%</div>
</div>
</div>
</div>
<div class="hidden-xs hidden-sm col-md-12 col-lg-8">
<div class="table">
<div class="table-row" v-show="nice != undefined">
<div class="table-cell text-left">nice:</div>
<div class="table-cell">{{ nice }}%</div>
</div>
<div class="table-row" v-show="irq != undefined">
<div class="table-cell text-left">irq:</div>
<div class="table-cell">{{ irq }}%</div>
</div>
<div class="table-row" v-show="iowait != undefined">
<div class="table-cell text-left">iowait:</div>
<div class="table-cell" :class="getDecoration('iowait')">{{ iowait }}%</div>
</div>
<div class="table-row" v-show="steal != undefined">
<div class="table-cell text-left">steal:</div>
<div class="table-cell" :class="getDecoration('steal')">{{ steal }}%</div>
</div>
</div>
</div>
<div class="hidden-xs hidden-sm hidden-md col-lg-8">
<div class="table">
<div class="table-row" v-if="ctx_switches">
<div class="table-cell text-left">ctx_sw:</div>
<div class="table-cell" :class="getDecoration('ctx_switches')">
{{ ctx_switches }}
</div>
</div>
<div class="table-row" v-if="interrupts">
<div class="table-cell text-left">inter:</div>
<div class="table-cell">
{{ interrupts }}
</div>
</div>
<div class="table-row" v-if="soft_interrupts">
<div class="table-cell text-left">sw_int:</div>
<div class="table-cell">
{{ soft_interrupts }}
</div>
</div>
<div class="table-row" v-if="!isLinux && syscalls">
<div class="table-cell text-left">syscal:</div>
<div class="table-cell">
{{ syscalls }}
</div>
</div>
</div>
</div>
</div>
</section>
</template>
<script>
export default {
props: {
data: {
type: Object
}
},
computed: {
stats() {
return this.data.stats['cpu'];
},
view() {
return this.data.views['cpu'];
},
isLinux() {
return this.data.isLinux;
},
total() {
return this.stats.total;
},
user() {
return this.stats.user;
},
system() {
return this.stats.system;
},
idle() {
return this.stats.idle;
},
nice() {
return this.stats.nice;
},
irq() {
return this.stats.irq;
},
iowait() {
return this.stats.iowait;
},
steal() {
return this.stats.steal;
},
ctx_switches() {
const { stats } = this;
return stats.ctx_switches
? Math.floor(stats.ctx_switches / stats.time_since_update)
: null;
},
interrupts() {
const { stats } = this;
return stats.interrupts ? Math.floor(stats.interrupts / stats.time_since_update) : null;
},
soft_interrupts() {
const { stats } = this;
return stats.soft_interrupts
? Math.floor(stats.soft_interrupts / stats.time_since_update)
: null;
},
syscalls() {
const { stats } = this;
return stats.syscalls ? Math.floor(stats.syscalls / stats.time_since_update) : null;
}
},
methods: {
getDecoration(value) {
if (this.view[value] === undefined) {
return;
}
return this.view[value].decoration.toLowerCase();
}
}
};
</script>

View File

@ -1,11 +0,0 @@
import angular from "angular";
import GlancesPluginCpuController from "./controller";
import template from "./view.html";
export default angular.module("glancesApp").component("glancesPluginCpu", {
controller: GlancesPluginCpuController,
controllerAs: 'vm',
templateUrl: template,
});

View File

@ -1,66 +0,0 @@
export default function GlancesPluginCpuController($scope, GlancesStats) {
var vm = this;
var _view = {};
vm.total = null;
vm.user = null;
vm.system = null;
vm.idle = null;
vm.nice = null;
vm.irq = null;
vm.iowait = null;
vm.steal = null;
vm.ctx_switches = null;
vm.interrupts = null;
vm.soft_interrupts = null;
vm.syscalls = null;
vm.$onInit = function () {
loadData(GlancesStats.getData());
};
$scope.$on('data_refreshed', function (event, data) {
loadData(data);
});
var loadData = function (data) {
var stats = data.stats['cpu'];
_view = data.views['cpu'];
vm.isLinux = data.isLinux;
vm.total = stats.total;
vm.user = stats.user;
vm.system = stats.system;
vm.idle = stats.idle;
vm.nice = stats.nice;
vm.irq = stats.irq;
vm.iowait = stats.iowait;
vm.steal = stats.steal;
if (stats.ctx_switches) {
vm.ctx_switches = Math.floor(stats.ctx_switches / stats.time_since_update);
}
if (stats.interrupts) {
vm.interrupts = Math.floor(stats.interrupts / stats.time_since_update);
}
if (stats.soft_interrupts) {
vm.soft_interrupts = Math.floor(stats.soft_interrupts / stats.time_since_update);
}
if (stats.syscalls) {
vm.syscalls = Math.floor(stats.syscalls / stats.time_since_update);
}
}
vm.getDecoration = function (value) {
if (_view[value] === undefined) {
return;
}
return _view[value].decoration.toLowerCase();
};
}

View File

@ -1,84 +0,0 @@
<section id="cpu" class="plugin">
<div class="row">
<div class="col-sm-24 col-md-12 col-lg-8">
<div class="table">
<div class="table-row">
<div class="table-cell text-left title">CPU</div>
<div class="table-cell">{{ vm.total }}%</div>
</div>
<div class="table-row">
<div class="table-cell text-left">user:</div>
<div class="table-cell" ng-class="vm.getDecoration('user')">
{{ vm.user }}%
</div>
</div>
<div class="table-row">
<div class="table-cell text-left">system:</div>
<div class="table-cell" ng-class="vm.getDecoration('system')">
{{ vm.system }}%
</div>
</div>
<div class="table-row">
<div class="table-cell text-left">idle:</div>
<div class="table-cell">{{ vm.idle }}%</div>
</div>
</div>
</div>
<div class="hidden-xs hidden-sm col-md-12 col-lg-8">
<div class="table">
<div class="table-row" ng-show="vm.nice != undefined">
<div class="table-cell text-left">nice:</div>
<div class="table-cell">
{{ vm.nice }}%
</div>
</div>
<div class="table-row" ng-show="vm.irq != undefined">
<div class="table-cell text-left">irq:</div>
<div class="table-cell">
{{ vm.irq }}%
</div>
</div>
<div class="table-row" ng-show="vm.iowait != undefined">
<div class="table-cell text-left">iowait:</div>
<div class="table-cell" ng-class="vm.getDecoration('iowait')">
{{ vm.iowait }}%
</div>
</div>
<div class="table-row" ng-show="vm.steal != undefined">
<div class="table-cell text-left">steal:</div>
<div class="table-cell" ng-class="vm.getDecoration('steal')">
{{ vm.steal }}%
</div>
</div>
</div>
</div>
<div class="hidden-xs hidden-sm hidden-md col-lg-8">
<div class="table">
<div class="table-row" ng-if="vm.ctx_switches">
<div class="table-cell text-left">ctx_sw:</div>
<div class="table-cell" ng-class="vm.getDecoration('ctx_switches')">
{{ vm.ctx_switches }}
</div>
</div>
<div class="table-row" ng-if="vm.interrupts">
<div class="table-cell text-left">inter:</div>
<div class="table-cell">
{{ vm.interrupts }}
</div>
</div>
<div class="table-row" ng-if="vm.soft_interrupts">
<div class="table-cell text-left">sw_int:</div>
<div class="table-cell">
{{ vm.soft_interrupts }}
</div>
</div>
<div class="table-row" ng-if="!vm.isLinux && vm.syscalls">
<div class="table-cell text-left">syscal:</div>
<div class="table-cell">
{{ vm.syscalls }}
</div>
</div>
</div>
</div>
</div>
</section>

View File

@ -0,0 +1,73 @@
<template>
<section>
<div class="table-row" v-if="disks.length > 0">
<div class="table-cell text-left title">DISK I/O</div>
<div class="table-cell" v-show="!args.diskio_iops">R/s</div>
<div class="table-cell" v-show="!args.diskio_iops">W/s</div>
<div class="table-cell" v-show="args.diskio_iops">IOR/s</div>
<div class="table-cell" v-show="args.diskio_iops">IOW/s</div>
</div>
<div class="table-row" v-for="(disk, diskId) in disks" :key="diskId">
<div class="table-cell text-left">
{{ $filters.minSize(disk.alias ? disk.alias : disk.name, 32) }}
</div>
<div class="table-cell" v-show="!args.diskio_iops">
{{ disk.bitrate.txps }}
</div>
<div class="table-cell" v-show="!args.diskio_iops">
{{ disk.bitrate.rxps }}
</div>
<div class="table-cell" v-show="args.diskio_iops">
{{ disk.count.txps }}
</div>
<div class="table-cell" v-show="args.diskio_iops">
{{ disk.count.rxps }}
</div>
</div>
</section>
</template>
<script>
import { orderBy } from 'lodash';
import { store } from '../store.js';
import { bytes } from '../filters.js';
export default {
props: {
data: {
type: Object
}
},
data() {
return {
store
};
},
computed: {
args() {
return this.store.args || {};
},
stats() {
return this.data.stats['diskio'];
},
disks() {
const disks = this.stats.map((diskioData) => {
const timeSinceUpdate = diskioData['time_since_update'];
return {
name: diskioData['disk_name'],
bitrate: {
txps: bytes(diskioData['read_bytes'] / timeSinceUpdate),
rxps: bytes(diskioData['write_bytes'] / timeSinceUpdate)
},
count: {
txps: bytes(diskioData['read_count'] / timeSinceUpdate),
rxps: bytes(diskioData['write_count'] / timeSinceUpdate)
},
alias: diskioData['alias'] !== undefined ? diskioData['alias'] : null
};
});
return orderBy(disks, ['name']);
}
}
};
</script>

View File

@ -1,11 +0,0 @@
import angular from "angular";
import GlancesPluginDiskioController from "./controller";
import template from "./view.html";
export default angular.module("glancesApp").component("glancesPluginDiskio", {
controller: GlancesPluginDiskioController,
controllerAs: 'vm',
templateUrl: template,
});

View File

@ -1,36 +0,0 @@
export default function GlancesPluginDiskioController($scope, $filter, GlancesStats, ARGUMENTS) {
var vm = this;
vm.arguments = ARGUMENTS;
vm.disks = [];
vm.$onInit = function () {
loadData(GlancesStats.getData());
};
$scope.$on('data_refreshed', function (event, data) {
loadData(data);
});
var loadData = function (data) {
var stats = data.stats['diskio'] || [];
stats = $filter('orderBy')(stats, 'disk_name');
vm.disks = stats.map(function(diskioData) {
var timeSinceUpdate = diskioData['time_since_update'];
return {
'name': diskioData['disk_name'],
'bitrate': {
'txps': $filter('bytes')(diskioData['read_bytes'] / timeSinceUpdate),
'rxps': $filter('bytes')(diskioData['write_bytes'] / timeSinceUpdate)
},
'count': {
'txps': $filter('bytes')(diskioData['read_count'] / timeSinceUpdate),
'rxps': $filter('bytes')(diskioData['write_count'] / timeSinceUpdate)
},
'alias': diskioData['alias'] !== undefined ? diskioData['alias'] : null
};
});
}
}

View File

@ -1,16 +0,0 @@
<div class="table-row" ng-if="vm.disks.length > 0">
<div class="table-cell text-left title">DISK I/O</div>
<div class="table-cell" ng-show="!vm.arguments.diskio_iops">R/s</div>
<div class="table-cell" ng-show="!vm.arguments.diskio_iops">W/s</div>
<div class="table-cell" ng-show="vm.arguments.diskio_iops">IOR/s</div>
<div class="table-cell" ng-show="vm.arguments.diskio_iops">IOW/s</div>
</div>
<div class="table-row" ng-repeat="disk in vm.disks">
<div class="table-cell text-left">{{ (disk.alias ? disk.alias : disk.name) | min_size:32 }}</div>
<div class="table-cell" ng-show="!vm.arguments.diskio_iops">{{ disk.bitrate.txps }}</div>
<div class="table-cell" ng-show="!vm.arguments.diskio_iops">{{ disk.bitrate.rxps }}</div>
<div class="table-cell" ng-show="vm.arguments.diskio_iops">{{ disk.count.txps }}</div>
<div class="table-cell" ng-show="vm.arguments.diskio_iops">{{ disk.count.rxps }}</div>
</div>

View File

@ -0,0 +1,98 @@
<template>
<section id="containers-plugin" class="plugin" v-if="containers.length">
<span class="title">CONTAINERS</span>
{{ containers.length }} (served by Docker {{ version }})
<div class="table">
<div class="table-row">
<div class="table-cell text-left">Name</div>
<div class="table-cell">Status</div>
<div class="table-cell">Uptime</div>
<div class="table-cell">CPU%</div>
<div class="table-cell">MEM</div>
<div class="table-cell">RSS</div>
<div class="table-cell">IOR/s</div>
<div class="table-cell">IOW/s</div>
<div class="table-cell">RX/s</div>
<div class="table-cell">TX/s</div>
<div class="table-cell text-left">Command</div>
</div>
<div
class="table-row"
v-for="(container, containerId) in containers"
:key="containerId"
>
<div class="table-cell text-left">{{ container.name }}</div>
<div class="table-cell" :class="container.status == 'Paused' ? 'careful' : 'ok'">
{{ container.status }}
</div>
<div class="table-cell" :class="container.status == 'Paused' ? 'careful' : 'ok'">
{{ container.uptime }}
</div>
<div class="table-cell">
{{ $filters.number(container.cpu, 1) }}
</div>
<div class="table-cell">
{{ $filters.bytes(container.memory) }}
</div>
<div class="table-cell">
{{ $filters.bytes(container.rss) }}
</div>
<div class="table-cell">
{{ $filters.bits(container.ior / container.io_time_since_update) }}
</div>
<div class="table-cell">
{{ $filters.bits(container.iow / container.io_time_since_update) }}
</div>
<div class="table-cell">
{{ $filters.bits(container.rx / container.net_time_since_update) }}
</div>
<div class="table-cell">
{{ $filters.bits(container.tx / container.net_time_since_update) }}
</div>
<div class="table-cell text-left">
{{ container.command }}
</div>
</div>
</div>
</section>
</template>
<script>
export default {
props: {
data: {
type: Object
}
},
computed: {
stats() {
return this.data.stats['docker'];
},
containers() {
return (this.stats.containers || []).map((containerData) => {
// prettier-ignore
return {
'id': containerData.Id,
'name': containerData.name,
'status': containerData.Status,
'uptime': containerData.Uptime,
'cpu': containerData.cpu.total,
'memory': containerData.memory.usage != undefined ? containerData.memory.usage : '?',
'rss': containerData.memory.rss != undefined ? containerData.memory.rss : '?',
'ior': containerData.io.ior != undefined ? containerData.io.ior : '?',
'iow': containerData.io.iow != undefined ? containerData.io.iow : '?',
'io_time_since_update': containerData.io.time_since_update,
'rx': containerData.network.rx != undefined ? containerData.network.rx : '?',
'tx': containerData.network.tx != undefined ? containerData.network.tx : '?',
'net_time_since_update': containerData.network.time_since_update,
'command': containerData.Command,
'image': containerData.Image
};
});
},
version() {
return (this.stats['version'] || {})['Version'];
}
}
};
</script>

View File

@ -1,11 +0,0 @@
import angular from "angular";
import GlancesPluginDockerController from "./controller";
import template from "./view.html";
export default angular.module("glancesApp").component("glancesPluginDocker", {
controller: GlancesPluginDockerController,
controllerAs: "vm",
templateUrl: template,
});

View File

@ -1,45 +0,0 @@
export default function GlancesPluginDockerController($scope, GlancesStats) {
var vm = this;
vm.containers = [];
vm.version = null;
var loadData = function (data) {
var stats = data.stats['docker'];
vm.containers = [];
if (_.isEmpty(stats) || _.isEmpty(stats['containers']) ) {
return;
}
vm.containers = stats['containers'].map(function(containerData) {
return {
'id': containerData.Id,
'name': containerData.name,
'status': containerData.Status,
'uptime': containerData.Uptime,
'cpu': containerData.cpu.total,
'memory': containerData.memory.usage != undefined ? containerData.memory.usage : '?',
'rss': containerData.memory.rss != undefined ? containerData.memory.rss : '?',
'ior': containerData.io.ior != undefined ? containerData.io.ior : '?',
'iow': containerData.io.iow != undefined ? containerData.io.iow : '?',
'io_time_since_update': containerData.io.time_since_update,
'rx': containerData.network.rx != undefined ? containerData.network.rx : '?',
'tx': containerData.network.tx != undefined ? containerData.network.tx : '?',
'net_time_since_update': containerData.network.time_since_update,
'command': containerData.Command,
'image': containerData.Image
};
});
vm.version = stats['version']['Version'];
}
vm.$onInit = function () {
loadData(GlancesStats.getData());
};
$scope.$on('data_refreshed', function (event, data) {
loadData(data);
});
}

View File

@ -1,34 +0,0 @@
<section id="containers-plugin" class="plugin" ng-if="vm.containers.length">
<span class="title">CONTAINERS</span> {{ vm.containers.length }} (served by Docker {{ vm.version }})
<div class="table">
<div class="table-row">
<div class="table-cell text-left">Name</div>
<div class="table-cell">Status</div>
<div class="table-cell">Uptime</div>
<div class="table-cell">CPU%</div>
<div class="table-cell">MEM</div>
<div class="table-cell">RSS</div>
<div class="table-cell">IOR/s</div>
<div class="table-cell">IOW/s</div>
<div class="table-cell">RX/s</div>
<div class="table-cell">TX/s</div>
<div class="table-cell text-left">Command</div>
</div>
<div class="table-row" ng-repeat="container in vm.containers track by container.id">
<div class="table-cell text-left">{{ container.name }}</div>
<div class="table-cell" ng-class="container.status == 'Paused' ? 'careful' : 'ok'">{{ container.status }}
</div>
<div class="table-cell" ng-class="container.status == 'Paused' ? 'careful' : 'ok'">{{ container.uptime }}
</div>
<div class="table-cell">{{ container.cpu | number:1 }}</div>
<div class="table-cell">{{ container.memory | bytes }}</div>
<div class="table-cell">{{ container.rss | bytes }}</div>
<div class="table-cell">{{ container.ior / container.io_time_since_update | bits }}</div>
<div class="table-cell">{{ container.iow / container.io_time_since_update | bits }}</div>
<div class="table-cell">{{ container.rx / container.net_time_since_update | bits }}</div>
<div class="table-cell">{{ container.tx / container.net_time_since_update | bits }}</div>
<div class="table-cell text-left">{{ container.command }}</div>
</div>
</div>
</section>

View File

@ -0,0 +1,57 @@
<template>
<section>
<div class="table-row" v-if="folders.length > 0">
<div class="table-cell text-left title">FOLDERS</div>
<div class="table-cell"></div>
<div class="table-cell">Size</div>
</div>
<div class="table-row" v-for="(folder, folderId) in folders" :key="folderId">
<div class="table-cell text-left">{{ folder.path }}</div>
<div class="table-cell"></div>
<div class="table-cell" :class="vm.getDecoration(folder)">
{{ $filters.bytes(folder.size) }}
</div>
</div>
</section>
</template>
<script>
export default {
props: {
data: {
type: Object
}
},
computed: {
stats() {
return this.data.stats['folders'];
},
folders() {
return this.stats.map((folderData) => {
return {
path: folderData['path'],
size: folderData['size'],
careful: folderData['careful'],
warning: folderData['warning'],
critical: folderData['critical']
};
});
}
},
methods: {
getDecoration(folder) {
if (!Number.isInteger(folder.size)) {
return;
}
if (folder.critical !== null && folder.size > folder.critical * 1000000) {
return 'critical';
} else if (folder.warning !== null && folder.size > folder.warning * 1000000) {
return 'warning';
} else if (folder.careful !== null && folder.size > folder.careful * 1000000) {
return 'careful';
}
return 'ok';
}
}
};
</script>

View File

@ -1,11 +0,0 @@
import angular from "angular";
import GlancesPluginFsController from "./controller";
import template from "./view.html";
export default angular.module("glancesApp").component("glancesPluginFolders", {
controller: GlancesPluginFsController,
controllerAs: "vm",
templateUrl: template,
});

View File

@ -1,49 +0,0 @@
export default function GlancesPluginFoldersController($scope, GlancesStats) {
var vm = this;
vm.folders = [];
vm.$onInit = function () {
loadData(GlancesStats.getData());
};
$scope.$on('data_refreshed', function (event, data) {
loadData(data);
});
var loadData = function (data) {
var stats = data.stats['folders'];
vm.folders = [];
for (var i = 0; i < stats.length; i++) {
var folderData = stats[i];
var folder = {
'path': folderData['path'],
'size': folderData['size'],
'careful': folderData['careful'],
'warning': folderData['warning'],
'critical': folderData['critical']
};
vm.folders.push(folder);
}
}
vm.getDecoration = function (folder) {
if (!Number.isInteger(folder.size)) {
return;
}
if (folder.critical !== null && folder.size > (folder.critical * 1000000)) {
return 'critical';
} else if (folder.warning !== null && folder.size > (folder.warning * 1000000)) {
return 'warning';
} else if (folder.careful !== null && folder.size > (folder.careful * 1000000)) {
return 'careful';
}
return 'ok';
};
}

View File

@ -1,10 +0,0 @@
<div class="table-row" ng-if="vm.folders.length > 0">
<div class="table-cell text-left title">FOLDERS</div>
<div class="table-cell"></div>
<div class="table-cell">Size</div>
</div>
<div class="table-row" ng-repeat="folder in vm.folders">
<div class="table-cell text-left">{{ folder.path }}</div>
<div class="table-cell"></div>
<div class="table-cell" ng-class="vm.getDecoration(folder)">{{ folder.size | bytes }}</div>
</div>

View File

@ -0,0 +1,84 @@
<template>
<section>
<div class="table-row">
<div class="table-cell text-left title">FILE SYS</div>
<div class="table-cell">
<span v-show="!args.fs_free_space">Used</span>
<span v-show="args.fs_free_space">Free</span>
</div>
<div class="table-cell">Total</div>
</div>
<div class="table-row" v-for="(fs, fsId) in fileSystems" :key="fsId">
<div class="table-cell text-left">
{{ fs.shortMountPoint }}
<span v-if="fs.shortMountPoint.length <= 12" class="visible-lg-inline">
({{ fs.name }})
</span>
</div>
<div class="table-cell" :class="getDecoration(fs.mountPoint, 'used')">
<span v-show="!args.fs_free_space">
{{ $filters.bytes(fs.used) }}
</span>
<span v-show="args.fs_free_space">
{{ $filters.bytes(fs.free) }}
</span>
</div>
<div class="table-cell">{{ $filters.bytes(fs.size) }}</div>
</div>
</section>
</template>
<script>
import { orderBy } from 'lodash';
import { store } from '../store.js';
export default {
props: {
data: {
type: Object
}
},
data() {
return {
store
};
},
computed: {
args() {
return this.store.args || {};
},
stats() {
return this.data.stats['fs'];
},
view() {
return this.data.views['fs'];
},
fileSystems() {
const fileSystems = this.stats.map((fsData) => {
let shortMountPoint = fsData['mnt_point'];
if (shortMountPoint.length > 22) {
shortMountPoint = '_' + fsData['mnt_point'].slice(-21);
}
return {
name: fsData['device_name'],
mountPoint: fsData['mnt_point'],
shortMountPoint: shortMountPoint,
percent: fsData['percent'],
size: fsData['size'],
used: fsData['used'],
free: fsData['free']
};
});
return orderBy(fileSystems, ['mnt_point']);
}
},
methods: {
getDecoration(mountPoint, field) {
if (this.view[mountPoint][field] == undefined) {
return;
}
return this.view[mountPoint][field].decoration.toLowerCase();
}
}
};
</script>

View File

@ -1,11 +0,0 @@
import angular from "angular";
import GlancesPluginFsController from "./controller";
import template from "./view.html";
export default angular.module("glancesApp").component("glancesPluginFs", {
controller: GlancesPluginFsController,
controllerAs: 'vm',
templateUrl: template,
});

View File

@ -1,50 +0,0 @@
export default function GlancesPluginFsController($scope, $filter, GlancesStats, ARGUMENTS) {
var vm = this;
var _view = {};
vm.arguments = ARGUMENTS;
vm.fileSystems = [];
vm.$onInit = function () {
loadData(GlancesStats.getData());
};
$scope.$on('data_refreshed', function (event, data) {
loadData(data);
});
var loadData = function (data) {
var stats = data.stats['fs'];
_view = data.views['fs'];
vm.fileSystems = [];
for (var i = 0; i < stats.length; i++) {
var fsData = stats[i];
var shortMountPoint = fsData['mnt_point'];
if (shortMountPoint.length > 22) {
shortMountPoint = '_' + fsData['mnt_point'].slice(-21);
}
vm.fileSystems.push({
'name': fsData['device_name'],
'mountPoint': fsData['mnt_point'],
'shortMountPoint': shortMountPoint,
'percent': fsData['percent'],
'size': fsData['size'],
'used': fsData['used'],
'free': fsData['free']
});
}
vm.fileSystems = $filter('orderBy')(vm.fileSystems, 'mnt_point');
};
vm.getDecoration = function (mountPoint, field) {
if (_view[mountPoint][field] == undefined) {
return;
}
return _view[mountPoint][field].decoration.toLowerCase();
};
}

View File

@ -1,18 +0,0 @@
<div class="table-row">
<div class="table-cell text-left title">FILE SYS</div>
<div class="table-cell">
<span ng-show="!vm.arguments.fs_free_space">Used</span>
<span ng-show="vm.arguments.fs_free_space">Free</span>
</div>
<div class="table-cell">Total</div>
</div>
<div class="table-row" ng-repeat="fs in vm.fileSystems">
<div class="table-cell text-left">{{ fs.shortMountPoint }}
<span class="visible-lg-inline" ng-show="fs.shortMountPoint <= 12">({{ fs.name }})</span>
</div>
<div class="table-cell" ng-class="vm.getDecoration(fs.mountPoint, 'used')">
<span ng-show="!vm.arguments.fs_free_space">{{ fs.used | bytes }}</span>
<span ng-show="vm.arguments.fs_free_space">{{ fs.free | bytes }}</span>
</div>
<div class="table-cell">{{ fs.size | bytes }}</div>
</div>

View File

@ -0,0 +1,131 @@
<template>
<section id="gpu" class="plugin">
<div class="gpu-name title">
{{ name }}
</div>
<div class="table">
<div class="table-row" v-if="args.meangpu || gpus.length === 1">
<div class="table-cell text-left">proc:</div>
<div class="table-cell" :class="getMeanDecoration('proc')" v-if="mean.proc != null">
{{ $filters.number(mean.proc, 0) }}%
</div>
<div class="table-cell" v-if="mean.proc == null">N/A</div>
</div>
<div class="table-row" v-if="args.meangpu || gpus.length === 1">
<div class="table-cell text-left">mem:</div>
<div class="table-cell" :class="getMeanDecoration('mem')" v-if="mean.mem != null">
{{ $filters.number(mean.mem, 0) }}%
</div>
<div class="table-cell" v-if="mean.mem == null">N/A</div>
</div>
<div class="table-row" v-if="args.meangpu || gpus.length === 1">
<div class="table-cell text-left">temperature::</div>
<div
class="table-cell"
:class="getMeanDecoration('temperature')"
v-if="mean.temperature != null"
>
{{ $filters.number(mean.temperature, 0) }}°
</div>
<div class="table-cell" v-if="mean.temperature == null">N/A</div>
</div>
<template v-if="!args.meangpu && gpus.length > 1">
<div class="table-row" v-for="(gpu, gpuId) in gpus" :key="gpuId">
<div class="table-cell text-left">
{{ gpu.gpu_id }}:
<span :class="getDecoration(gpu.gpu_id, 'proc')" v-if="gpu.proc != null">
{{ $filters.number(gpu.proc, 0) }}%
</span>
<span v-if="gpu.proc == null">N/A</span>
mem:
<span :class="getDecoration(gpu.gpu_id, 'mem')" v-if="gpu.mem != null">
{{ $filters.number(gpu.mem, 0) }}%
</span>
<span v-if="gpu.mem == null">N/A</span>
temp:
<span
:class="getDecoration(gpu.gpu_id, 'temperature')"
v-if="gpu.temperature != null"
>
{{ $filters.number(gpu.temperature, 0) }}C
</span>
<span v-if="gpu.temperature == null">N/A</span>
</div>
</div>
</template>
</div>
</section>
</template>
<script>
import { store } from '../store.js';
export default {
props: {
data: {
type: Object
}
},
data() {
return {
store
};
},
computed: {
args() {
return this.store.args || {};
},
stats() {
return this.data.stats['gpu'];
},
view() {
return this.data.views['gpu'];
},
gpus() {
return this.stats;
},
name() {
let name = 'GPU';
const sameName = true;
const { stats } = this;
if (stats.length === 1) {
name = stats[0].name;
} else if (stats.length && sameName) {
name = `${stats.length} GPU ${stats[0].name}`;
}
return name;
},
mean() {
const mean = {
proc: null,
mem: null,
temperature: null
};
const { stats } = this;
if (!stats.length) {
return mean;
}
for (let gpu of stats) {
mean.proc += gpu.proc;
mean.mem += gpu.mem;
mean.temperature += gpu.temperature;
}
mean.proc = mean.proc / stats.length;
mean.mem = mean.mem / stats.length;
mean.temperature = mean.temperature / stats.length;
return mean;
}
},
methods: {
getDecoration(gpuId, value) {
if (this.view[gpuId][value] === undefined) {
return;
}
return this.view[gpuId][value].decoration.toLowerCase();
},
getMeanDecoration(value) {
return this.getDecoration(0, value);
}
}
};
</script>

View File

@ -1,11 +0,0 @@
import angular from "angular";
import GlancesPluginGpuController from "./controller";
import template from "./view.html";
export default angular.module("glancesApp").component("glancesPluginGpu", {
controller: GlancesPluginGpuController,
controllerAs: "vm",
templateUrl: template,
});

View File

@ -1,69 +0,0 @@
export default function GlancesPluginGpuController($scope, GlancesStats, ARGUMENTS) {
var vm = this;
vm.arguments = ARGUMENTS;
var _view = {};
vm.gpus = [];
vm.name = "GPU";
vm.mean = {};
vm.$onInit = function () {
loadData(GlancesStats.getData());
};
$scope.$on('data_refreshed', function (event, data) {
loadData(data);
});
var loadData = function (data) {
var stats = data.stats['gpu'];
_view = data.views['gpu'];
if (stats.length === 0) {
return;
}
vm.gpus = [];
vm.name = "GPU";
vm.mean = {
proc: null,
mem: null,
temperature: null
};
var sameName = true;
for (var i = 0; i < stats.length; i++) {
var gpuData = stats[i];
var gpu = gpuData;
vm.mean.proc += gpu.proc;
vm.mean.mem += gpu.mem;
vm.mean.temperature += gpu.temperature;
vm.gpus.push(gpu);
}
if (stats.length === 1) {
vm.name = stats[0].name;
} else if (sameName) {
vm.name = stats.length + ' GPU ' + stats[0].name;
}
vm.mean.proc = vm.mean.proc / stats.length;
vm.mean.mem = vm.mean.mem / stats.length;
vm.mean.temperature = vm.mean.temperature / stats.length;
}
vm.getDecoration = function (gpuId, value) {
if (_view[gpuId][value] == undefined) {
return;
}
return _view[gpuId][value].decoration.toLowerCase();
};
vm.getMeanDecoration = function (value) {
return vm.getDecoration(0, value);
};
}

View File

@ -1,42 +0,0 @@
<section id="gpu" class="plugin">
<div class="gpu-name title">
{{ vm.name }}
</div>
<div class="table">
<div class="table-row" ng-if="arguments.meangpu || vm.gpus.length === 1">
<div class="table-cell text-left">proc:</div>
<div class="table-cell" ng-class="vm.getMeanDecoration('proc')" ng-if="vm.mean.proc != null">{{ vm.mean.proc |
number : 0 }}%
</div>
<div class="table-cell" ng-if="vm.mean.proc == null">N/A</div>
</div>
<div class="table-row" ng-if="arguments.meangpu || vm.gpus.length === 1">
<div class="table-cell text-left">mem:</div>
<div class="table-cell" ng-class="vm.getMeanDecoration('mem')" ng-if="vm.mean.mem != null">{{ vm.mean.mem | number :
0 }}%
</div>
<div class="table-cell" ng-if="vm.mean.mem == null">N/A</div>
</div>
<div class="table-row" ng-if="arguments.meangpu || vm.gpus.length === 1">
<div class="table-cell text-left">temperature::</div>
<div class="table-cell" ng-class="vm.getMeanDecoration('temperature')" ng-if="vm.mean.temperature != null">{{ vm.mean.temperature | number
:
0 }}°
</div>
<div class="table-cell" ng-if="vm.mean.temperature == null">N/A</div>
</div>
<div class="table-row" ng-if="!arguments.meangpu && vm.gpus.length > 1" ng-repeat="gpu in vm.gpus">
<div class="table-cell text-left">
{{ gpu.gpu_id }}:
<span ng-class="vm.getDecoration(gpu.gpu_id, 'proc')" ng-if="gpu.proc != null">{{ gpu.proc | number : 0 }}%</span>
<span ng-if="gpu.proc == null">N/A</span>
mem:
<span ng-class="vm.getDecoration(gpu.gpu_id, 'mem')" ng-if="gpu.mem != null">{{ gpu.mem | number : 0 }}%</span>
<span ng-if="gpu.mem == null">N/A</span>
temp:
<span ng-class="vm.getDecoration(gpu.gpu_id, 'temperature')" ng-if="gpu.temperature != null">{{ gpu.temperature | number : 0 }}C</span>
<span ng-if="gpu.temperature == null">N/A</span>
</div>
</div>
</div>
</section>

View File

@ -0,0 +1,43 @@
<template>
<section id="ip" v-if="address != undefined">
-
<span v-if="address != undefined" class="title">IP</span>
<span v-if="address != undefined">{{ address }}/{{ maskCidr }}</span>
<span v-if="publicAddress" class="title">Pub</span>
<span v-if="publicAddress">{{ publicAddress }}</span>
<span v-if="publicInfo">({{ publicInfo }})</span>
</section>
</template>
<script>
export default {
props: {
data: {
type: Object
}
},
computed: {
ipStats() {
return this.data.stats['ip'];
},
address() {
return this.ipStats.address;
},
gateway() {
return this.ipStats.gateway;
},
mask() {
return this.ipStats.mask;
},
maskCdir() {
return this.ipStats.mask_cidr;
},
publicAddress() {
return this.ipStats.public_address;
},
publicInfo() {
return this.ipStats.public_info_human;
}
}
};
</script>

View File

@ -1,11 +0,0 @@
import angular from "angular";
import GlancesPluginIpController from "./controller";
import template from "./view.html";
export default angular.module("glancesApp").component("glancesPluginIp", {
controller: GlancesPluginIpController,
controllerAs: "vm",
templateUrl: template,
});

View File

@ -1,30 +0,0 @@
export default function GlancesPluginIpController($scope, GlancesStats, ARGUMENTS) {
var vm = this;
vm.arguments = ARGUMENTS;
vm.address = null;
vm.gateway = null;
vm.mask = null;
vm.maskCidr = null;
vm.publicAddress = null;
vm.$onInit = function () {
loadData(GlancesStats.getData());
};
$scope.$on('data_refreshed', function (event, data) {
loadData(data);
});
var loadData = function (data) {
var ipStats = data.stats['ip'];
vm.address = ipStats.address;
vm.gateway = ipStats.gateway;
vm.mask = ipStats.mask;
vm.maskCidr = ipStats.mask_cidr;
vm.publicAddress = ipStats.public_address
vm.publicInfo = ipStats.public_info_human
}
}

View File

@ -1,8 +0,0 @@
<section id="ip" ng-if="vm.address != undefined && !vm.arguments.disable_ip">
-
<span ng-if="vm.address != undefined" class="title">IP</span>
<spanng-if="vm.address != undefined">{{ vm.address }}/{{ vm.maskCidr }}</span>
<span ng-if="vm.publicAddress" class="title">Pub</span>
<span ng-if="vm.publicAddress">{{ vm.publicAddress }}</span>
<span ng-if="vm.publicInfo">({{ vm.publicInfo }})</span>
</section>

View File

@ -0,0 +1,39 @@
<template>
<section>
<div class="table-row" v-if="irqs.length > 0">
<div class="table-cell text-left title">IRQ</div>
<div class="table-cell"></div>
<div class="table-cell">Rate/s</div>
</div>
<div class="table-row" v-for="(irq, irqId) in irqs" :key="irqId">
<div class="table-cell text-left">{{ irq.irq_line }}</div>
<div class="table-cell"></div>
<div class="table-cell">
<span>{{ irq.irq_rate }}</span>
</div>
</div>
</section>
</template>
<script>
export default {
props: {
data: {
type: Object
}
},
computed: {
stats() {
return this.data.stats['irq'];
},
irqs() {
return this.stats.map((IrqData) => {
return {
irq_line: IrqData['irq_line'],
irq_rate: IrqData['irq_rate']
};
});
}
}
};
</script>

View File

@ -1,11 +0,0 @@
import angular from "angular";
import GlancesPluginIrqController from "./controller";
import template from "./view.html";
export default angular.module("glancesApp").component("glancesPluginIrq", {
controller: GlancesPluginIrqController,
controllerAs: "vm",
templateUrl: template,
});

View File

@ -1,29 +0,0 @@
export default function GlancesPluginIrqController($scope, GlancesStats) {
var vm = this;
vm.irqs = [];
vm.$onInit = function () {
loadData(GlancesStats.getData());
};
$scope.$on('data_refreshed', function (event, data) {
loadData(data);
});
var loadData = function (data) {
var stats = data.stats['irq'];
vm.irqs = [];
for (var i = 0; i < stats.length; i++) {
var IrqData = stats[i];
var irq = {
'irq_line': IrqData['irq_line'],
'irq_rate': IrqData['irq_rate']
};
vm.irqs.push(irq);
}
}
}

View File

@ -1,10 +0,0 @@
<div class="table-row" ng-if="vm.irqs.length > 0">
<div class="table-cell text-left title">IRQ</div>
<div class="table-cell"></div>
<div class="table-cell">Rate/s</div>
</div>
<div class="table-row" ng-repeat="irq in vm.irqs">
<div class="table-cell text-left">{{irq.irq_line}}</div>
<div class="table-cell"></div>
<div class="table-cell"><span>{{irq.irq_rate}}</span></div>
</div>

View File

@ -0,0 +1,66 @@
<template>
<section id="load" class="plugin" v-if="cpucore != undefined">
<div class="table">
<div class="table-row">
<div class="table-cell text-left title">LOAD</div>
<div class="table-cell">{{ cpucore }}-core</div>
</div>
<div class="table-row">
<div class="table-cell text-left">1 min:</div>
<div class="table-cell">
{{ $filters.number(min1, 2) }}
</div>
</div>
<div class="table-row">
<div class="table-cell text-left">5 min:</div>
<div class="table-cell" :class="getDecoration('min5')">
{{ $filters.number(min5, 2) }}
</div>
</div>
<div class="table-row">
<div class="table-cell text-left">15 min:</div>
<div class="table-cell" :class="getDecoration('min15')">
{{ $filters.number(min15, 2) }}
</div>
</div>
</div>
</section>
</template>
<script>
export default {
props: {
data: {
type: Object
}
},
computed: {
stats() {
return this.data.stats['load'];
},
view() {
return this.data.views['load'];
},
cpucore() {
return this.stats['cpucore'];
},
min1() {
return this.stats['min1'];
},
min5() {
return this.stats['min5'];
},
min15() {
return this.stats['min15'];
}
},
methods: {
getDecoration(value) {
if (this.view[value] === undefined) {
return;
}
return this.view[value].decoration.toLowerCase();
}
}
};
</script>

View File

@ -1,11 +0,0 @@
import angular from "angular";
import GlancesPluginLoadController from "./controller";
import template from "./view.html";
export default angular.module("glancesApp").component("glancesPluginLoad", {
controller: GlancesPluginLoadController,
controllerAs: "vm",
templateUrl: template,
});

View File

@ -1,36 +0,0 @@
export default function GlancesPluginLoadController($scope, GlancesStats) {
var vm = this;
var _view = {};
vm.cpucore = null;
vm.min1 = null;
vm.min5 = null;
vm.min15 = null;
vm.$onInit = function () {
loadData(GlancesStats.getData());
};
$scope.$on('data_refreshed', function (event, data) {
loadData(data);
});
var loadData = function (data) {
var stats = data.stats['load'];
_view = data.views['load'];
vm.cpucore = stats['cpucore'];
vm.min1 = stats['min1'];
vm.min5 = stats['min5'];
vm.min15 = stats['min15'];
};
vm.getDecoration = function (value) {
if (_view[value] === undefined) {
return;
}
return _view[value].decoration.toLowerCase();
};
}

View File

@ -1,26 +0,0 @@
<section id="load" class="plugin" ng-if="vm.cpucore != undefined">
<div class="table">
<div class="table-row">
<div class="table-cell text-left title">LOAD</div>
<div class="table-cell">{{ vm.cpucore }}-core</div>
</div>
<div class="table-row">
<div class="table-cell text-left">1 min:</div>
<div class="table-cell">
{{ vm.min1 | number : 2}}
</div>
</div>
<div class="table-row">
<div class="table-cell text-left">5 min:</div>
<div class="table-cell" ng-class="vm.getDecoration('min5')">
{{ vm.min5 | number : 2}}
</div>
</div>
<div class="table-row">
<div class="table-cell text-left">15 min:</div>
<div class="table-cell" ng-class="vm.getDecoration('min15')">
{{ vm.min15 | number : 2}}
</div>
</div>
</div>
</section>

View File

@ -0,0 +1,49 @@
<template>
<section id="mem-more" class="plugin">
<div class="table">
<div class="table-row" v-show="active != undefined">
<div class="table-cell text-left">active:</div>
<div class="table-cell">{{ $filters.bytes(active) }}</div>
</div>
<div class="table-row" v-show="inactive != undefined">
<div class="table-cell text-left">inactive:</div>
<div class="table-cell">{{ $filters.bytes(inactive) }}</div>
</div>
<div class="table-row" v-show="buffers != undefined">
<div class="table-cell text-left">buffers:</div>
<div class="table-cell">{{ $filters.bytes(buffers) }}</div>
</div>
<div class="table-row" v-show="cached != undefined">
<div class="table-cell text-left">cached:</div>
<div class="table-cell">{{ $filters.bytes(cached) }}</div>
</div>
</div>
</section>
</template>
<script>
export default {
props: {
data: {
type: Object
}
},
computed: {
stats() {
return this.data.stats['mem'];
},
active() {
return this.stats['active'];
},
inactive() {
return this.stats['inactive'];
},
buffers() {
return this.stats['buffers'];
},
cached() {
return this.stats['cached'];
}
}
};
</script>

View File

@ -1,11 +0,0 @@
import angular from "angular";
import GlancesPluginMemMoreController from "./controller";
import template from "./view.html";
export default angular.module("glancesApp").component("glancesPluginMemMore", {
controller: GlancesPluginMemMoreController,
controllerAs: "vm",
templateUrl: template,
});

View File

@ -1,26 +0,0 @@
export default function GlancesPluginMemMoreController($scope, GlancesStats) {
var vm = this;
vm.active = null;
vm.inactive = null;
vm.buffers = null;
vm.cached = null;
vm.$onInit = function () {
loadData(GlancesStats.getData());
};
$scope.$on('data_refreshed', function (event, data) {
loadData(data);
});
var loadData = function (data) {
var stats = data.stats['mem'];
vm.active = stats['active'];
vm.inactive = stats['inactive'];
vm.buffers = stats['buffers'];
vm.cached = stats['cached'];
}
}

View File

@ -1,20 +0,0 @@
<section id="mem-more" class="plugin">
<div class="table">
<div class="table-row" ng-show="vm.active != undefined">
<div class="table-cell text-left">active:</div>
<div class="table-cell">{{ vm.active | bytes }}</div>
</div>
<div class="table-row" ng-show="vm.inactive != undefined">
<div class="table-cell text-left">inactive:</div>
<div class="table-cell">{{ vm.inactive | bytes }}</div>
</div>
<div class="table-row" ng-show="vm.buffers != undefined">
<div class="table-cell text-left">buffers:</div>
<div class="table-cell">{{ vm.buffers | bytes }}</div>
</div>
<div class="table-row" ng-show="vm.cached != undefined">
<div class="table-cell text-left">cached:</div>
<div class="table-cell">{{ vm.cached | bytes }}</div>
</div>
</div>
</section>

View File

@ -0,0 +1,62 @@
<template>
<section id="mem" class="plugin">
<div class="table">
<div class="table-row">
<div class="table-cell text-left title">MEM</div>
<div class="table-cell">{{ percent }}%</div>
</div>
<div class="table-row">
<div class="table-cell text-left">total:</div>
<div class="table-cell">{{ $filters.bytes(total) }}</div>
</div>
<div class="table-row">
<div class="table-cell text-left">used:</div>
<div class="table-cell" :class="getDecoration('used')">
{{ $filters.bytes(used, 2) }}
</div>
</div>
<div class="table-row">
<div class="table-cell text-left">free:</div>
<div class="table-cell">{{ $filters.bytes(free) }}</div>
</div>
</div>
</section>
</template>
<script>
export default {
props: {
data: {
type: Object
}
},
computed: {
stats() {
return this.data.stats['mem'];
},
view() {
return this.data.views['mem'];
},
percent() {
return this.stats['percent'];
},
total() {
return this.stats['total'];
},
used() {
return this.stats['used'];
},
free() {
return this.stats['free'];
}
},
methods: {
getDecoration(value) {
if (this.view[value] === undefined) {
return;
}
return this.view[value].decoration.toLowerCase();
}
}
};
</script>

View File

@ -1,11 +0,0 @@
import angular from "angular";
import GlancesPluginMemController from "./controller";
import template from "./view.html";
export default angular.module("glancesApp").component("glancesPluginMem", {
controller: GlancesPluginMemController,
controllerAs: "vm",
templateUrl: template,
});

Some files were not shown because too many files have changed in this diff Show More