nginx apache Smokeping 安装配置

简介:
Smokeping 安装配置
一、介绍
smokeping是rrdtool的作者Tobi Oetiker的作品,所以它在图形显示方面有很大优势,也是一个很有特点的opensource工具:多种探测方式,包括fping、echoping、dig、curl等;
易用可扩展的插件;
master/slave的工作方式,可以在多个节点收集同一个监测点的数据;很有特色的alert设置,不只是简单的设置一个阀值;

二、安装

在装好LAMP与PERL基础上,再安装以下软件 


Smokeping need few perl module and other package to run.
1. RRDtools Download here :  http://oss.oetiker.ch/rrdtool/
2. FPing Download here :  http://www.fping.com/
3. EchoPing Download here :  http://echoping.sourceforge.net/
4. Curl Download here :  http://curl.haxx.se/
5. Dig Download here:  http://www.isc.org/sw/bind/
6. SSH Download here :  http://www.openssh.org/

Various Perl Module Download here : http://www.cpan.org/
1. libwww-perl
2. Socket6 0.11-1
3. Net::Telnet
4. Net::DNS
5. Net::LDAP
6. IO::Socket::SSL
7. Authen::Radius

http://fping.sourceforge.net/download/fping.tar.gz
http://daemoninc.com/SpeedyCGI/CGI-SpeedyCGI-2.22.tar.gz
http://sourceforge.net/projects/echoping/files/echoping/6.0.2/echoping-6.0.2.tar.gz/download
http://oss.oetiker.ch/smokeping/pub/smokeping-2.4.2.tar.gz
我的rrdtool选择yum 
如果用编译 ,改一下配置 文件 
二个lib的使用

Install fping
tar zxvf fping.tar.gz
cd fping-2.4b2_to/
./configure 
make && make install 

Install CGI-SpeedyCGI
tar –zxvf CGI-SpeedyCGI-2.22.tar.gz
cd CGI-SpeedyCGI-2.22
perl Makefile.PL
Compile mod_speedycgi (default no)? no
make && make install

tar zxvf echoping-6.0.2.tar.gz
cd echoping-6.0.2
./configure --prefix=/usr/local/echoping --with-ssl --without-libidn
make && make install

tar zxvf smokeping-2.4.2.tar.gz
mv smokeping-2.4.2 /usr/local/smokeping

mkdir –p /usr/local/smokeping/cache
mkdir –p /usr/local/smokeping/var
1、/usr/local/smokeping/etc/ config.dist

*** General ***

owner = apache 
contact = bbs@linuxtone.org 
mailhost = localhost
sendmail = /usr/local/bin/sendmail
# NOTE: do not put the Image Cache below cgi-bin
# since all files under cgi-bin will be executed ... this is not
# good for images.
imgcache = /usr/local/smokeping/cache
imgurl = ../cache 不要用绝对路径
datadir = /usr/local/smokeping/var
piddir = /usr/local/smokeping/var
cgiurl = http://some.url/smokeping.cgi
smokemail = /usr/local/smokeping/etc/smokemail.dist
tmail = /usr/local/smokeping/etc/tmail.dist
# specify this to get syslog logging
syslogfacility = local0
# each probe is now run in its own process
# disable this to revert to the old behaviour
# concurrentprobes = no

*** Alerts ***
#to = |/usr/local/smokeping/fx.sh
to = bbs@linuxtone.org
from = abc@xy.com 
定义丢包率;
+someloss
type = loss
# in percent
pattern = >0%,*12*,>0%,*12*,>0%
comment = loss 3 times in a row
(检测12次,出现了3次丢包的情况,不论丢多少个包,就进行alter)
+rttbad
type = rtt
pattern = ==S,>50,>50
comment = route
(如果连续出现两次50ms 以上的延时,就进行alter)
*** Database ***
(每300秒ping 20次)

step = 300
pings = 20

# consfn mrhb steps total

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 = /usr/local/smokeping/etc/basepage.html.dist (定义页面模板)

+ 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

#+ hierarchies
#++ owner
#title = Host Owner
#++ location
#title = Location

*** Probes ***

+ FPing

binary = /usr/sbin/fping PING使用的工具

#*** Slaves ***
#secrets=/home/oetiker/checkouts/smokeping/trunk/software/etc/smokeping_secrets.dist
#+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 xxx Company. \
Here you will learn all about the latency of our network.

+ Test 定义一级目录
menu= test
tile = test
#parents = owner:/Test/James location:/

++ host1 添加主机
title = host1
alerts = someloss,rttbad
host = 192.168.11.111

+ nagios
menu = nagios
++ nagios
title = nagios
alerts = someloss
host = 192.168.11.105


2、/usr/local/smokeping/htdocs/smokeping.cgi修改

Cp /usr/local/smokeping/htdocs/smokeping.cgi.dist usr/local/smokeping/htdocs/smokeping.cgi
use lib qw(/usr/bin/perl);
use lib qw(/usr/local/smokeping/lib);
Smokeping::cgi("/usr/local/smokeping/etc/config.dist");

3、/usr/local/smokeping/bin/smokeping.dist 修改
use lib qw(/usr/bin/perl);
use lib qw(/usr/local/smokeping/lib);

4、启动/usr/local/smokeping/bin/smokeping.dist start
Chown www.www /usr/local/smokeping –R

三、配置httpd.conf

如下:

Alias /smokeping/ "/usr/local/smokeping/"
<Directory "/usr/local/smokeping/ ">
AllowOverride None
AddHandler cgi-script cgi
Options ExecCGI
Order allow,deny
Allow from all
</Directory>

四、nginx配置  (先安装Fcgi)
      安装perl cgi模块
wget  http://www.cpan.org/modules/by-module/FCGI/FCGI-0.67.tar.gz
tar -zxvf FCGI-0.67.tar.gz
cd FCGI-0.67
perl Makefile.PL
make && make install
安装FCGI-ProcManager:
wget  http://search.cpan.org/CPAN/authors/id/G/GB/GBJK/FCGI-ProcManager-0.18.t...
tar -xzxf FCGI-ProcManager-0.18.tar.gz
cd FCGI-ProcManager-0.18
perl Makefile.PL
make make install
下载nginx-fcgi脚本
Wget  http://www.nginx.eu/nginx-fcgi/nginx-fcgi.txt
放置在:/etc/nginx-fcgi
注释掉nginx-fcgi.txt 中的
if ( $> == “0″ ) {
print “\n\tERROR\tRunning as a root!\n”;
print “\tSuggested not to do so !!!\n\n”;
exit 1;
}
否则会提示:ERROR Running as a root! Suggested not to do so !!!
启动方法:
/etc/nginx-fcgi -l /var/log/nginx-fcgi.log -pid /var/run/nginx-fcgi.pid -S /var/run/nginx-fcgi.sock
注意给 nginx-fcgi.sock 777的权限
运行前使用cpan 安装 FCGI  Getopt::Long  IO::All  Socket;

server
   {
      listen       80;
      server_name  smokeping.linuxtone.org;
      root  /usr/local/smokeping/smokeping/;

location ~ .*\.cgi$ {
root  /usr/local/smokeping/htdocs/;
fastcgi_pass unix:/var/run/nginx-fcgi.sock;
fastcgi_index index.cgi;
include fastcgi_params;
include enable_php5.conf;
}

测试: /usr/local/smokeping/bin/smokeping.cgi --debug
启动脚本:http://oss.oetiker.ch/smokeping/pub/contrib/smokeping-start-script
apache访问:http://ip/smokeping/htdocs/smokeping.cgi
nginx访问:smokeping.linuxtone.org/smokeping;

参考:
http://www.joecen.com/2008/10/09/use-smokeping/
http://hi.baidu.com/powerdj/blog/item/553659dfc9ea371b48540366.html
http://bbs.linuxtone.org/viewthread.php?tid=4768&rpid=14614&ordertype=0&page=1#pid14614




本文转自守住每一天51CTO博客,原文链接:http://blog.51cto.com/liuyu/262248,如需转载请自行联系原作者
相关文章
|
28天前
|
应用服务中间件 BI nginx
Nginx的location配置详解
【10月更文挑战第16天】Nginx的location配置详解
|
1月前
|
缓存 负载均衡 安全
Nginx常用基本配置总结:从入门到实战的全方位指南
Nginx常用基本配置总结:从入门到实战的全方位指南
256 0
|
1月前
|
应用服务中间件 Linux nginx
Jetson 环境安装(四):jetson nano配置ffmpeg和nginx(亲测)之编译错误汇总
这篇文章是关于在Jetson Nano上配置FFmpeg和Nginx时遇到的编译错误及其解决方案的汇总。
89 4
|
8天前
|
存储 负载均衡 中间件
Nginx反向代理配置详解,图文全面总结,建议收藏
Nginx 是大型架构必备中间件,也是大厂喜欢考察的内容,必知必会。本篇全面详解 Nginx 反向代理及配置,建议收藏。
Nginx反向代理配置详解,图文全面总结,建议收藏
|
20天前
|
应用服务中间件 API nginx
nginx配置反向代理404问题
【10月更文挑战第18天】本文介绍了使用Nginx进行反向代理的配置方法,解决了404错误、跨域问题和302重定向问题。关键配置包括代理路径、请求头设置、跨域头添加以及端口转发设置。通过调整`proxy_set_header`和添加必要的HTTP头,实现了稳定的服务代理和跨域访问。
105 1
nginx配置反向代理404问题
|
5天前
|
应用服务中间件 网络安全 nginx
轻松上手Nginx Proxy Manager:安装、配置与实战
Nginx Proxy Manager (NPM) 是一款基于 Nginx 的反向代理管理工具,提供直观的 Web 界面,方便用户配置和管理反向代理、SSL 证书等。本文档介绍了 NPM 的安装步骤,包括 Docker 和 Docker Compose 的安装、Docker Compose 文件的创建与配置、启动服务、访问 Web 管理界面、基本使用方法以及如何申请和配置 SSL 证书,帮助用户快速上手 NPM。
23 1
|
1月前
|
XML 前端开发 JavaScript
Nginx 安装配置
10月更文挑战第5天
103 4
Nginx 安装配置
|
1月前
|
编解码 Ubuntu 应用服务中间件
Jetson 环境安装(三):jetson nano配置ffmpeg和nginx(亲测)
本文介绍了在NVIDIA Jetson Nano上配置FFmpeg和Nginx的步骤,包括安装、配置和自启动设置。
139 1
Jetson 环境安装(三):jetson nano配置ffmpeg和nginx(亲测)
|
25天前
|
缓存 负载均衡 应用服务中间件
Nginx配置
【10月更文挑战第22天】在实际配置 Nginx 时,需要根据具体的需求和环境进行调整和优化。同时,还需要注意配置文件的语法正确性和安全性。
44 7
|
1月前
|
前端开发 JavaScript 应用服务中间件
终极 Nginx 配置指南
本文介绍了Nginx的基本配置及其优化方法。首先,通过删除注释简化了Nginx的默认配置文件,使其更易于理解。接着,文章将Nginx配置文件分为全局块、events块和http块三部分进行详细解释。此外,还提供了如何快速上线网站、解决前端history模式404问题、配置反向代理、开启gzip压缩、设置维护页面、在同一IP上部署多个网站以及实现动静分离的具体配置示例。最后,附上了Nginx的基础命令,包括安装、启动、重启和关闭等操作。

推荐镜像

更多