2015年2月3日 星期二

將 Linux initrd micro code 格式 initramfs 檔案轉為一般格式


$_MICRO_CODE  micro code 格式 initramfs 檔案
$_NEWINITRD     轉換的檔案名稱

dd if=$_MICRO_CODE of=$_NEWINITRD bs=512 skip=$(cpio -t <$_MICRO_CODE 2>&1 |grep blocks |cut -d " " -f 1)

LogAnalyzer 遺失帳號密碼

update logcon_users set password=MD5('password') where username='admin';

LogAnalyzer 3.4.3 + Syslog 建置摘要

環境: CentOS 6.2, LogAnalyzer 3.4.3

安裝需求套件

    # yum install rsyslog rsyslog-mysql mysql-server \
          httpd mod_ssl php php-gd php-mysql

建立 Syslog 資料庫

    # mysql -u root -p < $(rpm -ql rsyslog-mysql | grep sql$)

Syslog 資料庫權限設置

    # mysql -u root -p -A mysql

        mysql> grant all privileges on Syslog.* to logger@localhost identified by 'loggerspasswd';
        mysql> flush privileges;
        mysql> exit

編輯 rsyslog.conf

    # vi /etc/rsyslog.conf

        於 #### MODULES #### 下一列加入
        $ModLoad ommysql.so

        取消以下內容的註解符號
        $ModLoad imudp.so
        $UDPServerRun 514

        於 #### RULES #### 下一列加入:
        *.* :ommysql:127.0.0.1,Syslog,logger,loggerspasswd

        若要將遠端設備的 Log 記錄寫在某個檔案中, 可加入以下內容:
        +ServerA
        *.* /var/log/server-a.log

        +ServerB
        *.* /var/log/server-b.log

        註. ServerA 與 ServerB 必須符合 SysLog 裡所出現的主機名稱; 完成後記得編輯 /etc/logrotate.d/syslog 讓 logrotate 處理這些新增加的 log 檔

重新啟動 rsyslog 服務

    # service rsyslog restart

讓其他的 Linux Server 傳遞 Syslog 記錄給 Log Server

    # vi /etc/rsyslog.sys

        於 RULES 加入以下內容
        *.*    @my.log.server:514
        註: @ 表示 UDP 傳輸; @@ 表示 TCP 傳輸

    # service rsyslog restart

安裝 LogAnalyzer (下載頁面: http://loganalyzer.adiscon.com/downloads)

    # wget http://download.adiscon.com/loganalyzer/loganalyzer-3.4.3.tar.gz
    # tar zxf loganalyzer-3.4.3.tar.gz
    # rsync -a loganalyzer-3.4.3/src/. /var/www/LogAnalyzer/
    # cd /var/www/LogAnalyzer
    # touch config.php
    # chmod 666 config.php
    # vi /etc/httpd/conf.d/ssl.conf

        DocumentRoot /var/www/LogAnalyzer
        ServerName my.log.server:443

開啟瀏覽器連入 Log Server, 開始進行 LogAnalyzer 初始化設置

    Step 3 - Basic Configuration:

        Enable User Database: Yes
        Database Name: Syslog
        Database User: logger
        Database Password: loggerspasswd
        Require user to be logged in: Yes

dmidecode 指令摘要

查詢特定 type 
dmidecode -t 0   #僅查詢 BIOS

DMI 支援的 type 
DMI TYPES
       The SMBIOS specification defines the following DMI types:

       Type   Information
       
          0   BIOS
          1   System
          2   Base Board
          3   Chassis
          4   Processor
          5   Memory Controller
          6   Memory Module
          7   Cache
          8   Port Connector
          9   System Slots
         10   On Board Devices
         11   OEM Strings
         12   System Configuration Options
         13   BIOS Language
         14   Group Associations
         15   System Event Log
         16   Physical Memory Array
         17   Memory Device
         18   32-bit Memory Error
         19   Memory Array Mapped Address
         20   Memory Device Mapped Address
         21   Built-in Pointing Device
         22   Portable Battery
         23   System Reset
         24   Hardware Security
         25   System Power Controls
         26   Voltage Probe
         27   Cooling Device
         28   Temperature Probe
         29   Electrical Current Probe
         30   Out-of-band Remote Access
         31   Boot Integrity Services
         32   System Boot
         33   64-bit Memory Error
         34   Management Device
         35   Management Device Component
         36   Management Device Threshold Data
         37   Memory Channel
         38   IPMI Device
         39   Power Supply