[Xymon] script alerts args
Galen Johnson
Galen.Johnson at sas.com
Sat Dec 2 17:52:10 CET 2017
It's almost like I know what I'm doing. I just wrapped it in quotes and pipe delimited it then added to my script to parse it (it's script to post to Slack channels that needed to be fed a channel since I changed how I wanted to separate the alerts). Just added the following and it basically just worked...
SCRIPT /path/to/script 'webhook|channelname'
?
# Parse the recipient to get the channel and key
VAR=`echo $RCPT | awk -F "|" '{ print "webhook="$1; print "channel="$2 }'`
eval $VAR
It really was that simple...
?=G=
________________________________
From: Ralph Mitchell <ralphmitchell at gmail.com>
Sent: Saturday, December 2, 2017 12:13 AM
To: Galen Johnson
Cc: xymon at xymon.com
Subject: Re: [Xymon] script alerts args
EXTERNAL
You might be able to comma-separate multiple args to make them look like one.
If not, could you just put the multiple args in a flat file and grep at the top of the script for the single $RCPT that gets passed?
Ralph Mitchell
On Fri, Dec 1, 2017 at 11:41 PM, Galen Johnson <Galen.Johnson at sas.com<mailto:Galen.Johnson at sas.com>> wrote:
Hey,
Is there any way to have the SCRIPT type recipient take more than 2 args? I need to be able to feed the script itself more than just the recipient...although, it occurs to me, I might be able to cheat by feeding it that inside a string with a separator. Anyone ever tried to do this?
thanks
=G=
_______________________________________________
Xymon mailing list
Xymon at xymon.com<mailto:Xymon at xymon.com>
http://lists.xymon.com/mailman/listinfo/xymon
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.xymon.com/pipermail/xymon/attachments/20171202/29dd3d97/attachment.html>
More information about the Xymon
mailing list