Home » Articles posted by Anders Bengtsson (Page 22)
Author Archives: Anders Bengtsson
Incident Notification in Service Manager 2010
This week I have been working with notification in Service Manager. Some of my Service Manager customers need Swedish e-mail messages to one part of the company and for example English e-mail messages to another part of the company. To get that to work there are a number of steps to take. After configure e-mail notification channels (Administration/Notification/Channels) we need to configure a notification template. In the template we can configure different e-mail body and subject for different languages. In this post I will use one template, one for new incidents that the affected user will get when an incident is registered for them, you could configured a second one to notify affected user when an incident change status to closed.
I configured the first template with the following settings (Administration/Notification/Templates)
- Notification template name: Contoso Blog New Incident
- Targeted class: Incident
- Management Pack: Service Manager Incident Management Configuration Library (default)
- Message subject: A suitable message and property, I use WorkItem/Id (insert as property) to get the case ID
- Message body: A suitable message and properties. I use
- WorkItem/Id
- WorkItem/CreatedDate
- WorkItem/Title
- Incident/Classification
- Language: Swedish (Sweden)
- Switch to another language, in my scenario English (United States). Input a new message subject and message body. Then click OK to save your template
Now we have a notification template that supports two languages, in my example Swedish and English (United States). Next step is to configure a workflow to send notification. We can use the default incident event workflow configuration workflow for that (Administration/Workflows/Configuration). Add a workflow with the following settings
- Name: Contoso blog New Incident
- Description: E-mail notification to affected user when a new incident is registered
- Check for events: When an incident is created
- Management Pack: Service Manager Incident Management Configuration Library (default)
- Enabled: Checked
- On the Specify Event Criteria page, click Next
- On the Select Incident Template, do not apply a template, click Next
- On the Select People to Notify,
- On the Summary page, click Next
- On the Completion page, click Create and Close
Now, If we register an incident for a English user and one for a Swedish user there will be a couple differences in the e-mail. First it will use different message body and subject as the users has different local settings on their user CI in Service Manager. As you can see we get a very strange value for the category in the Swedish e-mail. This will happen when the list value doesn’t have a display string in the language of the target recipient. The workflow will get the notification template that corresponds to that user´s locale property setting. Replace the list value display string given the user´s locale. Format the date and time values according to the users locale property and time zone. In this scenario the user Kurt has local property configured to Sweden (Swedish) so there is no default display string for Hardware Issues in Swedish. But for Ed it works out of the box as his locale property is configured to English (United States) which is provided out of the box.
If you need to update your users timezone and/or locale settings you could use the CSV connector. Travis has a good post about that here. I have a post about the CSV connector and importing knowledge here.
During my tests I found the following results when you mix user local property, notification template language and default display strings
| User Local Property | Notification Template Language | Available display string | Result in e-mail notification |
|---|---|---|---|
| Sweden (Swedish) | Sweden (Swedish)(only language configured) | US-EN (Default) | Incorrect list values |
| English (United States) | Sweden (Swedish)(only language configured) | US-EN (Default) | correct list values |
| English (United States) | Both English (United States) and Sweden (Swedish). Will use the English (United States) template body | US-EN (Default) | correct list values |
| Sweden (Swedish) | Both English (United States) and Sweden (Swedish). Will use the Sweden (Swedish) template body | US-EN (Default) | Incorrect list values |
| blank/null | Both English (United States) and Sweden (Swedish). Will use the Sweden (Swedish) template body which was first configured in the template. Swedish is also the local settings on the service manager server. | US-EN (Default) | Incorrect list values |
| Other language for example Sweden (Finish) | Both English (United States) and Sweden (Swedish) | US-EN (Default) | No e-mail |
What we need to do to get correct e-mail bodies for Swedish affected users is to add localization in the Service Manager Incident Management Configuration Library management pack. We need to configure the management pack to support Swedish. Travis has a good blog post about this here. General steps are
- Export the Incident Management Configuration management pack
- Open it with XML Notepad
- Add languagepack and localization display strings for your language<
- Save the management pack
- Import it into Service Manager again
If we now register a incident for a English (United States) user and one for a Swedish (Sweden) user they will get one e-mail each, from the same notification template, but with different values for the list properties. In this case the incident category parameter will be translated to different words.
To summarize this post I would say that notification in Service Manager is a key feature that everyone will use. It support multiple-language templates and there are workflows and wizards to help you. But! Remember to plan the user CI local setting, language of your notification template and language of your display string
Cross-platform failover
With default settings cross-platform agents in Operations Manager 2007 R2 don’t fail-over to another management server if the primary management server goes offline. If the primary management server goes offline you will loose monitoring of all cross-platform machines communicating through that management server. The System Center Cross platform and Interop team blog has a couple of scripts that can help you manage cross-platform machines. One of these scripts is used to to change the current management server monitoring a UNIX/Linux server (or group of UNIX/Linux servers) to a new management server.
But if you move a cross-platform over to another management server you will get an alert like this
A simple explanation to this is that the new management server don’t trust the CA which have issue the certificate that the cross-platform machine is communicating with. You can solve this by copy the certificate from the management server that first discover the cross-platform machine over to the second management server. Store the certificate under Local Computer/Trusted Root Certification Authorities (in the certificates MMC). The certificate is named SCX-Certificate, issued by the primary management server.
When the new management server has the certificate installed it will start communicate with the cross platform machine. You could build a timed script two state monitor to check if the first management server is working, else run the script to move all cross-platform agents.
Update resolution state with a script
This is a script you can use to update resolution state. It will look at all new alerts (resolutionstate = 0) and see if the alert description contains “domain” or “AD”, if they do, the script will set a new resolution state. The ID for the resolution state can be found under alert settings in the administration workspace, in the Operations Manager console. You can schedule task to run this script every X minute to update all new alerts.
$RMS = “myRMSHost”
Add-PSSnapin “Microsoft.EnterpriseManagement.OperationsManager.Client”
Set-Location “OperationsManagerMonitoring::”
New-ManagementGroupConnection -ConnectionString:$RMS
Set-Location $RMS$resState =Â 42Â
$alerts = get-alert -criteria ‘ResolutionState =”0″‘ | where-object {($_.Description -match “AD”) -or ($_.Description -match “domain”)}
If ($alerts) Â {
   foreach ($alert in $alerts)
   {
    $alert.ResolutionState = $resState
    $alert.Update(“”)
   }
  }Â
The schedule task command can be
C:\WINDOWS\system32\windowspowershell\v1.0\powershell.exe -command C:\myscripts\change_resolutionstate.ps1
Importing knowledge into Service Manager 2010 – part 2
In this post I wrote about how-to import knowledge into Service Manager 2010. This week I did some tests about importing knowledge including data from a word file (docx) and a rich text format file (rtf). In my previous post about importing knowledge I wrote how you could use files and how they are mapped to the knowledge article text fields. If I use a Word file (docx) the result is “raw data”, not how we see the same file in Word.
Â
If I instead use a Rich Text form file it looks really nice in the Service Manager console.
Summary: Try to use rich text format files instead of normal Word files when importing knowledge into Service Manager.
The System Center Configuration Manager 2007 Dashboard with Operations Manager
The System Center Configuration Manager 2007 Dashboard can show you a web based status report, including system deployments, security updates, system health status and more for your Configuration Manager environment. More info about the dashboard at the System Center Team Blog. Timothy McFadden posted a good post about how to use this dashboard with Operations Manager 2007 R2. I have tried this in my sandbox and it works really good.
Here are some example queries to use
Total number of computers in the management group
SELECT COUNT(*) AS NumManagedComps FROM (
SELECT bme2.BaseManagedEntityID
FROM BaseManagedEntity bme WITH (NOLOCK)
INNER JOIN BaseManagedEntity bme2 WITH (NOLOCK) ON bme2.BaseManagedEntityID = bme.TopLevelHostEntityID
WHERE bme2.IsDeleted = 0
AND bme2.IsDeleted = 0
AND bme2.BaseManagedTypeID = (SELECT TOP 1 ManagedTypeID FROM ManagedType WHERE TypeName = ‘microsoft.windows.computer’)
GROUP BY bme2.BaseManagedEntityID
) AS Comps
Number of new active alerts
SELECT COUNT(1) AS ActiveAlerts FROM Alert WHERE ResolutionState = ‘0’
Health State summary of all Windows Computers based
SELECT [State] = CASE ManagedEntityGenericView.HealthState
WHEN 1 THEN ‘Healthy’
WHEN 2 THEN ‘Warning’
WHEN 3 THEN ‘Critical’
ELSE ‘Unknown’
END
, COUNT(1) AS GroupCountFROM ManagedEntityGenericView INNER JOIN
ManagedTypeView ON ManagedEntityGenericView.MonitoringClassId = ManagedTypeView.Id
WHERE (ManagedTypeView.Name LIKE ‘Microsoft.Windows.Computer’)
GROUP BY ManagedEntityGenericView.HealthState
ORDER BY GroupCount
Top 10 alerts
SELECT TOP 10 SUM(1) AS AlertCount, AlertStringName
FROM Alertview WITH (NOLOCK)
WHERE TimeRaised is not NULL
GROUP BY AlertStringName, AlertStringDescription, MonitoringRuleId, Name
ORDER BY AlertCount DESC
If you would like to replace the banner you will find it in C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\12\TEMPLATE\IMAGES\Microsoft.DashboardFramework. One idea for a new banner could be
Thanks to my colleague Ola Ahrens for SQL support.
How-to monitor file size
This script can be used with a monitor to monitor size of a file. In this example it monitor file C:\temp\myfile.txt and will generate an alert if that file is bigger then 50Mb (52428800 bytes). Settings for your two state script monitor can be
- General
- Name: Contoso – check file monitor
- Monitor Target: choose a suitable class
- Management Pack: choose a suitable MP
- Schedule
- Run every 15 Minutes
- Script
- File Name: contosocheckfilesize.vbs
- Script: see below
- Unhealthy Expression
- Property[@Name=’Status’] does not contain Ok
- Healthy Expression
- Property[@Name=’Status’] contain Ok
- Health
- Healthy Healthy Healthy
- Unhealthy Unhealthy Warning
- Alerting
- check Generate alerts fort this monitor
- check Automatically resolve the alert when the monitor returns to a healthy state
- Alert Name: Contoso – File Size monitor
- Alert Description: Warning. C:\temp\myfile.txt is to big. The file is $Data/Context/Property[@Name=’Size’]$ bytes.
Set objFSO = CreateObject(“Scripting.FileSystemObject”)
Set objFile = objFSO.GetFile(“C:\temp\myfile.txt”)
varSize = objFile.SizeDim oAPI, oBag
If varSize > 52428800 Then
Set oAPI = CreateObject(“MOM.ScriptAPI”)
Set oBag = oAPI.CreatePropertyBag()
Call oBag.AddValue(“Status”,”Bad”)
Call oBag.AddValue(“Size”, varSize)
Call oAPI.Return(oBag)
Else
Set oAPI = CreateObject(“MOM.ScriptAPI”)
Set oBag = oAPI.CreatePropertyBag()
Call oBag.AddValue(“Status”,”Ok”)
Call oAPI.Return(oBag)
End If
Investigate most common alert
The following SQL queries can be used to first list which machine or path and then rules or monitors that generate most alerts in your environment. The first query will show you which computer or path that generate most alerts. The second query will show you which rule or monitor that generate most alerts on one singel machine or path. Run both queries against your data warehouse database (OperationsManagerDW).
Â
SELECT
vManagedEntity.Path, COUNT(1) AS pathcountFROM Alert.vAlertDetail INNER JOIN
Alert.vAlert ON Alert.vAlertDetail.AlertGuid = Alert.vAlert.AlertGuid INNER JOIN
vManagedEntity ON Alert.vAlert.ManagedEntityRowId =
vManagedEntity.ManagedEntityRowId
GROUP BY vManagedEntity.Path
ORDER BY pathcount DESCÂ Â Â
SELECT
Alert.vAlert.AlertName,
Alert.vAlert.AlertDescription,
vManagedEntity.Path, COUNT(1) AS alertcount
FROM Alert.vAlertDetail INNER JOIN
Alert.vAlert ON Alert.vAlertDetail.AlertGuid = Alert.vAlert.AlertGuid INNER JOIN
vManagedEntity ON Alert.vAlert.ManagedEntityRowId =
vManagedEntity.ManagedEntityRowIdWHERE Path = 'opsmgr29.hq.contoso.local'
GROUP BY Alert.vAlert.AlertName, Alert.vAlert.AlertDescription, vManagedEntity.Path
ORDER BY alertcount DESCYou could also use these queries in a report, take a look at this post about author custom reports.
Query a database with a monitor – part two
In this post I wrote about a script that you can use to query a databas. The script in this post will count number of fields, if there are more then four, status of the monitor will be changed. It will also include number of rows in the alert description. I use the following settings on the monitor, a scripting/timed script two state monitor. In the following example I have a database on my root management server. The database is named TechDaysdb and includes a table named OpsMgrV. The name of the root management server is mobile-opsmgr.
- General
- Name: Contoso – query db monitor
- Monitor Target: for Root Management Server
- Management Pack: TechDays demo
- Schedule
- Run every 2 Minutes
- Script
- File Name: TechDaysmonitor.vbs
- Script: see below
- Unhealthy Expression
- Property[@Name=’Status’] does not contain Ok
- Healthy Expression
- Property[@Name=’Status’]Â contain Ok
- Health
- Healthy Healthy Healthy
- Unhealthy Unhealthy Warning
- Alerting
- check Generate alerts fort this monitor
- check Automatically resolve the alert when the monitor returns to a healthy state
- Alert Name: TechDays – db monitor
- Alert Description: There are to many rows in the database. There are $Date/Context/Property[@Name=’Rows’]$ rows.
Â
Const adOpenStatic = 3
Const adLockOptimistic = 3
Set oAPI = CreateObject(“MOM.ScriptAPI”)
Set oBag = oAPI.CreatePropertyBag()
Set objConnection = CreateObject(“ADODB.Connection”)
Set objRecordSet = CreateObject(“ADODB.Recordset”)
objConnection.Open _
“Provider=SQLOLEDB;Data Source=mobile-opsmgr;” & _
“Trusted_Connection=Yes;Initial Catalog=TechDaysdb;” & _
“User ID=domain\username;Password=password;”
objRecordSet.Open “SELECT * FROM OpsMgrV”, _
objConnection, adOpenStatic, adLockOptimistic
varNo = objRecordSet.RecordCount
If varNO > 4 Then
Rows = varNo
Call oBag.AddValue(“Status”,”Error”)
Call oBag.AddValue(“Rows”,Rows)
Call oAPI.Return(oBag)
Else
Call oBag.AddValue(“Status”,”Ok”)
Call oAPI.Return(oBag)
End If
Port 1434 UDP
Some time ago I installed a management server in a network different that the one where the Operations Manager 2007 database and root management server was installed. According to the guide I would need to open port 1434 between management server and database, 5723/5724 between management server and root management server and 1433 between management server and data warehouse.
But we also found out that when using named SQL instances you will need to open port 1434 UDP between the management server and the SQL database. In our scenario we used named instances on the data warehouse machine. The management server knew about it and tried to query the SQL Browser service on port 1434 UDP to get the correct network port for the SQL instance. Even if the instance is using the default port, the management server needs to query the SQL Browser service to get it. That query is sent on port 1434 UDP.
Importing knowledge into Service Manager 2010
This week I have tested to import knowledge into Service Manager. Knowledge can be used for example as guides in the self service portal for end-users, system documentation for engineers or troubleshooting guides for service desk personnel. One of the ways to get knowledge into Service Manager is to use the CSV import feature. The CSV import feature allows you to bulk-import instances of any class type or projection type defined in the Service Manager Configuration Management Database (SMCMDB). More info about CSV import here.
I started to map the labels on the knowledge form with properties of the knowledge class. When you use the CSV import feature you have one XML file with the properties that you will write data to and in which order they are, then you have a CSV file with the data itself.
| Property | Form label |
| Status | Status (top left corner of the form) |
| Tag | Flag article as |
| PrimaryLocaleID | Language |
| Category | Category |
| ArticleOwner | ArticleOwner |
| Comments | Comments |
| CreatedBy | CreatedBy |
| VendorArticleID | did not find this one |
| Title | Title |
| Abstract | Description |
| Keywords | Keywords |
| ArticleId | ArticleId |
| ExternalURLSource | did not find this one |
| ExternalURL | URL |
| AnalystContent | Analyst Content |
| EndUserContent | Internal Content |
There are a couple of fields where you cant use normal display values, for example the status property, when you import knowledge articles you cant use “Draft” you will have to use “10F171DF-3AB1-648D-D151-D83A5171DD7B” in the CSV file. That is because the knowledge form use StringIds then there is a “translation table” in the database to translate the string into the correct work and language. So how do you get hold of these values?
They are all in the LocalizedText table in the Service Manager database. For example to get the StringID for draft status you can run the following query
SELECT [LTStringId]
,[LanguageCode]
,[LTStringType]
,[ManagementPackId]
,[ElementName]
,[MPElementId]
,[SubElementName]
,[LTValue]
,[TimeAdded]
,[LastModified]
,[DisplayStringId]
FROM [ServiceManager].[dbo].[LocalizedText] WHERE ElementName LIKE '%knowledge%status%draft%'
It will give you a result like this
As you can see there are different values for different languages. When you need to get StringIds for your values you will need to check in this table. During my test I found that you need to do this for status, tag and category.
There are two other intresting properties,  AnalystContent and EndUserContent. When you use these two with the CSV import feature is looking for files in the C:\Program Files\Microsoft System Center\Service Manager 2010 folder (default path). The content in these two files will be uploaded to the corresponding text field in the knowledge article form.
Â
The following is a example of a CSV file and a XML file I used to import a knowledge article. If you save them to a folder and import them into Service Manager you will get a new knowledge article with some guidelines in each text field, so you easy can identify where to put your text.
10F171DF-3AB1-648D-D151-D83A5171DD7B,
F982E5B1-7864-7FC5-D0A4-8E000C91C241,75F786E2-CAA7-E7E9-47A0-BCC714BF1EDF,ArticleOwner,Comments,
CreatedBy,VendorArticleID,Title,Abstract,keyword,,
ExternalURLSource,http://www.contoso.se,
comment01.txt,comment02.txt
and the XML file used with the CSV file
Travis Wright in the Service Manager product team has written a good post with more info about this.
How many instances of this activity do we have? And where are they?












Recent Comments