lost and found ( for me ? )

measure latency w/ smokeping

SLA監視に使えるかもと思ったので、ちょっと使ってみました。

[root@arizona ~]# cat /etc/redhat-release
Fedora release 11 (Leonidas)

[root@arizona ~]# uname -r
2.6.29.6-213.fc11.i686.PAE

[root@arizona ~]# yum install -y smokeping.noarch

- smokeping の設定ファイル ( /etc/smokeping/config )

適当に修正

#imgcache = /var/lib/smokeping/images
imgcache = /var/www/html/smokeping/img
#imgurl = /smokeping/images
imgurl = http://127.0.0.1/smokeping/img
datadir = /var/lib/smokeping/rrd
piddir = /var/run/smokeping
#cgiurl = http://localhost/smokeping/smokeping.cgi
cgiurl = http://127.0.0.1/cgi-bin/smokeping.cgi

- apache で結果ファイルが閲覧できるように設定する ( httpd.conf )

Apacheにてsmokepingの結果が閲覧できるように設定。

smokeping.cgi スクリプトをコピー

# cp /usr/share/smokeping/cgi/smokeping.cgi /var/www/cgi-bin/

所有者の変更

# chown apache.apache /var/www/cgi-bin/smokeping.cgi

- smokeping.cgi を編集

# use lib qw(/usr/pack/rrdtool-1.0.33-to/lib/perl);
use lib qw(/usr/bin); ← rrdttol のある場所 /usr/bin/rrdtool

One pointing to your B installation

# use lib qw(/home/oetiker/public_html/smokeping/lib);
use lib qw(/usr/share/smokeping/lib); ← smokeping のライブラリの場所

One pointing to the place where you have installed the SmokePing libraries

use Smokeping;

# Smokeping::cgi("/home/oetiker/.smokeping/config");
Smokeping::cgi("/etc/smokeping/config"); ← smokeping のconfigを指定

httpd.conf ( cgi を実行できるようにコメントを外す )

ScriptAlias /cgi-bin/ "/var/www/cgi-bin/"

所有者の変更

[root@arizona ~]# mkdir -p /var/www/html/smokeping/img
[root@arizona ~]# chown -R apache.apache /var/www/html/smokeping/img

smokeping , httpd を起動

[root@arizona ~]# /etc/init.d/smokeping start
smokeping を起動中: [ OK ]
[root@arizona ~]# /etc/init.d/httpd start
httpd を起動中: [ OK ]
[root@arizona ~]#

[root@arizona ~]# ps aux | grep smoke | grep -v grep
root 4303 0.0 0.3 26548 13612 ? Ss 01:07 0:00 /usr/sbin/smokeping [FPing]

下記urlにアクセス。

http://127.0.0.1/cgi-bin/smokeping.cgi

画面が表示されればとりあえず、基本設定は成功。




監視対象の設定 ( /etc/smokeping/config )

+ Ping

menu = Google
title = Google Pings

++ Google

menu = www.google.com
title = www.google.com
host = 66.249.89.99

グラフが表示されん。。
httpd の error.log

# less /var/log/httpd/error_log

[error] [client 127.0.0.1] File does not exist: /usr/share/smokeping/htdocs/img, referer: http://127.1/cgi-bin/smokeping.cgi?target=Ping.Google

/usr/share/smokeping/htdocs/img ??

確かにそんなファイル(ディレクトリ?)はない。

# ls /usr/share/smokeping/htdocs/
cropper resource rrdtool.png script smokeping.png tr.html

シンボリックリンクはってみるか。

# ln -s /var/www/html/smokeping/img /usr/share/smokeping/htdocs/img

# ls -l /usr/share/smokeping/htdocs/img
lrwxrwxrwx 1 root root /usr/share/smokeping/htdocs/img -> /var/www/html/smokeping/img

グラフができたー。



一応グラフができたあとの各種コンフィグ。

/etc/smokeping/config

[root@arizona ~]# egrep -v "^#" /etc/smokeping/config | grep -v "^$"
*** General ***
owner = Super User
contact = root@localhost
mailhost = my.mail.host
sendmail = /usr/sbin/sendmail
imgcache = /var/www/html/smokeping/img
imgurl = http://127.0.0.1/smokeping/img
datadir = /var/lib/smokeping/rrd
piddir = /var/run/smokeping
cgiurl = http://127.0.0.1/cgi-bin/smokeping.cgi
smokemail = /etc/smokeping/smokemail
tmail = /etc/smokeping/tmail
syslogfacility = local0
*** Alerts ***
to = root@localhost
from = root@localhost
+someloss
type = loss
pattern = >0%,*12*,>0%,*12*,>0%
comment = loss 3 times in a row
*** Database ***
step = 300
pings = 20
AVERAGE 0.5 1 1008
AVERAGE 0.5 12 4320
MIN 0.5 12 4320
MAX 0.5 12 4320
AVERAGE 0.5 144 720
MAX 0.5 144 720
MIN 0.5 144 720
*** Presentation ***
template = /etc/smokeping/basepage.html
+ charts
menu = Charts
title = The most interesting destinations
++ stddev
sorter = StdDev(entries=>4)
title = Top Standard Deviation
menu = Std Deviation
format = Standard Deviation %f
++ max
sorter = Max(entries=>5)
title = Top Max Roundtrip Time
menu = by Max
format = Max Roundtrip Time %f seconds
++ loss
sorter = Loss(entries=>5)
title = Top Packet Loss
menu = Loss
format = Packets Lost %f
++ median
sorter = Median(entries=>5)
title = Top Median Roundtrip Time
menu = by Median
format = Median RTT %f seconds
+ overview
width = 600
height = 50
range = 10h
+ detail
width = 600
height = 200
unison_tolerance = 2
"Last 3 Hours" 3h
"Last 30 Hours" 30h
"Last 10 Days" 10d
"Last 400 Days" 400d
*** Probes ***
+ FPing
binary = /usr/sbin/fping
*** Slaves ***
secrets=/etc/smokeping/smokeping_secrets
+boomer
display_name=boomer
color=0000ff
+slave2
display_name=another
color=00ff00
*** Targets ***
probe = FPing
menu = Top
title = Network Latency Grapher
remark = Welcome to the SmokePing website of Insert Company Name Here. \
Here you will learn all about the latency of our network.
+ Ping
menu = Google
title = Google Pings
++ Google
menu = www.google.com
title = www.google.com
host = 66.249.89.99
[root@arizona ~]#

/var/www/cgi-bin/smokeping.cgi
[root@arizona ~]# egrep -v "^#" /var/www/cgi-bin/smokeping.cgi

use strict;
use warnings;

use lib qw(/usr/share/smokeping/lib);

use CGI::Carp qw(fatalsToBrowser);

use Smokeping 2.004002;

Smokeping::cgi("/etc/smokeping/config");

=head1 NAME

smokeping.cgi - SmokePing webfrontend

=head1 OVERVIEW

This script acts as a 'website' for your SmokePing monitoring operation. It
presents the targets you are looking at in a tree structure and draws graphs
as they are required by people looking at the pages.

=head1 DESCRIPTION

To get B going, you need a webserver which allows you to run
cgi scripts. The system must be setup so that the B is
allowed to write to the image caching area as defined in the config file.

This script runs with normal perl. B it will appear to be very slow,
because it does a lot of things when starting up. So if the script has to be
started a fresh on every click, this is both slow and a tough thing for your
webserver. I therefore strongly recomment using SpeedyCGI.

Please refer to the installation document for detailed setup instructions.

=head1 SETUP

When installing SmokePing, this file has to be adjusted to fit your
local system. Three paths have to be entered.

use lib qw(/usr/bin);

One pointing to your B installation

use lib qw(/usr/share/smokeping/lib);

One pointing to the place where you have installed the SmokePing libraries

use Smokeping;

Smokeping::cgi("/etc/smokeping/config");

The third path is the argument to the Smokeping::cgi command. It points to
the SmokePing configuration file.

=head1 COPYRIGHT

Copyright (c) 2001 by Tobias Oetiker. All right reserved.

=head1 LICENSE

This program is free software; you can redistribute it
and/or modify it under the terms of the GNU General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later
version.

This program is distributed in the hope that it will be
useful, but WITHOUT ANY WARRANTY; without even the implied
warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE. See the GNU General Public License for more
details.

You should have received a copy of the GNU General Public
License along with this program; if not, write to the Free
Software Foundation, Inc., 675 Mass Ave, Cambridge, MA
02139, USA.

=head1 AUTHOR

Tobias Oetiker Etobi@oetiker.chE

=cut
[root@arizona ~]#

- httpd.conf は ScriptAlias のコメントを外しただけ。

ScriptAlias /cgi-bin/ "/var/www/cgi-bin/"


AllowOverride None
Options None
Order allow,deny
Allow from all


--

ping 以外にもいろいろなプロトコル ( DNS , HTTP etc ) みたいなので、もうちょっとさわってみよう。意外と苦戦。

久々に DJ Tiesto 聞いてる。あいかわらず最高だー。
elements of life !

No comments:

Post a Comment

Note: Only a member of this blog may post a comment.