buffer_sprintf(wb, "%s\"%s\":null%s", prefix, label, suffix);
}
-static inline void health_alarm_entry2json_nolock(BUFFER *wb, ALARM_ENTRY *ae) {
+static inline void health_alarm_entry2json_nolock(BUFFER *wb, ALARM_ENTRY *ae, RRDHOST *host) {
buffer_sprintf(wb, "\n\t{\n"
+ "\t\t\"hostname\":\"%s\",\n"
"\t\t\"unique_id\":%u,\n"
"\t\t\"alarm_id\":%u,\n"
"\t\t\"alarm_event_id\":%u,\n"
"\t\t\"non_clear_duration\":%lu,\n"
"\t\t\"status\":\"%s\",\n"
"\t\t\"old_status\":\"%s\",\n",
+ host->hostname,
ae->unique_id,
ae->alarm_id,
ae->alarm_event_id,
for(ae = host->health_log.alarms; ae && count < max ; count++, ae = ae->next) {
if(ae->unique_id > after) {
if(likely(count)) buffer_strcat(wb, ",");
- health_alarm_entry2json_nolock(wb, ae);
+ health_alarm_entry2json_nolock(wb, ae, host);
}
}
// global namespace
var NETDATA = window.NETDATA || {};
- NETDATA.hostname = 'localhost';
-
// ----------------------------------------------------------------------------------------------------------------
// Detect the netdata server
}
else NETDATA.error(406, host + '/api/v1/charts');
- NETDATA.hostname = data.hostname;
-
if(typeof callback === 'function')
callback(data);
})
}
var name = entry.name.replace(/_/g, ' ');
+ var status = entry.status.toLowerCase();
var title = name + ' = ' + ((entry.value === null)?'NaN':Math.floor(entry.value)).toString() + ' ' + entry.units;
- var body = NETDATA.hostname + ' - ' + entry.chart + ' (' + entry.family + ') - ' + entry.status.toLowerCase() + ': ' + entry.info;
var tag = entry.alarm_id;
var icon = 'images/seo-performance-128.png';
var interaction = false;
// console.log('alarm' + entry.unique_id + ' switch to CLEAR from ' + entry.old_status);
return;
}
- title = entry.name + ' back to normal';
+ title = name + ' back to normal';
icon = 'images/check-mark-2-128-green.png'
interaction = false;
break;
case 'WARNING':
+ if(entry.old_status === 'CRITICAL')
+ status = 'demoted to ' + entry.status.toLowerCase();
+
icon = 'images/alert-128-orange.png';
interaction = false;
break;
case 'CRITICAL':
+ if(entry.old_status === 'WARNING')
+ status = 'escalated to ' + entry.status.toLowerCase();
+
icon = 'images/alert-128-red.png'
interaction = true;
break;
return;
}
+ var body = entry.hostname + ' - ' + entry.chart + ' (' + entry.family + ') - ' + status + ': ' + entry.info;
+
// cleanup old notifications with the same alarm_id as this one
var len = NETDATA.alarms.notifications_shown.length;
while(len--) {