Book Image

Learning Nagios 3.0

Book Image

Learning Nagios 3.0

Overview of this book

Table of Contents (16 chapters)
Learning Nagios 3.0
Credits
About the Author
About the Reviewer
Preface

Your Own Notifications


Another part of Nagios that can be extended to fit your needs are notifications. These are messages that Nagios sends out whenever a problem occurs, or is resolved.

One way in which Nagios notification system can be expanded is to create template-based email sending. This will send notifications as both plain text and HTML messages. The of the email will be kept in separate files.

We will use Tcl for this purpose as it contains libraries for MIME (http://tcllib.sourceforge.net/doc/mime.html) and SMTP (http://tcllib.sourceforge.net/doc/smtp.html) functionality. The first one allows the creation of structured emails whereas the latter one is used to send these using an SMTP server.

Emails that contain content in multiple formats need to be wrapped in the multipart/alternative MIME type. This type will contain two subparts — first the plain text version, and following this the HTML version. This order makes email clients choose HTML over plain text if both the types are...