달력

5

« 2024/5 »

  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24
  • 25
  • 26
  • 27
  • 28
  • 29
  • 30
  • 31

SCOM System Center Operations Manager VBS VBScript VB Script 클래스 인스턴스 Class Instance Discovery
아래는 특정 레지스트리 키와 문자열 값을 확인해 값이 있으면 해당 클래스의 인스턴스를 생성하고, 값이 없는 경우 다시 미등록 컴퓨터라는 클래스로 빠지게 하는 스크립트다.

' $MPElement$ $Target/Id$ $Target/Property[Type="Windows!Microsoft.Windows.Computer"]/PrincipalName$

Dim oAPI

Set oAPI = CreateObject("MOM.ScriptAPI")


Dim oArgs

Set oArgs = WScript.Arguments


If oArgs.Count < 3 Then

Call oAPI.LogScriptEvent("AppDiscovery.vbs",101,0, "Arguments Error.")

WScript.Quit -1

End If


Dim SourceID, ManagedEntityId, TargetComputer, oDiscoveryData, oInst

SourceId = oArgs(0)

ManagedEntityId = oArgs(1)

TargetComputer = oArgs(2)


Set oDiscoveryData = oAPI.CreateDiscoveryData(0, SourceId, ManagedEntityId)


const HKEY_LOCAL_MACHINE = &H80000002

Set oReg=GetObject("winmgmts:{impersonationLevel=impersonate}!\\.\root\default:StdRegProv")


strKeyPath = "SOFTWARE\TEST-SCOM"

oReg.GetStringValue HKEY_LOCAL_MACHINE,strKeyPath,"Site",strSite

oReg.GetStringValue HKEY_LOCAL_MACHINE,strKeyPath,"Process",strProcess

oReg.GetStringValue HKEY_LOCAL_MACHINE,strKeyPath,"Line",strLine

oReg.GetStringValue HKEY_LOCAL_MACHINE,strKeyPath,"Role",strRole

Set oReg=Nothing


If IsNull(strSite) OR IsNull(strProcess) OR IsNull(strLine) OR IsNull(strRole) OR strSite="" OR strProcess="" OR strLine="" OR strRole="" Then

' 미등록 컴퓨터 인스턴스 생성

Set oInst = oDiscoveryData.CreateClassInstance("$MPElement[Name='TEST.Unregistered']$")

Call oInst.AddProperty("$MPElement[Name='Windows!Microsoft.Windows.Computer']/PrincipalName$", TargetComputer)

Call oDiscoveryData.AddInstance(oInst)

Call oAPI.Return(oDiscoveryData)

WScript.Quit

End If


Set objWMIService = GetObject("winmgmts:{impersonationLevel=impersonate}!\\.\root\cimv2")

Set colItems = objWMIService.ExecQuery ("Select * from Win32_ComputerSystem")

For Each Item in colItems

strVendor = Item.Manufacturer

strModel = Item.Model

Next

Set colItems = objWMIService.ExecQuery ("Select * from Win32_OperatingSystem")

For Each Item in colItems

strOS = Item.Caption

strSP = Item.CSDVersion

Next

Set colItems = Nothing

Set objWMIService = Nothing


' TEST 설비 인스턴스 생성

Set oInst = oDiscoveryData.CreateClassInstance("$MPElement[Name='TEST.ALLEQUIP']$")

Call oInst.AddProperty("$MPElement[Name='Windows!Microsoft.Windows.Computer']/PrincipalName$", TargetComputer)

Call oInst.AddProperty("$MPElement[Name='TEST.ALLEQUIP']/Site$", strSite)

Call oInst.AddProperty("$MPElement[Name='TEST.ALLEQUIP']/Process$", strProcess)

Call oInst.AddProperty("$MPElement[Name='TEST.ALLEQUIP']/Line$", strLine)

Call oInst.AddProperty("$MPElement[Name='TEST.ALLEQUIP']/Role$", strRole)

Call oInst.AddProperty("$MPElement[Name='TEST.ALLEQUIP']/Vendor$", strVendor)

Call oInst.AddProperty("$MPElement[Name='TEST.ALLEQUIP']/Model$", strModel)

Call oInst.AddProperty("$MPElement[Name='TEST.ALLEQUIP']/OS$", strOS)

Call oInst.AddProperty("$MPElement[Name='TEST.ALLEQUIP']/SP$", strSP)

Call oDiscoveryData.AddInstance(oInst)

Call oAPI.Return(oDiscoveryData)

WScript.Quit

:
Posted by 커널64
파라미터로 텍스트 파일의 전체 경로
Property[@Name='Message'] 를 이용해 문자열 검색

Alert Description
$Data/Context/Property[@Name='Message']$

-----------------------------------------------------------------------------------------------------

Dim oAPI, oBag, strMessage
Set oAPI = CreateObject("MOM.ScriptAPI")
Set oBag = oAPI.CreatePropertyBag()

Set oArgs = WScript.Arguments
ParamCount = oArgs.Count

If ParamCount < 1 Then
Call oAPI.LogScriptEvent("StringCheck.vbs", 5009, 0, "Script aborted. Not enough parameters provided.")
WScript.Quit -1
End If

strMessage=getlastline(oArgs(0))

Call oBag.AddValue("Message", strMessage)
Call oAPI.Return(oBag)

function getlastline (ascfile)
set fs = createobject("scripting.filesystemobject")
set file = fs.GetFile(ascfile)
set stream = file.OpenAsTextStream
stream.skip file.size
line = stream.line
stream.close 
set stream = file.OpenAsTextStream
for i=1 to line-2
stream.skipline
next
getlastline = stream.readline
if not stream.atendofstream then
getlastline = stream.readline
end if
end function
:
Posted by 커널64

[증상]
기본 서비스 모니터를 이용해 서비스 모니터를 생성하고 '서비스 시작 유형이 자동인 경우에만 경고합니다.'를 False로 설정해도 경고가 뜨지 않는다.

[처리 방법]
해당 관리팩을 Export해 메모장으로 연 후 <CheckStartupType>true</CheckStartupType>을 추가한다.

<ComputerName>$Target/Property[Type="Windows!Microsoft.Windows.Computer"]/NetworkName$</ComputerName>
<ServiceName>서비스 이름</ServiceName>
<CheckStartupType>true</CheckStartupType>
</Configuration>
</UnitMonitor>

:
Posted by 커널64

Rule > New > Probe based > Script(performance)

Object, Counter, Instance 적당한 값
Value: $Data/Property[@Name='% Used Memory']$

--------------------------------------------------------------------------------

UsedMemoryPercent.vbs

Dim oAPI, oBag
Set oAPI = CreateObject("MOM.ScriptAPI")
Set oBag = oAPI.CreatePropertyBag()

dim hostName,strComputer
dim tMemoryKB,FreeMemoryKB,MemoryUsage

strComputer = "."
Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\cimv2")
tMemoryKB = 0
Set colItems = objWMIService.ExecQuery("select * from Win32_OperatingSystem")

For Each objItem in colItems
tMemoryKB = objItem.TotalVisibleMemorySize
next

Set colItems = objWMIService.ExecQuery("select FreePhysicalMemory from Win32_OperatingSystem")
For Each objItem in colItems
FreeMemoryKB= objItem.FreePhysicalMemory
next

MemoryUsage = ((tMemoryKB - FreeMemoryKB)/tMemoryKB) * 100

Call oBag.AddValue("% Used Memory",MemoryUsage)
Call oAPI.Return(oBag)

:
Posted by 커널64

Monitor -> New -> Scripting -> Timed Script Two State Monitor

Parameters
[ProcessName.exe] [WorkingSetLimit(MB)]

State Expression
For Unhealthy Expression Property[@Name='State'] Equals Good
For Healthy Expresion Property[@Name='State'] Equals Bad

Alert Description
$Data/Context/Property[@Name='Message']$

----------------------------------------------------------------------------------------------

 'Parameter [ProcessName.exe] [WorkingSetLimit(MB)]

    Dim oAPI, oBag
    Set oAPI = CreateObject("MOM.ScriptAPI")
    Set oBag = oAPI.CreatePropertyBag()

    Set oArgs  = WScript.Arguments
    strTaskName = oArgs(0)
    strWorkingSet = oArgs(1)

    Set oArgs = nothing
    Set shellobj = WScript.CreateObject("WScript.Shell")
    State = "Good"

    Const wbemFlagReturnImmediately = &h10
    Const wbemFlagForwardOnly = &h20

    strComputer = "."

    Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\CIMV2")
    Set colItems = objWMIService.ExecQuery("SELECT * FROM Win32_Process where name ='" & strTaskName & "'", "WQL", wbemFlagReturnImmediately + wbemFlagForwardOnly)

    For Each objItem In colItems
    if clng(objItem.WorkingSetSize/(1024*1024)) > clng(strWorkingSet) then


    strMsg = objItem.Name & "(이)가 WorkingSet 임계치(" & strWorkingSet & "MB)를 초과합니다. " & objItem.Name & "의 현재 WorkingSet은 " & clng(objItem.WorkingSetSize/(1024*1024)) & "MB 입니다."
    State = "Bad"
    end if
    Next

    Set shellobj = nothing

    Call oBag.AddValue("State",State)
    Call oBag.AddValue("Message",strMsg)
    Call oAPI.Return(oBag)

:
Posted by 커널64
2009. 6. 4. 11:33

HPC 2008 Management Pack 설정 (관리팩) SystemCenter2009. 6. 4. 11:33

1. 모든 노드(Head/Compute)에 대해 Agent Proxy 설정
2. 기본 작업 계정 설정
   - Cluster Admin 권한이 있는 작업 계정 생성
   - 생성한 작업 계정을 모든 노드의 기본 작업 계정으로 설정
3.  (Optional) 클러스터링의 경우
   - Head 노드와 SQL Server가 Clustering되어 있는 경우에는
     각 가상 Head 노드와 가상 SQL Server를 '유지관리모드'로 설정
4. 성능 임계치 모니터 설정
   - 다음 각 모니터는 기본적으로 사용하지 않는 상태이므로
      모니터링을 통해 '사용'으로 변경하는 작업이 필요

[모니터 이름/Target]
   - Cluster CPU Usage/HPC 2008 Head Node
   - Cluster Disk Throughput/HPC 2008 Head Node
   - Cluster Network Usage/HPC 2008 Head Node
   - Daily Job Queue Time/HPC 2008 Job Scheduler

:
Posted by 커널64
1. 모든 DC에 대해 Agent Proxy 설정

2. Replication Monitoring을 위한 Domain Admins 그룹의 계정 생성(예: AD-Repl-Mon)

3. ADSIEDIT를 이용해 OpsMgrLatencyMonitors 컨테이너 생성(자동으로 생성될 수 있음)
   - adsiedit.msc 실행
   - Domain [ComputerName] 더블클릭
   - DC = DomainName, DC = com 우클릭 > New > Object
   - OpsMgrLatencyMonitors 컨테이너 생성

4. RunAs account 생성 및 설정
   - Run As Account > Display Name: AD-REPL-MON > 계정 정보/암호 입력 > 생성
   - Run As Profile > AD MP Account 더블클릭 > 모든 DC에 대해 Run As Account 설정

5. Client Monitoring 활성화
   - 새 그룹 생성 > Display Name: AD Client Monitoring Group
   - Monitoring에 사용할 서버들을 구성원으로 추가
   - Authoring > Management Pack Objects > Discovery > AD Client Monitoring Discovery
       > Overrides > Overrides for Group > AD Client Monitoring Group 선택 > Enable: True

6. Intersite Replication Latency 임계치 수정
   - Authoring > Management Pack Objects > Monitor
       > Active Directory Domain Controller Server Computer Role > Entity Health > Availability
       > AD Replication Monitoring > Overrides > 개체 또는 그룹 선택
       > Intersite Expected Max Latency (min) 수정

7. Replcation Latency 보고서를 위한 성능 수집 활성화
   - Authoring > Management Pack Objects > Rule > Active Directory Domain Controller Server
       > AD Replication Monitoring Preformance Collection (Sources) > Override > Domain Contoller
   - Authoring > Management Pack Objects > Rule > Active Directory Domain Controller Server
       > AD Replication Monitoring Preformance Collection (Targets) > Override > Domain Contoller

8. Task에 대한 파라미터 설정
   - Windows Support Tools의 설치 경로 확인
   - Monitoring > Microsoft Windows Active Directory > Active Directory Server 2003 > DC Server 2003 State
   - Action 창에서 Task 실행 > Override 클릭 > 설치 경로로 Override
:
Posted by 커널64

ACS로 사용할 관리 서버 준비 후
1. ACS 보고 서버로 사용할 SRS 서버에 관리자 계정으로 로그인
2. 임시 폴더 생성 (예: C:\ACS)
3. 설치 미디어의 \ReportModels\acs 내용을 임시 폴더로 복사
4. 설치 미디어의 \SupportTools\ReportingConfig.exe 파일을 임시 폴더로 복사
5. 명령 프롬프트 실행해 임시 폴더로 이동 후 다음 명령 실행
UploadAuditReports "<AuditDBServer\Instance>" "<Reporting Server URL>" "<임시 폴더>"
(예: UploadAuditReports "AuditDbServer\Instance" http://ReportServer/ReportServer$instance" "C:\ACS")
위 명령을 통해 Db Audit라는 데이터 원본을 생성하고 Audit.smdl, Audit5.smdl 보고 모델을 업로드하고 Reports 폴더의 모든 보고서를 업로드한다.
6. 웹브라우저를 실행해 다음 URL로 접근한다.
http://<ReportingServerName>/Reports$<InstanceName>
7. Audit Reports 폴더 클릭, 오른쪽 상단의 Show Detail 클릭
8. 'Db Audit' 데이터원본 클릭
9. 인증을 'Windows Integrated Security'로 설정

:
Posted by 커널64
Symptoms:
Event Type: Error
Event Source: Health Service Modules
Event Category: Data Warehouse
Event ID: 31569
사용자 삽입 이미지

Data Warehouse failed to enumerate database components to be deployed. Failed to enumerate Data Warehouse components for deployment. The operation will be retried. Exception 'SqlException': Timeout expired. The timeout period elapsed prior to completion of the operation or the server is not responding. One or more workflows were affected by this. Workflow name: Microsoft.SystemCenter.DataWarehouse.Deployment.Component Instance name: <Instance name> Instance ID: {AC6FACD9-

Resolution:
1. OpsMgr DW 데이터베이스에 대해 exec sp_updatestats 실행
2. 1의 방법으로 해결되지 않을 경우
http://support.microsoft.com/?kbid=954643 설치 후
Managementpackinstall.sp.sql 쿼리 실행
:
Posted by 커널64

Component

Exception

Port and Protocol

Configured By

RMS

·         System Center Management service

·         System Center Data Access service

·         Operations Manager Connector Framework

·         Operations Manager Customer Experience Improvement

·         Operations Manager Application Error Monitoring

5723/TCP

5724/TCP

51905/TCP

51907/TCP

51906/TCP

Setup

Setup

Setup

Setup

Setup

Management server

·         System Center Management service

·         System Center Data Access service

·         Operations Manager Connector Framework

·         Operations Manager Customer Experience Improvement

·         Operations Manager Application Error Monitoring

5723/TCP

5724/TCP

51905/TCP

51907/TCP

51906/TCP

Setup

Setup

Setup

Setup

Setup

Web console

Operations Manager Web console

51908/TCP

Setup

Web console, forms authentication, http

World Wide Web Services, http

80/TCP

Windows Firewall

Web console, forms authentication, https

Secure World Wide Web Service

443/TCP

Windows Firewall

OperationsManager database

·         SQL Server database server

·         If using a named instance, add

1433/TCP

1434/UDP

Windows Firewall

Windows Firewall

Operations Manager data warehouse database

·         SQL Server database server

·         If using a named instance add

1433/TCP

1434/UDP

Windows Firewall

Windows Firewall

Operations Manager Reporting

SQL Server Reporting Services

80/TCP

Windows Firewall

Agent, manual installation of MOMAgent.msi

System Center Management service

5723/TCP

Windows Firewall

Agent, push installation

·         System Center Management Service

·         File and Print Sharing

·         Remote Administration

5723/TCP

137/UDP, 138/UDP, 139/TCP, 445/TCP

135/TCP, 445/TCP

Windows Firewall

Windows Firewall

Windows Firewall

Agent, pending repair

·         System Center Management service

·         File and Print Sharing

·         Remote Administration

5723/TCP

137/UDP, 138/UDP, 139/TCP, 445/TCP

135/TCP, 445/TCP

Windows Firewall

Windows Firewall

Windows Firewall

Agent, pending upgrade

·         System Center Management service

·         File and Print Sharing

·         Remote Administration

5723/TCP

137/UDP, 138/UDP, 139/TCP, 445/TCP

135/TCP, 445/TCP

Windows Firewall

Windows Firewall

Windows Firewall

gateway

System Center Management Service

5723/TCP

Setup

Operations Manager Audit Collection Service database

·         SQL Server

·         If using a named instance, add

1433/TCP

1434/UDP

Windows Firewall

Windows Firewall

Operations Manager Audit Collection Service Collector

ACS Collector Service

51909/TCP

Windows Firewall

 

:
Posted by 커널64