name="${1}" # the name of the alarm, as given in netdata health.d entries
chart="${2}" # the name of the chart (type.id)
-status="${3}" # the current status : UNITIALIZED, UNDEFINED, CLEAR, WARNING, CRITICAL
-old_status="${4}" # the previous status: UNITIALIZED, UNDEFINED, CLEAR, WARNING, CRITICAL
-value="${5}" # the current value
-old_value="${6}" # the previous value
-src="${7}" # the line number and file the alarm has been configured
-duration="${8}" # the duration in seconds the previous state took
-non_clear_duration="${9}" # the total duration in seconds this is non-clear
+family="${3}" # the family of the chart
+status="${4}" # the current status : UNITIALIZED, UNDEFINED, CLEAR, WARNING, CRITICAL
+old_status="${5}" # the previous status: UNITIALIZED, UNDEFINED, CLEAR, WARNING, CRITICAL
+value="${6}" # the current value
+old_value="${7}" # the previous value
+src="${8}" # the line number and file the alarm has been configured
+duration="${9}" # the duration in seconds the previous state took
+non_clear_duration="${10}" # the total duration in seconds this is non-clear
# get the system hostname
-hostname="$(hostname)"
+hostname="${NETDATA_HOSTNAME}"
+[ -z "${hostname}" ] && hostname="${NETDATA_REGISTRY_HOSTNAME}"
+[ -z "${hostname}" ] && hostname="$(hostname)"
+
+goto_url="${NETDATA_REGISTRY_URL}/alarmcallback.html?machine_guid=${NETDATA_REGISTRY_UNIQUE_ID}&chart=${chart}&family=${family}"
# get the current date
date="$(date)"
style="display:block;color:#666666;font-size:12px;font-weight:300;line-height:1;text-transform:uppercase">Time</span>
</td>
</tr>
+ <!--
+ <tr style="margin:0;padding:0">
+ <td style="font-size:18px;vertical-align:top;margin:0;padding:0 0 20px">
+ <a href="${goto_url}" style="font-size:14px;color:#ffffff;text-decoration:none;line-height:1.5;font-weight:bold;text-align:center;display:inline-block;text-transform:capitalize;background:#35568d;border-width:1px;border-style:solid;border-color:#2b4c86;margin:0;padding:10px 15px" target="_blank">View Netdata</a>
+ </td>
+ </tr>
+ -->
<tr style="text-align:center;margin:0;padding:0">
<td style="font-size:11px;vertical-align:top;margin:0;padding:10px 0 0 0;color:#666666"
align="center" valign="bottom">The source of this alarm is line <code>${src}</code>
const char *exec = ae->exec;
if(!exec) exec = health_default_exec;
- snprintfz(buffer, FILENAME_MAX, "exec %s '%s' '%s' '%s' '%s' '%0.0Lf' '%0.0Lf' '%s' '%u' '%u'",
+ snprintfz(buffer, FILENAME_MAX, "exec %s '%s' '%s' '%s' '%s' '%s' '%0.0Lf' '%0.0Lf' '%s' '%u' '%u'",
exec,
ae->name,
ae->chart?ae->chart:"NOCAHRT",
+ ae->family?ae->family:"NOFAMILY",
rrdcalc_status2string(ae->new_status),
rrdcalc_status2string(ae->old_status),
ae->new_value,
}
static inline void health_alarm_log(time_t when,
- const char *name, const char *chart, const char *exec,
- time_t duration,
+ const char *name, const char *chart, const char *family,
+ const char *exec, time_t duration,
calculated_number old_value, calculated_number new_value,
int old_status, int new_status,
const char *source
ae->hash_chart = simple_hash(ae->chart);
}
+ if(family)
+ ae->family = strdupz(family);
+
if(exec) ae->exec = strdupz(exec);
if(source) ae->source = strdupz(source);
while(ae) {
ALARM_ENTRY *t = ae->next;
+ freez(ae->family);
freez(ae->chart);
freez(ae->name);
freez(ae->exec);
}
if(status != rc->status) {
- health_alarm_log(time(NULL), rc->name, rc->rrdset->id, rc->exec, now - rc->last_status_change, rc->old_value, rc->value, rc->status, status, rc->source);
+ health_alarm_log(time(NULL), rc->name, rc->rrdset->id, rc->rrdset->family, rc->exec, now - rc->last_status_change, rc->old_value, rc->value, rc->status, status, rc->source);
rc->last_status_change = now;
rc->status = status;
}
char *chart;
uint32_t hash_chart;
+ char *family;
+
char *exec;
char *source;
calculated_number old_value;
error("WARNING: Cannot get machine hostname.");
hostname = config_get("global", "hostname", hostnamebuf);
debug(D_OPTIONS, "hostname set to '%s'", hostname);
+ setenv("NETDATA_HOSTNAME", hostname, 1);
}
// --------------------------------------------------------------------
close(fd);
}
+ setenv("NETDATA_REGISTRY_UNIQUE_ID", registry.machine_guid, 1);
+
return registry.machine_guid;
}
registry.hostname = config_get("registry", "registry hostname", config_get("global", "hostname", hostname));
registry.verify_cookies_redirects = config_get_boolean("registry", "verify browser cookies support", 1);
+ setenv("NETDATA_REGISTRY_HOSTNAME", registry.hostname, 1);
+ setenv("NETDATA_REGISTRY_URL", registry.registry_to_announce, 1);
+
registry.max_url_length = config_get_number("registry", "max URL length", 1024);
if(registry.max_url_length < 10) {
registry.max_url_length = 10;