| @@ 156-169 (lines=14) @@ | ||
| 153 | super(Plugin, self).update_views() |
|
| 154 | ||
| 155 | # Add specifics informations |
|
| 156 | # Alert |
|
| 157 | for i in self.stats: |
|
| 158 | if not i['value']: |
|
| 159 | continue |
|
| 160 | if i['type'] == 'battery': |
|
| 161 | self.views[i[self.get_key()]]['value']['decoration'] = self.get_alert(100 - i['value'], header=i['type']) |
|
| 162 | else: |
|
| 163 | self.views[i[self.get_key()]]['value']['decoration'] = self.get_alert(i['value'], header=i['type']) |
|
| 164 | ||
| 165 | def msg_curse(self, args=None): |
|
| 166 | """Return the dict to display in the curse interface.""" |
|
| 167 | # Init the return message |
|
| 168 | ret = [] |
|
| 169 | ||
| 170 | # Only process if stats exist and display plugin enable... |
|
| 171 | if not self.stats or args.disable_sensors: |
|
| 172 | return ret |
|
| @@ 143-155 (lines=13) @@ | ||
| 140 | elif self.input_method == 'snmp': |
|
| 141 | # Update stats using SNMP |
|
| 142 | # No standard way for the moment... |
|
| 143 | pass |
|
| 144 | ||
| 145 | return self.stats |
|
| 146 | ||
| 147 | def update_views(self): |
|
| 148 | """Update stats views.""" |
|
| 149 | # Call the father's method |
|
| 150 | super(Plugin, self).update_views() |
|
| 151 | ||
| 152 | # Add specifics informations |
|
| 153 | # Alert |
|
| 154 | for i in self.stats: |
|
| 155 | disk_real_name = i['disk_name'] |
|
| 156 | self.views[i[self.get_key()]]['read_bytes']['decoration'] = self.get_alert(int(i['read_bytes'] // i['time_since_update']), |
|
| 157 | header=disk_real_name + '_rx') |
|
| 158 | self.views[i[self.get_key()]]['write_bytes']['decoration'] = self.get_alert(int(i['write_bytes'] // i['time_since_update']), |
|
| @@ 147-156 (lines=10) @@ | ||
| 144 | elif value <= self.get_limit('careful', stat_name=self.plugin_name): |
|
| 145 | ret = 'CAREFUL' |
|
| 146 | except KeyError: |
|
| 147 | ret = 'DEFAULT' |
|
| 148 | ||
| 149 | return ret |
|
| 150 | ||
| 151 | def update_views(self): |
|
| 152 | """Update stats views.""" |
|
| 153 | # Call the father's method |
|
| 154 | super(Plugin, self).update_views() |
|
| 155 | ||
| 156 | # Add specifics informations |
|
| 157 | # Alert on signal thresholds |
|
| 158 | for i in self.stats: |
|
| 159 | self.views[i[self.get_key()]]['signal']['decoration'] = self.get_alert(i['signal']) |
|