- "\r\n"
- "Message: %s",
- subject, timestamp_str, severity, n->host, n->message);
+ "\r\n",
+ subject, timestamp_str, severity, n->host);
+
+ if (status > 0) {
+ buf_ptr += status;
+ buf_len -= status;
+ }
+
+#define APPEND(format, value) \
+ if ((buf_len > 0) && (strlen(value) > 0)) { \
+ status = ssnprintf(buf_ptr, buf_len, format "\r\n", value); \
+ if (status > 0) { \
+ buf_ptr += status; \
+ buf_len -= status; \
+ } \
+ }
+
+ APPEND("Host: %s", n->host);
+ APPEND("Plugin: %s", n->plugin);
+ APPEND("Plugin instance: %s", n->plugin_instance);
+ APPEND("Type: %s", n->type);
+ APPEND("Type instance: %s", n->type_instance);
+ APPEND("\r\nMessage: %s", n->message);