summaryrefslogtreecommitdiffstats
path: root/docs/aoa/actions.rst
diff options
context:
space:
mode:
authornicolargo <nicolas@nicolargo.com>2021-04-25 09:42:23 +0200
committernicolargo <nicolas@nicolargo.com>2021-04-25 09:42:23 +0200
commita2c0357898c24518867efd37adfc1e7bbed83b81 (patch)
tree69cd6ca479cb695ec15512cd8285a9ccd83be5af /docs/aoa/actions.rst
parent29d4662fd274ebcb54d08845daab946533f523ba (diff)
Manage multiple commands (&&) in the secure popen
Diffstat (limited to 'docs/aoa/actions.rst')
-rw-r--r--docs/aoa/actions.rst16
1 files changed, 9 insertions, 7 deletions
diff --git a/docs/aoa/actions.rst b/docs/aoa/actions.rst
index a594d34d..3ee6779e 100644
--- a/docs/aoa/actions.rst
+++ b/docs/aoa/actions.rst
@@ -28,16 +28,21 @@ reached:
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:
+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
-
+
+
+.. note::
+ Use && as seprator for multiple commands
+
+
Within ``/etc/glances/actions.d/fs-critical.py``:
.. code-block:: python
@@ -55,9 +60,6 @@ Within ``/etc/glances/actions.d/fs-critical.py``:
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-RESTFULL-JSON-API