Merge pull request #25 from lsjostro/fix-nodes-without-timestamp
Add nodes with missing timestamp to unreported nodes
This commit is contained in:
@@ -96,10 +96,13 @@ def index():
|
|||||||
|
|
||||||
unreported = []
|
unreported = []
|
||||||
for node in puppetdb.nodes():
|
for node in puppetdb.nodes():
|
||||||
node_last_seen = node.report_timestamp.replace(tzinfo=None)
|
try:
|
||||||
if node_last_seen < (datetime.utcnow()-timedelta(hours=app.config['UNRESPONSIVE_HOURS'])):
|
node_last_seen = node.report_timestamp.replace(tzinfo=None)
|
||||||
delta = (datetime.utcnow()-node_last_seen)
|
if node_last_seen < (datetime.utcnow()-timedelta(hours=app.config['UNRESPONSIVE_HOURS'])):
|
||||||
node.noresponse = str(delta.days) + "d " + str(int(delta.seconds/3600)) +"h " + str(int((delta.seconds%3600)/60))+ "m"
|
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)
|
unreported.append(node)
|
||||||
|
|
||||||
return render_template('index.html', metrics=metrics, latest_event_count=latest_event_count, latest_events=latest_events, unreported=unreported)
|
return render_template('index.html', metrics=metrics, latest_event_count=latest_event_count, latest_events=latest_events, unreported=unreported)
|
||||||
|
|||||||
Reference in New Issue
Block a user