透過CentOS 6 Linux ipmitool設定Dell C6100 IPMI IP Address

參考資料:
http://www.thomas-krenn.com/en/wiki/Configuring_IPMI_under_Linux_using_ipmitool

#安裝ipmitool
yum -y install ipmitool

# 啟動IPMI kernel module
# ref: http://serverfault.com/questions/480371/ipmitool-cant-find-dev-ipmi0-or-dev-ipmidev-0
modprobe ipmi_devintf
#modprobe ipmi_si

#列出目前設定
ipmitool lan print

#使用固定IP方式設定
ipmitool lan set 1 ipsrc static
ipmitool lan set 1 ipaddr 172.31.10.21
ipmitool lan set 1 netmask 255.255.255.0
ipmitool lan set 1 defgw ipaddr 172.31.10.254

#修改密碼
#ref: http://serverfault.com/questions/85042/is-it-possible-to-reset-the-password-on-a-supermicro-ipmi-interface
ipmitool user list 1
ipmitool -I open user set password 2 mypassword

 

Linux CentOS 6安裝nagios監控

安裝環境檢查

  • Linux CentOS 6.5 x86_64 (本範例採用環境)
  • 確定已安裝好EPEL repository
    • rpm -qa|grep epel (檢查是否已有epel)
    • 若沒有安裝請使用下面指令安裝EPEL
      rpm -ivh http://mirror01.idc.hinet.net/epel/6/x86_64/epel-release-6-8.noarch.rpm

安裝nagios

#安裝nagios相關RPM
yum -y install nagios nagios-plugins-all

#設定nagiosadmin預設密碼
htpasswd -m /etc/nagios/passwd nagiosadmin (執行後輸入要修改的密碼)

#設定開機自動啟動nagios
chkconfig nagios on

#檢查nagios相關設定是否正確 (修改設定後建議都先跑一次)
nagios -v /etc/nagios/nagios.cfg

#啟動nagios服務
service nagios start

 

 

 

XenServer 6.2 NFS SR無法移除解法

問題:

供裝/刪除VM時NFS Storage本身或是Storage網路有問題,導致供裝/刪除VM程序不完整,此時會造成VM上Disk相關資訊殘留在XenServer上

參考資料:
http://playingwithtechnology.com/unable-to-delete-xenserver-vdi/
http://discussions.citrix.com/topic/307439-vdi-in-use-but-its-not-really/

解法:

#找到要修復的SR UUID
xe sr-list|grep omnios-zfs01 -B 3

#列出此SR內之vdi
xe vdi-list sr-uuid=d034edd0-aa37-be67-ef99-abb1e89e88ba

#找到要刪除之vdi uuid後先嘗試刪除
xe vdi-destroy uuid=777f68db-0260-448c-a93c-cd610a734aff

#若無法直接刪除則需找到vbd uuid將其unplug及destroy
xe vbd-list vdi-uuid=777f68db-0260-448c-a93c-cd610a734aff
xe vbd-unplug uuid=ba59a452-ee88-d51c-998e-125511e4c80c
xe vbd-destroy uuid=ba59a452-ee88-d51c-998e-125511e4c80c

圖檔補充說明:

xenserver-datastore-storage issue

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

xenserver-datastore-storage issue-fix

內部網路使用postfix發送/管理信件

參考資料:
http://blog.miniasp.com/post/2008/03/24/How-to-delete-undelivered-email-in-Postfix.aspx

 

新增/etc/postfix/transport-private-cloud檔案加入下面內容

*               smtp:10.160.1.1

 

執行下列指令

cd /etc/postfix
postmap hash:/etc/postfix/transport-private-cloud

 

修改/etc/postfix/main.cf增加下面設定

#透過command line發信時會帶test.chtos.info網域如root@test.chtos.info
#許多郵件主機會有防SPAM機制,若發信網域不存在mail會直接被reject
mydomain = test.chtos.info
myorigin = $mydomain

#設定mail relay
transport_maps = hash:/etc/postfix/transport-private-cloud

重新啟動postfix

service postfix restart

 

測試command line或是nagios發信

刪除mail queue (轉發自http://blog.miniasp.com/post/2008/03/24/How-to-delete-undelivered-email-in-Postfix.aspx)

# 刪除所有在 Queue 中的郵件
postsuper -d ALL

# 刪除所有正在 deferred 佇列中的郵件 ( 刪除曾經發送失敗的信 )
postsuper -d ALL deferred

# 刪除所有正在 deferred 佇列中的郵件 ( 可看出哪些信被刪除了 )
find /var/spool/postfix/deferred -type f -exec rm -vf \{\} \;

# 刪掉「三天以前」無法發出的郵件
find /var/spool/postfix/deferred -type f -mtime +3 -exec rm -f \{\} \;

# 列出目前所有無法發出的郵件
find /var/spool/postfix/deferred -type f -exec ls -l --time-style=+%Y-%m-%d_%H:%M:%S {} \;

# 刪除超過 5 天的 "defer" 佇列中的退信紀錄
find /var/spool/postfix/defer -type f -mtime +5 -exec rm -f \{\} \;

 

 

PowerCLI – 查詢/設定/重新啟動VMware Host NTP服務

參考資料
Setting ESXi DNS and NTP using PowerCLI

ESX(i) NTP Server settings: PowerCLI

$esxHosts = get-VMHost

foreach ($esx in $esxHosts) {
   Write-Host "Configuring NTP Client Policy on $esx" -ForegroundColor Green
   Get-VMHostService -VMHost $esx | where{$_.Key -eq "ntpd"} | Set-VMHostService -policy "on" -Confirm:$false

   Write-Host "Restarting NTP Client on $esx" -ForegroundColor Green
   Get-VMHostService -VMHost $esx | where{$_.Key -eq "ntpd"} | Restart-VMHostService -Confirm:$false

}

 

$vmhosts = Get-VMHost
$details = @()
foreach ($vmhost in $vmhosts) {
    $detail = "" | select Name,NTPServer
    $detail.Name = $vmhost.Name
    $detail.NTPServer = Get-VMHostNtpServer $vmhost
    $details += $detail
}

$details

 

bash script – 透過SNMP檢查VMWare Host NTP同步狀態

#!/bin/bash

for i in 18 19 21 22 23 24 25 26 27 28 29 30 31 32
do
  echo -n "  UCS:`printf %03d $i` "
  snmpwalk -c public -v 2c -Ov 172.24.2.$i hrSystemDate.0
done

for j in 2 3 4 5 6 7 8 18 19 20 21 22 23 24 34 35 36 37 38 39 40 50 51 52 53
do
  echo -n "Blade:`printf %03d $j` "
  snmpwalk -c public -v 2c -Ov 172.24.18.$j hrSystemDate.0
done

for k in {9..15} {25..31} {41..48} 54 {55..56}
do
  echo -n "Blade:`printf %03d $k` "
  snmpwalk -c public -v 2c -Ov 172.24.18.$k hrSystemDate.0
done

 

cacti thold plugin微調

預設Cacti thold plugin在發送告警email時rrd圖檔顯示的內容為1day週期,因特殊需求需調整成2hrs,需修改/usr/share/cacti/plugins/thold/thold_functions.php

2811,2815c2811
<                       #$graph_data_array = array('output_flag'=> RRDTOOL_OUTPUT_STDOUT);
<                         $graph_end_time = date("U");
<                         $graph_start_time = $graph_end_time - 7200;
<                         $graph_data_array = array('output_flag'=> RRDTOOL_OUTPUT_STDOUT, 'graph_start'=>$graph_start_time, 'graph_end'=>$graph_end_time);
<
---
>                       $graph_data_array = array('output_flag'=> RRDTOOL_OUTPUT_STDOUT);

 

幾個Windows 2008R2/Windows7可以設定proxy的位置

今天在幫客戶查WSUS無法使用問題時發現有可能是SID衝到需要sysprep調整SID,不過sysprep改完SID後仍無法WSUS?
透過netstat -na -p tcp指令持續觀察Windows update時的網路流量一直被導向到proxy

把下面相關的proxy設定移除即可 (Windows可以設定proxy的位置)

  1. Internet Explorer
    • 工具->網際網路選項->連線->區域網路設定->Proxy伺服器
  2. gpedit.msc
    • 使用者設定->Internet Explorer維護->連線->Proxy設定值
  3. netsh winhttp get proxy (很容易被忽略的地方)