Xymon Mailing List Archive search

play sound

3 messages in this thread

list Matthew Tice · Fri, 9 Nov 2007 08:16:10 -0700 ·
Is it possible to play a sound (through bbdisplay) when an alert it
triggered (red, purple, whatever)?  This feature is used in Sitescope
. . . but  Sitescope doesn't hold a flame to hobbit.

Matt
list Josh Luthman · Fri, 9 Nov 2007 10:21:28 -0500 ·
You could use BBtray and stick in the wave file accordingly.

http://www.deadcat.net/viewfile.php?fileid=233

If you want it to be embedded on the WWW pages then you'll have find out
what outputs the red/yellow/green/purple backgrounds and title and embed
flash (at least I suggest flash) file along side that.
quoted from Matthew Tice

On 11/9/07, Matthew Tice <user-9d69468ed888@xymon.invalid> wrote:
Is it possible to play a sound (through bbdisplay) when an alert it
triggered (red, purple, whatever)?  This feature is used in Sitescope
. . . but  Sitescope doesn't hold a flame to hobbit.

Matt

-- 

Josh Luthman
Office: XXX-XXX-XXXX
Direct: XXX-XXX-XXXX
XXXX Wayne St
Suite XXXX
Troy, OH XXXXX

Those who don't understand UNIX are condemned to reinvent it, poorly.
--- Henry Spencer
list Tod Hansmann · Fri, 9 Nov 2007 10:26:05 -0700 ·
I wrote a custom script to do this via javascript.  It's a bit
over-complicated I think, but I haven't had time to go back and optimize
it.  It works, and well enough.  We keep the non-sound version of
bb2.html separate, and thus I had to create a separate page.  If you
don't need to keep it separate, you could just modify the bb2_header
file and include the tag we're adding with the php script.  We also
added a menu link to the bb2.php page via the menu_items.js file.
Replace the sound with whatever you want to be played.  Here are the
files I wrote:

 
bb2.php:


<?

        $bb2file = fopen("bb2.html", "r") or die("Can't open bb2.html");

        if ($bb2file)

        {

        while (!feof($bb2file))

        {

                $daline = fgets($bb2file);

                if ($daline === "</head>\n" || $daline === "</HEAD>\n")

                {

                        echo "<script type=\"text/javascript\"
language=\"javascript\" src=\"playsound.js\"></script>\n";

                }

                if (preg_match("$<[bB][oO][dD]$", $daline))

                {

                        echo $daline;

                        echo "<input type=\"hidden\" name=\"sounds_on\"
id=\"sounds_on\" value=\"true\" />";

                        break;

                }

                echo $daline;

        }

        }

        while (!feof($bb2file))

        {

                $daline = fgets($bb2file);

                echo $daline;

        }

        flcose($bb2file);

 
?>


The Javascript "playsound.js":

 
function doAlarm()

{

        var casdf = document.getElementsByTagName("body");

        var dasdf = casdf[0].innerHTML;

        var myEmbed = document.createElement('embed');

        myEmbed.setAttribute('src','giddyupthing.mp3');

        myEmbed.setAttribute('hidden','true');

        myEmbed.setAttribute('autostart','true');

        myEmbed.setAttribute('loop','false');

        myEmbed.setAttribute('id','theAlarm');

        casdf[0].appendChild(myEmbed);

}

 
function check_table(aasdf)

{

        var basdf = aasdf.getElementsByTagName("img")

        var buh = false;

        for (i=0;i<=basdf.length;i++)

        {

                if (basdf[i] != undefined)

                {

                if (basdf[i].title != undefined)

                {

                        var broken = basdf[i].title.split(":");

                        if (broken[1] == "red" || broken[1] == "yellow")

                        {

                                if (broken[2] != "acked")

                                {

                                        var minsasdf = broken[2];

                                        var testit =
minsasdf.substr(0,1);

                                        if (isFinite(testit))

                                        {

                                          testit = minsasdf.substr(0,2);

                                          if (isFinite(testit))

                                          {

                                            buh = true;

                                          }

                                          else if (
parseInt(minsasdf.substr(0,1)) >= 4)

                                          {

                                            buh = true;

                                          }

                                          else if ( minsasdf.substr(1,1)
== 'd' || minsasdf.substr(1,1) == 'h')

                                          {

                                            buh = true;

                                          }

                                        }

                                }

                        }

                }

                }

        }

        if (buh)

        {       doAlarm(); }

}

 
function checkAcks()

{

        var xasdf=document.getElementsByTagName("table");

        for (i=0;i<=xasdf.length;i++)

        {

                if(xasdf[i] != undefined)

                {

                        if(xasdf[i].summary != undefined)

                        {

                                if(xasdf[i].summary == "Group Block")

                                {

                                        check_table(xasdf[i]);

                                        break;

                                }

                        }

                }

        }

}

 
var snd = document.getElementById("sounds_on");

if ( snd != undefined)

{

        if ( snd.value = "true" )

        {

                checkAcks();

        }

}

 
Tod Hansmann

Network Engineer

 
  <http://www.directpointe.com/>;  
quoted from Josh Luthman


From: Josh Luthman [mailto:user-4c45a83f15cb@xymon.invalid] 
Sent: Friday, November 09, 2007 8:21 AM
To: user-ae9b8668bcde@xymon.invalid
Subject: Re: [hobbit] play sound

 
You could use BBtray and stick in the wave file accordingly.

http://www.deadcat.net/viewfile.php?fileid=233

If you want it to be embedded on the WWW pages then you'll have find out
what outputs the red/yellow/green/purple backgrounds and title and embed
flash (at least I suggest flash) file along side that. 

On 11/9/07, Matthew Tice <user-9d69468ed888@xymon.invalid> wrote:

Is it possible to play a sound (through bbdisplay) when an alert it
triggered (red, purple, whatever)?  This feature is used in Sitescope
. . . but  Sitescope doesn't hold a flame to hobbit.

Matt


-- 
Josh Luthman
Office: XXX-XXX-XXXX
Direct: XXX-XXX-XXXX
XXXX Wayne St
Suite XXXX
Troy, OH XXXXX

Those who don't understand UNIX are condemned to reinvent it, poorly.
--- Henry Spencer