From ae038d061614f75eacd04dc2f46cf2034e2530f4 Mon Sep 17 00:00:00 2001 From: Florian Forster Date: Wed, 4 Jun 2008 15:50:56 +0200 Subject: [PATCH] notify_email plugin: Renamed some configuration options. SMTPHost -> SMTPServer SMTPFrom -> From SMTPSubject -> Subject EmailTo -> Recipient --- src/collectd.conf.in | 11 ++++++----- src/notify_email.c | 32 ++++++++++++++++---------------- 2 files changed, 22 insertions(+), 21 deletions(-) diff --git a/src/collectd.conf.in b/src/collectd.conf.in index 06f9a92c..476a39d3 100644 --- a/src/collectd.conf.in +++ b/src/collectd.conf.in @@ -213,14 +213,15 @@ FQDNLookup true # # -# SMTPHost "localhost" +# SMTPServer "localhost" # SMTPPort 25 -# SMTPSubject "Aaaaaa!! %s on %s!!!!!" # on . 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" +# # on . 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" # # diff --git a/src/notify_email.c b/src/notify_email.c index 2059db4c..dc4e47f7 100644 --- a/src/notify_email.c +++ b/src/notify_email.c @@ -31,13 +31,13 @@ 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); @@ -52,8 +52,8 @@ static int smtp_port = 25; 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" @@ -149,7 +149,7 @@ static int notify_email_shutdown (void) static int notify_email_config (const char *key, const char *value) { - if (strcasecmp (key, "EmailTo") == 0) + if (strcasecmp (key, "Recipient") == 0) { char **tmp; @@ -167,7 +167,7 @@ static int notify_email_config (const char *key, const char *value) } recipients_len++; } - else if (0 == strcasecmp (key, "SMTPHost")) { + else if (0 == strcasecmp (key, "SMTPServer")) { sfree (smtp_host); smtp_host = strdup (value); } @@ -188,13 +188,13 @@ static int notify_email_config (const char *key, const char *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; @@ -222,7 +222,7 @@ static int notify_email_notification (const notification_t *n) : ((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); @@ -250,7 +250,7 @@ static int notify_email_notification (const notification_t *n) 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); -- 2.30.2