OpsMgr 2007 R2 (SCOM): Coretech Coffee Monitor Management Pack – 0.0.0.1

Download: rar CoretechCoffeeMonitor-MP-0.0.0.1 18.15 MB
Downloaded 1403 times

The file has included test examples and vlc player. The Management Pack is 32Kb

Intro:

This management packs can be used to keep track of the level of coffee in left in the pot.

With this management pack, you will never run dry of, what we all know, is the most important part of a productive environment!

This is mostly made as a proof of concept, as this technique can be transferred to other monitor types. It could be expanded with other types of sensors, like a weight to check the level of coffee instead of a camera, or a thermometer to check the temperature of the coffee.

This is the very first version. It has been tested in test environments.

By default, it will trigger a warning when under 50% is left, and a Critical Alert when under 20% is left.

Please do not hesitate to report any bugs and please send suggestions for the next version you might have.

This was developed by Jakob Gottlieb Svendsen with the help of Kåre Rude Andersen

Requirements

Microsoft System Center Operations Manager 2007 R2

Microsoft .Net Framework 3.5 SP1

A network connected camera

Coffee machine with clear-glass pot and free view to all of the pot, see an example in the video.

The management pack is based upon Microsoft .Net Framework 3.5 SP1. This is required to be installed before the executables can run.

The Monitor requires a Camera to take snapshots of the Coffee pot, and the Monitor application uses the snapshot to count how much coffee is left.

The camera and coffee machine has to be placed correctly and a number of requirements have to be fulfilled. These requirements could become obese if one would spend time at modifying a Coffee Machine to include a web camera.

  1. Coffee pot have to be in clear glass.
  2. The whole of the coffee pot has to be visible from one side from the camera.
  3. The background behind the machine/pot has to be white, or similar very light color. This have only been tested with white background.
  4. Camera have to be level with the coffee pot, and point towards the pot in a 0 degrees horizontal angle. Otherwise the level of coffee could be inconsistent.
  5. The light in the room have to be turned on a all times, while the monitor is scheduled to run, and must not point directly at the pot, since the glass, with black coffee behind, can act as a mirror, making it impossible for the camera to see the coffee level. A Camera with Polaroid lense, or polaroid filter i front of, should in teory overcome this problem, making the measurement much more stable.
  6. The camera have to place a snapshot JPG,PNG or BMP at a specified location once every minute or so, depending on how you setup the monitor. Alternatively, if the camera has a .asf stream, we have included our test setup, that utilizes VLC player to grab a snapshot of the ASF stream every time the monitor script is run (Extra\Debug-version-with-VLC-Snapshot Folder).

Install:

1. Extract all files to a folder on the server drive (C:\CCM etc.)
2. Import the Management Pack “CoretechCoffeeMonitor.xml” into OpsMgr.
3. Setup Coffee Machine and Camera
4. Use CCM-Config.exe to configure maximum and minimum amount of coffee as well as the black thersholm. See the video for more details.
5. Schedule your camera to put a new image in a specific location every minute (default is c:\CCM\snap.png).Pictures can be JPG, BMP or PNG
5. Setup the image file location in the script parameters in the unit monitor called “Coretech Coffee Monitor”
6. System is now ready!

Configuration:

You should use CCM-Config.exe to create a config.xml file. See Video for more details.

This file have to be placed in the same directory as the executables (etc. C:\CCM)

The path for the image file have to be setup in the Script parameters in the Unit Monitor called “Coretech Coffee Monitor”

Files:

CoretechCoffeeMonitor.exe Main executable, this is used by the management pack to count the number of black pixels in the snapshots
CCM-config.exe Configuration application, is used to create the nessesary config.xml file.
config.xml This have to be placed in the same folder as the executables for the system to work. Is generated by CCM-Config.exe
CoretechCoffeeMonitor.xml Main Management Pack XML file.

Management Pack Content:

<?xml version="1.0" encoding="utf-8"?><ManagementPack ContentReadable="true" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
  <Manifest>
    <Identity>
      <ID>CoretechCoffeeMonitor</ID>
      <Version>0.0.0.1</Version>
    </Identity>
    <Name>CoretechCoffeeMonitor</Name>
    <References>
      <Reference Alias="Windows">
        <ID>Microsoft.Windows.Library</ID>
        <Version>6.1.7221.0</Version>
        <PublicKeyToken>31bf3856ad364e35</PublicKeyToken>
      </Reference>
      <Reference Alias="System">
        <ID>System.Library</ID>
        <Version>6.1.7221.0</Version>
        <PublicKeyToken>31bf3856ad364e35</PublicKeyToken>
      </Reference>
      <Reference Alias="SC">
        <ID>Microsoft.SystemCenter.Library</ID>
        <Version>6.1.7221.0</Version>
        <PublicKeyToken>31bf3856ad364e35</PublicKeyToken>
      </Reference>
      <Reference Alias="Health">
        <ID>System.Health.Library</ID>
        <Version>6.1.7221.0</Version>
        <PublicKeyToken>31bf3856ad364e35</PublicKeyToken>
      </Reference>
    </References>
  </Manifest>
  <Monitoring>
    <Monitors>
      <UnitMonitor ID="CoretechCoffeeMonitor.Monitor" Accessibility="Internal" Enabled="true" Target="SC!Microsoft.SystemCenter.RootManagementServer" ParentMonitorID="Health!System.Health.EntityState" Remotable="true" Priority="Normal" TypeID="Windows!Microsoft.Windows.TimedScript.ThreeStateMonitorType" ConfirmDelivery="false">
        <Category>AvailabilityHealth</Category>
        <AlertSettings AlertMessage="CoretechCoffeeMonitor.Monitor_AlertMessageResourceID">
          <AlertOnState>Warning</AlertOnState>
          <AutoResolve>true</AutoResolve>
          <AlertPriority>Normal</AlertPriority>
          <AlertSeverity>MatchMonitorHealth</AlertSeverity>
          <AlertParameters>
            <AlertParameter1>$Data/Context/Property[@Name='percentCoffee']$</AlertParameter1>
          </AlertParameters>
        </AlertSettings>
        <OperationalStates>
          <OperationalState ID="Success" MonitorTypeStateID="Success" HealthState="Success" />
          <OperationalState ID="Warning" MonitorTypeStateID="Warning" HealthState="Warning" />
          <OperationalState ID="Error" MonitorTypeStateID="Error" HealthState="Error" />
        </OperationalStates>
        <Configuration>
          <IntervalSeconds>60</IntervalSeconds>
          <SyncTime />
          <ScriptName>CoretechCoffeeMonitor.vbs</ScriptName>
          <Arguments>"C:\CCM\Snap.png"</Arguments>
          <ScriptBody>Dim WshShell, oExec
Dim oAPI, oBag

If Wscript.Arguments.Count = 1 Then
	strImageFile = Wscript.Arguments.Item(0)
Else
	Call oAPI.LogScriptEvent("CoretechCoffeeMonitor.vbs",101,1,"CoffeeMonitor failed: Please specify no more or less than 1 Argument (Image file Path)")
	Wscript.Quit(2)
End if

'Setup objects
Set WshShell = CreateObject("WScript.Shell")
Set wshFso = WScript.CreateObject("Scripting.Filesystemobject")

'Setup property bag
Set oAPI = CreateObject("MOM.ScriptAPI")
Set oBag = oAPI.CreatePropertyBag()

'Calculate Coffee Status
Set oExec = WshShell.Exec("C:\CCM\CoretechCoffeeMonitor.exe " &amp; strImageFile)

Do while Not oExec.StdOut.AtEndOfStream
	output = oExec.StdOut.ReadLine
	'Display each line as it is received.
	WScript.Sleep 100
Loop

'Try converting the result
On Error Resume Next
percentCoffee = Cint(output)
If Err Then
	Call oAPI.LogScriptEvent("CoretechCoffeeMonitor.vbs",101,1,"CoffeeMonitor failed: " &amp; output)
	Wscript.Quit(1)
End if
On Error Goto 0

Call oBag.AddValue("percentCoffee",percentCoffee)

'Return result
Call oAPI.Return(oBag)

</ScriptBody>
          <TimeoutSeconds>60</TimeoutSeconds>
          <ErrorExpression>
            <And>
              <Expression>
                <SimpleExpression>
                  <ValueExpression>
                    <XPathQuery Type="Double">Property[@Name='percentCoffee']</XPathQuery>
                  </ValueExpression>
                  <Operator>LessEqual</Operator>
                  <ValueExpression>
                    <Value Type="Double">20</Value>
                  </ValueExpression>
                </SimpleExpression>
              </Expression>
              <Expression>
                <SimpleExpression>
                  <ValueExpression>
                    <XPathQuery Type="Double">Property[@Name='percentCoffee']</XPathQuery>
                  </ValueExpression>
                  <Operator>GreaterEqual</Operator>
                  <ValueExpression>
                    <Value Type="Double">0</Value>
                  </ValueExpression>
                </SimpleExpression>
              </Expression>
            </And>
          </ErrorExpression>
          <WarningExpression>
            <And>
              <Expression>
                <SimpleExpression>
                  <ValueExpression>
                    <XPathQuery Type="Double">Property[@Name='percentCoffee']</XPathQuery>
                  </ValueExpression>
                  <Operator>Less</Operator>
                  <ValueExpression>
                    <Value Type="Double">50</Value>
                  </ValueExpression>
                </SimpleExpression>
              </Expression>
              <Expression>
                <SimpleExpression>
                  <ValueExpression>
                    <XPathQuery Type="Double">Property[@Name='percentCoffee']</XPathQuery>
                  </ValueExpression>
                  <Operator>Greater</Operator>
                  <ValueExpression>
                    <Value Type="Double">20</Value>
                  </ValueExpression>
                </SimpleExpression>
              </Expression>
            </And>
          </WarningExpression>
          <SuccessExpression>
            <SimpleExpression>
              <ValueExpression>
                <XPathQuery Type="Double">Property[@Name='percentCoffee']</XPathQuery>
              </ValueExpression>
              <Operator>GreaterEqual</Operator>
              <ValueExpression>
                <Value Type="Double">50</Value>
              </ValueExpression>
            </SimpleExpression>
          </SuccessExpression>
        </Configuration>
      </UnitMonitor>
    </Monitors>
  </Monitoring>
  <Presentation>
    <StringResources>
      <StringResource ID="CoretechCoffeeMonitor.Monitor_AlertMessageResourceID" />
    </StringResources>
  </Presentation>
  <LanguagePacks>
    <LanguagePack ID="DAN" IsDefault="false">
      <DisplayStrings>
        <DisplayString ElementID="CoretechCoffeeMonitor">
          <Name>Coretech Coffee Monitor</Name>
          <Description>Monitor the Coffee Status! 

More info: http://blog.coretech.dk</Description>
        </DisplayString>
        <DisplayString ElementID="CoretechCoffeeMonitor.Monitor">
          <Name>Coretech Coffee Monitor</Name>
          <Description>Monitor for checking the level of Coffee left in the Machine.

Please visit http://blog.coretech.dk for more info</Description>
        </DisplayString>
        <DisplayString ElementID="CoretechCoffeeMonitor.Monitor" SubElementID="Error">
          <Name>Error</Name>
        </DisplayString>
        <DisplayString ElementID="CoretechCoffeeMonitor.Monitor" SubElementID="Success">
          <Name>Success</Name>
        </DisplayString>
        <DisplayString ElementID="CoretechCoffeeMonitor.Monitor" SubElementID="Warning">
          <Name>Warning</Name>
        </DisplayString>
        <DisplayString ElementID="CoretechCoffeeMonitor.Monitor_AlertMessageResourceID">
          <Name>Coretech Coffee Monitor</Name>
          <Description>Coffee Status: {0} %</Description>
        </DisplayString>
      </DisplayStrings>
    </LanguagePack>
    <LanguagePack ID="ENU" IsDefault="true">
      <DisplayStrings>
        <DisplayString ElementID="CoretechCoffeeMonitor">
          <Name>Coretech Coffee Monitor</Name>
        </DisplayString>
        <DisplayString ElementID="CoretechCoffeeMonitor.Monitor">
          <Name>Coretech Coffee Monitor</Name>
        </DisplayString>
        <DisplayString ElementID="CoretechCoffeeMonitor.Monitor_AlertMessageResourceID">
          <Name>Coretech Coffee Monitor</Name>
          <Description>{0}</Description>
        </DisplayString>
      </DisplayStrings>
    </LanguagePack>
  </LanguagePacks>
</ManagementPack>

That should be it for now!

Please bring your feedback :)


Comments (45):

  1. Henrik Nesager says:

    Brilliant !
    And you could maybe improve the accuracy by using a pot with white handles and cap (paint them…).
    Could you expand/use same technology for monitoring the amount of people in the cantina ???

    Nice work – keep it up !

  2. Hello Henrik

    Thanks for the feedback!

    Actually the handle and cap is included in the calibration, therefore there should not be any difference. Only the black plastic inside the coffee pot, in our setup, will make a difference :)

    And i guess you could expand it to work in the cantina, alltough you might have to tell all people to put dark, or a specific color clothes on 😉

    – Jakob

  3. […] This post was mentioned on Twitter by Florin Matincă, Kenneth van Surksum. Kenneth van Surksum said: OpsMgr 2007 R2 (SCOM): Coretech Coffee Monitor Management Pack – 0.0.0.1: http://bit.ly/4ni07E Brilliant :) […]

  4. […] OpsMgr 2007 R2 (SCOM): Coretech Coffee Monitor Management Pack – 0.0.0.1 | Coretech Blog Filed under: System Center, OpsMgr 2007, Management Packs […]

  5. […] you have left. All you need a network-connected camera, and you’re good to go. See a full demo here. Only published comments… Oct 22 2009, 12:16 PM by Aubrey Filed under: Migration, SCOM 2007 […]

  6. […] Svendsen over at CoreTech released a management pack today. That management pack will alert you when the coffee in your coffee pot gets low. I’ll go […]

  7. […] Go here to read the rest: OpsMgr 2007 R2 (SCOM): Coretech Coffee Monitor Management Pack … […]

  8. Polprav says:

    Hello from Russia!
    Can I quote a post in your blog with the link to you?

  9. Polprav:

    Yes, sure you can 😀

  10. Finally someone doing something cool with OpsMgr that I can use at home… :-)

  11. Flemming Riis says:

    i er for seje

    manuel trackback http://it-experts.dk/blogs/flemmingriis/archive/2009/10/25/coretech-er-for-seje-check-denne-mp.aspx

    usecase kig efter røde lamper i er server rum for defekt diske :)

  12. Doctib says:

    Hello From France :)

    Great Job ;).

    Nice proof of concept, that’s a new way to use SCOM, congrat. !

  13. BR says:

    Hi from NL 😀
    This is f#$^cking brilliant haha 😉

  14. Tim says:

    Greetings from the US! I found this both entertaining and thought provoking. This is a GREAT example of how you can use SCOM to monitor the world (not just computers) just by being creative. Excellent Work!

  15. Dennis says:

    Great management pack, gives me a lot of inspiration. Gonna try to convert this one to be used in Service Manager, so that I can give somebody a task to fill the coffee pot 😉

  16. Adam says:

    Hi,
    This is great… for those of us without a see through coffee pot could it be configured to work with network attached scales to weigh the coffee?

  17. really?? this is the very first version?? good to know that it has been tested by the test environments…i already using this to track of the level of coffee that was left in my pot..

  18. Mikkel Tramm says:

    Haha – Finally something we all can relate to! Great job mate, love to see serious programs being used serious 😉

  19. […] Список того, что можно мониторить, может показаться не большим. Но на самом деле ответ на вопрос «Что можно мониторить с помощью OpsMgr» прост – всё. Абсолютно всё, что доступно по сети, можно так или иначе мониторить с помощью OpsMgr. Всё зависит только от вашей фантазии и желания. Например, можно проверять наличие кофе в кофеварке. […]

  20. Hector Marcia says:

    Jakob,

    This idea is simply brilliant! Since you ask for ideas for the next version:
    What are the changes needed in the MP to use a thermometer or a CO/Heat Detector?

  21. Juegos says:

    I like your idea Jakob, great concept. Best wishes to you

  22. Juegos says:

    Jakob great concept. Greetings

  23. Ron Hagerman says:

    This could maybe be modified a little to alert me when the temprature in my lab gets too warm or maybe for intrusion detection when someone messes with one of my servers. (my lab racks don’t have doors on them)

    Just my thoughts on it. Of course, watching the coffee pot is good too 😉

  24. […] http://blog.coretech.dk/jgs/opsmgr-2007-r2-scom-coretech-coffee-monitor-management-pack-0001/ Share this:TwitterFacebookLike this:LikeBe the first to like this post. CategoriasSystem Center Tags:Management Pack Comentários (0) Trackbacks (0) Deixar um comentário Trackback […]

  25. Daniel says:

    Hi guys, does this work in a SCOM 2012 environment as well?

    Awesome work!

  26. Daniel says:

    Don’t bother, it works absolutely fine. I have only tried the test images so far but i will continue trying when i lay my hands on a camera :)

  27. Shawn says:

    Good day! I could have sworn I’ve been to this site before but after browsing through some of the post I realized it’s new to me.

    Anyways, I’m definitely glad I found it and I’ll be bookmarking and checking back often!

    Here is my web page :: Shawn

  28. Graphics says:

    …[Trackback]…

    […] What host are you the use of? Can I am getting your associate link for your host? I desire my website loaded up as fast as yours lol[…]…

  29. […] Coffee pot monitoring management pack […]

  30. mahesh says:

    Hai this is very great to use opsmgr in day to day life. This is a great achievement. Could you use the same process to monitor the level of water in water tank
    and also to monitor the level of water while filling the tank. So that there wont be any wastage.What are the changes need to be done to this management pack.

    • hello mahesh

      i think the webcam method would not be good for clear water, since you cannot see the water using the camera.

      but u would get a water tank or water measure device that is connected via USB.

      or you could use the weight of the water and have the water tank on a weight (depends on size)

      but if the water is colored, and the water tank is clear, you should be able to use this pack directly.

      but please notice that this is a proof of concept, by using a webcam, lighting issue come into play.

      i think what could be possible, is to go a camera that includes a polaroid filter, to make sure the reflections og light does not distroy the measurement.

      good luck :)

      – Jakob

  31. […] Coretech Blog » Blog Archive » OpsMgr 2007 R2 (SCOM): Coretech Coffee Monitor Management Pack – … […]

  32. england Information On Wikipedia

    Coretech Blog » Blog Archive » OpsMgr 2007 R2 (SCOM): Coretech Coffee Monitor Management Pack – 0.0.0.1

  33. Also, if you could make your own map pack consisting of
    4 maps from any of the titles, what would they be.
    Where in case you are play say demolition, the grenade launcher is wonderful choice for shooting enemies around
    the bomb site. Your cake will surely be stylish and trendy with these patriotic loop ribbons topped on it.

  34. […] szinte bármilyen rendszerhez illeszthető. (Emlékezetes a SCOM2007R2-höz készült Coffee Monitor Management Pack (!), ami mint rendkívül fontos IT üzemeltetési paramétert, az „elérhető” kávé […]

Leave a Reply