Fixed filenames

This commit is contained in:
Sebastian 2018-10-13 14:47:58 +02:00
parent 999a24c632
commit 1c86aa4fe3
1 changed files with 8 additions and 4 deletions

View File

@ -69,10 +69,12 @@ def update_database(line):
rrdtool.update(ARCHIVE_DATA_FILE, line)
def update_graphs():
for name, lines in GRAPHS.items():
for graph_name, lines in GRAPHS.items():
# Render current data
graph_params = ['%s.png' % name, '-a', 'PNG', '-s', 'n-%d' % ARCHIVE_INTERVAL]
graph_params = ['%s.png' % graph_name, '-a',
'PNG', '-s', 'n-%d' % ARCHIVE_INTERVAL]
for name, lable, color in lines:
graph_params += ['DEF:%s=%s:%s:LAST' % (name, DATA_FILE, name)]
graph_params += ['LINE1:%s%s:%s' % (name, color, lable)]
@ -80,7 +82,8 @@ def update_graphs():
rrdtool.graph(*graph_params)
# Also render Archives
graph_params = ['%s_archive.png' % name, '-a', 'PNG', '-s', 'n-%d' % ARCHIVE_KEEP_INTERVAL]
graph_params = ['%s_archive.png' % graph_name, '-a',
'PNG', '-s', 'n-%d' % ARCHIVE_KEEP_INTERVAL]
for name, lable, color in lines:
graph_params += ['DEF:%s=%s:%s:AVERAGE' % (name, DATA_FILE, name)]
@ -101,10 +104,11 @@ def upload_graphs():
sftp.put('%s.png' % name, 'solar/%s.png' % name)
sftp.put('%s_archive.png' % name, 'solar/%s_archive.png' % name)
sftp.put('index.html', 'solar/index.html')
sftp.close()
transport.close()
except:
print("Unexpected error uploading:", sys.exc_info()[1])
print("Unexpected error while uploading:", sys.exc_info()[1])
def main():
pass