Skip to content

Commit

Permalink
Correct issue on FS action (issue nicolargo#497)
Browse files Browse the repository at this point in the history
  • Loading branch information
nicolargo committed Jan 25, 2015
1 parent 88d7e40 commit 3817b84
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 5 deletions.
5 changes: 5 additions & 0 deletions glances/core/glances_actions.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,11 @@ def run(self, stat_name, criticity, commands, mustache_dict=None):
# Action already executed => Exit
return False

logger.debug("Run action {0} for {1} ({2}) with stats {3}".format(commands,
stat_name,
criticity,
mustache_dict))

# Ran all actions in background
for cmd in commands:
# Replace {{arg}} by the dict one (Thk to {Mustache})
Expand Down
1 change: 1 addition & 0 deletions glances/plugins/glances_fs.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
import psutil

from glances.plugins.glances_plugin import GlancesPlugin
from glances.core.glances_logging import logger

# SNMP OID
# The snmpd.conf needs to be edited.
Expand Down
11 changes: 6 additions & 5 deletions glances/plugins/glances_plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -413,14 +413,15 @@ def get_alert(self, current=0, min=0, max=100, header="", log=False):
if type(self.stats) is list:
# If the stats are stored in a list of dict (fs plugin for exemple)
# Return the dict for the current header
try:
mustache_dict = (
item for item in self.stats if item[self.get_key()] == header).next()
except StopIteration:
mustache_dict = {}
mustache_dict = {}
for item in self.stats:
if item[self.get_key()] == header:
mustache_dict = item
break
else:
# Use the stats dict
mustache_dict = self.stats
# Run the action
self.actions.run(
stat_name, ret.lower(), command, mustache_dict=mustache_dict)

Expand Down

0 comments on commit 3817b84

Please sign in to comment.