views:

72

answers:

2

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 .

+2  A: 

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" [email protected]

Works even with colours. See http://stackoverflow.com/questions/2013091/coloured-diff-to-html.

hendry
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 <html><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8"/> <style type="text/css">/* linux console palette */.ef0,.f0 { color: #000000; } .eb0,.b0 { background-color: #000000; }.ef1,.f1 { color: #AA0000; } .eb1,.b1 { background-color: #AA0000; }.......</style></head><body class="f9 b9"><pre></pre></body></html
Kimi
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