OpsMgr 2007 R2 (SCOM): Coretech Coffee Monitor Management Pack – 0.0.0.1
Download: CoretechCoffeeMonitor-MP-0.0.0.1 18.15 MB
Downloaded 408 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.
- Coffee pot have to be in clear glass.
- The whole of the coffee pot has to be visible from one side from the camera.
- The background behind the machine/pot has to be white, or similar very light color. This have only been tested with white background.
- 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.
- 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.
- 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 " & 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: " & 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

Henrik Nesager:
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 !
22nd October 2009, 10:34Jakob Gottlieb Svendsen:
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
22nd October 2009, 10:57System Center – Manageability blog » OpsMgr 2007 R2 (SCOM): Coretech Coffee Monitor Management Pack – 0.0.0.1:
[...] Source: http://blog.coretech.dk/opsmgr07/opsmgr-2007-r2-scom-coretech-coffee-monitor-management-pack-0001/ [...]
22nd October 2009, 11:21Tweets that mention OpsMgr 2007 R2 (SCOM): Coretech Coffee Monitor Management Pack – 0.0.0.1 | Coretech Blog -- Topsy.com:
[...] 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
[...]
22nd October 2009, 13:06Coretech Coffee Monitor Management Pack – 0.0.0.1 - Rod Trent at myITforum.com:
[...] OpsMgr 2007 R2 (SCOM): Coretech Coffee Monitor Management Pack – 0.0.0.1 | Coretech Blog Filed under: System Center, OpsMgr 2007, Management Packs [...]
22nd October 2009, 13:14Coffee Management Pack! - Garth Jones:
[...] http://blog.coretech.dk/opsmgr07/opsmgr-2007-r2-scom-coretech-coffee-monitor-management-pack-0001/ Published Oct 22 2009, 07:29 AM by Garth Filed under: MOM, OpsMgr [...]
22nd October 2009, 14:29The System Center Connector » Blog Archive » OpsMgr 2007 R2 (SCOM): Coretech Coffee Monitor Management Pack – 0.0.0.1:
[...] Source: Coretech [...]
22nd October 2009, 15:22Using SCOM 2007 R2 To Monitor How Much Coffee Is In The Pot - Get Connected With Aubrey:
[...] 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 [...]
22nd October 2009, 19:17I have been usurped in the silly monitors department! | Pavleck.NET:
[...] 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 [...]
22nd October 2009, 20:19NerdXpress » OpsMgr 2007 R2 (SCOM): Coretech Coffee Monitor Management Pack …:
[...] Go here to read the rest: OpsMgr 2007 R2 (SCOM): Coretech Coffee Monitor Management Pack … [...]
22nd October 2009, 23:51Polprav:
Hello from Russia!
23rd October 2009, 07:23Can I quote a post in your blog with the link to you?
Jakob Gottlieb Svendsen:
Polprav:
Yes, sure you can
23rd October 2009, 09:34Rikard Ronnkvist:
Finally someone doing something cool with OpsMgr that I can use at home…
23rd October 2009, 11:55Coretech er for seje check denne MP - Flemming Riis - IT-experts.dk:
[...] http://blog.coretech.dk/opsmgr07/opsmgr-2007-r2-scom-coretech-coffee-monitor-management-pack-0001/ [...]
25th October 2009, 00:21Flemming Riis:
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
25th October 2009, 00:24FUN : Supervision du niveau de café dans votre machine à café ! - Operations Manager:
[...] http://blog.coretech.dk/opsmgr07/opsmgr-2007-r2-scom-coretech-coffee-monitor-management-pack-0001/ [...]
26th October 2009, 18:17Doctib:
Hello From France
Great Job
.
Nice proof of concept, that’s a new way to use SCOM, congrat. !
27th October 2009, 10:57SCOM 2007 - October News - Blog de François DUFOUR [EXAKIS]:
[...] Coffee [...]
28th October 2009, 23:52BR:
Hi from NL
4th November 2009, 12:55This is f#$^cking brilliant haha
Tim:
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!
4th November 2009, 21:50Dennis:
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
7th November 2009, 13:49Porque o mundo precisa do System Center Configuration Manager 2007 R2? « .:: dotnetwork.com.br ::.:
[...] http://blog.coretech.dk/opsmgr07/opsmgr-2007-r2-scom-coretech-coffee-monitor-management-pack-0001/ [...]
10th November 2009, 14:38Adam:
Hi,
25th January 2010, 17:56This 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?