Antwort: SMS script...

h.baecker at ecofis.de h.baecker at ecofis.de
Tue Feb 17 22:24:05 CET 2004


Hi,

Did you try to execute your script as root or as the user nagios runs 
under?
Sounds like a file permission problem.

Regards
Hendrik




Christiaan Ehlers <Christiaan.Ehlers at inclarity.co.uk> 
Gesendet von: nagios-users-admin at lists.sourceforge.net
17.02.2004 17:33

An
nagios-users at lists.sourceforge.net
Kopie

Thema
[Nagios-users] SMS script...






Hi

Our sms server can not take more than 160 characters in the body of the 
text
message.  I then wrote a script to help cut down those notifications that
are larger than 160 characters.  (the script is pretty shabby, please feel
free to sugest improvements)  Now when I run the script manualy, I get a
txt.  But it would seem when I empliment the script in nagios (see the
misccommand.cfg extract) I don't seem to get any messages.

I have the following command in misccommand.cfg

define command{
        command_name    service-notify-cleansms
        command_line    /bin/echo "$SERVICESTATE$ alert for
$HOSTALIAS$/$SERVICEDESC$ $OUTPUT$" > /home/scripts/msg && /home/scripts
/sms.sh $CONTACTEMAIL$
        }

And the sms.sh script is as follow... Deletes one character after the 
other,
starting at the back, untill it has 160.

noclobber=0
FILE=/home/scripts/msg

while [ `wc -m $FILE | awk '{print $1}'` -gt 160 ] 
        do

        if [ `cat $FILE | sed -n '$p' | wc -m`  = 1 ]; then
                cat $FILE | sed '$d' > $FILE
        else
                cat $FILE | sed '$s/.$//' > $FILE
        fi

        done

cat $FILE | mail $1


-------------------------------------------------------
SF.Net is sponsored by: Speed Start Your Linux Apps Now.
Build and deploy apps & Web services for Linux with
a free DVD software kit from IBM. Click Now!
http://ads.osdn.com/?ad_id=1356&alloc_id=3438&op=click
_______________________________________________
Nagios-users mailing list
Nagios-users at lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/nagios-users
::: Please include Nagios version, plugin version (-v) and OS when 
reporting any issue. 
::: Messages without supporting info will risk being sent to /dev/null


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://www.monitoring-lists.org/archive/users/attachments/20040217/999ca855/attachment.html>


More information about the Users mailing list