Showing posts with label SCSM Reports. Show all posts
Showing posts with label SCSM Reports. Show all posts

Tuesday, 14 August 2012

Data Synchronization issue between ServiceManager Database and DWDatamart Database in SCSM 2012

Data Synchronization issue between ServiceManager Database and DWDatamart Database in SCSM 2012
As you know Service Manager is an online transactional database and Microsoft recommends not to run queries on transactional database. For reporting purpose we can use DWDataMart DB.
There are 4 jobs which has to run in the order for the synchronization to happen
·         Extract_SM
·         Extract_DW
·         Load.COmmon
·         Transform.Common

You can schedule the job in such an order that each runs after other in the above order. This took some time to understand the synchronzization between ServiceManager and DWDatamart happens through this ETL Process.

I use this script  which runs the job in each order and waits for the current running job to complete before starting another one. You can automate this using task scheduler to run the powershell script on an hourly or daily basis if the out of box schedule doesn’t work.

 $DWComputer = "DW Server Name"
$SMExtractJobName = "Extract_SM_Name?"
$DWExtractJobName = "Extract_DW_Name?"$MPSync="MPSyncJob"
Import-Module 'C:\Program Files\Microsoft System Center 2012\Service Manager\Microsoft.EnterpriseManagement.Warehouse.Cmdlets.psd1'
function Start-Job ($JobName, $Computer)
{
    $JobRunning = 1
    while($JobRunning -eq 1)
    {
        $JobRunning = Start-Job-Internal $JobName $Computer
    }
}
function Start-Job-Internal($JobName, $Computer)
{
    $JobStatus = Get-JobStatus $JobName
    if($JobStatus -eq "Not Started")
    {
        Write-Host "Starting the $JobName Job..."
        Start-SCDWJob -JobName $JobName -Computer $Computer
        Start-Sleep -s 5
    }
    elseif($JobStatus -eq "Running")
    {
        Write-Host "$JobName Job is already running.  Waiting 30 seconds and will call again."
        Start-Sleep -s 30
        return 1
    }
    else
    {
        Write-Host "Exiting since the job is in an unexpected status"
        exit
    }
   
    $JobStatus = "Running"
    while($JobStatus -eq "Running")
    {
        Write-Host "Waiting 30 seconds"
        Start-Sleep -s 30
        $JobStatus = Get-JobStatus $JobName
        Write-Host "$JobName Job Status: $JobStatus"
        if($JobStatus -ne "Running" -and $JobStatus -ne "Not Started")
        {
            Write-Host "Exiting since the job is in an unexpected status"
            exit
        }
    }
    return 0
}
function Get-JobStatus($JobName)
{
        $Job = Get-SCDWJob -JobName $JobName -Computer $Computer
        $JobStatus = $Job.Status
        return $JobStatus   
}
#ETL
Start-Job $MPSync $DWComputer
Start-Job $SMExtractJobName $DWComputer
Start-Job $MPSync $DWComputer
Start-Job $DWExtractJobName $DWComputer
Start-Job $MPSync $DWComputer
Start-Job "Transform.Common" $DWComputer
Start-Job $MPSync $DWComputer
Start-Job "Load.Common" $DWComputer
 

Tuesday, 17 July 2012

Daily Report by Incidents SCSM 2012

Daily report is something which is used by service delivery managers and there is no out of box reports in SCSM to process this.
Below SQL query will give you the count of following incidents assigned to Support Engineer:
·         Active
·         Pending
·         Resolved
·         Closed

Run this against DWDataMart database as per Microsoft’s suggest no query should be run directly on a transactional database in this case it ServerManager Database.
Select
 distinct userdim.DisplayName as AssignedToUser , count ( case incident.status
when 'IncidentStatusEnum.Active' THEN 'ACTIVE' end )  as Active,
 count ( case incident.status
when 'IncidentStatusEnum.Closed' THEN 'Closed' end )  as Closed,
Count ( case incident.status
when 'IncidentStatusEnum.Resolved' THEN 'Resolved' end )  as Resolved

From    IncidentDim incident JOIN   
WorkItemDim workitem on incident.EntityDimKey = workItem.EntityDimKey JOIN  
 WorkItemAssignedToUserFactvw assignedtouser
on workitem.WorkItemDimKey = assignedtouser.WorkItemDimKey JOIN   
UserDimvw userdim on assignedtouser.WorkItemAssignedToUser_UserDimKey = userdim.UserDimKey
 Where    assignedtouser.DeletedDate is null and incident.createddate>= CONVERT(varchar(8), GETDATE()-1, 112)
 group by userdim.DisplayName, incident.status

Output:

Assigned To
Active
Closed
Resolved
Support Engineer A
2
0
0
Support Engineer B
1
0
0
Support Engineer C
1
0
0
Support Engineer D
2
0
0


 Please note this query will only pull info for Incidents but not Service or Change requests

Wednesday, 6 June 2012

The service manager data warehouse SQL reporting services is currently unavailable. You will be able to execute reports until this server is available. Please contact your system administrator. After the server becomes available please close your console and re-open to view reports SCSM 2012

Error: The service manager data warehouse SQL reporting services is currently unavailable. You will be able to execute reports until this server is available. Please contact your system administrator. After the server becomes available please close your console and re-open to view reports SCSM 2012
We encountered this error in our SCSM 2012 test environment. On further diagnosis figured out the SSRS box had some serious issues, after fixing one issue it was going in cycles other issue popped in. finally decided to reinstall SSRS but when you do that you lose SSRS configuration changes, encryption key.
I would suggest to take a backup of Report Server and Report Server Temp databases via management studio or scripts whatever you prefer and the encryption key from SSRS Configuration Manager before performing any steps
In our case the backup of encryption wasn’t available. Here is what we did to resolve the issue.
1)       Backup of Report Server and Report Server Temp Databases from SCSM 2012 Production environment
2)      Back up Encryption key from SSRS Configuration Manager Production Environment
3)      Restored the Report Server and Report Server Temp Databases as ReportServerNew and RepoertServerNewTemp DB’s on SCSM 2012 Test environment
4)      From SSRS Configuration manager, associated the new two databases
5)      Restored the encryption key from Production into Test environment via SSRS Configuration Manager
Note: This is the tricky part, when you restore the encryption key; it creates an entry of the Production and Test instance in your restored Report Server Database on Test Environment.
6)      To overcome this, Launch Management Studio, Connect to the Database Engine
Expand ReportServerNew Database, Navigate and Select KEYS Table
Expand KEYS table, edit and delete the entry mapped to Production Instance.
7)      Follow the steps from here to copy Microsoft.EnterpriseManagement.Reporting.Code.dll and edit Rssrvpolicy.config  to add segment code
8)      When that’s done, stop and Start the SSRS Service
Launch SCSM console you should see the reports there provided the ReportGroup has permissions on SSRS Report Manager URL.  In our case ReportGroup is an AD Group that contains the list of users who can run reports in SCSM 2012 Console.
This resolved the issue for me and happy jolly days.
Key thing is to have the backup of your report server databases and encryption , configuration file, without that it’s difficult to make this working.

Thursday, 31 May 2012

Failed to load expression host assembly. Details: Could not load file or assembly 'Microsoft.EnterpriseManagement.Reporting.Code, or one of its dependencies. Failed to grant minimum permission requests.(rsErrorLoadingExprHostAssembly)

Got this error in SSRS reports containg SCSM 2012 reports performed the following steps and it resolved the issue for me.

Logon to the SSRS server

1)       Copy the Microsoft.EnterpriseManagement.Reporting.Code.dll file from the prerequisite folder of SCSM 2012 Installation media and place it in a folder
2)      Drag and Drop Microsoft.EnterpriseManagement.Reporting.Code.dll  here

C:\Program Files\Microsoft SQL Server\MSRS10_50.MSSQLSERVER\Reporting Services\ReportServer\Bin.

3)        Add a code segment to the Rssrvpolicy.config file
4)      Navigate to C:\Program Files\Microsoft SQL Server\MSRS10.MSSQLSERVER\Reporting Services\ReportServer.
5)      Open the Rssrvpolicy.config file.
6)      Scroll through the Rssrvpolicy.config file and locate the CodeGroup code segments. The following code shows an example of a CodeGroup segment.
   class="UnionCodeGroup"
   version="1"
   PermissionSetName="FullTrust">
   <IMembershipCondition
      class="UrlMembershipCondition"
      version="1"
      Url="$CodeGen$/*"
   />
</CodeGroup>

7)      Add the following CodeGroup segment to the same section as the other CodeGroup segments in the Rssrvpolicy.config file.
<CodeGroup
   class="UnionCodeGroup"
   version="1"
   PermissionSetName="FullTrust"
   Name="Microsoft System Center Service Manager Reporting Code Assembly"
   Description="Grants the SCSM Reporting Code assembly full trust permission.">
   <IMembershipCondition
      class="StrongNameMembershipCondition"  
      version="1"
      PublicKeyBlob="0024000004800000940000000602000000240000525341310004000001000100B5FC90E7027F67871E773A8FDE8938C81DD402BA65B9201D60593E96C492651E889CC13F1415EBB53FAC1131AE0BD333C5EE6021672D9718EA31A8AEBD0DA0072F25D87DBA6FC90FFD598ED4DA35E44C398C454307E8E33B8426143DAEC9F596836F97C8F74750E5975C64E2189F45DEF46B2A2B1247ADC3652BF5C308055DA9"
/>
</CodeGroup>
8)      Close and save the changes.
9)      Stop and Start SSRS Service