<div dir="ltr"><div dir="ltr">How about this?<div><br></div><div>     INFO=`echo "$BBALPHAMSG" | grep -c INFO`</div><div><br></div><div>     if [ ........ ]; then</div><div>          # something</div><div>     elif [ $INFO -gt 0 ]; then<br></div><div>          echo "INFO found"</div><div>     fi</div><div><br></div><div>Ralph Mitchell</div><div><br></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Thu, Aug 27, 2020 at 1:18 AM <<a href="mailto:kspringer@innovateteam.com">kspringer@innovateteam.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div>I did a lot of searching and tried all sorts of different variations with no success. So I gave up on it unless someone has a known functioning line of code they can share. <br>
<br>
Thanks, <br>
Kris Springer <br>
<br><br>-----Original Message-----<br>From: Torsten Richter <<a href="mailto:bb4@richter-it.net" target="_blank">bb4@richter-it.net</a>><br>To: Kris Springer <<a href="mailto:kspringer@innovateteam.com" target="_blank">kspringer@innovateteam.com</a>><br>Cc: Xymon MailingList <<a href="mailto:xymon@xymon.com" target="_blank">xymon@xymon.com</a>><br>Sent: Wed, 26 Aug 2020 10:55 PM<br>Subject: Re: [Xymon] Alert script "BBCOLORLEVEL" is red when recovered<br><br></div>-----BEGIN PGP SIGNED MESSAGE-----
<br>
Hash: SHA1
<br>

<br>

<br>
Hi Kris,
<br>

<br>
maybe you should try
<br>

<br>
elif [[ $BBALPHAMSG =~ INFO ]]
<br>

<br>
and see if that works.
<br>

<br>
Cheers,
<br>
Torsten
<br>

<br>
On <a href="tel:2608202017" target="_blank">26.08.2020 17</a>:48, Kris Springer wrote:
<br>
> Thanks Ralph, I got the 'Recovered' emails working now.  On to the
<br>
> 'Info' emails!  I've tried added an elif line to look for the word INFO
<br>
> in the message content, but it doesn't seem to work.  Any thoughts?
<br>
> Here's the line I'm using.
<br>
>
<br>
> elif [[ $BBALPHAMSG = *INFO* ]];
<br>
> then
<br>
> echo "Info found"
<br>
>
<br>
> Kris Springer
<br>
>
<br>
>
<br>
> On 8/25/20 7:32 PM, Ralph M wrote:
<br>
>> Call me crazy if you like, but in the alerts.cfg file, in the list of
<br>
>> environment variables passed to the script, it says:
<br>
>>
<br>
>>      #    BBCOLORLEVEL  - The color of the alert: "red", "yellow" or
<br>
>> "purple"
<br>
>>      ... [snip] ...
<br>
>>      #    RECOVERED     - Is "1" if the service has recovered.
<br>
>>
<br>
>> So, um, just check $RECOVERED ??
<br>
>>
<br>
>>      if [ $RECOVERED -eq 1 ]; then
<br>
>>           # send recovery email
<br>
>>      fi
<br>
>>
<br>
>> Ralph Mitchell
<br>
>>
<br>
>>
<br>
>>
<br>
>> On Tue, Aug 25, 2020 at 8:04 PM Jeremy Laidman <<a href="mailto:jeremy@laidman.org" target="_blank">jeremy@laidman.org</a>
<br>
>> <mailto:<a href="mailto:jeremy@laidman.org" target="_blank">jeremy@laidman.org</a>>> wrote:
<br>
>>
<br>
>>     Kris
<br>
>>
<br>
>>     I suspect $BBCOLORLEVEL is set to the color of the original
<br>
>> condition.
<br>
>>
<br>
>>     According to the man page for alerts.cfg, if the word &COLOR& is
<br>
>>     in the recipient parameter, it is replaced by the colour of the
<br>
>>     alert. This might give the updated colour after the alert
<br>
>>     recovered, instead of the alert colour.
<br>
>>
<br>
>>     Or, you can use something like this:
<br>
>>
<br>
>>     NEWCOL=`$XYMON $XYMSRV "xymondboard host=$BBHOSTNAME
<br>
>>     test=$BBSVCNAME fields=color"`
<br>
>>
<br>
>>     Cheers
<br>
>>     Jeremy
<br>
>>
<br>
>>     On Wed, 26 Aug 2020 at 08:38, Kris Springer
<br>
>>     <<a href="mailto:kspringer@innovateteam.com" target="_blank">kspringer@innovateteam.com</a> <mailto:<a href="mailto:kspringer@innovateteam.com" target="_blank">kspringer@innovateteam.com</a>>>
<br>
>>     wrote:
<br>
>>
<br>
>>         I know this is old, but it's still an issue.  I have a script
<br>
>>         that uses
<br>
>>         $BBCOLORLEVEL that works great, except the RECOVERED messages
<br>
>>         come in as
<br>
>>         Red.  They don't say 'Recovered', they say 'Red'.  I'm not
<br>
>>         much of a
<br>
>>         coder, but is there perhaps some way to have my bash script
<br>
>>         figure out
<br>
>>         if the message is a 'recovered' message and print that as the
<br>
>>         BBCOLORLEVEL instead of printing Red?
<br>
>>
<br>
>>         --
<br>
>>         Kris Springer
<br>
>>
<br>
>>
<br>
>>         _______________________________________________
<br>
>>         Xymon mailing list
<br>
>>         <a href="mailto:Xymon@xymon.com" target="_blank">Xymon@xymon.com</a> <mailto:<a href="mailto:Xymon@xymon.com" target="_blank">Xymon@xymon.com</a>>
<br>
>>         <a href="http://lists.xymon.com/mailman/listinfo/xymon" target="_blank">http://lists.xymon.com/mailman/listinfo/xymon</a>
<br>
>>
<br>
>>     _______________________________________________
<br>
>>     Xymon mailing list
<br>
>>     <a href="mailto:Xymon@xymon.com" target="_blank">Xymon@xymon.com</a> <mailto:<a href="mailto:Xymon@xymon.com" target="_blank">Xymon@xymon.com</a>>
<br>
>>     <a href="http://lists.xymon.com/mailman/listinfo/xymon" target="_blank">http://lists.xymon.com/mailman/listinfo/xymon</a>
<br>
>>
<br>
>
<br>
>
<br>
>
<br>
> _______________________________________________
<br>
> Xymon mailing list
<br>
> <a href="mailto:Xymon@xymon.com" target="_blank">Xymon@xymon.com</a>
<br>
> <a href="http://lists.xymon.com/mailman/listinfo/xymon" target="_blank">http://lists.xymon.com/mailman/listinfo/xymon</a>
<br>
>
<br>

<br>
- -- 
<br>
+---------------------------------------------------------+
<br>
| E-mail  : bb4 [at] <a href="http://richter-it.net" target="_blank">richter-it.net</a>                          |
<br>
|                                                         |
<br>
| Homepage: <a href="http://www.richter-it.net" target="_blank">http://www.richter-it.net</a>/                    |
<br>
+---------------------------------------------------------+
<br>
Download my public key from:
<br>
<a href="http://keys.gnupg.net/pks/lookup?search=0x899093AC&op=get" target="_blank">http://keys.gnupg.net/pks/lookup?search=0x899093AC&op=get</a>
<br>
-----BEGIN PGP SIGNATURE-----
<br>

<br>
iF0EARECAB0WIQQJ3zkARmUgZ5/ufuPsOWbGiZCTrAUCX0c8uQAKCRDsOWbGiZCT
<br>
rMPiAKDPsq0JkjD7++YhAJ/+SInZ5/+XSgCg3R/ArtLfgnoCv6vzUoxq+JVpIhc=
<br>
=pAQS
<br>
-----END PGP SIGNATURE-----
<br>
_______________________________________________<br>
Xymon mailing list<br>
<a href="mailto:Xymon@xymon.com" target="_blank">Xymon@xymon.com</a><br>
<a href="http://lists.xymon.com/mailman/listinfo/xymon" rel="noreferrer" target="_blank">http://lists.xymon.com/mailman/listinfo/xymon</a><br>
</blockquote></div></div>