Over time there have been several excellent posts to guide people in how to dynamically populate groups using regular expressions.The ones I found however did not answer the question I had regarding the grouping I wanted to make.
Consider the following situation:
Your servers are named as follows:
- NY-DC01
- NY-TS02
- NY-BIZ01
- NY-DB01
- NY-WEB01
- NY-WEB02
- NY-WEB03
- NY-WEB04
- NY-WEB05
- LA-DC01
- LA-DB01
- LA-WEB01
- LA-WEB02
In the above situation I have multiple webservers (All starting with ‘NY-WEB’ or ‘LA-WEB’) and a bunch of other servers (Database, Biztalk, Terminal Server etc.). In my case I wanted to make a selection of all New York servers not being web-servers. Furthermore, since OpsMgr is case sensitive where it comes to groupings, I wanted to make the selection case insensitive.
In this case I could use a regular expression with an inclusion to include all servers starting with ‘NY-‘ as well as an exclusion to exclude servers containing ‘web’ and get what I need. To achieve what I want, I need the following regular expression:
- ^(?i:ny-)(?!(?i:web)).*$
‘^(?i:ny-)’ will make a case insensitive selection of all servers starting with ‘ny-‘. ‘(?i:web)’ is another case insensitive selection of all servers containing the text ‘web’, and this selection in turn is excluded by ‘(?!…)’, by which it is enclosed.
To create the group, perform the following steps:
- In the operations console, create a new Group under ‘Authoring’ > ‘Groups’
- Give it a name of your choice and select a managementpack to save it in (not the default managementpack)
- Select ‘Next’ twice and click ‘Create/Edit Rules…’
- Verify ‘Windows Computer’ is selected and click ‘Add’
- Now select ‘principal name’ > ‘Matches regular expression’
- Now entering this: ^(?i:ny-)(?!(?i:web)).*$ should do the trick
- Click ‘OK’
- Click ‘Next’ twice and ‘Create’
- Now test your group by selecting the group and clicking ‘view group members…’
Some very good posts on regular expressions in Operations Manager can be found here:
- http://social.technet.microsoft.com/wiki/contents/articles/7205.operations-manager-dynamic-group-examples.aspx
- http://blogs.technet.com/b/kevinholman/archive/2009/04/21/quick-tip-using-regular-expressions-in-a-dynamic-group.aspx
- http://blogs.technet.com/b/smsandmom/archive/2008/03/25/opsmgr-2007-monitoring-health-service-availability.aspx
- http://www.systemcentercentral.com/BlogDetails/tabid/143/indexid/13097/Default.aspx
- http://www.systemcentercentral.com/BlogDetails/tabid/143/IndexId/51151/Default.aspx
- http://blogs.technet.com/b/jonathanalmquist/archive/2010/10/13/regular-expression-syntax-in-scom-for-filtering-groups-monitor-elements-operational-views-notification-subscriptions-etc.aspx
- OpsManJam Regex Documentation