#</Plugin>
#<Plugin notify_email>
-# SMTPHost "localhost"
+# SMTPServer "localhost"
# SMTPPort 25
-# SMTPSubject "Aaaaaa!! %s on %s!!!!!" # <WARNING/FAILURE/OK> on <hostname>. beware! do not use not more than two %s in this string!!!
-# SMTPFrom "collectd@main0server.com"
# SMTPUser "my-username"
# SMTPPassword "my-password"
-# EmailTo "email1@domain1.net"
-# EmailTo "email2@domain2.com"
+# From "collectd@main0server.com"
+# # <WARNING/FAILURE/OK> on <hostname>. beware! do not use not more than two %s in this string!!!
+# Subject "Aaaaaa!! %s on %s!!!!!"
+# Recipient "email1@domain1.net"
+# Recipient "email2@domain2.com"
#</Plugin>
#<Plugin ntpd>
static const char *config_keys[] =
{
- "SMTPHost",
+ "SMTPServer",
"SMTPPort",
"SMTPUser",
"SMTPPassword",
- "SMTPFrom",
- "SMTPSubject",
- "EmailTo"
+ "From",
+ "Recipient",
+ "Subject"
};
static int config_keys_num = STATIC_ARRAY_SIZE (config_keys);
static char *smtp_host = NULL;
static char *smtp_user = NULL;
static char *smtp_password = NULL;
-static char *smtp_from = NULL;
-static char *smtp_subject = NULL;
+static char *email_from = NULL;
+static char *email_subject = NULL;
#define DEFAULT_SMTP_HOST "localhost"
#define DEFAULT_SMTP_FROM "root@localhost"
static int notify_email_config (const char *key, const char *value)
{
- if (strcasecmp (key, "EmailTo") == 0)
+ if (strcasecmp (key, "Recipient") == 0)
{
char **tmp;
}
recipients_len++;
}
- else if (0 == strcasecmp (key, "SMTPHost")) {
+ else if (0 == strcasecmp (key, "SMTPServer")) {
sfree (smtp_host);
smtp_host = strdup (value);
}
sfree (smtp_password);
smtp_password = strdup (value);
}
- else if (0 == strcasecmp (key, "SMTPFrom")) {
- sfree (smtp_from);
- smtp_from = strdup (value);
+ else if (0 == strcasecmp (key, "From")) {
+ sfree (email_from);
+ email_from = strdup (value);
}
- else if (0 == strcasecmp (key, "SMTPSubject")) {
- sfree (smtp_subject);
- smtp_subject = strdup (value);
+ else if (0 == strcasecmp (key, "Subject")) {
+ sfree (email_subject);
+ email_subject = strdup (value);
}
else {
return -1;
: ((n->severity == NOTIF_OKAY) ? "OKAY" : "UNKNOWN")));
ssnprintf (subject, sizeof (subject),
- (smtp_subject == NULL) ? DEFAULT_SMTP_SUBJECT : smtp_subject,
+ (email_subject == NULL) ? DEFAULT_SMTP_SUBJECT : email_subject,
severity, n->host);
localtime_r (&n->time, ×tamp_tm);
ERROR ("notify_email plugin: cannot set SMTP message");
return (-1);
}
- smtp_set_reverse_path (message, smtp_from);
+ smtp_set_reverse_path (message, email_from);
smtp_set_header (message, "To", NULL, NULL);
smtp_set_message_str (message, buf);