Smokeping安装教程

#Smokeping2.6.8安装教程

#2016.3.6 改编v1.0

#Linux运维技术交流 347163978

环境

CentOS release 6.4 (Final)

kernel 2.6.32-358.el6.x86_64  x86_64

软件下载

http://pan.baidu.com/s/1kTTbnpH

ftp://195.220.108.108/linux/epel/6/x86_64/

1、换源163和epel

http://user.qzone.qq.com/1261507525/blog/1452949535

2、用yum安装httpd服务以及一些库文件

1 # yum -y install httpd httpd-devel gcc gcc-c++ make curl wget libxml2-devel libpng-devel glib pango pango-devel freetype freetype-devel fontconfig cairo cairo-devel libart_lgpl libart_lgpl-devel perl perl-Net-Telnet perl-Net-DNS perl-LDAP perl-libwww-perl perl-IO-Socket-SSL perl-Socket6 perl-CGI-SpeedyCGI  perl-FCGI perl-Time-HiRes perl-ExtUtils-MakeMaker 

3、安装rrdtool

1 [[email protected] wang]# tar zxvf rrdtool-1.4.7.tar.gz
2 [[email protected] rrdtool-1.4.7]# cd rrdtool-1.4.7
3 [[email protected] rrdtool-1.4.7]# ./configure --prefix=/usr/local/rrdtool
4 [[email protected] rrdtool-1.4.7]#make
5 [[email protected] rrdtool-1.4.7]#make install
6 [[email protected] rrdtool-1.4.7]#/usr/local/rrdtool/bin/rrdtool -v
7 RRDtool 1.4.7  Copyright 1997-2010 by Tobias Oetiker .........(省略N行)......

4、安装CGILIB

1 [[email protected] wang]# tar zxvf cgilib-0.5.tar.gz
2 [[email protected] cgilib-0.5]# cd cgilib-0.5
3 [[email protected] cgilib-0.5]# make
4 [[email protected] cgilib-0.5]# cp libcgi.a /usr/local/lib64
5 [[email protected] cgilib-0.5]# cp cgi.h /usr/include

5、安装FPING-2.4B_TO

1 [[email protected] wang]# tar zxvf fping.tar.gz
2 [[email protected] wang]# cd fping-2.4b2_to4-ipv6/
3 [[email protected] fping-2.4b2_to4-ipv6]# ./configure
4 [[email protected] fping-2.4b2_to4-ipv6]# make
5 [[email protected] fping-2.4b2_to4-ipv6]# make check
6 [[email protected] fping-2.4b2_to4-ipv6]# make install

6、安装echoping

1 [[email protected] ~]# yum install popt popt-devel gettext libidn libidn-devel
2 [[email protected] wang]# tar zxvf echoping-6.0.0.tar.gz
3 [[email protected] wang]# cd echoping-6.0.0
4 [[email protected] echoping-6.0.0]# ./configure
5 [[email protected] echoping-6.0.0]# make
6 [[email protected] echoping-6.0.0]# make install

7、安装FCGI

1 [[email protected] wang]# tar zxvf FCGI-0.74.tar.gz
2 [[email protected] wang]# cd FCGI-0.74
3 [[email protected] FCGI-0.74]# perl Makefile.PL
4 [[email protected] FCGI-0.74]# make
5 [[email protected] FCGI-0.74]# make install

8、安装MOD_FASTCGI

1 [[email protected] wang]# tar zxvf mod_fastcgi-2.4.6.tar.gz
2 [[email protected] wang]# cd mod_fastcgi-2.4.6
3 [[email protected] mod_fastcgi-2.4.6]# apxs -o mod_fastcgi.so -c *.c
4 [[email protected] mod_fastcgi-2.4.6]# apxs -i -a -n fastcgi .libs/mod_fastcgi.so

9、安装smokeping

 1 [[email protected] ]#yum install cpan
 2 [[email protected] wang]# tar zxvf smokeping-2.6.8.tar.gz
 3 [[email protected] wang]# cd smokeping-2.6.8
 4 [[email protected] smokeping-2.6.8]# cp /usr/local/rrdtool/lib/perl/5.10.1/x86_64-linux-thread-multi/RRDs.pm /usr/lib64/perl5
 5 [[email protected] smokeping-2.6.8]# cp /usr/local/rrdtool/lib/perl/5.10.1/x86_64-linux-thread-multi/auto/RRDs/RRDs.so /usr/lib64/perl5
 6 [[email protected] smokeping-2.6.8]# ./configure --prefix=/usr/local/smokeping
 7 **可以用 && 依次执行4条命令(半小时)后再执行一次./configure --prefix=/usr/local/smokeping
 8 [[email protected] smokeping-2.6.8]# ./setup/build-perl-modules.sh /usr/local/smokeping/thirdparty
 9 [[email protected] smokeping-2.6.8]# perl -MCPAN -e ‘install CGI‘
10 [[email protected] smokeping-2.6.8]# perl -MCPAN -e ‘install CGI::Fast‘
11 [[email protected] smokeping-2.6.8]# perl -MCPAN -e ‘Config::Grammar‘
12 [[email protected] smokeping-2.6.8]# /usr/bin/gmake install

10、验证smokeping安装是否成功!

[[email protected] smokeping-2.6.8]# cd /usr/local/smokeping/
[[email protected] smokeping]# ls
bin  etc  htdocs  lib  share  thirdparty

11、创建data、var、cache、smokeing日志文件并修改权限

[[email protected] smokeping]# mkdir -p data var cache
[[email protected] ~]# touch /var/log/smokeping.log
[[email protected] ~]# chown apache.apache /var/log/smokeping.log
[[email protected] ~]# chown -R apache.apache /usr/local/smokeping/

12、给smokeping配置文件修改名字

[[email protected] smokeping~]# cp -a htdocs/smokeping.fcgi.dist htdocs/smokeping.fcgi
[[email protected] smokeping~]# cp -a etc/config.dist etc/config

13、修改密码文件权限

# chmod 600 etc/smokeping_secrets.dist
# ll etc/smokeping_secrets.dist

14、修改smokeping主配置文件

[[email protected] ~]# vi /usr/local/smokeping/etc/config
cgiurl   = http://x.x.x.x/smokeping.cgi    //这个是访问smokeping的路径
*** Database ***
step     = 60  60秒ping20个包
pings    = 20
*** Presentation ***
template = /usr/local/smokeping/etc/basepage.html.dist
charset=UTF-8  新添加的一行内容
+ FPing        修改fping的路径(whereis fping)
binary = /usr/local/sbin/fping
packetsize = 1024
末行添加
++ CQDX

menu = CQDX
title = CQDX
alerts = someloss
#slaves = boomer slave2
host = 61.128.128.68
[[email protected] ~]# vi /usr/local/smokeping/bin/smokeping
注释#8“use lib qw(); # PERL5LIB”并插入
use lib qw(/usr/local/rrdtool/lib/perl);
use lib qw(/usr/local/smokeping/lib);
支持中文防止乱码
#yum -y install wqy-zenhei-fonts
#vim /usr/local/smokeping/lib/Smokeping/Graphs.pm
在#148 加入‘--font TITLE:20:"WenQuanYi Zen Hei Mono"‘,
141     if ($mode =~ /[anc]/){
142         my $val = 0;
143         for my $host (@hosts){
144             my ($graphret,$xs,$ys) = RRDs::graph
145             ("dummy",
146             ‘--start‘, $tasks[0][1],
147             ‘--end‘, $tasks[0][2],
148 ‘--font TITLE:20:"WenQuanYi Zen Hei Mono"‘,
149             "DEF:maxping=$cfg->{General}{datadir}${host}.rrd:median:AVERAGE",

15、配置Apache服务的主配置文件

[[email protected] ~]# yum -y install php-fpm
[[email protected] ~]# vim /etc/httpd/conf.d/fastcgi.php
DirectoryIndex index.html index.shtml index.cgi index.php
AddHandler php5-fcgi .php
Action php5-fcgi /php5-fcgi
Alias /php5-fcgi /var/www/cgi-bin/php5-fcgi
FastCgiExternalServer /var/www/cgi-bin/php5-fcgi -idle-timeout 60 -host 127.0.0.1:9000 -pass-header Authorization
[[email protected] local]# vi /etc/httpd/conf/httpd.conf
Alias /cache "/usr/local/smokeping/cache/"
Alias /cropper "/usr/local/smokeping/htdocs/cropper/"
Alias /smokeping "/usr/local/smokeping/htdocs/smokeping.fcgi"
<Directory "/usr/local/smokeping/htdocs">
AllowOverride None
Options All
AddHandler cgi-script .fcgi .cgi
ALLowOverride AuthConfig
Order allow,deny
Allow from all
AuthName "Smokeping"
AuthType Basic
AuthUserFile /usr/local/smokeping/htdocs/htpasswd
Require valid-user
DirectoryIndex smokeping.fcgi
</Directory>

16、创建登录smokeping的账户并设置密码(可省略)

[[email protected] ~]# htpasswd -c /usr/local/smokeping/htdocs/htpasswd admin

17、编写一个smokeping启动脚本(可省略)

  1 #!/bin/bash
  2 PIDFILE=/usr/local/smokeping/var/smokeping.pid
  3 SMOKEPING=/usr/local/smokeping/bin/smokeping
  4 ERROR=0
  5 RUNNING=0
  6 ARGV="[email protected]"
  7 if [ "x$ARGV" = "x" ] ; then
  8 ARGS=help
  9 fi
 10 for ARG in [email protected] $ARGS
 11 do
 12 if [ -f $PIDFILE ] ; then
 13 PID=`cat $PIDFILE`
 14 if kill -0 $PID 2>/dev/null ; then
 15 # smokeping is running
 16 RUNNING=1
 17 else
 18 # smokeping not running but PID file exists => delete PID file
 19 rm -f $PIDFILE
 20 RUNNING=0
 21 fi
 22 else
 23 # smokeping (no pid file) not running
 24 RUNNING=0
 25 fi
 26 case $ARG in
 27 start)
 28 if [ $RUNNING -eq 0 ] ; then
 29 if $SMOKEPING > /dev/null; then
 30 echo "$0 $ARG: smokeping started"
 31 else
 32 echo "$0 $ARG: smokeping could not be started"
 33 ERROR=1
 34 fi
 35 else
 36 echo "$0 $ARG: smokeping is running with PID $PID"
 37 ERROR=2
 38 fi
 39 ;;
 40 stop)
 41 if [ $RUNNING -eq 1 ] ; then
 42 if kill $PID ; then
 43 echo "$0 $ARG: smokeping ($PID) stopped"
 44 rm $PIDFILE
 45 else
 46 echo "$0 $ARG: smokeping could not be stopped"
 47 ERROR=3
 48 fi
 49 else
 50 echo "$0 $ARG: smokeping not running"
 51 ERROR=4
 52 fi
 53 ;;
 54 restart)
 55 if [ $RUNNING -eq 1 ] ; then
 56 if $SMOKEPING --restart > /dev/null; then
 57 echo "$0 $ARG: smokeping restarted"
 58 else
 59 echo "$0 $ARG: smokeping could not be started"
 60 ERROR=5
 61 fi
 62 else
 63 $0 start
 64 fi
 65 ;;
 66 strace_debug)
 67 rm -f /tmp/strace_smokeping
 68 if [ $RUNNING -eq 1 ] ; then
 69 if strace -o/tmp/strace_smokeping $SMOKEPING --restart >/dev/null; then
 70 echo "$0 $ARG: smokeping restarted with strace debug in /tmp/strace_smokeping"
 71 else
 72 echo "$0 $ARG: smokeping strace debug could not be started"
 73 ERROR=6
 74 fi
 75 else
 76 if strace -o/tmp/strace_smokeping $SMOKEPING >/dev/null; then
 77 echo "$0 $ARG: smokeping started with strace debug in /tmp/strace_smokeping"
 78 else
 79 echo "$0 $ARG: smokeping strace debug could not be started"
 80 ERROR=7
 81 fi
 82 fi
 83 ;;
 84 status)
 85 if [ $RUNNING -eq 1 ] ; then
 86 echo "$0 $ARG: smokeping is running with PID ($PID)"
 87 else
 88 echo "$0 $ARG: smokeping is not running"
 89 fi
 90 ;;
 91 *)
 92 echo "usage: $0 (start|stop|restart|status|strace_debug|help)"
 93 cat <<EOF
 94 start - start smokeping
 95 stop - stop smokeping
 96 restart - restart smokeping if running or start if not running
 97 status - show status if smokeping is running or not
 98 help - this screen
 99 EOF
100 ;;
101 esac
102 done
103 exit $ERROR

添加执行权限

# chmod +x /etc/init.d/smokeping

18、解决目录安全并启动smokeping、httpd服务

[[email protected] local]# chcon -R -t httpd_sys_content_t /usr/local/smokeping/
[[email protected] local]#iptables -I INPUT -p tcp --dport 80 -j ACCEPT

检测smokeping配置
[[email protected] ~]# /usr/local/smokeping/bin/smokeping --check
[[email protected] ~]# echo "/usr/local/smokeping/bin/smokeping --logfile=/var/log/smokeping.log 2>&1 &" >> /etc/rc.local
#/etc/init.d/smokeping restart
# service httpd restart
# service php-fpm restart 

19、访问smokeping页面

http://x.x.x.x/smokeping

时间: 2024-10-12 08:36:36

Smokeping安装教程的相关文章

Centos6.3系统下Smokeping2.6.8安装教程

Centos6.3系统下Smokeping2.6.8安装教程 smokeping是对IDC网络质量,稳定性等最好的检测工具,包括常规的 ping,dig,echoping,curl等,可以监视www服务器性能,监视dns查询性能,监视ssh性能等. 1.关闭防火墙和selinux服务 [[email protected] ~]# service iptables stop [[email protected] ~]# setenforce 0 2.用yum安装httpd服务以及一些库文件 [[e

mac苹果电脑上Mathtype软件的安装教程

对于数学学习来将,Mathtype是一款非常不错的工具,在这里您可以方便快捷的计算出公式的结果,只需要将方程式填写进去就能出来结果.小编为大家准备了Mathtype安装教程,安装的过程是非常简单的,安装好了之后会让您的工作变得更加轻松,还能提升工作的效率哦! Mathtype安装教程介绍:第一步:打开下载的Mathtype文件 第二步:点击左边的安装文件,会得到提示,下图所示: 第三步:选择好,然后会在弹出提示窗口,点击继续,如下图所示: 第四步:因为暂时只有英文版的,所以选择英文版,点击继续安

Android Studio的下载和安装教程(从ADT到AS)

之前一直使用的是Android development tools(简称ADT),后来说是google对ADT不再提供支持,然后一直在考虑是否把自己电脑换成Android Studio(简称AS),从ADT到AS这个过程自己觉得软件安装真的伤不起,端午节第二天和第三天(也是今天),终于完成了从ADT到AS的转 变,OK,我还有很多要学习的地方. 下面我来介绍一下ADT的转变成AS: 1.第一次安装完之后模拟器根本启动不了(就算你刚新建的模拟器,他还是不能在启动APP时候没有可用的模拟器),而且用

MYCNCART 自适应主题模板 MCCThemes-001 安装教程

附件里介绍了 MYCNCART 自适应主题模板 MCCThemes-001 通过FTP进行安装及配置的具体步骤,欢迎各位友人下载使用. 安装教程下载地址 http://pan.baidu.com/s/1gd1xfJ9

Linux环境安装教程——Centos6.6安装Selenium

本人特别喜欢在Centos下搭建环境.目前,主要负责公司的产品测试.所以,需要研究一下Selenium自动化测试如何在Centos上搭建.当然了,Selenium也可以安装在Windows,这方面的教程网上比较多就不说了.但是基于Linux特别是基于Centos的文章比较少,网上有一些安装教程都是基于Ubuntu的,而且python版本.selenium版本都比较老的. 我这次安装的都是最新版本的 先看一下本人虚拟机的系统版本 cat /etc/issue 如图:(本人的虚拟机是最小化安装的)

Windows环境下Android Studio v1.0安装教程

Windows环境下Android Studio v1.0安装教程 Windows环境下Android Studio v1.0安装教程 准备工具 JDK安装包. 要求:JDK 7以及以上版本. Android Studio安装文件. Windows: exe(包含SDK) (813 MB) exe(不包含SDK) (250 MB) zip (235 MB) Mac dmg (234 MB) zip (233 MB) Linux: zip (233 MB) 说明: 32位系统和64位系统是同一个安

hadoop安装教程

hadoop的核心 Hadoop的核心就是HDFS和MapReduce,而两者只是理论基础,不是具体可使用的高级应用,Hadoop旗下有很多经典子项目,比如HBase.Hive等,这些都是基于HDFS和MapReduce发展出来的.要想了解Hadoop,就必须知道HDFS和MapReduce是什么. HDFS HDFS(Hadoop Distributed File System,Hadoop分布式文件系统),它是一个高度容错性的系统,适合部署在廉价的机器上.HDFS能提供高吞吐量的数据访问,适

Windows Sever 2012的安装教程(图文)

转自脚本之家 Windows Sever 2012的安装教程(图文) 作者:佚名 来源:互联网 最近微软先行放出发布了下一代Windows服务器版本windows server 2012,笔者下载下来测试安装了,相对于windows server 2008,确实有许多细节方面的改进. 我是通过vmware workstation 8来安装windows server 2012的,由于安装的时候无法选择2012只好选择windows server 2008 64位版本的. 启动界面,由前一个版本的

【转】Windows环境下Android Studio v1.0安装教程

原文网址:http://ask.android-studio.org/?/article/9 http://android-studio.org/index.php/docs/experience/158-androidstudio-v1-0-win-install Windows环境下Android Studio v1.0安装教程 准备工具 JDK安装包.要求:JDK 7以及以上版本. Android Studio安装文件. Windows:exe(包含SDK) (813 MB)exe(不包含