[Xymon] customize the email body alerts for xymon

sonal kumar nc.sonal at gmail.com
Fri May 13 16:12:26 CEST 2011


>
> Hi Gatis,
>
> Thanks for providing the scipt ,after applying it ,we are getting blank
> mails as below
>
>  sapsrp disk - red 718518
> XYMON
>  X
>   Reply
>     from xymon at sapsrp.sasrv.biz to nc.sonal at gmail.com
>  date Fri, May 13, 2011 at 6:47 PM subject sapsrp disk - red 718518
>
>
>
>
>
>
>
> So just one more favour,as i am not good at scripting.
> We need the mail to be some thing line below. with the body displaying
> alert and and TEXT having some presentable format with possible action
> items.
>
> sapsrp disk </filesystem name> - red 718518
> XYMON
>  X
>   Reply
>    from xymon at sapsrp.sasrv.biz to nc.sonal at gmail.com
>  date Fri, May 13, 2011 at 6:47 PM subject sapsrp disk - red 718518
>
>
>
>
>
>
> Hi team,
>
> Please look at the below alert for system <hostname> and take the action.
>
> red Thu May 12 15:59:21 WST 2011 - Filesystems NOT ok
> &red /var (98% used) has reached the PANIC level (90%)
>
> Action: Remove the irrelevant files from </filesystem>
>
> On Fri, May 13, 2011 at 2:06 AM, Gatis A. <gatis.anee at gmail.com> wrote:
>
>> Hi,
>>
>> Quick and dirty solution to get &red lines to be sent out only (tested
>> with xymon 4.2.2)
>> Basicly $BBALPHAMSG variable is the key here!
>>
>>
>>
>> hobbit-alerts.cfg:
>> #-----------------------------------------------------
>> GROUP=TESTGROUP
>>         SCRIPT /path/to/custom_alerts.sh test at test.com
>> #-----------------------------------------------------
>>
>>
>> custom_alerts.sh:
>> #-----------------------------------------------------
>> #!/bin/bash
>>
>> BBALPHAMSG=`echo "$BBALPHAMSG" | /path/to/custom_grep.pl`;export
>> BBALPHAMSG
>>
>> if [ $RECOVERED -eq 1 ]
>>         then
>>         RECOVERED="recovered"
>>         else
>>         RECOVERED=""
>> fi
>>
>> echo "${BBALPHAMSG:0:300}" | mail -s "$BBHOSTNAME $BBSVCNAME -
>> $BBCOLORLEVEL $ACKCODE $RECOVERED $DOWNSECSMSG" $RCPT
>> exit 0
>> #-----------------------------------------------------
>>
>>
>> custom_grep.pl:
>> #-----------------------------------------------------
>> #!/usr/bin/perl
>>
>> # searching for lines which has "&red"
>>
>> while (<>) {
>>
>> @maches=/&red .*\s/ig;
>>
>> foreach $_ (@maches) {
>>         s/<.*?>//ig; # removing all the html tags
>>         print "$_ ";
>>         }
>>
>> }
>> #-----------------------------------------------------
>>
>>
>>
>> On Thu, May 12, 2011 at 3:31 PM, sonal kumar <nc.sonal at gmail.com> wrote:
>>
>>> Hi team,
>>>
>>> I need to customize the email body and pattern for the alerts receiving
>>> from xymon.
>>> As in the below alert mail for disk ,
>>>
>>>    - we need the mail to display only the filesystem which is critical
>>>    in individual mails and avoid displaying the the entire list of filesystems.
>>>    - We need to customise the body of the mail and add some meaningful
>>>    text unique for each alert,let me know if any sample script can be used for
>>>    it.
>>>    - in below mail /oracle/SRP/sapdata0 alert is shown in KB UNITS, can
>>>    this be changed to show MB units free
>>>
>>> Please suggest.thanks in advance
>>>
>>> ---------- Forwarded message ----------
>>> From: <xymon at sapsrp.sasrv.biz>
>>> Date: Thu, May 12, 2011 at 5:31 PM
>>> Subject: Xymon [313335] sapsrp:disk CRITICAL (RED)
>>> To: nc.sonal at gmail.com
>>>
>>>
>>> red Thu May 12 15:59:21 WST 2011 - Filesystems NOT ok
>>> &red /var (98% used) has reached the PANIC level (90%)
>>> &yellow /tempsp (96% used) has reached the WARNING level (95%)
>>> &yellow /usr/sap (81% used) has reached the WARNING level (70%)
>>> &yellow /oracle/SRP/saparch (77% used) has reached the WARNING level
>>> (75%)
>>> &yellow /oracle/SRP/sapdata0 (3013196 units free) has reached the WARNING
>>> level (3013199 units)
>>>
>>> Filesystem    1024-blocks      Used      Free %Used Mounted on
>>> /dev/hd4          1048576    473192    575384   46% /
>>> /dev/hd2         10485760   4792084   5693676   46% /usr
>>> /dev/hd9var        524288    513520     10768   98% /var
>>> /dev/hd3          1572864    950588    622276   61% /tmp
>>> /dev/hd1           262144       968    261176    1% /home
>>> /proc                   -         -         -    -  /proc
>>> /dev/hd10opt      1179648    478100    701548   41% /opt
>>> /dev/lvsrporacle      212992    103972    109020   49% /oracle
>>> /dev/lvsrp_client      409600    264280    145320   65% /oracle/client
>>> /dev/lvsrp_srp     1359872    262204   1097668   20% /oracle/SRP
>>> /dev/fslv01       5242880   5006128    236752   96% /tempsp
>>> /dev/lvsrpmira      720896    410056    310840   57% /oracle/SRP/mirrlogA
>>> /dev/lvsrpmirb      720896    410056    310840   57% /oracle/SRP/mirrlogB
>>> /dev/lvsrporia      720896    426576    294320   60% /oracle/SRP/origlogA
>>> /dev/lvsrporib      720896    410056    310840   57% /oracle/SRP/origlogB
>>> /dev/lvsrp_sapreorg      565248     33572    531676    6%
>>> /oracle/SRP/sapreorg
>>> /dev/lvsrp_sapmnt     4194304   2273984   1920320   55% /sapmnt/SRP
>>> /dev/lvsrp_usr_sap     7856128   6303556   1552572   81% /usr/sap
>>> /dev/lvsrp_102     8183808   5288020   2895788   65% /oracle/SRP/102_64
>>> /dev/lvsrparch    10240000   7882476   2357524   77% /oracle/SRP/saparch
>>> /dev/lvsrpdata0   185073664 182060468   3013196   99%
>>> /oracle/SRP/sapdata0
>>>
>>> See http://sapsrp/xymon-cgi/svcstatus.sh?HOST=sapsrp&SERVICE=disk
>>>
>>>
>>>
>>> --
>>> Thanks & Regards
>>> Sonal kumar N C
>>>
>>>
>>> _______________________________________________
>>> Xymon mailing list
>>> Xymon at xymon.com
>>> http://lists.xymon.com/mailman/listinfo/xymon
>>>
>>>
>>
>
>
> --
> Thanks & Regards
> Sonal kumar N C
>
>


-- 
Thanks & Regards
Sonal kumar N C
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.xymon.com/pipermail/xymon/attachments/20110513/bf369f5c/attachment.html>


More information about the Xymon mailing list