Add audio alerts to your SCOM diagrams

By now you should be aware that we have an add-in for Visio that allows you to connect to System Center Operations Manager data, published here - https://blogs.msdn.com/b/chhopkin/archive/2012/04/03/visio-and-sharepoint-extensions-for-system-center-2012-released.aspx

I know several customers that have built diagrams in Visio using this add-in to connect their shapes to SCOM data and then display this diagram using Visio’s full screen mode on a large display.  With the Automatic Refresh setting enabled this gives you a very nice unattended graphical monitoring application.

Today it was suggest to me that adding the ability to play an audio clip based on the Health State property changing for specific shapes would enhance the usability of this scenario…and I agree.

While the add-in will not do this for you, this functionality is easily added to any shape.

  1. Find audio clips, I like to use one sound for errors and another for warnings.
  2. Enable Developer Mode – click here to find out how
  3. Edit each shape that you wish to trigger an audio alert ( or edit one shape and make copies )

To get a shape to play a audio clip you need to add the PLAYSOUND() function to the shape.  This can be done in a number of ways however for this purpose we want the function to execute when the Health State property of our shape changes to Warning or Error.  This requires a formula to test for this condition before playing the audio clip.

IF(STRSAME(Prop._VisDM_Health_State,"Error"),PLAYSOUND("error.wav"),0)

This formula uses 3 functions

PLAYSOUND allows Visio to play a WAV file.  The WAV file has to be in the same folder as the Visio diagram if you do not wish to supply a path, otherwise you will need to supply the path and filename to the WAV file.

STRSAME compares two string values and returns TRUE if they are the same or FALSE if they are not.

IF evaluates a formula for a TRUE result and a different formula for a FALSE result.

All of this together allows Visio to play the error.wav file if the value of the Health State property is set to “Error”

Here is what the formula looks like contained within a user cell on my shape…

image

To add this formula to a User cell:

  1. Right-click on the target shape and choose the Show ShapeSheet menu item.
  2. Scroll to the bottom of the User-Defined cells section
  3. Right-click on the last row in the User-Defined cells section and choose the Insert Row menu item
  4. Copy and paste the formula above into the Value column of the new row.
  5. You can also click on the Name column and give your User cell a meaningful name as shown in the screen shot above.

Now you can manually test this formula by changing the Health State property of the shape to Error in the Shape Data window.

If you want a different sound to play when the Health State property is set to Warning simply repeat the procedure but change the “Error” condition to “Warning” and choose a different WAV filename.

IF(STRSAME(Prop._VisDM_Health_State,"Warning"),PLAYSOUND("warning.wav"),0)

 

NOTE: There is a lot you can do with Visio shapes just by adding formulas to different areas of the ShapeSheet. For an introduction to the ShapeSheet review this article - https://msdn.microsoft.com/en-us/library/office/gg144579.aspx