Created
October 12, 2014 18:03
-
-
Save Raboo/5e0c127f525b4e335bf9 to your computer and use it in GitHub Desktop.
What I think(haven't tested) could be a working class for freenas/gui/reporting/rrd.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class DiskTempPlugin(RRDBase): | |
vertical_label = "Celcius" | |
def get_title(self): | |
title = self.identifier.replace("disk-", "") | |
return 'Disk Temperature (%s)' % title | |
def get_identifiers(self): | |
ids = [] | |
for entry in glob.glob('%s/disk-*' % self._base_path): | |
ident = entry.split('-', 1)[-1] | |
if not os.path.exists('/dev/%s' % ident): | |
continue | |
if ident.startswith('pass'): | |
continue | |
if os.path.exists(os.path.join(entry, 'temperature.rrd')): | |
ids.append(ident) | |
ids.sort(key=RRDBase._sort_identifiers) | |
return ids | |
def graph(self): | |
path = os.path.join(self._base_path, "disk-%s" % self.identifier, "temperature.rrd") | |
args = [ | |
'DEF:min_tmp=%s:value:MIN' % path, | |
'DEF:avg_tmp=%s:value:AVERAGE' % path, | |
'DEF:max_tmp=%s:value:MAX' % path, | |
'AREA:avg_tmp#bfbfff', | |
'LINE1:avg_tmp#0000ff:Temp ', | |
'GPRINT:min_tmp:MIN:%5.1lf%s Min\g', | |
'GPRINT:avg_tmp:AVERAGE: %5.1lf%s Avg\g', | |
'GPRINT:max_tmp:MAX: %5.1lf%s Max\g', | |
'GPRINT:avg_tmp:LAST: %5.1lf%s Last\g', | |
] | |
return args |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment