2013年3月21日 星期四

Zabbix安裝SOP

環境
OS: Linux RedHat 5.5

1.安裝 RedHat5.5
因為該死的Zabbix只能安裝在Linux系統上,再加上公司決定使用RedHat作為資料庫的系統,所以我們只好安裝這不熟悉的小紅帽(不然筆者超想用Ubuntu)。
首先拿出RedHat光碟片放進光碟機裡開始安裝,
接著安裝細節就不多說了,
這裡提醒一點,
因為之後安裝Zabbix時需要PHP5. MySQL. Apache2..等套件,
而安裝這些套件又需要其他雜七雜八套件的相依性,
所以建議把相關的套件能勾的就勾吧。

2.檢查安裝套件
安裝完RedHat後,
我們要檢查套件是否有安裝,
輸入以下指令來檢查PHP5. MySQL與相關套件是否有安裝:
# rpm -qa | grep mysql
# rpm -qa | grep php
以此類推檢查所需的套件
(zlib-devel. openssl-devel. libxml2-devel. flex. bison. gcc. automake. autoconf. snmp. 
rrdtool. php-gd. php-mysql. php-pear. apache2. mysql. php...),
如果沒有的話就拿出光碟一一的安裝吧,
安裝時可以直接Double Click rpm套件檔安裝,
也可用指令進行安裝:
# rpm -ivh <package name>

2013年3月20日 星期三

看懂AWR


原始出處AWR分析


Host CPU (CPUs: 4 Cores: 2 Sockets: 1)
Load Average BeginLoad Average End%User%System%WIO%Idle
4.94.091.2
  • 在OS來說CPU的使用率=Busy + Idle→所以在這裡Busy%=1-91.2=8.8%
  • 搭著Operating System Statistics看
    • %User = USER_TIME/(BUSY_TIME+IDLE_TIME)*100 
      • 18457/(33590+345995)*100=4.86 
    • %Sys  = SYS_TIME/(BUSY_TIME+IDLE_TIME)*100
      • 15133/379585=3.98
    • %Idle = IDLE_TIME/(BUSY_TIME+IDLE_TIME)*100
      • 345995/379585=91.15

Operating System Statistics

  • *TIME statistic values are diffed. All others display actual values. End Value is displayed if different
  • ordered by statistic type (CPU Use, Virtual Memory, Hardware Config), Name
StatisticValueEnd Value
AVG_BUSY_TIME8,372
AVG_IDLE_TIME86,474
AVG_SYS_TIME3,761
AVG_USER_TIME4,590
BUSY_TIME33,590
IDLE_TIME345,995
SYS_TIME15,133
USER_TIME18,457
RSRC_MGR_CPU_WAIT_TIME0
VM_IN_BYTES66,340,137,790,754,816
VM_OUT_BYTES-144,554,992,965,316,608
PHYSICAL_MEMORY_BYTES8,470,183,936
NUM_CPUS4
NUM_CPU_CORES2
NUM_CPU_SOCKETS1
  • BUSY_TIME + IDLE_TIME = ELAPSED_TIME * CPU_COUNT
  • 至于DB对CPU的利用情况,这就涉及到10g新引入的一个关于时间统计的视图了, v$sys_time_model,简单而言,Oracle采用了一个统一的时间模型对一些重要的时间指标进行了记录,具体而言,这些指标包括:
1) background elapsed time
    2) background cpu time
          3) RMAN cpu time (backup/restore)
1) DB time
    2) DB CPU
    2) connection management call elapsed time
    2) sequence load elapsed time
    2) sql execute elapsed time
    2) parse time elapsed
          3) hard parse elapsed time
                4) hard parse (sharing criteria) elapsed time
                    5) hard parse (bind mismatch) elapsed time
          3) failed parse elapsed time
                4) failed parse (out of shared memory) elapsed time
    2) PL/SQL execution elapsed time
    2) inbound PL/SQL rpc elapsed time
    2) PL/SQL compilation elapsed time
    2) Java execution elapsed time
    2) repeated bind elapsed time
  • 紅色的兩個CPU時間才需要注意,並且在Time Model Statistics也可以看到。

2013年3月14日 星期四

.NET Debugging Demos Lab 4: High CPU Hang - Review

原始文章出處:.NET Debugging Demos Lab 4: High CPU Hang - Review

Reproducing the issue:

  1. 重啟IIS (IISReset)
  2. 瀏覽http://localhost/BuggyBits/AllProducts.aspx 
  3. 當瀏覽這個網頁時,觀看工作管理員的CPU使用率
    • Q: What is the CPU usage like for w3wp.exe during the processing of this request?
    • A: Very high, approaching 100% 

Set up a performance counter log:

Prepare to gather a memory dump:

  • 開啟cmd.exe並移至debuggers 目錄並輸入adplus -hang -pn w3wp.exe -quiet -o D:\Dump但不要按下enter

2013年3月12日 星期二

.NET Debugging Demos Lab 3: Memory - Review

原始文章:
.NET Debugging Demos Lab 3: Memory
.NET Debugging Demos Lab 3: Memory - Review

Set up a performance monitor log

  1. 開啟http://127.0.0.1/Links.aspx 頁面
  2. 開啟效能監視器(所有程式→系統管理工具)
    1. 執行→新增資料收集器集合工具→名稱lab3-memory、手動建立
    2. 勾選效能計數器
    3. 新增(抽樣間隔1秒):
      1. .NET CLR Memory的w3wp
      2. Process的w3wp
    4. 根目錄→可以自選(ex. D:\Logs)
    5. 執行身分(工作管理員權限)
    6. 點選儲存後開啟

WinDbg_!address 說明文件


The following filter values specify memory regions by the way that the target process is using them.
Filter value Memory regions displayed
VAR Busy regions. These regions include all virtual allocation blocks, the SBH heap, memory from custom allocators, and all other regions of the address space that fall into no other classification.
Free Free memory. This includes all memory that has not been reserved.
Image Memory that is mapped to a file that is part of an executable image.
Stack Memory used for thread stacks.
Teb Memory used for thread environment blocks (TEBs).
Peb Memory used for the process environment block (PEB).
Heap Memory used for heaps.
PageHeap The memory region used for the full-page heap.
CSR CSR shared memory.
Actx Memory used for activation context data.
NLS Memory used for National Language Support (NLS) tables.
FileMap Memory used for memory-mapped files. This filter is applicable only during live debugging.

2013年3月11日 星期一

WinDbg_DumpHeap說明

0:000> !help DumpHeap
-------------------------------------------------------------------------------
!DumpHeap [-stat]
          [-strings]
          [-short]
          [-min <size>]
          [-max <size>]
          [-thinlock]
          [-startAtLowerBound]
          [-mt <MethodTable address>]
          [-type <partial type name>]
          [start [end]]

!DumpHeap is a powerful command that traverses the garbage collected heap,
collection statistics about objects. With it's various options, it can look for
particular types, restrict to a range, or look for ThinLocks (see !SyncBlk
documentation). Finally, it will provide a warning if it detects excessive
fragmentation in the GC heap.

2013年3月8日 星期五

.NET Debugging Demos Lab 2: Crash - Review

文章原始出處:.NET Debugging Demos Lab 2: Crash - Review

Reproduce the problem

  1. 開啟http://127.0.0.1/Reviews.aspx頁面
  2. Click Refresh按鈕後,將會crash w3wp.exe。Note:如果你有Visual Studio,它可能會引起Debugg視窗,選擇no即可。

2013年3月7日 星期四

.NET Debugging Demos Lab 1: Hang - Review

Note:Debug的結果跟Thread ID會因為操作的速度以及基礎環境而有所出入。原作者使用W2k3,而作者我是用Win7。
原始出處.NET Debugging Demos Lab 1: Hang - Review

Reproduce the problem:

  1. 瀏覽http://localhost/BuggyBits/FeaturedProducts.aspx
    • 顯示這個頁面需要五秒,可以在頁面下看到開始跟執行時間。
  2. 開啟五個相同的頁面,並且盡量同時重整頁面(reflash)
    • 留意每個頁面的執行時間,並且確認開始時間是幾乎相同的(如果沒有,就代表可能沒有先執行一開始說的reg)
    • Q:執行時間分別為多少?
    • A:依序應該是5s、9.3s、13.96s、17.99、21.53(會有出入,不過如果看到的都是5s那就表示,你沒有幾乎同時的送出request)
    • Q:從工作管理員觀看w3wp.exe的CPU使用率,是高還是低?
    • A:非常低,根本就是0

2013年3月6日 星期三

.NET Debugging Demos - Information and setup instructions

翻譯自Tess  .NET Debugging Demos - Information and setup instructions
希望有需要的人可以看得懂

.NET Debugging Demos

這一系列的Debugging Demos目的在協助體驗Debugging在.Net application中最常見的Hang/performance, memory and crash 狀況。

因為範例是用ASP.NET,所以在開發及範例的環境下需要有IIS以及.net framework 2.0,
所有的範例都是使用同一個網站。

Note: 這些範例將會導致高CPU使用率,高記憶體使用率以及Crash,所以必須確保你只有安裝這個範例,避免其他的網站或應用程式所發生的hanging及Crashing干擾學習Debugging。