etsy / nagios-herald

Add context to Nagios alerts
https://codeascraft.com/2014/06/06/introducing-nagios-herald/
MIT License
321 stars 32 forks source link

Modify formatters to generate a single hash that contains all available content. #1

Closed RyanFrantz closed 10 years ago

RyanFrantz commented 10 years ago

Because the formatter and message classes need to be decoupled, we need a universal, abstract solution for making content available to any message class such that it can pull in the content that it needs. For example, while an email message requires a recipient, subject, and optional body, an IRC message only requires a recipient and simple message/body.

Rather than hard-code behavior per message type (which won't scale), Formatter::Base will have a method (i.e. #generate_content) that generates all the available content that a message object can then select required bits from.

I imagine the hash looks like:

content = {
    attachments = [],
    html = {
        additional_info = "",
        additional_details = "",
        ...
    },
    subject = "",
    text = {
        additional_info = "",
        additional_details = "",
        ...
    }
}
RyanFrantz commented 10 years ago

This issue is resolved per commit https://github.com/etsy/nagios-herald/commit/1b2280e6294d74550e93c5a6d6f63353230dd2ec