As I said before, we want our users to see any nodes that have an alert triggered highlighted on the status page. Say that they defined an alert for when the disk usage on any node goes beyond 0.85
and the latest data point that we have for dbmaster disk usage has the value 0.9
. When the user visits the status page, we would like the row showing the disk usage of the dbmaster node to be highlighted in red so that the user is immediately aware of the alert and is able to take actions to correct this.
Change StatusView
in data_collector/view.py
to match the following code. The changed bits are highlighted:
class StatusView(TemplateView):
template_name = 'status.html'
def get_context_data(self, **kwargs):
ctx = super(StatusView, self).get_context_data(**kwargs)
alerts = Alert.objects.filter(is_active=True)
nodes_and_data_types = DataPoint.objects.all().values('node_name', 'data_type').distinct()
status_data_dict...