perfmon 데이터를 c#으로 db에 쌓은 후 perfmon 으로 그리기
일단 원격 데이터 수집을 위해 리버스 하면서 수집한 정보를 조금 남겨둔다.
https://msdn.microsoft.com/en-us/library/aa371915(VS.85).aspx
The CounterData table contains a row for each counter that is collected at a particular time. There will be a large number of these rows.
The CounterData table defines the following fields:
- GUID: GUID for this data set. Use this key to join with the DisplayToID table.
- CounterID: Identifies the counter. Use this key to join with the CounterDetails table.
- RecordIndex: The sample index for a specific counter identifier and collection GUID. The value increases for each successive sample in this log file.
- CounterDateTime: The time the collection was started, in UTC time.
- CounterValue: The formatted value of the counter. This value may be zero for the first record if the counter requires two sample to compute a displayable value.
- FirstValueA: Combine this 32-bit value with the value of FirstValueB to create the FirstValue member ofPDH_RAW_COUNTER. FirstValueA contains the low order bits.
- FirstValueB: Combine this 32-bit value with the value of FirstValueA to create the FirstValue member ofPDH_RAW_COUNTER. FirstValueB contains the high order bits.
- SecondValueA: Combine this 32-bit value with the value of SecondValueB to create the SecondValue member ofPDH_RAW_COUNTER. SecondValueA contains the low order bits.
- SecondValueB: Combine this 32-bit value with the value of SecondValueA to create the SecondValue member ofPDH_RAW_COUNTER. SecondValueB contains the high order bits.
The GUID, CounterID, and RecordIndex fields make up the primary key for this table.
SecondValueA 와 B
timestamp 값이다. 결국 1초 차이는 3312642 라는 systemfrequency 이고 TimeStamp 값에 1초마다 차곡 차곡 더해진다. 이 값을 32bit Value 2개에 나누어 담아서 secondValueA 를 하위값 secondValueB 를 상위값으로 기록 (만철이가 리버스 함)
countertype 별 timebasea
=DEC2BIN(MOD(QUOTIENT(A1,256^3),256),8)&DEC2BIN(MOD(QUOTIENT(A1,256^2),256),8)&DEC2BIN(MOD(QUOTIENT(A1,256^1),256),8)&DEC2BIN(MOD(QUOTIENT(A1,256^0),256),8)
timebasea 는 SystemFrequency 이거나 10000000 인데 countertype 에 종속된다. 자세한 컬럼은 위 그림을 참고한다.
virtual Machine 은 10000000 이다.
DefaultSclae 은 모두 0으로 두고 모니터링 할 때 선택한 카운터 배율조정을 선택해 모두 잘 나타낼 수 있도록 만들면 된다.
counterdata 의 multicount 는 모두 0으로 해도 이상없이 데이터가 출력된다.
workgroup 환경에서 원격서버의 데이터를 수집하기 위해서는 가장(Impersonation)을 통해 로그인 한다.
이제 perfmon extendedevent dmv 모두 수집할 수 있다.
일정 잡고 만들면 된다. 만드는건 쉽다........아~ 돌아버릴뻔~