|
1: 2009-08-19 (水) 00:37:54 maruo |
| + | [[Gentoo Linuxな生活/システム管理関連]] |
| | | |
| + | *サーバの監視に必要なこと [#xf4db2f8] |
| + | サーバ監視で必要なことと言えば、 |
| + | -ちゃんと動いているか? |
| + | |
| + | これに尽きると思います。で、ちゃんと動かなくなる要因といえば、 |
| + | -ソフトの異常 |
| + | -ハードの異常 |
| + | |
| + | この2つですね。ソフトの異常はインストールすればすぐにわかります。ハードの異常は、ある日突然やってきたりします。なので、予兆があるかどうかは、日々の監視が必要なのです。 |
| + | |
| + | *何を見ておこうか [#x99f8170] |
| + | まず何が壊れると一番まずいか。HDDです。HDDは消耗品ですし、寿命も比較的短いです。ですので、サーバのトラブルと言うと、大体HDDクラッシュが原因です。で、データが論理的に壊れるのは、データ管理に注意さえすれば何とかなります。ハードのクラッシュについては、温度が非常に重要なファクターを持っていると言われます。 |
| + | |
| + | *温度を監視しよう [#x2400f9f] |
| + | 最近のPCは、CPUの発熱も厳しいところから、センサーチップを搭載していたりします。ですので、このセンサーチップを読み取るツールがあればいろんな情報を見ることができます。 |
| + | |
| + | **lm_sensors [#f89d78bf] |
| + | lm_sensorsと言うツールで、センサーチップの情報を見ることができます。 |
| + | |
| + | # emerge lm_sensors |
| + | |
| + | インストール完了~ |
| + | **設定 [#yb15511a] |
| + | ***カーネル [#z2dc6f2d] |
| + | まずカーネルのI2Cドライバーコンフィグレーションを有効化してやります。 |
| + | <*> I2C support |
| + | <M> I2C device interface |
| + | I2C Algorithms ---> |
| + | I2C Hardware Bus support ---> |
| + | Hardware Sensors Chip support ---> |
| + | Other I2C Chip support ---> |
| + | |
| + | んで、I2C Hardware Bus support や、Hardware Sensors Chip supportも、有効にしておいてやりましょうね。 |
| + | |
| + | ***lm_sensors側 [#yded695f] |
| + | # sensors_detect |
| + | |
| + | コマンドを投入します。するてーと、メニュー形式で設定を保存してくれます。あとは |
| + | # rc-update add lm_sensors default |
| + | |
| + | でlm_sensorsを起動時に有効にするようにするとi2cデバイスを読み込んでくれます。 |
| + | |
| + | **使い方 [#kffd80b9] |
| + | # sensors |
| + | w83697hf-isa-0290 |
| + | Adapter: ISA adapter |
| + | VCore: +1.46 V (min = +1.71 V, max = +1.89 V) |
| + | +3.3V: +3.20 V (min = +3.14 V, max = +3.47 V) |
| + | +5V: +4.89 V (min = +4.76 V, max = +5.24 V) |
| + | +12V: +11.55 V (min = +10.82 V, max = +13.19 V) |
| + | -12V: -11.70 V (min = -13.18 V, max = -10.80 V) |
| + | -5V: -7.71 V (min = -5.25 V, max = -4.75 V) |
| + | V5SB: +5.54 V (min = +4.76 V, max = +5.24 V) |
| + | VBat: +3.06 V (min = +2.40 V, max = +3.60 V) |
| + | fan1: 0 RPM (min = 51923 RPM, div = 2) |
| + | fan2: 0 RPM (min = 225000 RPM, div = 2) |
| + | temp1: +29°C (high = +2°C, hyst = +0°C) sensor = thermistor |
| + | temp2: +17.0°C (high = +80°C, hyst = +75°C) sensor = thermistor |
| + | alarms: Chassis intrusion detection ALARM |
| + | beep_enable: |
| + | Sound alarm disabled |
| + | |
| + | eeprom-i2c-1-51 |
| + | Adapter: SiS96x SMBus adapter at 0x10c0 |
| + | Memory type: DDR SDRAM DIMM |
| + | Memory size (MB): 512 |
| + | |
| + | eeprom-i2c-1-50 |
| + | Adapter: SiS96x SMBus adapter at 0x10c0 |
| + | Memory type: DDR SDRAM DIMM |
| + | Memory size (MB): 512 |
| + | |
| + | eeprom-i2c-0-50 |
| + | Adapter: ivtv i2c driver #0 |
| + | Unknown EEPROM type (255). |
| + | |
| + | adm1030-i2c-1-2e |
| + | Adapter: SiS96x SMBus adapter at 0x10c0 |
| + | CPU Fan: 2537 RPM (min = 1323 RPM, div = 2) |
| + | SYS Temp: +46.8°C (low = +0°C, high = +60°C) |
| + | SYS Crit: +85°C |
| + | CPU Temp: +48.2°C (low = +40°C, high = +52°C) |
| + | CPU Crit: +85°C |
| + | |
| + | ほれ、どうですか?ちゃんと出ましたでしょ?つーか、何気にCPUとか、筐体内の温度が高いんだよね。う~ん、対策考えなきゃ、かなー。 |
| + | |
| + | |
| + | **smartデーモン [#b25ea45e] |
| + | smartとは、HDDの自己診断機能S.M.A.R.Tのことで、これを導入すると、S.M.A.R.T対応HDDでは自己診断して、やばそう!ってのを教えてくれたりします。 |
| + | |
| + | ***インストール [#q25463f0] |
| + | # emerge smartmontools |
| + | |
| + | 終了~ |
| + | ***設定 [#a6649f4b] |
| + | /etc/smartd.confを開きます。ほとんど書いてある例を参考にすればいいのですが、サンプルを参考にちょっと変えて、私はこんな感じで |
| + | /dev/hda -a -o on -S on -s (S/../.././04|L/../../6/05) -m mailowner |
| + | |
| + | 説明すると、-aはヘルスチェックステータス、Usageアトリビュートのエラーチェック、Prefailerアトリビュートチェック、Usageアトリビュートチェック、errorログ、selftestログなどを有効にするオプション、-oはオフラインテスト、-S はオートセーブ、-sはショートセルフテストを毎日4時、ロングセルフテストを土曜日の5時からスタート。で-mはステータスの変化があったらmailownerにメールする、てオプション。 |
| + | |
| + | これでsmartdを起動すればOK |
| + | |
| + | # rc-update add smartd default |
| + | |
| + | これでS.M.A.R.Tデーモン監視がスタートします。ちなみにコマンドラインでも情報が取れるとです。 |
| + | # smartctl -a /dev/hda |
| + | === START OF INFORMATION SECTION === |
| + | Device Model: HDS722516VLAT20 |
| + | Serial Number: VNR4GMC4GJR2KM |
| + | Firmware Version: V34OA60A |
| + | User Capacity: 164,696,555,520 bytes |
| + | Device is: In smartctl database [for details use: -P show] |
| + | ATA Version is: 6 |
| + | ATA Standard is: ATA/ATAPI-6 T13 1410D revision 3a |
| + | Local Time is: Sun Apr 17 00:10:59 2005 JST |
| + | SMART support is: Available - device has SMART capability. |
| + | SMART support is: Enabled |
| + | |
| + | === START OF READ SMART DATA SECTION === |
| + | SMART overall-health self-assessment test result: PASSED |
| + | |
| + | General SMART Values: |
| + | Offline data collection status: (0x00) Offline data collection activity |
| + | was never started. |
| + | Auto Offline Data Collection: Disabled. |
| + | Self-test execution status: ( 0) The previous self-test routine completed |
| + | without error or no self-test has ever |
| + | been run. |
| + | Total time to complete Offline |
| + | data collection: (3585) seconds. |
| + | Offline data collection |
| + | capabilities: (0x1b) SMART execute Offline immediate. |
| + | Auto Offline data collection on/off support. |
| + | Suspend Offline collection upon new |
| + | command. |
| + | Offline surface scan supported. |
| + | Self-test supported. |
| + | No Conveyance Self-test supported. |
| + | No Selective Self-test supported. |
| + | SMART capabilities: (0x0003) Saves SMART data before entering |
| + | power-saving mode. |
| + | Supports SMART auto save timer. |
| + | Error logging capability: (0x01) Error logging supported. |
| + | General Purpose Logging supported. |
| + | Short self-test routine |
| + | recommended polling time: ( 1) minutes. |
| + | Extended self-test routine |
| + | recommended polling time: ( 60) minutes. |
| + | |
| + | SMART Attributes Data Structure revision number: 16 |
| + | Vendor Specific SMART Attributes with Thresholds: |
| + | ID# ATTRIBUTE_NAME FLAG VALUE WORST THRESH TYPE UPDATED WHEN_FAILED RAW_VALUE |
| + | 1 Raw_Read_Error_Rate 0x000b 100 100 060 Pre-fail Always - 0 |
| + | 2 Throughput_Performance 0x0005 100 100 050 Pre-fail Offline - 0 |
| + | 3 Spin_Up_Time 0x0007 134 134 024 Pre-fail Always - 229 (Average 216) |
| + | 4 Start_Stop_Count 0x0012 100 100 000 Old_age Always - 55 |
| + | 5 Reallocated_Sector_Ct 0x0033 100 100 005 Pre-fail Always - 0 |
| + | 7 Seek_Error_Rate 0x000b 100 100 067 Pre-fail Always - 0 |
| + | 8 Seek_Time_Performance 0x0005 100 100 020 Pre-fail Offline - 0 |
| + | 9 Power_On_Hours 0x0012 099 099 000 Old_age Always - 8711 |
| + | 10 Spin_Retry_Count 0x0013 100 100 060 Pre-fail Always - 0 |
| + | 12 Power_Cycle_Count 0x0032 100 100 000 Old_age Always - 55 |
| + | 192 Power-Off_Retract_Count 0x0032 100 100 050 Old_age Always - 415 |
| + | 193 Load_Cycle_Count 0x0012 100 100 050 Old_age Always - 415 |
| + | 194 Temperature_Celsius 0x0002 125 125 000 Old_age Always - 44 (Lifetime Min/Max 25/54) |
| + | 196 Reallocated_Event_Count 0x0032 100 100 000 Old_age Always - 0 |
| + | 197 Current_Pending_Sector 0x0022 100 100 000 Old_age Always - 0 |
| + | 198 Offline_Uncorrectable 0x0008 100 100 000 Old_age Offline - 0 |
| + | 199 UDMA_CRC_Error_Count 0x000a 200 200 000 Old_age Always - 0 |
| + | |
| + | SMART Error Log Version: 1 |
| + | No Errors Logged |
| + | |
| + | SMART Self-test log structure revision number 1 |
| + | No self-tests have been logged. [To run self-tests, use: smartctl -t] |
| + | |
| + | |
| + | Device does not support Selective Self Tests/Logging |
| + | |
| + | こんな感じで情報が出てきます。かなり細かいでしょ?これで相当の情報が得られるはず。セルフテストでNGになってから壊れるとは限りませんけど、最低限の保障はほしいもんね。 |