SCSM Bulk deleting of Deleted Items

Hi All!

Here is great article about Deleting Configuration Items in Bulk in System Center 2012 Service Manager with PowerShell.

So in some case it is good idea to automate such process with Powershell. For example then we faced situation then Deleted Items even cannot be access with Exception. Lets try it on our “deleted” from CMDB Objects (placed in Deleted Items) .

#Find CI instances with status ‘Pending Delete’
$SMDelObj = Get-SCSMObject -class $SMClass | where {$_.objectstatus -match “Pending”}

#Delete the CI instances found above
$SMDelObjs | Set-SCSMobject -property objectstatus -value deleted

Ok, it executed lets go back to SCSM Console and check if we get those “deleted” items eliminated – same issue view cannot be opened.

If we check out Operations Manager event log

Event ID: 33333

Event Source: DataAccessLayer

Event Category: Unknown

Data Access Layer rejected retry on SqlError:

Request: MTV_Select_SOME_GUID — (ObjectStatus_4AE3E5FE_BC03_1336_0A45_80BF58DEE57B0=GUID_FROM_EnumType_Table_where_EnumTypeName =’System.ConfigItem.ObjectStatusEnum.PendingDelete’)

Class: 16

Number: 8623

Message: The query processor ran out of internal resources and could not produce a query plan. This is a rare event and only expected for extremely complex queries or queries that reference a very large number of tables or partitions. Please simplify the query. If you believe you have received this message in error, contact Customer Support Services for more information.

Event ID: 26319

Event Source: OpsMgr SDK Service

Event Category: Unknown

An exception was thrown while processing GetManagedEntitiesByManagedEntityTypesAndCriteriaWithInstanceQueryOptions for session ID uuid:GUID;id=11.

Exception message: The creator of this fault did not specify a Reason.

Full Exception: System.ServiceModel.FaultException`1[Microsoft.EnterpriseManagement.Common.UnknownDatabaseException]: The creator of this fault did not specify a Reason. (Fault Detail is equal to The query processor ran out of internal resources and could not produce a query plan. This is a rare event and only expected for extremely complex queries or queries that reference a very large number of tables or partitions. Please simplify the query. If you believe you have received this message in error, contact Customer Support Services for more information.).

So here we need some SQL Insight. I found great BLOG from Pedro Lopez SQL Swiss Army Knife #11.1 – Locking, blocking and active transactions – so try to execute this sql query 6888.view_Running_Blocked_processes

to determine what is going on in SQL during PS Execution or View Opening.

It will return you something like that if you trying to open Deleted Items in SCSM Console:

What is this SELECT!

 

Ok, but what we can do here?

  1. Most of CMDB Items came from Connectors – you have to be careful with SCOM CI and SCCM Connectors
  2. If you delete items from CMDB try to automate task for Maintenance Deleted Items with Service Manager workflow, Orchestrator, Service Management Automation or even with Win task Scheduler

import-smlets
$class = Get-SCSMClass | where{$_.name -match “system.configitem”}
$deletedobjects = Get-SCSMObject -class $class | where{$_.objectstatus -match “Pending”}
$deletedobjects | set-scsmobject -property objectstatus -value deleted

Happy Managing!

THE USE OF THE WEBPAGES OF artempro.ru IS ON YOUR OWN RISK. THE INFORMATION IS PROVIDED “AS IS” WITHOUT WARRANTY OF ANY KIND INCLUDING ALL IMPLIED WARRANTIES AND CONDITIONS OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, TITLE, COURSE OF DEALING OR USAGE OF TRADE. artempro.ru AG IS NOT LIABLE FOR ANY WARRANTY CLAIMS OR DAMAGES, IRRESPECTIVE OF THE LEGAL CAUSE, WHETHER IN CONTRACT, WARRANTY, FAILURE OF A REMEDY TO ACHIEVE ITS INTENDED OR ESSENTIAL PURPOSES, TORT (INCLUDING NEGLIGENCE), STRICT LIABILITY, INDEMNITY OR ANY OTHER LEGAL THEORY AND IN PARTICULAR SHALL NOT BE LIABLE FOR DAMAGES INCURRED AS A RESULT OF CONSULTATION, ASSISTANCE IN SETTING-UP PROCEDURES, BUSINESS INTERRUPTION OR SOFTWARE DEFECTS, EXCEPT WHERE LIABILITY IS MANDATORY FOR DAMAGES TO PRIVATELY USED PROPERTY OR BECAUSE OF VIOLATION OF CARDINAL CONTRACTUAL OBLIGATIONS OR DUE TO INTENT, GROSS NEGLIGENCE OR FAILURE TO CONFORM TO EXPRESS WARRANTIES. HOWEVER, LIABILITY FOR DAMAGES ARISING FROM THE VIOLATION OF CARDINAL CONTRACTUAL OBLIGATIONS SHALL BE LIMITED TO THE FORESEEABLE DAMAGE NORMALLY COVERED BY A CONTRACT EXCEPT IN CASES OF WILFUL MISCONDUCT OR GROSS NEGLIGENCE.

SCOM Monitoring of Linux/Unix of Windows workgroup Agent with same name

Hello All!

Lets assume that for some reason you have in yours infrastructure servers which have exact same FQDNs but different IPs (sometimes it can happen with best of us). And you have question if it is possible to monitor such Objects with your SCOM. Every Entity in SCOM has its own unique HealthService GUID – according to this blog How are GUIDs in SCOM and SCSM calculated? such GUIDs calculated based on many parameter which are same inside Management Group and FQDNs for Windows  Computer and Unix/Linux Computer (which are same for our servers). So it is looks like we cannot monitor Servers with same FQDN.

Workaround available:

Imagine we have two servers deployed

– Server1

FQDN:ubuntu1.contoso.com

IP: XXX.XXX.XXX.001

– Server2

FQDN:ubuntu1.contoso.com

IP: XXX.XXX.XXX.002

On SCOM Management server we can create records in c:\Windows\System32\drivers\etc\hosts file

# Server1

#FQDN:ubuntu1.contoso.com

XXX.XXX.XXX.001 ubuntu1.contoso.com

# Server2

# FQDN:ubuntu1.contoso.com

XXX.XXX.XXX.002 ubuntu1-sec.contoso.com

Next on our “second” server we have to manually generate Certificate

/opt/microsoft/scx/bin/tools/scxsslconfig -h ubuntu1-sec.contoso.com -f -v

Now we can discover this server through SCOM Console with appropriate IP address.

Same can be done with Windows Server Computer but Certificate generated different way.

Happy Monitoring!

THE USE OF THE WEBPAGES OF artempro.ru IS ON YOUR OWN RISK. THE INFORMATION IS PROVIDED “AS IS” WITHOUT WARRANTY OF ANY KIND INCLUDING ALL IMPLIED WARRANTIES AND CONDITIONS OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, TITLE, COURSE OF DEALING OR USAGE OF TRADE. artempro.ru AG IS NOT LIABLE FOR ANY WARRANTY CLAIMS OR DAMAGES, IRRESPECTIVE OF THE LEGAL CAUSE, WHETHER IN CONTRACT, WARRANTY, FAILURE OF A REMEDY TO ACHIEVE ITS INTENDED OR ESSENTIAL PURPOSES, TORT (INCLUDING NEGLIGENCE), STRICT LIABILITY, INDEMNITY OR ANY OTHER LEGAL THEORY AND IN PARTICULAR SHALL NOT BE LIABLE FOR DAMAGES INCURRED AS A RESULT OF CONSULTATION, ASSISTANCE IN SETTING-UP PROCEDURES, BUSINESS INTERRUPTION OR SOFTWARE DEFECTS, EXCEPT WHERE LIABILITY IS MANDATORY FOR DAMAGES TO PRIVATELY USED PROPERTY OR BECAUSE OF VIOLATION OF CARDINAL CONTRACTUAL OBLIGATIONS OR DUE TO INTENT, GROSS NEGLIGENCE OR FAILURE TO CONFORM TO EXPRESS WARRANTIES. HOWEVER, LIABILITY FOR DAMAGES ARISING FROM THE VIOLATION OF CARDINAL CONTRACTUAL OBLIGATIONS SHALL BE LIMITED TO THE FORESEEABLE DAMAGE NORMALLY COVERED BY A CONTRACT EXCEPT IN CASES OF WILFUL MISCONDUCT OR GROSS NEGLIGENCE.