BB Unix Network Monitor - Message

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

{bb} Put returned messages on two lines



Hello, I have a simple script (that is modified from a brother's RAID reporting script) in which it will look through lastlog and if there are more than 2 people listed it will send a red alert. So far the script works fine but the output to BBDISP doesn't look fine.

Here's part of the script:

***[code]***

LAST_LOG=`/usr/bin/lastlog | grep -v "**Never logged in**" | grep -v "Username" | grep -v "root" | wc -l`


if [ ${LAST_LOG} -ne "2" ];
then
COLOR="red"
MESSAGE="Additional user has logged in: `/usr/bin/lastlog | grep -v "**Never logged in**" | grep -v "Username" | grep -v "root"`"
else
COLOR="green"
MESSAGE="Two users have logged in:`/usr/bin/lastlog | grep - v "**Never logged in**" | grep -v "Username" | grep -v "root"`"
fi


# Prepare to send message
LINE="status $HOST.$TEST $COLOR `date` $MESSAGE $result"

***[/code]***

The results on BBDISP are:

green Mon Apr 3 17:43:11 MDT 2006 Two users have logged in:mtice pts/ 2 Mon Apr 3 16:56:42 -0600 2006

dstringham pts/2 Mon Apr 3 16:56:25 -0600 2006


********************
A little confusing to look at but see how it combines the status/date/ first line of the message into one line? Any ideas on how to format this? I'm sorry if this looks sloppy and sorry if this has been posted/replied to in the past, I couldn't find an answer.


Any help would be appreciated
Matt

--
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-==-=-=-=-=-=-=-=-=-=-=-=
To unsubscribe from this list, or to subscribe to the bb-digest list
send e-mail to mailto:majordomo@bb4.com with unsubscribe bb -and/or-
subscribe bb-digest in the BODY of the message.


Home | Main Index | Thread Index