Merge pull request #25 from lsjostro/fix-nodes-without-timestamp

Add nodes with missing timestamp to unreported nodes
This commit is contained in:
Daniele Sluijters
2013-10-29 06:33:06 -07:00

View File

@@ -96,11 +96,14 @@ def index():
unreported = []
for node in puppetdb.nodes():
try:
node_last_seen = node.report_timestamp.replace(tzinfo=None)
if node_last_seen < (datetime.utcnow()-timedelta(hours=app.config['UNRESPONSIVE_HOURS'])):
delta = (datetime.utcnow()-node_last_seen)
node.noresponse = str(delta.days) + "d " + str(int(delta.seconds/3600)) +"h " + str(int((delta.seconds%3600)/60))+ "m"
unreported.append(node)
except AttributeError:
unreported.append(node)
return render_template('index.html', metrics=metrics, latest_event_count=latest_event_count, latest_events=latest_events, unreported=unreported)