initial commit
	new file:   .gitignore
added a standard ignore file
	new file:   email_test.py
this is the current testing script
	new file:   icinga-python-email.py
this will be the production script
	new file:   icinga.jpg
test image
cleaned up the email script
removed some of the comments and cleaned up the test code
added functions for embedding images and sending the email

diff --git a/icinga-python-email.py b/icinga-python-email.py
index f902ab9..f2b864d 100644
--- a/icinga-python-email.py
+++ b/icinga-python-email.py
@@ -12,20 +12,33 @@
+# Get MAIL_SENDER dynamically
+# Changelog:
+# MJONES - 10.09.2013 - incremented the version to .2
+# MJONES - 10.09.2013 - split off the logo and sending parts into functions
+#
+

 import getopt
 import sys
+import smtplib
+from email.MIMEMultipart import MIMEMultipart
+from email.MIMEText import MIMEText
+from email.MIMEImage import MIMEImage

-
-VERSION = 0.1                                       # script version
-MAIL_SENDER = 'Icinga Monitoring <icinga@ICINGA_HOST>'  # sender e-mail address
+VERSION = 0.20                                       # script version
+MAIL_SENDER = 'Icinga Monitoring <icinga@monicingatst201.be.monster.com>'
 ICINGA_CGI_URL = 'https://$hostname/icinga/cgi-bin'        # the Icinga CGI URL
-SMTP_HOST = '127.0.0.1'                               # cmdline arg -H/--smtphost
+SMTP_HOST = 'localhost'                               # cmdline arg -H/--smtphost
+LOGO_FILE = 'icinga.jpg'
+TO = 'matt.jones@monster.com'
+

+#MAIL_SENDER+=str(ICINGA_HOST)

 HTML_STYLE = (
@@ -58,92 +71,20 @@ TABLE_SIZE = '600px'
 HEADER_SIZE = '180px'
 DATA_SIZE = '429px'

-# Icinga logo
-
-LOGO = '''iVBORw0KGgoAAAANSUhEUgAAAHgAAAArCAYAAACzfkyLAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv\n
-8YQUAAAAJcEhZcwAADsQAAA7EAZUrDhsAABJaSURBVHhe7VwHWFVXtv7p0juoIFVUQKmiYNRglKCCio\n
-6KJfZRY3Qyzzjq2FuMiS150ViSGDuOAUvUqIkTO+o8FYOKsUeNDaQjvZy31r5cRrj3wsFA5n3vuyvf+\n
-bjeu8/a+6y1V9n/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BEnGNwz3h9iUMRJ8mvth//n1FwfR9GO16eBP4XOQzHB6wuiLQAAAAASUV\n
-ORK5CYII='''
-
-
+HTML_MSG = '''
+<html>
+    <head>
+        <title> this is a test title </title>
+    </head>
+    <body>
+        <p> Test me <br>
+        Another line <br>
+        This is the image you were looking for <img src="cid:icinga_logo"><br>
+        This will teach you not to click on links in strange <a href="http://purple.com">emails</a>
+        </p>
+    </body>
+</html>
+'''

@@ -193,6 +134,17 @@ def set_cc_recipient(r):
     recipients = r
     print(r)

+def attach_icinga_logo(msg, LOGO_FILE):
+    img_data = open(LOGO_FILE, 'rb').read()
+    img = MIMEImage(img_data, 'jpeg')
+    img.add_header('Content-Id', '<icinga_logo>')
+    msg.attach(img)
+
+def send_msg(msg, SMTP_HOST, MAIL_SENDER, TO):
+    s = smtplib.SMTP(SMTP_HOST)
+    s.sendmail(MAIL_SENDER, TO, msg.as_string())
+    s.quit()
+

@@ -215,3 +167,17 @@ for a in options[:]:
         set_recipient(xarguments[0])
     elif a[0] in ('-c', 'cc-recipient'):
         set_cc_recipient(xarguments[0])
+
+
+msg = MIMEMultipart()
+msg['Subject'] = 'icinga image test message'
+msg['From'] = MAIL_SENDER
+msg['To'] = TO
+
+
+body = MIMEText(HTML_MSG, 'HTML')
+msg.attach(body)
+
+attach_icinga_logo(msg, LOGO_FILE)
+
+send_msg(msg, SMTP_HOST, MAIL_SENDER, TO)
added method to get the local host name for comparasion
set git to ignore csv files
set git to ignore csv files

created file to parse vsphere output
not needed
Finished check_machine_type.py and put into testing
cleaned up
initial commit