Get Polymon to talk to you

Nov 3, 2008 at 3:04 PM
Edited Nov 3, 2008 at 3:17 PM
We run Polymon to keep an eye on about 20 different servers, and 25 or so network links.  We have a big LCD tv acting as a central "dashboard" to alert us if an error is found.

I thought it would be nice if this central machine could give us an audible alert if one of our network links goes down.  Here's how I did it:

1.  Get a wav file that announces what you want.  For our example we save it as c:\audible\warning.wav on the c: drive of the dashboard computer.
 You can record your own voice, or use one of several TTS options: 
Microsoft Mike from the MSAgent,
(Open source) espeak, or
for testing purposes only (Due to license restrictions), AT&T's natural voice. (Crystal is the most understandable, but Audrey has a lovely British accent, and sounds VERY intelligent.) http://www.research.att.com/~ttsweb/tts/demo.php
2.  Create a vbscript that launches the wav file.
a.  I keep the dashboard machine muted, because I don't want to continually hear the "ding" if Polymon has an error condition.
b.  the vbs file unmutes the volume, plays the wav, and then re-mutes.
c.  programatically, the easiest way I found to control the sound by script is by using Nircmd.exe http://www.nirsoft.net/utils/nircmd.html
d.  I put nircmd.exe in c:\audible\ of the dashboard computer.
e:  Sample script:  Save this as c:\audible\warning.vbs (On the dashboard computer)
********
set oShell = CreateObject("WScript.Shell")
oShell.run"c:\audible\nircmd.exe setsysvolume 65530"
oShell.run"c:\audible\nircmd.exe setsysvolume 65530 waveout"
oShell.run"c:\audible\nircmd.exe mutesysvolume 0"

Set oShell = CreateObject("Wscript.Shell")
sWaveFile = "c:\audible\warning.wav"
oShell.Run "sndrec32.exe /embedding /play /close """ _
& sWaveFile & """", 0, True
set oShell = CreateObject("WScript.Shell")
oShell.run"c:\audible\nircmd.exe mutesysvolume 1"
*********
3.  Use an action script to tell the executive machine to tell the dashboard machine to play the file:
I don't want the executive machine to play the wav file.  I want the dashboard machine to play it. 
So I use powershell to launch a PSExec command.  That command tells the specified machine to play the wav file. See http://technet.microsoft.com/en-us/sysinternals/bb897553.aspx
1.  The actual command being run is "c:\pstools\psexec.exe..."  That's "c:\pstools\" on the executive computer, not the dashboard computer.
2.  PSExec can either target a specific pc or target a list of PC's.  I'm choosing to use a list, because it'll make it easy to change the name of the dashboard computer, or add additional computers should I ever wish to.
3.  The computer list file is found in the c:\ drive of the executive computer.  I've got my list in c:\pstools\  You merely type the target machine name(s), one per line.
4.  The domain/username and passwords need to be changed for your situation.  The username specified must have admin rights to the dashboard computer.
5.  The command that the dashboard pc is being told to run is :  [cscript "c:\audible\warning.vbs"]  This script exists on the c: drive of the dashboard computer.
6.  Sample command:  Paste this in the "Action Script" tab in Polymon
*********
if ($Status.StatusID -gt 1)
    {c:\pstools\psexec.exe  `@"c:\pstools\warninglist.txt" -u thisismydomain\thisismyusername -p thisismypassword -i -d -realtime cscript "c:\audible\warning.vbs"}
*********

So now, if your error condition is met, the dashboard machine pipes up, "Warning Will Robinson.....!"

Bob