[Fed11-2nd] apacheとmuninで簡易監視!

まずは下準備。
ファイアウォール構築(iptables)
http://fedorasrv.com/iptables.shtml
ここでミスるとSSHで入れなくなるw 当たり前ですけど、rebootできるようにしておきましょう^^;
ほとんどコピペでいけます。動く事が確認できたら必要な設定以外コメントアウトしてポートは閉じておきましょう^^;
Webサーバー構築(Apache)
http://fedorasrv.com/apache.shtml
とりあえず標準的な設定をして、外から見れるようにしておく。
まだインストールしてなければ。yum -y isntall munin munin-node
mkdir /usr/log/munin
chown munin. /usr/log/munin

vim /etc/munin/munin.conf
htmldir /usr/log/munin

vim /etc/httpd/conf.d/munin.conf
Alias /munin/ “/usr/log/munin/”

AllowOverride None
Options None
Order allow,deny
Allow from all

service httpd restart
service munin-node restart
chkconfig munin-node on
chkconfig munin-node –list
とりあえず動作の確認。10分たってインデックスページが作成されない場合は所有者など確認するということで。Fedora8までは小細工しないとうまく動作した記憶がないけど最近は特に問題もなく動作するようですw
◆munin:Apache関連のグラフを表示させる
まずはシンボリックリンクを張りましょう。
ln -s /usr/share/munin/plugins/apache_accesses /etc/munin/plugins/apache_accesses
ln -s /usr/share/munin/plugins/apache_processes /etc/munin/plugins/apache_processes
ln -s /usr/share/munin/plugins/apache_volume /etc/munin/plugins/apache_volume
それからhttpd.confを開き、以下の行があることを確認。コメントアウトしていたら戻しておきましょう。サーバの活動状況と性能に関する情報を提供する「mod_status」がオフだとプラグインが動作できません。
LoadModule status_module modules/mod_status.so
次にStatusを使用可能にするため、以下のコードを追加、あるいはコメントアウトから戻して変更します。ポイントは「Allow from」のあとにローカルホストから閲覧できるように設定しておくこと。これを設定していないと値が取得できません。127.0.0.1とかlocalhostとかあるいはIPアドレスを割り振っているならばローカルから参照できるIPアドレスを指定しましょう。

SetHandler server-status
Order Deny,Allow
Deny from all
Allow from 127.0.0.1
Allow from localhost

それから、ExtendedStatusを「On」にしておきましょう。
ExtendedStatus On
あとは「/etc/init.d/munin-node restart」として、munin-nodeを再起動させれば完了。
◆munin:FANの回転数を表示させる
温度・FAN・電圧を追加
ln -s /usr/share/munin/plugins/sensors_ /etc/munin/plugins/sensors_volt
ln -s /usr/share/munin/plugins/sensors_ /etc/munin/plugins/sensors_temp
ln -s /usr/share/munin/plugins/sensors_ /etc/munin/plugins/sensors_fan
◆munin:Hddの温度を表示させる
ln -s /usr/share/munin/plugins/hddtemp_smartctl /etc/munin/plugins/hddtemp_smartctl
vim /etc/munin/plugin-conf.d/hddtemp_smartctl
[hddtemp_smartctl]
user root
env.drives sda
env.type_sda ata

“φ(・_.) メモッ!HDDのステータス
# smartctl –all /dev/sda
smartctl version 5.38 [i386-redhat-linux-gnu] Copyright (C) 2002-8 Bruce Allen
Home page is http://smartmontools.sourceforge.net/
=== START OF INFORMATION SECTION ===
Model Family: Western Digital Caviar Second Generation Serial ATA family
Device Model: WDC WD5000AAKS-00TMA0
Serial Number: WD-WCAPW0603116
Firmware Version: 12.01C01
User Capacity: 500,107,862,016 bytes
Device is: In smartctl database [for details use: -P show]
ATA Version is: 7
ATA Standard is: Exact ATA specification draft version not indicated
Local Time is: Wed Nov 11 11:32:35 2009 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: (0x82) Offline data collection activity
was completed without error.
Auto Offline Data Collection: Enabled.
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: (12000) seconds.
Offline data collection
capabilities: (0x7b) SMART execute Offline immediate.
Auto Offline data collection on/off support.
Suspend Offline collection upon new
command.
Offline surface scan supported.
Self-test supported.
Conveyance Self-test supported.
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: ( 2) minutes.
Extended self-test routine
recommended polling time: ( 150) minutes.
Conveyance self-test routine
recommended polling time: ( 6) minutes.
SCT capabilities: (0x303f) SCT Status supported.
SCT Feature Control supported.
SCT Data Table supported.
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 0x000f 200 200 051 Pre-fail Always – 0
3 Spin_Up_Time 0x0003 169 166 021 Pre-fail Always – 6541
4 Start_Stop_Count 0x0032 099 099 000 Old_age Always – 1225
5 Reallocated_Sector_Ct 0x0033 200 200 140 Pre-fail Always – 0
7 Seek_Error_Rate 0x000e 200 200 051 Old_age Always – 0
9 Power_On_Hours 0x0032 088 088 000 Old_age Always – 9064
10 Spin_Retry_Count 0x0012 100 100 051 Old_age Always – 0
11 Calibration_Retry_Count 0x0012 100 100 051 Old_age Always – 0
12 Power_Cycle_Count 0x0032 100 100 000 Old_age Always – 572
192 Power-Off_Retract_Count 0x0032 200 200 000 Old_age Always – 54
193 Load_Cycle_Count 0x0032 200 200 000 Old_age Always – 1227
194 Temperature_Celsius 0x0022 112 095 000 Old_age Always – 38
196 Reallocated_Event_Count 0x0032 200 200 000 Old_age Always – 0
197 Current_Pending_Sector 0x0012 200 200 000 Old_age Always – 0
198 Offline_Uncorrectable 0x0010 200 200 000 Old_age Offline – 0
199 UDMA_CRC_Error_Count 0x003e 200 200 000 Old_age Always – 3
200 Multi_Zone_Error_Rate 0x0008 200 200 051 Old_age Offline – 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]
SMART Selective self-test log data structure revision number 1
SPAN MIN_LBA MAX_LBA CURRENT_TEST_STATUS
1 0 0 Not_testing
2 0 0 Not_testing
3 0 0 Not_testing
4 0 0 Not_testing
5 0 0 Not_testing
Selective self-test flags (0x0):
After scanning selected spans, do NOT read-scan remainder of disk.
If Selective self-test is pending on power-up, resume after 0 minute delay.

◆munin:CPUスピードの表示
今のATOMにゃ用はないけどCPUの省エネ設定が有効になってクロックが下がっているのを確認したいときに使うアレ、、、さらに“φ(・_.) メモッ!
muninのプラグインの追加/削除
http://d.hatena.ne.jp/over80/20080701/1214926377
(download)
# wget “http://muninexchange.projects.linpro.no/download.php?phid=243”
# mv “download.php?phid=243″cpuspeed2
# chmod +x /usr/share/munin/plugins/cpuspeed2
# ln -s /usr/share/munin/plugins/cpuspeed2 /etc/munin/plugins/
# service munin-node restart
・削除したい項目はプラグインの中からがりがり削る。
・元ファイルではなくシンボリックリンクのほうです^^;

Fedora11
スポンサーリンク
極彩色のハテナ?