I have been working in IT since 2001 for companies such as Computacenter and Getronics. I started out as a first line support analyst supporting heterogeneous networks but rapidly worked my way up the ranks expanding my knowledge as I went to include areas such as system builds, deployments, networking, and security to name a few.In 2008 I decided to concentrate on the monitoring and management of large enterprise networks using Microsoft's System Center Operations Manager (OpsMgr) 2007 of which I have extensive knowledge. As testament to this the Windows Management User Group (WMUG), invited me to join their ranks as a Community Leader where I have been invaluable in helping to bolster the OpsMgr skills to the benefit of the group and it's members.I have now moved into an OpsMgr 2007 consultancy role to do what I like most - working with OpsMgr and sharing my knowledge and experiences with the community.
Recently, I had a requirement to discover a number of devices that existing on a Linux server, which got me thinking as previously I’ve only ever run a shell command that returns a status to determine whether an object is discovered or not. In this scenario I needed to run a script to return all the devices that existed on it, and then discover an object for each device returned. On Windows, this is pretty straightforward as you can just use a scripted discovery to discover multiple items, but on Unix/Linux computers we can’t quite do the same thing.
When thinking about it a bit further though, I realised that I could almost do the same as a Windows discovery. Because the all workflows for UNIX/Linux computers run on the management server managing the computer, and not on the agent, I can return the data I need using a script or command from the computer, and then pass that through to a Windows Script or PowerShell module where I can use a similar discovery script as I would for a Windows discovery.
So here is a breakdown of the workflow for a custom discovery data source:
Note: If the command or script that needs running requires a privileged account, you could swap the Microsoft.Unix.WSMan.Invoke.ProbeAction probe with the Microsoft.Unix.WSMan.Invoke.Privileged.ProbeAction. And, if you would rather use PowerShell than VBS, you could always use the Microsoft.Windows.PowerShellDiscoveryProbe instead of the Microsoft.Windows.ScriptDiscovery probe.
Once the data source is created, it is just a matter of creating a new discovery that utilises the data source and specifying the relevant details, and presto, you will start discovering!
To get a good idea on building a discovery data source for Unix/Linux computers using the 2007 R2 Authoring Console, I highly recommend reading a series on extending Unix/Linux monitoring by Kris Bash. Part 1 of the series is viewable here, http://operatingquadrant.com/2011/03/23/operations-manager-extending-unixlinux-monitoring-with-mp-authoring-part-i/.
So, with the information from the blog above, and what we know about discoveries with VBS or PowerShell, we can can hook everything together to discover multiple items on a Unix/Linux Computer.
Below I have provided an example management pack for you, so you can see how everything works. I have used a basic script to simply return the devices on a Linux server using ‘iostat’, and then create an object representing each device. I know the default monitoring MP’s already discover this, I am just using it as an example. The management pack also contains the script that gets run on the UNIX/Linux computer, it is not executing a script that is already on the computer, so this MP will work as an example if you would like to know how to embed the script and use the ExecuteScript method of the Microsoft.Unix.WSMan.Invoke.ProbeAction probe.
Management pack: ExampleMP.xml
Hope this proves useful, and enjoy!
David
I have noticed that when uploading the XML file, it got prepended with "0844.". You'll need to remove this before being able to import the MP!