2008年4月28日星期一

mailgraph on RHEL 3

為免mon住第二部mail server,我其實之前已經install過一次mail graph,但係好神奇咁成個mailgraph唔見左...

Anyway,可能自己之前發神經install錯左响第二部server上面啦,其實而家真係講咩都無意思,嘅然無左就再install過咪算囉...其實mailgraph嘅install都幾易,只係上去佢個website download個tar.gz落嚟.然後跟住佢個README做就得.不過世事點會咁易就搞得掂架...

為左唔駛下次又R哂頭都唔知點算,我就將今次嘅經驗寫低落嚟:-

cd tmp
mkdir mailgraph
cd mailgraph
wget http://mailgraph.schweikert.ch/pub/mailgraph-1.14.tar.gz

tar -xvzf mailgraph-1.14.tar.gz
cd mailgraph-1.14

cp mailgraph.cgi /var/www/cgi-bin/
cp mailgraph.pl /usr/local/bin
cp maiilgraph-init /etc/init.d

chkconfig --add mailgraph-init

本來以為已經搞掂,但係當然無咁易啦,一行"server maiilgraph-init start"就比佢鬧”mailgraph-init: unrecognized service”...但係我”chkconfig --list”又見”mailgraph-init 0:off 1:off 2:on 3:on 4:on 5:on 6:off”,之後試吓"chkconfig --del mailgraph-init"再用"chkconfig --add mailgraph-init" add佢一次,但係個result都係一樣.check左/etc/init.d/mailgraph-init响度,不過一睇"ls /etc/init.d"就發覺有d唔對路,點解個"mailgraph-init"咁特別唔同色嘅?哈哈,原來無有execute flag,行完"chmod +x /etc/init.d/mailgraph-init"之後當然搞掂啦,其實加多一句响個help度啫,都咁難?定expect人地一定知道呢?不過我估佢係要我地一定要清楚個permission setting,好事嚟嘅,不過都可以加一句架....唉!

Anyway,事情當然無咁快就完結啦,一行”service mailgraph-init start”佢就鬧:-

Starting mail statistics grapher: mailgraphCan't locate RRDs.pm in @INC (@INC contains: /usr/lib/perl5/5.8.0/i386-linux-thread-multi /usr/lib/perl5/5.8.0 /usr/lib/perl5/site_perl/5.8.0/i386-linux-thread-multi /usr/lib/perl5/site_perl/5.8.0 /usr/lib/perl5/site_perl /usr/lib/perl5/vendor_perl/5.8.0/i386-linux-thread-multi /usr/lib/perl5/vendor_perl/5.8.0 /usr/lib/perl5/vendor_perl /usr/lib/perl5/5.8.0/i386-linux-thread-multi /usr/lib/perl5/5.8.0 .) at /usr/local/bin/mailgraph.pl line 360.BEGIN failed--compilation aborted at /usr/local/bin/mailgraph.pl line 360.

但係我ls /usr/local就見有個rrdtool-1.0.49 install左,不過當然去睇/usr/lib/perl5就搵極都唔見果d "RRDx.pm" (x for 好多個咁解),又唔想自己copy過去, source又唔見左,於是咪去http://oss.oetiker.ch/諗住download latest stable嚟install囉,本來佢都有一份好詳細嘅documentation比我跟住嚟install,但係當install到最last一個step嘅時候就比佢鬧:-

/usr/bin/ld: cannot find -lpngcollect2: ld returned 1 exit status

有無搞錯啊...search左一陣internet都搵唔到咩頭緒,於是咪上去佢個website download返個舊version (1.0.50)嚟install,諗住實得添.Anyway,上網search到個relevant嘅installation help,不過當然無咁易放過我啦,當我行:-

perl -MCPAN -e shell
install Time::HiRes

佢就鬧我:-

NOTE: if you get an error like this (the Makefile line number may vary):Makefile:91: *** missing separatorthen set the environment variable LC_ALL to "C" and retryfrom scratch (re-run perl "Makefile.PL").(And consider upgrading your Perl to, say, at least Perl 5.8.8.)(You got this message because you seem to have an UTF-8 locale active in your shell environment, this used to cause broken Makefiles to be created from Makefile.PLs)Makefile:91: *** missing separator. Stop. /usr/bin/make -- NOT OKRunning make test Can't test without successful makeRunning make install make had returned bad status, install seems impossible

吓?係唔係玩咁咁盡啊?唉,又唔識點manual install,又唔想update去5.8.8,費事行梗嘅嘢唔work都唔知吖嗎...試過加"force install Time::HiRes"都係一樣.好彩,search左一陣就比我搵到有教我點manual install.於是我就跟住佢教咁:-

wget http://search.cpan.org/CPAN/authors/id/J/JH/JHI/Time-HiRes-1.9715.tar.gz
tar -xvzf Time-HiRes-1.9715.tar.gz
cd Time-HiRes-1.9715.tar.gz
perl Makefile.PL

點知都未make就比佢鬧

NOTE: if you get an error like this (the Makefile line number may vary):
Makefile:91: *** missing separator
then set the environment variable LC_ALL to "C" and retry
from scratch (re-run perl "Makefile.PL").
(And consider upgrading your Perl to, say, at least Perl 5.8.8.)
(You got this message because you seem to have
an UTF-8 locale active in your shell environment, this used
to cause broken Makefiles to be created from Makefile.PLs)
[root@mmsmtp Time-HiRes-1.9715]# make
Makefile:91: *** missing separator. Stop.

但係今次清楚要做咩:-

LC_ALL="C"
export LC_ALL

跟住都係真係跟住佢嘅instruction:-

perl Makefile.PL
make
make test
make install

然後就咁install File::Tail

perl -MCPAN -e shell
install File::Tail
quit

YEAH,點不知一行佢就無嘢睇,所有圖都corrupt哂,check過"/var/logl/httpd/access_log”同"/var/log/httpd/error_log"都無咩meaningful嘅message.好彩我有第二部server行梗,咁就梗係對吓兩邊嘅mailgraph.cgi睇吓有咩唔妥,點不知一睇就見比兩行錯path陰到添.

my $rrd = 'mailgraph.rrd'; # path to where the RRD database is
my $rrd_virus = 'mailgraph_virus.rrd'; # path to where the Virus RRD database is

大佬,要改你就話聲我聽咪得囉,唔駛咁陰濕架...搵到果d rrd database原來係一樣都係响/var/lib,於是就改果兩句,用返條啱嘅path.

my $rrd = '/var/lib/mailgraph.rrd'; # path to where the RRD database is
my $rrd_virus = '/var/lib/mailgraph_virus.rrd'; # path to where the Virus RRD database is

之後點?梗係work啦,唔好玩我啦...

沒有留言: