diff --git a/README.rst b/README.rst index 8de1db91..8c39d020 100644 --- a/README.rst +++ b/README.rst @@ -282,7 +282,7 @@ Start Termux on your device and enter: $ apt update $ apt upgrade - $ apt install clang python python-dev + $ apt install clang python $ pip install bottle $ pip install glances diff --git a/conf/glances-grafana.json b/conf/glances-grafana.json index 4d6cda5b..f6e7b8b7 100644 --- a/conf/glances-grafana.json +++ b/conf/glances-grafana.json @@ -141,8 +141,8 @@ "type": "time" } ], - "measurement": "localhost.load", - "query": "SELECT mean(\"cpucore\") FROM \"localhost.load\" WHERE $timeFilter GROUP BY time($interval)", + "measurement": "$host.load", + "query": "SELECT mean(\"cpucore\") FROM \"$host.load\" WHERE $timeFilter GROUP BY time($interval)", "refId": "A", "resultFormat": "time_series", "select": [ @@ -246,10 +246,10 @@ "type": "fill" } ], - "measurement": "localhost.load", + "measurement": "$host.load", "orderByTime": "ASC", "policy": "default", - "query": "SELECT mean(\"min1\") FROM \"localhost.load\" WHERE $timeFilter GROUP BY time($interval) fill(null)", + "query": "SELECT mean(\"min1\") FROM \"$host.load\" WHERE $timeFilter GROUP BY time($interval) fill(null)", "refId": "A", "resultFormat": "time_series", "select": [ @@ -289,10 +289,10 @@ "type": "fill" } ], - "measurement": "localhost.load", + "measurement": "$host.load", "orderByTime": "ASC", "policy": "default", - "query": "SELECT mean(\"min5\") FROM \"localhost.load\" WHERE $timeFilter GROUP BY time($interval) fill(null)", + "query": "SELECT mean(\"min5\") FROM \"$host.load\" WHERE $timeFilter GROUP BY time($interval) fill(null)", "refId": "B", "resultFormat": "time_series", "select": [ @@ -332,10 +332,10 @@ "type": "fill" } ], - "measurement": "localhost.load", + "measurement": "$host.load", "orderByTime": "ASC", "policy": "default", - "query": "SELECT mean(\"min15\") FROM \"localhost.load\" WHERE $timeFilter GROUP BY time($interval) fill(null)", + "query": "SELECT mean(\"min15\") FROM \"$host.load\" WHERE $timeFilter GROUP BY time($interval) fill(null)", "refId": "C", "resultFormat": "time_series", "select": [ @@ -467,10 +467,10 @@ "type": "time" } ], - "measurement": "localhost.processcount", + "measurement": "$host.processcount", "orderByTime": "ASC", "policy": "default", - "query": "SELECT mean(\"total\") FROM \"localhost.processcount\" WHERE $timeFilter GROUP BY time($interval)", + "query": "SELECT mean(\"total\") FROM \"$host.processcount\" WHERE $timeFilter GROUP BY time($interval)", "refId": "A", "resultFormat": "time_series", "select": [ @@ -563,10 +563,10 @@ "type": "fill" } ], - "measurement": "localhost.cpu", + "measurement": "$host.cpu", "orderByTime": "ASC", "policy": "default", - "query": "SELECT mean(\"user\") FROM \"localhost.cpu\" WHERE $timeFilter GROUP BY time($interval) fill(null)", + "query": "SELECT mean(\"user\") FROM \"$host.cpu\" WHERE $timeFilter GROUP BY time($interval) fill(null)", "refId": "A", "resultFormat": "time_series", "select": [ @@ -605,10 +605,10 @@ "type": "fill" } ], - "measurement": "localhost.cpu", + "measurement": "$host.cpu", "orderByTime": "ASC", "policy": "default", - "query": "SELECT mean(\"system\") FROM \"localhost.cpu\" WHERE $timeFilter GROUP BY time($interval) fill(null)", + "query": "SELECT mean(\"system\") FROM \"$host.cpu\" WHERE $timeFilter GROUP BY time($interval) fill(null)", "refId": "B", "resultFormat": "time_series", "select": [ @@ -648,10 +648,10 @@ "type": "fill" } ], - "measurement": "localhost.cpu", + "measurement": "$host.cpu", "orderByTime": "ASC", "policy": "default", - "query": "SELECT mean(\"iowait\") FROM \"localhost.cpu\" WHERE $timeFilter GROUP BY time($interval) fill(null)", + "query": "SELECT mean(\"iowait\") FROM \"$host.cpu\" WHERE $timeFilter GROUP BY time($interval) fill(null)", "refId": "C", "resultFormat": "time_series", "select": [ @@ -761,10 +761,10 @@ "type": "time" } ], - "measurement": "localhost.mem", + "measurement": "$host.mem", "orderByTime": "ASC", "policy": "default", - "query": "SELECT mean(\"used\") FROM \"localhost.mem\" WHERE $timeFilter GROUP BY time($__interval) fill(none)", + "query": "SELECT mean(\"used\") FROM \"$host.mem\" WHERE $timeFilter GROUP BY time($__interval) fill(none)", "rawQuery": true, "refId": "A", "resultFormat": "time_series", @@ -798,10 +798,10 @@ "type": "time" } ], - "measurement": "localhost.mem", + "measurement": "$host.mem", "orderByTime": "ASC", "policy": "default", - "query": "SELECT mean(\"total\") FROM \"localhost.mem\" WHERE $timeFilter GROUP BY time($__interval) fill(none)", + "query": "SELECT mean(\"total\") FROM \"$host.mem\" WHERE $timeFilter GROUP BY time($__interval) fill(none)", "rawQuery": true, "refId": "B", "resultFormat": "time_series", @@ -922,10 +922,10 @@ } ], "interval": "", - "measurement": "localhost.network", + "measurement": "$host.network", "orderByTime": "ASC", "policy": "default", - "query": "SELECT mean(\"$interface.rx\")/mean(\"$interface.time_since_update\")*8 FROM \"localhost.network\" WHERE $timeFilter GROUP BY time($interval) fill(none)", + "query": "SELECT mean(\"$interface.rx\")/mean(\"$interface.time_since_update\")*8 FROM \"$host.network\" WHERE $timeFilter GROUP BY time($interval) fill(none)", "rawQuery": true, "refId": "A", "resultFormat": "time_series", @@ -965,10 +965,10 @@ "type": "fill" } ], - "measurement": "localhost.network", + "measurement": "$host.network", "orderByTime": "ASC", "policy": "default", - "query": "SELECT mean(\"$interface.tx\")/mean(\"$interface.time_since_update\")*8*-1 FROM \"localhost.network\" WHERE $timeFilter GROUP BY time($interval) fill(none)", + "query": "SELECT mean(\"$interface.tx\")/mean(\"$interface.time_since_update\")*8*-1 FROM \"$host.network\" WHERE $timeFilter GROUP BY time($interval) fill(none)", "rawQuery": true, "refId": "B", "resultFormat": "time_series", @@ -1080,10 +1080,10 @@ "type": "time" } ], - "measurement": "localhost.memswap", + "measurement": "$host.memswap", "orderByTime": "ASC", "policy": "default", - "query": "SELECT mean(\"used\") FROM \"localhost.memswap\" WHERE $timeFilter GROUP BY time($__interval) fill(none)", + "query": "SELECT mean(\"used\") FROM \"$host.memswap\" WHERE $timeFilter GROUP BY time($__interval) fill(none)", "rawQuery": true, "refId": "A", "resultFormat": "time_series", @@ -1117,10 +1117,10 @@ "type": "time" } ], - "measurement": "localhost.memswap", + "measurement": "$host.memswap", "orderByTime": "ASC", "policy": "default", - "query": "SELECT mean(\"total\") FROM \"localhost.memswap\" WHERE $timeFilter GROUP BY time($__interval) fill(none)", + "query": "SELECT mean(\"total\") FROM \"$host.memswap\" WHERE $timeFilter GROUP BY time($__interval) fill(none)", "rawQuery": true, "refId": "B", "resultFormat": "time_series", @@ -1240,10 +1240,10 @@ "type": "fill" } ], - "measurement": "localhost.diskio", + "measurement": "$host.diskio", "orderByTime": "ASC", "policy": "default", - "query": "SELECT mean(\"$disk.read_bytes\")/mean(\"$disk.time_since_update\") FROM \"localhost.diskio\" WHERE $timeFilter GROUP BY time($__interval) fill(none)", + "query": "SELECT mean(\"$disk.read_bytes\")/mean(\"$disk.time_since_update\") FROM \"$host.diskio\" WHERE $timeFilter GROUP BY time($__interval) fill(none)", "rawQuery": true, "refId": "A", "resultFormat": "time_series", @@ -1283,10 +1283,10 @@ "type": "fill" } ], - "measurement": "localhost.diskio", + "measurement": "$host.diskio", "orderByTime": "ASC", "policy": "default", - "query": "SELECT mean(\"$disk.write_bytes\")/mean(\"$disk.time_since_update\") FROM \"localhost.diskio\" WHERE $timeFilter GROUP BY time($__interval) fill(none)", + "query": "SELECT mean(\"$disk.write_bytes\")/mean(\"$disk.time_since_update\") FROM \"$host.diskio\" WHERE $timeFilter GROUP BY time($__interval) fill(none)", "rawQuery": true, "refId": "B", "resultFormat": "time_series", @@ -1408,10 +1408,10 @@ "type": "fill" } ], - "measurement": "localhost.fs", + "measurement": "$host.fs", "orderByTime": "ASC", "policy": "default", - "query": "SELECT mean(\"/.used\") FROM \"localhost.fs\" WHERE $timeFilter GROUP BY time($interval) fill(null)", + "query": "SELECT mean(\"/.used\") FROM \"$host.fs\" WHERE $timeFilter GROUP BY time($interval) fill(null)", "refId": "A", "resultFormat": "time_series", "select": [ @@ -1450,10 +1450,10 @@ "type": "fill" } ], - "measurement": "localhost.fs", + "measurement": "$host.fs", "orderByTime": "ASC", "policy": "default", - "query": "SELECT mean(\"/.size\") FROM \"localhost.fs\" WHERE $timeFilter GROUP BY time($interval) fill(null)", + "query": "SELECT mean(\"/.size\") FROM \"$host.fs\" WHERE $timeFilter GROUP BY time($interval) fill(null)", "refId": "B", "resultFormat": "time_series", "select": [ @@ -1583,8 +1583,8 @@ "type": "time" } ], - "measurement": "localhost.fs", - "query": "SELECT mean(\"/.percent\") FROM \"localhost.fs\" WHERE $timeFilter GROUP BY time($interval)", + "measurement": "$host.fs", + "query": "SELECT mean(\"/.percent\") FROM \"$host.fs\" WHERE $timeFilter GROUP BY time($interval)", "refId": "A", "resultFormat": "time_series", "select": [ @@ -1692,10 +1692,10 @@ "type": "time" } ], - "measurement": "localhost.fs", + "measurement": "$host.fs", "orderByTime": "ASC", "policy": "default", - "query": "SELECT mean(\"/boot/efi.percent\") FROM \"localhost.fs\" WHERE $timeFilter GROUP BY time($interval)", + "query": "SELECT mean(\"/boot/efi.percent\") FROM \"$host.fs\" WHERE $timeFilter GROUP BY time($interval)", "refId": "A", "resultFormat": "time_series", "select": [ @@ -1750,7 +1750,7 @@ "aliasColors": { "CPU%": "#cca300", "MEM": "#2f575e", - "localhost.docker.mean": "#ba43a9" + "$host.docker.mean": "#ba43a9" }, "bars": false, "dashLength": 10, @@ -1785,7 +1785,7 @@ "repeatDirection": "v", "seriesOverrides": [ { - "alias": "localhost.docker.mean", + "alias": "$host.docker.mean", "fill": 0 }, { @@ -1820,10 +1820,10 @@ } ], "hide": false, - "measurement": "localhost.docker", + "measurement": "$host.docker", "orderByTime": "ASC", "policy": "default", - "query": "SELECT mean(\"$container.cpu_percent\") FROM \"localhost.docker\" WHERE $timeFilter GROUP BY time($__interval) fill(none)", + "query": "SELECT mean(\"$container.cpu_percent\") FROM \"$host.docker\" WHERE $timeFilter GROUP BY time($__interval) fill(none)", "rawQuery": true, "refId": "A", "resultFormat": "time_series", @@ -1861,7 +1861,7 @@ ], "orderByTime": "ASC", "policy": "default", - "query": "SELECT mean(\"$container.memory_usage\") FROM \"localhost.docker\" WHERE $timeFilter GROUP BY time($__interval) fill(none)", + "query": "SELECT mean(\"$container.memory_usage\") FROM \"$host.docker\" WHERE $timeFilter GROUP BY time($__interval) fill(none)", "rawQuery": true, "refId": "B", "resultFormat": "time_series", @@ -2011,10 +2011,10 @@ } ], "interval": "60s", - "measurement": "localhost.cpu", + "measurement": "$host.cpu", "orderByTime": "ASC", "policy": "default", - "query": "SELECT mean(\"user\") FROM \"localhost.cpu\" WHERE $timeFilter GROUP BY time($__interval) fill(none)", + "query": "SELECT mean(\"user\") FROM \"$host.cpu\" WHERE $timeFilter GROUP BY time($__interval) fill(none)", "rawQuery": false, "refId": "A", "resultFormat": "time_series", @@ -2055,10 +2055,10 @@ } ], "interval": "60s", - "measurement": "localhost.cpu", + "measurement": "$host.cpu", "orderByTime": "ASC", "policy": "default", - "query": "SELECT min(\"user\") FROM \"localhost.cpu\" WHERE $timeFilter GROUP BY time($__interval) fill(none)", + "query": "SELECT min(\"user\") FROM \"$host.cpu\" WHERE $timeFilter GROUP BY time($__interval) fill(none)", "rawQuery": false, "refId": "B", "resultFormat": "time_series", @@ -2100,10 +2100,10 @@ } ], "interval": "60s", - "measurement": "localhost.cpu", + "measurement": "$host.cpu", "orderByTime": "ASC", "policy": "default", - "query": "SELECT max(\"user\") FROM \"localhost.cpu\" WHERE $timeFilter GROUP BY time($__interval) fill(none)", + "query": "SELECT max(\"user\") FROM \"$host.cpu\" WHERE $timeFilter GROUP BY time($__interval) fill(none)", "rawQuery": false, "refId": "C", "resultFormat": "time_series", @@ -2237,10 +2237,10 @@ } ], "interval": "60s", - "measurement": "localhost.cpu", + "measurement": "$host.cpu", "orderByTime": "ASC", "policy": "default", - "query": "SELECT mean(\"system\") FROM \"localhost.cpu\" WHERE $timeFilter GROUP BY time($__interval) fill(none)", + "query": "SELECT mean(\"system\") FROM \"$host.cpu\" WHERE $timeFilter GROUP BY time($__interval) fill(none)", "rawQuery": false, "refId": "A", "resultFormat": "time_series", @@ -2281,10 +2281,10 @@ } ], "interval": "60s", - "measurement": "localhost.cpu", + "measurement": "$host.cpu", "orderByTime": "ASC", "policy": "default", - "query": "SELECT min(\"system\") FROM \"localhost.cpu\" WHERE $timeFilter GROUP BY time($__interval) fill(none)", + "query": "SELECT min(\"system\") FROM \"$host.cpu\" WHERE $timeFilter GROUP BY time($__interval) fill(none)", "rawQuery": false, "refId": "B", "resultFormat": "time_series", @@ -2326,10 +2326,10 @@ } ], "interval": "60s", - "measurement": "localhost.cpu", + "measurement": "$host.cpu", "orderByTime": "ASC", "policy": "default", - "query": "SELECT max(\"system\") FROM \"localhost.cpu\" WHERE $timeFilter GROUP BY time($__interval) fill(none)", + "query": "SELECT max(\"system\") FROM \"$host.cpu\" WHERE $timeFilter GROUP BY time($__interval) fill(none)", "rawQuery": false, "refId": "C", "resultFormat": "time_series", @@ -2465,10 +2465,10 @@ } ], "interval": "60s", - "measurement": "localhost.cpu", + "measurement": "$host.cpu", "orderByTime": "ASC", "policy": "default", - "query": "SELECT mean(\"iowait\") FROM \"localhost.cpu\" WHERE $timeFilter GROUP BY time($__interval) fill(none)", + "query": "SELECT mean(\"iowait\") FROM \"$host.cpu\" WHERE $timeFilter GROUP BY time($__interval) fill(none)", "rawQuery": false, "refId": "A", "resultFormat": "time_series", @@ -2509,10 +2509,10 @@ } ], "interval": "60s", - "measurement": "localhost.cpu", + "measurement": "$host.cpu", "orderByTime": "ASC", "policy": "default", - "query": "SELECT min(\"iowait\") FROM \"localhost.cpu\" WHERE $timeFilter GROUP BY time($__interval) fill(none)", + "query": "SELECT min(\"iowait\") FROM \"$host.cpu\" WHERE $timeFilter GROUP BY time($__interval) fill(none)", "rawQuery": false, "refId": "B", "resultFormat": "time_series", @@ -2554,10 +2554,10 @@ } ], "interval": "60s", - "measurement": "localhost.cpu", + "measurement": "$host.cpu", "orderByTime": "ASC", "policy": "default", - "query": "SELECT max(\"iowait\") FROM \"localhost.cpu\" WHERE $timeFilter GROUP BY time($__interval) fill(none)", + "query": "SELECT max(\"iowait\") FROM \"$host.cpu\" WHERE $timeFilter GROUP BY time($__interval) fill(none)", "rawQuery": false, "refId": "C", "resultFormat": "time_series", @@ -2678,10 +2678,10 @@ } ], "interval": "60s", - "measurement": "localhost.cpu", + "measurement": "$host.cpu", "orderByTime": "ASC", "policy": "default", - "query": "SELECT mean(\"ctx_switches\") / mean(\"time_since_update\") FROM \"localhost.cpu\" WHERE $timeFilter GROUP BY time($interval)", + "query": "SELECT mean(\"ctx_switches\") / mean(\"time_since_update\") FROM \"$host.cpu\" WHERE $timeFilter GROUP BY time($interval)", "rawQuery": false, "refId": "A", "resultFormat": "time_series", @@ -2801,10 +2801,10 @@ } ], "interval": "60s", - "measurement": "localhost.cpu", + "measurement": "$host.cpu", "orderByTime": "ASC", "policy": "default", - "query": "SELECT mean(\"interrupts\") / mean(\"time_since_update\") FROM \"localhost.cpu\" WHERE $timeFilter GROUP BY time($interval)", + "query": "SELECT mean(\"interrupts\") / mean(\"time_since_update\") FROM \"$host.cpu\" WHERE $timeFilter GROUP BY time($interval)", "rawQuery": false, "refId": "A", "resultFormat": "time_series", @@ -2920,7 +2920,7 @@ "type": "fill" } ], - "measurement": "localhost.sensors", + "measurement": "$host.sensors", "orderByTime": "ASC", "policy": "default", "refId": "A", @@ -3010,7 +3010,7 @@ "type": "fill" } ], - "measurement": "localhost.sensors", + "measurement": "$host.sensors", "orderByTime": "ASC", "policy": "default", "refId": "A", diff --git a/docker-files/devel/Dockerfile b/docker-files/devel/Dockerfile index 30d16dcc..a0d31190 100644 --- a/docker-files/devel/Dockerfile +++ b/docker-files/devel/Dockerfile @@ -5,7 +5,7 @@ # # Pull base image. -FROM ubuntu +FROM ubuntu:20.04 # Install Glances (develop branch) RUN apt-get update && apt-get -y install curl iputils-ping && rm -rf /var/lib/apt/lists/* diff --git a/docker-files/master/Dockerfile b/docker-files/master/Dockerfile index db42dec4..b2c874c1 100644 --- a/docker-files/master/Dockerfile +++ b/docker-files/master/Dockerfile @@ -5,12 +5,30 @@ # # Pull base image. -FROM ubuntu +FROM ubuntu:20.04 -# Install Glances (develop branch) -RUN apt-get update && apt-get -y install curl iputils-ping && rm -rf /var/lib/apt/lists/* -RUN curl -L https://raw.githubusercontent.com/nicolargo/glancesautoinstall/master/install.sh | /bin/bash && rm -rf /var/lib/apt/lists/* +# Install package +# Must used calibre package to be able to run external module +ENV DEBIAN_FRONTEND noninteractive +RUN \ + apt-get update && \ + apt-get install -y \ + curl \ + gcc \ + lm-sensors \ + wireless-tools \ + iputils-ping \ + python3-pip \ + python3-dev && \ + rm -rf /var/lib/apt/lists/* + +## Instal glances +RUN \ + pip3 install --upgrade pip && \ + pip3 install setuptools \ + glances[action,batinfo,browser,cpuinfo,docker,export,folders,gpu,graph,ip,raid,snmp,web,wifi] \ + glances # Define working directory. WORKDIR /glances @@ -22,4 +40,4 @@ EXPOSE 61209 EXPOSE 61208 # Define default command. -CMD python -m glances -C /glances/conf/glances.conf $GLANCES_OPT +CMD python3 -m glances -C /glances/conf/glances.conf $GLANCES_OPT diff --git a/docs/aoa/actions.rst b/docs/aoa/actions.rst index b83f1737..448d4fea 100644 --- a/docs/aoa/actions.rst +++ b/docs/aoa/actions.rst @@ -16,7 +16,9 @@ then add the ``_action`` line to the Glances configuration file: critical_action=python /path/to/foo.py All the stats are available in the command line through the use of the -`{{mustache}}`_ syntax. Another example would be to create a log file +`{{mustache}}`_ syntax. `Pystache`_ is required to render the mustache's template syntax. + +Another example would be to create a log file containing used vs total disk space if a space trigger warning is reached: @@ -25,10 +27,40 @@ reached: [fs] warning=70 warning_action=echo {{mnt_point}} {{used}}/{{size}} > /tmp/fs.alert + +A last example would be to create a log file +containing the total user disk space usage for a device and notify by email each time a space trigger critical is +reached: + +.. code-block:: ini + + [fs] + critical=90 + critical_action_repeat=echo {{device_name}} {{percent}} > /tmp/fs.alert && python /etc/glances/actions.d/fs-critical.py + +Within ``/etc/glances/actions.d/fs-critical.py``: + +.. code-block:: python + + import subprocess + from requests import get + + fs_alert = open('/tmp/fs.alert', 'r').readline().strip().split(' ') + device = fs_alert[0] + percent = fs_alert[1] + system = subprocess.check_output(['uname', '-rn']).decode('utf-8').strip() + ip = get('https://api.ipify.org').text + + body = 'Used user disk space for ' + device + ' is at ' + percent + '%.\nPlease cleanup the filesystem to clear the alert.\nServer: ' + str(system)+ '.\nIP address: ' + ip + ps = subprocess.Popen(('echo', '-e', body), stdout=subprocess.PIPE) + subprocess.call(['mail', '-s', 'CRITICAL: disk usage above 90%', '-r', 'postmaster@example.com', 'glances@example.com'], stdin=ps.stdout) + + + .. note:: You can use all the stats for the current plugin. See - https://github.com/nicolargo/glances/wiki/The-Glances-2.x-API-How-to + https://github.com/nicolargo/glances/wiki/The-Glances-RESTFULL-JSON-API for the stats list. It is also possible to repeat action until the end of the alert. @@ -42,3 +74,4 @@ use with caution: critical_action_repeat=/home/myhome/bin/bipper.sh .. _{{mustache}}: https://mustache.github.io/ +.. _Pystache: https://github.com/defunkt/pystache diff --git a/docs/aoa/fs.rst b/docs/aoa/fs.rst index 38c56097..37dae695 100644 --- a/docs/aoa/fs.rst +++ b/docs/aoa/fs.rst @@ -8,18 +8,18 @@ File System Glances displays the used and total file system disk space. The unit is adapted dynamically. -Alerts are set for used disk space. +Alerts are set for `user disk space usage `_. Legend: -=========== ============ -Disk usage Status -=========== ============ -``<50%`` ``OK`` -``>50%`` ``CAREFUL`` -``>70%`` ``WARNING`` -``>90%`` ``CRITICAL`` -=========== ============ +===================== ============ +User disk space usage Status +===================== ============ +``<50%`` ``OK`` +``>50%`` ``CAREFUL`` +``>70%`` ``WARNING`` +``>90%`` ``CRITICAL`` +===================== ============ .. note:: Limit values can be overwritten in the configuration file under @@ -40,8 +40,9 @@ Also, you can hide mount points as well (in the following ``/boot``): .. code-block:: ini -[fs] -hide=/boot.* + [fs] + hide=/boot.* + Filtering can also be done on device name (Glances 3.1.4 or higher): .. code-block:: ini diff --git a/docs/aoa/sensors.rst b/docs/aoa/sensors.rst index 3ecdf685..b5efc65f 100644 --- a/docs/aoa/sensors.rst +++ b/docs/aoa/sensors.rst @@ -7,7 +7,7 @@ Sensors .. image:: ../_static/sensors.png -Glances can displays the sensors information using ``psutil`` and/or +Glances can display the sensors information using ``psutil`` and/or ``hddtemp``. There is no alert on this information. diff --git a/glances/exports/glances_rabbitmq.py b/glances/exports/glances_rabbitmq.py index e8f48d1a..58701983 100644 --- a/glances/exports/glances_rabbitmq.py +++ b/glances/exports/glances_rabbitmq.py @@ -44,6 +44,7 @@ class Export(GlancesExport): self.user = None self.password = None self.queue = None + self.protocol = None # Optionals configuration keys # N/A @@ -53,7 +54,7 @@ class Export(GlancesExport): mandatories=['host', 'port', 'user', 'password', 'queue'], - options=[]) + options=['protocol']) if not self.export_enable: sys.exit(2) @@ -67,9 +68,18 @@ class Export(GlancesExport): """Init the connection to the rabbitmq server.""" if not self.export_enable: return None + + # Needed for when protocol is not specified and when protocol is upper case + # only amqp and amqps supported + if self.protocol is not None and (self.protocol.lower() == 'amqps'): + self.protocol = 'amqps' + else: + self.protocol = 'amqp' + try: parameters = pika.URLParameters( - 'amqp://' + self.user + + self.protocol + + '://' + self.user + ':' + self.password + '@' + self.host + ':' + self.port + '/') diff --git a/glances/plugins/glances_fs.py b/glances/plugins/glances_fs.py index bc0a981d..6c1e618a 100644 --- a/glances/plugins/glances_fs.py +++ b/glances/plugins/glances_fs.py @@ -199,7 +199,7 @@ class Plugin(GlancesPlugin): # Alert for i in self.stats: self.views[i[self.get_key()]]['used']['decoration'] = self.get_alert( - i['used'], maximum=i['size'], header=i['mnt_point']) + current=i['size'] - i['free'], maximum=i['size'], header=i['mnt_point']) def msg_curse(self, args=None, max_width=None): """Return the dict to display in the curse interface."""