[prev in list] [next in list] [prev in thread] [next in thread] 

List:       rt-users
Subject:    Re: [rt-users] Audible alerts
From:       Hornet <hornetmadness () gmail ! com>
Date:       2007-08-29 17:30:40
Message-ID: f42935a60708291030q67ca8e75u68e847f13405a064 () mail ! gmail ! com
[Download RAW message or body]

On 7/8/07, Chr. v. Stuckrad <stucki@mi.fu-berlin.de> wrote:
> On Sat, 07 Jul 2007, Hornet wrote:
> 
> > I'm looking to add an alert when a new ticket is created or status has
> 
> I've done this with a local schellscript and the 'lynx'
> ascii-browser for only a very spacial case but it might
> be an idea to start with?
> 
> Thie following is not really a 'runnable version',
> because I had to remove some parts specific to my
> own setup and system, but it will be a 'nearly' usable
> example.
> 
> May be it helps?  I run this while 'on dipatch duty'
> to not need to look at RT while working on other windows.
> 
> #!/bin/bash
> 
> # the trick in this script is, that 'echo' builtin of bash
> # seems NOT to puts iths argument into the commandline
> # so running "echo ... '$PASSWORD'| lynx ..."  does
> # not show tha password, and because it must be entered
> # it is not saved in a File.  But of course you may
> # install/use this only on 'locally secure hosts' because
> # the Password will exist in ClearText in Memory at rntime.
> 
> # Startup URL
> STURI='https://...SERVER.../rt/...URL_to_GET'
> 
> #  user to ask RT with
> USER=...username_to_login_with...
> 
> # ask every N Seconds
> SLEEPTIME=${SLEEPTIME:-30}
> 
> PLAYER=...soundplayer_used...
> 
> ADDSOUND=...wherever_the_sound_is...
> 
> ########################### change at your own risk ########################
> 
> # cd hopefully to the locally-correct home?
> cd $HOME
> 
> # (re)set terminal if aborted
> trap "stty echo echoe echok; exit 1" 0 1 2 3 15
> # ok, now check sound / ask for password
> $PLAYER $PWDSOUND
> # read without echo
> echo -n 'pw: '
> stty -echo -echoe -echok echonl; read line ; stty echo echoe echok
> # password now known
> # check access:
> if echo -e "-dump\n-source\n-auth=${USER}:$line\n${STURI}" | lynx - >/dev/null 2>&1
> then
> echo Access OK, backgrounding...
> else
> echo "${BELL}SORRY, cannot access RT"
> exit 1
> fi
> #  OK run in background!
> (
> # loop forever
> while true
> do
> #[1] *DER* Trick
> if echo -e "-dump\n-source\n-auth=${USER}:$line\n${STURI}" | lynx - | tee \
> ~/.rtcheck.html | awk $ADEBUG ' BEGIN { if (DEBUG) { print 0 }; mibad=0; red=0 }
> DEBUG==1 { print $0 }
> /class="oddline MIbad"/ { mibad=1; if (DEBUG) { print 1 }; next }
> /class="evenline MIbad"/ { mibad=1; if (DEBUG) { print 1 }; next }
> mibad==1 && /Query.*eingang.*Rechnerbetrieb/ {
> if (DEBUG) { print 2 }; red=1
> }
> mibad==1 { if (DEBUG) { print 0 }; mibad=0 }
> END {   if (red) {
> if (DEBUG) { print "red" }; exit 0
> } else {
> if (DEBUG) { print "green" }; exit 1
> }
> }'
> then
> $PLAYER $ATTSOUND
> fi
> sleep $SLEEPTIME
> done
> ) &
> 
> --
> Christoph von Stuckrad      * * |nickname |<stucki@mi.fu-berlin.de>   \
> Freie Universitaet Berlin   |/_*|'stucki' |Tel(days):+49 30 838-75 459|
> Mathematik & Informatik EDV |\ *|if online|Tel(else):+49 30 77 39 6600|
> Takustr. 9 / 14195 Berlin   * * |on IRCnet|Fax(alle):+49 30 838-75 454/
> 


-- 

Thanks for the info.

I wrote something similar in perl maily because I didn't want to tied
it to any one PC. just make it +x and place it in your cgi-bin dir and
open it in a web browser.

Firefox (windows) seemed to want to install quicktime, and since I
hate QT and RA, I just use IE. Weird for a simpe .wav file.
______________

#!/usr/bin/perl

use strict;
use Date::Manip;

my $refresh=300;  #in sec
my $date=UnixDate("now","%Y-%m-%d %H:%MGMT");

$ENV{'RTUSER'}="nagios";
$ENV{'RTPASSWD'}="ThePassw0rd";
$ENV{'RTSERVER'}="http://yourserver/rt";

my $naghome="/home/noc";
my $ref=$refresh/60;

my $cmd="$naghome/scripts/rt-3.4 ls -s \"\'Status\' = \'new\'\ OR
\'Status\' = \'open\'\"";
#print $cmd."\n";

open (RT, "$cmd|") || die "$cmd $!\n";
print "Content-type: text/html\n\n";
print '<meta http-equiv="refresh" content="300"><br>';
print "Date: $date :  Refreshed every $ref minutes<br><br>";

my $skip=0;
while (<RT>) {
        chomp;
        if ($_ =~ /^\d+/) {
                print "$_<br>";
                if (!$skip) {
                        print '<EMBED SRC="/offline1.wav" VSPACE="0"
HSPACE="0" AUTOSTART=TRUE LOOP=FALSE HIDDEN=TRUE>';
#                       print '<EMBED SRC="/offline7.wav" VSPACE="0"
HSPACE="0" AUTOSTART=TRUE LOOP=FALSE HIDDEN=TRUE>';
                        $skip=1;
                }
        } else {
                print "All is well!";
        }
}
close RT;




-Erik-
_______________________________________________
http://lists.bestpractical.com/cgi-bin/mailman/listinfo/rt-users

Community help: http://wiki.bestpractical.com
Commercial support: sales@bestpractical.com


Discover RT's hidden secrets with RT Essentials from O'Reilly Media. 
Buy a copy at http://rtbook.bestpractical.com


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic