Xymon Mailing List Archive search

script alerts args

3 messages in this thread

list Galen Johnson · Sat, 2 Dec 2017 04:41:04 +0000 ·
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=
list Ralph Mitchell · Sat, 2 Dec 2017 00:13:31 -0500 ·
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 <user-87f955643e3d@xymon.invalid>
quoted from Galen Johnson
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=

list Galen Johnson · Sat, 2 Dec 2017 16:52:10 +0000 ·
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 <user-00a5e44c48c0@xymon.invalid>
Sent: Saturday, December 2, 2017 12:13 AM
To: Galen Johnson
Cc: xymon at xymon.com
Subject: Re: [Xymon] script alerts args


EXTERNAL
quoted from Ralph Mitchell

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 <user-87f955643e3d@xymon.invalid<mailto:user-87f955643e3d@xymon.invalid>> 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=