0

Using Solaris

I have a monitoring script that uses other scripts as plugins.

Theses pugins are also scripts which work in difffernt ways like: 1. Sending an alert while high memory uilization 2. High Cpu usage 3. Full disk Space 4. chekcking the core file dump

Now all this is dispalyed on my terminal and I want to put them in a HTML file/format and send it as a body of the mail not as attachment. Thanks .

Kimi
  • 332
  • 2
  • 11
  • 25
  • Is the output of your scripts already in html format? If not, then you'll need to decide how you want them marked up. You can simply add markup to the output and use a method like **James** linked to in his answer below. – Dennis Williamson May 17 '10 at 16:14

1 Answers1

2

You can use an ANSI to HTML convertor like so:

top -b -n 1 | /tmp/ansi2html.sh | mail -s "Server load" -a "Content-Type: text/html" myboss@example.com

Works even with colours. See Coloured Git diff to HTML.

Community
  • 1
  • 1
hendry
  • 9,725
  • 18
  • 81
  • 139
  • I copied the script . But it is not giving the proper output the command you mentioned. It send me a mail like below , did not mention the complete mail due to lack of words -n
    
    
    – Kimi May 22 '10 at 14:00
  • Hi Kimi, I should have been diligent enough to test my code. I've fixed it with the HTML content type. Just for the record, I prefer plain text :) – hendry May 24 '10 at 09:42