[Xymon] Custom alert mail with script

谈工作 tanwork1 at gmail.com
Thu Sep 8 15:58:09 CEST 2016


Hi there

I have been working on custom alert script for days, but it just doesn't
work.

Here is my config in alerts.cfg(based on the man page):

HOST=*  SERVICE=cpu,disk,memory,files COLOR=red,yellow
     #MAIL me at mydomain.com RECOVERED #This one works fine.
     SCRIPT /home/xymon/RedAlert.sh me at mydomain.com FORMAT=sms

And here is my script(based on
http://lists.xymon.com/pipermail/xymon/2011-May/031660.html):

#!/usr/bin/sh
CALL_LEVEL="存在异常"
ASK_LEVEL="请您关注。"
RCPT=$1
[ "$BBCOLORLEVEL" = "RED" ] && ASK_LEVEL="情况严重,请立即处理。"
[ "$BBCOLORLEVEL" = "RED" ] && CALL_LEVEL="严重告警"
echo "告警主机$BBHOSTNAME ,IP地址为$MACHIP,告警项目:$BBSVCNAME,$ASK_LEVEL
持续时长:$DOWNSECS。
相关日志详情:
$BBALPHAMSG" | mail -s "$MACHIP 的 $BBSVCNAME $CALL_LEVEL【Xymon监控】" $RCPT

The alert.log keep logging:
Could not launch paging script /home/xymon/RedAlert.sh: No such file or
directory

I have checked the file permission (-rwxrwxr-x), and when I run:
sh /home/xymon/RedAlert.sh me at mydomain.com
with user xymon, I receive what i want  immediately.

Would someone please help me out of this?
Thanks a lot.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.xymon.com/pipermail/xymon/attachments/20160908/ecf175be/attachment.html>


More information about the Xymon mailing list