设为首页 收藏本站
查看: 1457|回复: 0

[经验分享] Centos 下Smokeping的安装与配置

[复制链接]
累计签到:1 天
连续签到:1 天
发表于 2015-9-6 14:32:29 | 显示全部楼层 |阅读模式
1.先关闭selinux和清空iptables
vim /etc/selinux/config
SELINUX=disabled
iptables -F
2.更改国内比较快的yum源,我修改为ustc的,个人感觉他比较快。
cd /etc/yum.repos.d/
mv CentOS-Base.repo CentOS-Base.repo.bak
vim CentOS-Base.repo
# CentOS-Base.repo
#
# The mirror system uses the connecting IP address of the client and the
# update status of each mirror to pick mirrors that are updated to and
# geographically close to the client. You should use this for CentOS updates
# unless you are manually picking other mirrors.
#
# If the mirrorlist= does not work for you, as a fall back you can try the
# remarked out baseurl= line instead.
#YunVN.com
#
[base]
name=CentOS-$releasever - Base - mirrors.ustc.edu.cn
baseurl=http://mirrors.ustc.edu.cn/centos/$releasever/os/$basearch/
#mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=os
gpgcheck=1
gpgkey=http://mirrors.ustc.edu.cn/centos/RPM-GPG-KEY-CentOS-6
#released updates
[updates]
name=CentOS-$releasever - Updates - mirrors.ustc.edu.cn
baseurl=http://mirrors.ustc.edu.cn/centos/$releasever/updates/$basearch/
#mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=updates
gpgcheck=1
gpgkey=http://mirrors.ustc.edu.cn/centos/RPM-GPG-KEY-CentOS-6
#additional packages that may be useful
[extras]
name=CentOS-$releasever - Extras - mirrors.ustc.edu.cn
baseurl=http://mirrors.ustc.edu.cn/centos/$releasever/extras/$basearch/
#mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=extras
gpgcheck=1
gpgkey=http://mirrors.ustc.edu.cn/centos/RPM-GPG-KEY-CentOS-6
#additional packages that extend functionality of existing packages
[centosplus]
name=CentOS-$releasever - Plus - mirrors.ustc.edu.cn
baseurl=http://mirrors.ustc.edu.cn/centos/$releasever/centosplus/$basearch/
#mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=centosplus
gpgcheck=1
enabled=0
gpgkey=http://mirrors.ustc.edu.cn/centos/RPM-GPG-KEY-CentOS-6
#contrib - packages by Centos Users
[contrib]
name=CentOS-$releasever - Contrib - mirrors.ustc.edu.cn
baseurl=http://mirrors.ustc.edu.cn/centos/$releasever/contrib/$basearch/
#mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=contrib
gpgcheck=1
enabled=0
gpgkey=http://mirrors.ustc.edu.cn/centos/RPM-GPG-KEY-CentOS-6
ok,准备工作已做好,下面我们开始安装了。
3.安装环境所需要的yum包
yum -y install libxml2-devel libpng-devel glib pango pango-devel freetypefreetype-devel fontconfig cairo cairo-devel libart_lgpl libart_lgpl-devel perl perl-Net-Telnet perl-Net-DNSperl-LDAP perl-libwww-perl perl-RadiusPerl perl-IO-Socket-SSL perl-Socket6perl-CGI-SpeedyCGI rrdtool-perl
4.安装rrdtool
wget http://down1.chinaunix.net/distfiles/rrdtool-1.4.5.tar.gz
tar zxvf rrdtool-1.4.7.tar.gz
cd rrdtool-1.4.7
./configure --prefix=/usr/local/rrdtool
make && make install
5.安装smokeping依赖的软件
【cgilib】
wget  http://down1.chinaunix.net/distfiles/cgilib-0.5.tar.gz
tar zxvf cgilib-0.5.tar.gz
cd cgilib-0.5
make
cp libcgi.a /usr/local/lib
cp cgi.h /usr/include
【fping-2.4b2_to】
tar zxvf fping.tar.gz
cd fping-2.4b2_to
./configure
make
make check
make install
whereis fping
fping: /usr/local/sbin/fping


tar zxvf echoping-5.2.0.tar.gz
cd echoping-5.2.0

报错信息:
./configure

configure: error: Popt libraries is required  

yum install popt-devel gettext
./configure
echo  $?
configure: error: GNU   --without-libidn

./configure   --without-libidn
echo  $?

make  && make install

6.安装smokeping
wget http://oss.oetiker.ch/smokeping/pub/smokeping-2.6.8.tar.gz
tar zxvf smokeping-2.6.8.tar.gz
cd smokeping-2.6.8
./configure –prefix=/usr/local/smokeping
编译的时候会报错提示缺少很多的扩展程序,这时候我们只需要执行一个安装脚本就好了
./setup/build-perl-modules.sh /usr/local/smokeping/thirdparty
等他安装完再继续编译安装
./configure –prefix=/usr/local/smokeping
make  &&  make install
/usr/bin/gmake install
安装完毕,下面修改配置文件。
/usr/local/smokeping/bin
进入bin目录,修改smokeping文件
#vim smokeping
第八行:         use lib qw(); # PERL5LIB
修改为:   use lib qw(/usr/local/rrdtool/lib/perl);
进入htdocs目录
# mv smokeping.fcgi.dist smokeping.fcgi
进入etc目录
cp config.dist config
修改config文件
#vim config
以下自行修改为自己需要的
owner = sundong
contact =
mailhost =
修改报警邮箱
*** Alerts ***
to = 1578980735@qq.com   
from = 18062069926@163.com
*** Probes ***
+ FPing
binary = /usr/sbin/fping##修改为实际路径
binary = /usr/local/sbin/fping

监控主机是分层结构的,用+号表示
例如+第一层 ++第二层 +++第三层 根据自己情况修改;
在这里,设备名中不能有”.”和“-”,应该还有其他的字符我没有遇到的。
master/slave方式以及其他的一些功能后续补充
+ Test
menu= local
#parents = owner:/Test/James location:/
++ Yunvn
menu = localhost
title =localhost
host = localhost
下面附录我的配置文件,仅供参考。

创建存放数据文件的目录
mkdir -p /usr/local/smokeping/data /usr/local/smokeping/var /usr/local/smokeping/cache
修改smokeping的目录为apache运行用户的属主、组
chown -R daemon.daemon smokeping/
chmod 600 /usr/local/smokeping/etc/smokeping_secrets.dist
chmod 777 /usr/local/smokeping/cache /usr/local/smokeping/data /usr/local/smokeping/var
创建smokeping的log文件
touch /var/log/smokeping.log
chown daemon.daemon /var/log/smokeping.log
启动smokeping
perl /usr/local/smokeping/bin/smokeping --logfile=/var/log/smokeping.log
建立smokeping启动脚本,方便启动
vim /etc/init.d/smokeping
添加为以下内容:
#!/bin/bash
#
# chkconfig: 2345 80 05
# Description: Smokeping init.d script
# Hacked by : sundong
# Get function from functions library
. /etc/init.d/functions
# Start the service Smokeping
start() {
echo -n "Starting Smokeping: "
/usr/local/smokeping/bin/smokeping >/dev/null 2>&1
### Create the lock file ###
touch /var/lock/subsys/smokeping
success $"Smokeping startup"
echo
}
# Restart the service Smokeping
stop() {
echo -n "Stopping Smokeping: "
kill -9 `ps ax | grep "/usr/local/smokeping/bin/smokeping" | grep -v grep | awk '{ print $1 }'` >/dev/null 2>&1
### Now, delete the lock file ###
rm -f /var/lock/subsys/smokeping
success $"Smokeping shutdown"
echo
}
### main logic ###
case "$1" in
start)
start
;;
stop)
stop
;;
status)
status Smokeping
;;
restart|reload|condrestart)
stop
start
;;
*)
echo $"Usage: $0 {start|stop|restart|reload|status}"
exit 1
esac
exit 0
给脚本有可执行权限
# chmod 755 /etc/init.d/smokeping
设置开机启动smokeping
chkconfigure  smokeping on
配置apache
#vim /etc/httpd/conf/httpd.conf
最后加入
Alias /smokeping "/usr/local/smokeping/htdocs/smokeping.fcgi"
Alias /cache "/usr/local/smokeping/cache"
Alias /cropper "/usr/local/smokeping/htdocs/cropper/"
<Directory /usr/local/smokeping>
        AllowOverride None
       AddHandler cgi-script cgi fcgi
        Options ExecCGI
        Order allow,deny
        Allow from all
        DirectoryIndex smokeping.cgi
</Directory>

保存

报错信息

[iyunv@Cacti local]# service  httpd  start
Starting httpd: httpd: apr_sockaddr_info_get() failed for Cacti
httpd: Could not reliably determine the server's fully qualified domain name, using 127.0.0.1 for ServerName
修改 httpd.conf   里的  ServerName  localhost:80
设置开机启动httpd
chkconfigurehttpd  on

好了,至此安装配置完成;

访问http://IP/smokeping

报错信息

Can't locate RRDs.pm in @INC (@INC contains:.............................
执行  
yum install  perl-rrdtool



运维网声明 1、欢迎大家加入本站运维交流群:群②:261659950 群⑤:202807635 群⑦870801961 群⑧679858003
2、本站所有主题由该帖子作者发表,该帖子作者与运维网享有帖子相关版权
3、所有作品的著作权均归原作者享有,请您和我们一样尊重他人的著作权等合法权益。如果您对作品感到满意,请购买正版
4、禁止制作、复制、发布和传播具有反动、淫秽、色情、暴力、凶杀等内容的信息,一经发现立即删除。若您因此触犯法律,一切后果自负,我们对此不承担任何责任
5、所有资源均系网友上传或者通过网络收集,我们仅提供一个展示、介绍、观摩学习的平台,我们不对其内容的准确性、可靠性、正当性、安全性、合法性等负责,亦不承担任何法律责任
6、所有作品仅供您个人学习、研究或欣赏,不得用于商业或者其他用途,否则,一切后果均由您自己承担,我们对此不承担任何法律责任
7、如涉及侵犯版权等问题,请您及时通知我们,我们将立即采取措施予以解决
8、联系人Email:admin@iyunv.com 网址:www.yunweiku.com

所有资源均系网友上传或者通过网络收集,我们仅提供一个展示、介绍、观摩学习的平台,我们不对其承担任何法律责任,如涉及侵犯版权等问题,请您及时通知我们,我们将立即处理,联系人Email:kefu@iyunv.com,QQ:1061981298 本贴地址:https://www.yunweiku.com/thread-110210-1-1.html 上篇帖子: 运维工具之smokeping部署 下篇帖子: 网络质量监控smokeping master/slave部署
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

扫码加入运维网微信交流群X

扫码加入运维网微信交流群

扫描二维码加入运维网微信交流群,最新一手资源尽在官方微信交流群!快快加入我们吧...

扫描微信二维码查看详情

客服E-mail:kefu@iyunv.com 客服QQ:1061981298


QQ群⑦:运维网交流群⑦ QQ群⑧:运维网交流群⑧ k8s群:运维网kubernetes交流群


提醒:禁止发布任何违反国家法律、法规的言论与图片等内容;本站内容均来自个人观点与网络等信息,非本站认同之观点.


本站大部分资源是网友从网上搜集分享而来,其版权均归原作者及其网站所有,我们尊重他人的合法权益,如有内容侵犯您的合法权益,请及时与我们联系进行核实删除!



合作伙伴: 青云cloud

快速回复 返回顶部 返回列表