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

[经验分享] CentOS6.2 上搭建smokeping

[复制链接]

尚未签到

发表于 2019-1-17 11:08:03 | 显示全部楼层 |阅读模式
一    介绍
smokeping是rrdtool的作者Tobi Oetiker的作品,所以它在图形显示方面有很大优势,也是一个很有特点的opensource工具:
多种探测方式,包括fping、echoping、dig、curl等。



二    安装环境


虚拟机版本:    VMware Workstation 8.0.4 build-744019
OS 版本 :    CentOS 6.2 i686
IP 地址:192.168.1.115


三    安装步骤
  a.查看系统版本及内核

http://s3.运维网.com/wyfs02/M00/46/38/wKioL1PvVn7S5AxAAAHs45-LQ-Q265.jpg
  ##################################################
b. 查看selinux是否关闭
http://s3.运维网.com/wyfs02/M02/46/36/wKiom1PvVYSzK6E8AAD1CPwUhKk110.jpg
  #################################################

c. 本文使用YUM安装其他资源包,编译安装smokeping方式。apt.sw.be这个第三方软件仓库,更新很快,资源很全。
   下载跟系统适合的对应rpmforge RPM包进行安装,这样安装好rpmforge包后,在/etc/yum.repos.d/目录下会生成.repo文件
[root@localcentos upload]# wget http://pkgs.repoforge.org/rpmforge-release/rpmforge-release-0.5.3-1.el6.rf.i686.rpm
[root@localcentos upload]# rpm -ivh rpmforge-release-0.5.3-1.el6.rf.i686.rpm
[root@localcentos upload]# yum clean
[root@localcentos upload]# yum makecache   ############################################

    d.安装rrdtool与依赖库
[root@localcentos yum.repos.d]# yum install perl perl-Net-Telnet perl-Net-DNS perl-LDAP perl-libwww-perl perl-RadiusPerl perl-IO-Socket-SSL perl-Socket6perl-CGI-SpeedyCGI perl-FCGI perl-CGI-SpeedCGI perl-Time-HiRes perl-ExtUtils-MakeMaker perl-RRD-Simple rrdtool rrdtool-perl curl fping echoping  httpd httpd-devel gcc make wget libxml2-devel libpng-devel glib pango  pango-devel freetype freetype-devel fontconfig cairo cairo-devel libart_lgpl libart_lgpl-devel mod_fastcgi screen  #######################################################

    e.安装smokeping
[root@localcentos upload]# wget http://oss.oetiker.ch/smokeping/pub/smokeping-2.6.9.tar.gz
[root@localcentos upload]# tar zxvf smokeping-2.6.9.tar.gz
[root@localcentos smokeping-2.6.9]# ./configure --prefix=/usr/local/smokeping          *******编译过程中checking checking for perl module 'Config::Grammar'... Failed,这是缺少Config::Grammar这个模块(这个模块的作用是生成smokeping的配置文件,运行下面脚本会自动从网上下载安装需要的模块。否则在smokeping的安装目录下的etc目录下缺少config.dist这个文件。

            *******备注:下面几个模块是安装smokeping缺一不可的

                          FCGI (The module for supporting FastCGI operation.)

                          CGI, CGI::Fast (Perl CGI/FastCGI support. Might already be installed localy.)
                          Config::Grammar (The configuration file parser used in smokeping)
                           LWP (The master/slave functionality introduced a dependency on LWP::UserAgent from the libwww-perl (also known as LWP) library. The module is  required even if the master/slave mode is not enabled)
[root@localcentos smokeping-2.6.9]# ./setup/build-perl-modules.sh /usr/local/smokeping/thirdparty
[root@localcentos smokeping-2.6.9]# /usr/bin/gmake install
***** smokeping 安装完毕 **********      ##################################################
    f.安装中文语言支持
[root@localcentos smokeping-2.6.9]# yum groupinstall "Chinese Support"      ###################################################

    g.配置smokeping

        1.创建cache . data . var目录   
[root@localcentos smokeping-2.6.9]# cd /usr/local/smokeping/
[root@localcentos smokeping]# mkdir cache data var
[root@localcentos smokeping]# ll
      总用量 36
  drwxr-xr-x. 2 root root 4096 8月  17 02:13 bin
  drwxr-xr-x. 2 root root 4096 8月  17 02:19 cache
  drwxr-xr-x. 2 root root 4096 8月  17 02:19 data
  drwxr-xr-x. 3 root root 4096 8月  17 02:14 etc
  drwxr-xr-x. 3 root root 4096 8月  17 02:14 htdocs
  drwxr-xr-x. 3 root root 4096 8月  17 02:14 lib
  drwxr-xr-x. 3 root root 4096 8月  17 02:14 share
  drwxr-xr-x. 6 root root 4096 8月  17 02:11 thirdparty
  drwxr-xr-x. 2 root root 4096 8月  17 02:19 var        2.创建日志文件          
[root@localcentos smokeping]# touch /var/log/smokeping.log        3.授权      
[root@localcentos smokeping]# chown apache:apache cache data var
[root@localcentos smokeping]# chown apache:apache /var/log/smokeping.log
        4.修改配置文件

            
[root@localcentos smokeping]# touch /var/log/smokeping.log
[root@localcentos smokeping]# chown apache:apache cache data var
[root@localcentos smokeping]# chown apache:apache /var/log/smokeping.log
[root@localcentos smokeping]# cd /usr/local/smokeping/htdocs/
[root@localcentos htdocs]# mv smokeping.fcgi.dist smokeping.fcgi
[root@localcentos htdocs]# cd /usr/local/smokeping/etc/
[root@localcentos etc]# mv config.dist config
[root@localcentos etc]# vi config

               修改配置文件以下内容
            
*** General ***
cgiurl   = http://some.url/smokeping.cgi  将some.url改为你的IP或域名
cgiurl   = http://192.168.1.115/smokeping.cgi  这里改为本机器的IP
*** Database ***
step     = 300  将300改为60,这个是检测的时间
pings    = 20    这个不用修改
*** Presentation ***
charset = zh_CN.UTF-8  在*** Presentation ***这个下面添加这行
*** Probes ***
binary = /usr/sbin/fping  根据实际情况该此处fping程序路径(依实际情况而定,不能照搬)
######修改binary参数时要依据实际情况改,不能照搬
######[root@localcentos etc]# type fping
######fping is /usr/sbin/fping
######运行上面的命令确定fping这个二进制程序的位置




          5.配置完成之后修改密码文件

[root@localcentos etc]# chmod 600 /usr/local/smokeping/etc/smokeping_secrets.dist          

##########修改apache配置文件 httpd.conf ,让监控数据可以在浏览器上呈现。

修改配置httpd.conf文件
[root@localcentos etc]# vi /etc/httpd/conf/httpd.conf  在此文件最后位置加入如下访问控制参数
                   #########changed by kl 2014/08/15##############
                    Alias /cache "/usr/local/smokeping/cache/"
                    Alias /cropper "/usr/local/smokeping/htdocs/cropper/"
                    Alias /smokeping "/usr/local/smokeping/htdocs/smokeping.fcgi"
                    
                    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
                    
6.设置登录帐号与密码             
[root@localcentos etc]# vi /etc/httpd/conf/httpd.conf
[root@localcentos etc]# cd /usr/local/smokeping/htdocs/
[root@localcentos htdocs]# htpasswd -c /usr/local/smokeping/htdocs/htpasswd admin
   New password:
   Re-type new password:
   Adding password for user admin
7.设置smokeping开机启动               
[root@localcentos htdocs]# echo "/usr/local/smokeping/bin/smokeping -- logfile=/var/log/smokeping.log 2>&1 &" >> /etc/rc.local 8.启动http和smokeping服务         
[root@localcentos htdocs]# service httpd restart
  停止 httpd:                                               [失败]
  正在启动 httpd:httpd: apr_sockaddr_info_get() failed for localcentos.localdomain
  httpd: Could not reliably determine the server's fully qualified domain name, using 127.0.0.1 for ServerName
                                                             [确定]  修改httpd.conf文件

  276 #ServerName www.example.com:80  -------> 去掉#注释 我更改为我自己的  ServerName 192.168.1.115:80

[root@localcentos htdocs]# service httpd restart
[root@localcentos htdocs]# chkconfig --level 25 httpd on
[root@localcentos htdocs]# /usr/local/smokeping/bin/smokeping --logfile=/var/log/smokeping.log 2>&1 &                

OK,打开页面看看http://192.168.1.115/smokeping 输入用户名和密码 看看

h.将本机纳入监控
[root@localcentos ~]# vi /usr/local/smokeping/etc/config
           在此文件*** Targets *** 最末尾加入
           ++ Localhost
            menu = Localhos               
            title = Localhost
            alerts = someloss
            #slaves = boomer slave2
            host = 192.168.1.115
            加入上面targets后,需要重启smokeping进程才能生效,否则会报错的
[root@localcentos ~]# ps -ef | grep smokeping
root      1585     1  0 04:13 ?        00:00:00 /usr/local/smokeping/bin/smokeping           [FPing]
root      1965  1622  0 04:26 pts/0    00:00:00 grep smokeping
[root@localcentos ~]# kill -HUP 1585  ** 每次加入监控点的时候都需要重启smokeping进程,切记。

    四.后记

下面是实际配置好的例子,smokeping配置文件config和httpd.conf在附件中,可以下载查看。

            http://s3.运维网.com/wyfs02/M01/46/36/wKiom1PvVhji_Dq0AARHXjE2rrI794.jpg   

   
  



附件:http://down.运维网.com/data/2364759


运维网声明 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-664335-1-1.html 上篇帖子: 网络检测工具smokeping安装配置 下篇帖子: Centos6.3系统下Smokeping2.6.8安装教程
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

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

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

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

扫描微信二维码查看详情

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


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


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


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



合作伙伴: 青云cloud

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