eAccelerator と monit

monit web管理画面はdelayしたぶんだけ502返すからmonit -vIでCUIで動作確認するしかない。設定が起動時にdisableになったりとか高負荷だとはまるところおおい

monitでapacheが1900M使ったらstop&startする設定

check process apache with pidfile /usr/local/apache2/logs/httpd.pid
start program = "/etc/init.d/apache2 start"
stop program = "/etc/init.d/apache2 stop"
if totalmem > 1900 Mb for 3 cycles then restart

stop&startするとeAcceleratorの共有メモリ(コンパイル済みPHP)は破棄される


eAcceleratorのcontrol.phpを見ていて気付いたのだけど
eAcceleratorの共有メモリは MaxRequestsPerChild の数が来てもクリアされない
apacheのプロセスがでかくなるような環境では早めに殺してしまうほうがよい
MaxRequestsPerChild 100とか

結論:monitいらないかも?

Amazon Product APIでかえってきたデータを整形する

文字コードはutf8 tr($zen, $han)の中はEUC出ないとダメ(ハマッタ)

use Jcode;
use Encode;

my $zen = '0-9 ()';
my $han = '0-9 ';
Encode::from_to($zen, 'utf-8','euc-jp');
Encode::from_to($han, 'utf-8','euc-jp');

my $title= "デッドマン・ワンダーランド (10)";
$title = jcode($title)->tr($zen, $han, 'd')->utf8;
print "TITLE:$title\n";

デッドマン・ワンダーランド 10

child pid ????? exit signal File size limit exceeded (25)

[Mon Oct 19 04:02:05 2009] [notice] child pid 16503 exit signal File size limit exceeded (25)
[Mon Oct 19 04:02:05 2009] [notice] child pid 16507 exit signal File size limit exceeded (25)
[Mon Oct 19 04:02:05 2009] [notice] child pid 16509 exit signal File size limit exceeded (25)

こんなわかりやすいエラーがずっと出ていた。(ログ2G超えたらアクセス不能)
そのときのmuninの
apache_accesses_day
apache_volume-day
netstat-day
のグラフ


netstatでは接続がきてるのに接続できてない様子がよくわかる

対策方法は画像をログに取らないで回避(httpd.conf)

SetEnvIf Request_URI "\.(png)|(jpg)|(gif)$" no-log
CustomLog /home/www/logs/access_log combined env=!no-log

SetEnvIf入っててよかった

check_rbl覚書

https://trac.id.ethz.ch/projects/nagios_plugins/wiki/check_rbl


管理サーバーのIPをcheck_rblで監視していたら11時くらいから bl.spamcop.net に登録されたらしく通知が来始める。13時より打ち合わせなのでとりあえず「Acknowledge this service problem」を発行して放置


spamcop 解除とかで調べると
登録して24時間以内に本登録がなければ自働解除されるようなので、そのまま放置することに
本日11時、nagiosの通知が来て24時間後に解除されたようでRecoveryメールが来て一見落着

3ware 3DM RAID1死亡

先日より立て続けにエラーメールが出ていたのだけど

3ware 3DM alert -- host: www.example.com

WARNING: Drive sector ECC error corrected on port 1 on controller ID:0. (0x23)

source: www.example.com

本日下記2通が来て完全にお亡くなりに

3ware 3DM alert -- host: www.example.com

WARNING: Drive timeout encountered on port 1 on controller ID:0. Check cables and drives for media errors. (0x9)

source: www.example.com

3ware 3DM alert -- host: www.example.com

ERROR: Disk Array Unit 0 on controller ID:0 is degraded and no longer fault tolerant. Check log for drive errors. (0x2)

Fault tolerant disk arrays become degraded or incomplete when they cannot write to or read from a member drive. The array's data may be read and new data may be written to the array, however, the array is still NO LONGER FAULT TOLERANT.

When an array is degraded or incomplete you have three courses of action:

1. Replace the suspected drive and REBUILD the array using 3DM.See the Configure page.

2. BRING THE SYSTEM DOWN and check cabling and connections. Reboot the system and attempt to REBUILD THE ARRAY using the 3ware Disk Array Configuration Utility BIOS extension.

3. DO NOTHING and continue operating with the array functional but not fault tolerant.

NOTE: Please examine the 3DM ALARMS page fr more information regarding the cause of the failure.



source: www.example.com

logwatchではこんな感じ

--------------------- Kernel Begin ------------------------


2 Time(s): 3w-xxxx: scsi0: AEN: WARNING: Sector repair occurred: Port #1.

---------------------- Kernel End -------------------------

やっててよかったRAID1。寿命は4年と1月でした。

[Apache] slowloris

Apacheに新たな脆弱性発見
http://slashdot.jp/security/article.pl?sid=09/06/23/0455215

http://ha.ckers.org/slowloris/

簡単に接続できない状況にもっていけますね。
自分の管理外のとこにやって捕まっても知らないので…