-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Bug: [fs] plugin needs to reflect user disk space usage #1658
Comments
I have a third issue. |
I see that mustache use is restricted to the action's command line where mustache is one of the attribute of the current plugin section. If an action executes an external file that is using the mustache syntax related to some attributes of the current plugin section, it will not display them. Sounds logic. |
I updated my conf, now using an external Python script. Still getting the main issue. Here is my critical_action_repeat=echo {{percent}} > /tmp/fs.alert && python /etc/glances/actions.d/fs-critical.py Mustache attributes are here being saved to Here is my import subprocess
system = subprocess.check_output(['uname', '-rn']).decode('utf-8')
percent = open('/tmp/fs.alert', 'r').readline().rstrip()
body = 'Used filesystem disk space for /dev/sda3 is at ' + percent + '%.\nPlease cleanup the filesystem to clear the alert.\nScaleway server: ' + str(system)
ps = subprocess.Popen(('echo', '-e', body), stdout=subprocess.PIPE)
subprocess.call(['mail', '-s', 'CRITICAL: disk usage above 90%', '-r', 'postmaster@example.com', 'hlfh@example.com'], stdin=ps.stdout) When an external python file is used, the Remaining issues:
What I see for the second issue with /dev/sda3 909G 793G 70G 92% / 793G is 87.24% of 909G Real disk usage is not 87.24% but around 92.3% because real available filesystem space is 70G. This second issue might be related to this file. 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']) EDIT: At the time, I no longer have duplicates with *_action_repeat and I don't know why. |
`psutill` [says the following](https://github.com/giampaolo/psutil/blob/master/psutil/_psposix.py): > Note: UNIX usually reserves 5% disk space which is not accessible by user. In this function "total" and "used" values reflect the total and used disk space whereas "free" and "percent" represent the "free" and "used percent" user disk space. To fix the alert value that has been notified in this issue nicolargo#1658 where the alert has not been fixed. The issue nicolargo#644 has fixed it one way, this PR is completing the fix for the alert feature of the `fs` plugin.
@nicolargo You might check the PR #1680 as I fixed the second issue related in this topic. |
Bug description
python-pystache is required for the mustache templating.
When I start glances with 2 mins refresh time, I want to execute an action that alerts me when my disk usage is above 90%.
What I see is if I use the "%" character, everything breaks with error AttributeError: 'NoneType' object has no attribute 'get_stats_display', so I need to use two "%%" characters to escape it.
The second issue is I want to get an alert email, and I am getting two alert emails related to disk usage at the same time.
When I see
actions.py
, I observe:Technically, the action is being executed twice, since I am getting two identical alert emails at the same time.
When I execute the echo command directly from the command line outside of glances and its conf, I get one email.
So there is definitely an issue within
glances actions
.Versions
Packages: glances & python-pystache
Conf
systemd
/etc/systemd/system/glances.service
Logs
What I am getting in debug mode:
The text was updated successfully, but these errors were encountered: