diff options
Diffstat (limited to 'docs/aoa/actions.rst')
-rw-r--r-- | docs/aoa/actions.rst | 20 |
1 files changed, 11 insertions, 9 deletions
diff --git a/docs/aoa/actions.rst b/docs/aoa/actions.rst index 448d4fea..3ee6779e 100644 --- a/docs/aoa/actions.rst +++ b/docs/aoa/actions.rst @@ -16,7 +16,7 @@ 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. `Pystache`_ is required to render the mustache's template syntax. +`{{mustache}}`_ syntax. `Chevron`_ 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 @@ -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 @@ -74,4 +76,4 @@ use with caution: critical_action_repeat=/home/myhome/bin/bipper.sh .. _{{mustache}}: https://mustache.github.io/ -.. _Pystache: https://github.com/defunkt/pystache +.. _Chevron: https://github.com/noahmorrison/chevron |