基于Apache搭建的smokeping监控及配置
来源:互联网 发布:淘宝课程 编辑:程序博客网 时间:2024/05/16 11:46
Smokeping搭建可分多种web框架可选nginx、apache等,接口可选fcgi、cgi等。
操作系统:选择centOS6.5 版, 里面的RPM包基本上都是最新的。
一、基本环境的设置
1. 网卡的设置 /etc/sysconfig/network-scripts/ifcfg-eth0
图略
2. DNS的设置 /etc/resolv.conf
图略
3. 设置时区 tzselect
依次选择5-9-1-1所在大洲—所在国家—所使用的时区—确定所选时区。
检验 输入date 查看是否为CST时区
图略
4. 同步时间
Ntpdate time.nist.gov
二、部署前期工作
1. 安装epel源
64位 rpm -Uvh http://apt.sw.be/redhat/el6/en/x86_64/rpmforge/RPMS/rpmforge-release-0.5.3-1.el6.rf.x86_64.rpm
32位 Rpm -Uvh http://apt.sw.be/redhat/el6/en/i386/rpmforge/RPMS/rpmforge-release-0.5.3-1.el6.rf.i686.rpm
2. 安装rrdtool与依赖库
yum -y install perl perl-Net-Telnet perl-Net-DNS perl-LDAP perl-libwww-perl perl-RadiusPerl perl-IO-Socket-SSL perl-Socket6 perl-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
注:perl-CGI-SpeedyCGI,perl-CGI-SpeedCGI这两个包在安装过程中会提示找不到,但没关系。
三、安装及配置Smokeping
1. 下载并安装Smokeping
cd /tmp
wget http://oss.oetiker.ch/smokeping/pub/smokeping-2.6.9.tar.gz
tar -zxvf smokeping-2.6.9.tar.gz
cd smokeping-2.6.9
mkdir /usr/local/smokeping
./configure --prefix=/usr/local/smokeping
出现问题是因为需要安装perl的模块,所以运行下面内容即可
解决 'Config::Grammar' ... Failed
Wget http://search.cpan.org/CPAN/authors/id/D/DS/DSCHWEI/Config-Grammar-1.10.tar.gz
tar zxvf Config-Grammar-1.10.tar.gz
cd Config-Grammar
perl Makefile.PL
make
make install
./setup/build-perl-modules.sh /usr/local/smokeping/thirdparty
./configure --prefix=/usr/local/smokeping
/usr/bin/gmake install
现在smokeping安装完成。
2. 配置Smokeping(基于Apache)
(1) 创建cache、data、var目录
cd /usr/local/smokeping
mkdir cache data var
(2) 在创建日志
touch /var/log/smokeping.log
(3) 授权
chown apache:apache cache data var
chown apache:apache /var/log/smokeping.log
(4) 修改配置文件
mv cache ./htdocs/
cd /usr/local/smokeping/htdocs/
mv smokeping.fcgi.dist smokeping.fcgi
cd /usr/local/smokeping/etc
mv config.dist config
修改配置文件config
vim config
imgcache = /usr/local/smokeping/cache
imgcache = /usr/local/smokeping/htdocs/cache
修改cache的路径与Apache里修改的对应。
cgiurl = http://some.url/smokeping.cgi
把some.url修改为你的ip或者域名
*** Database ***
step = 300
pings = 20
然后修改step,从300改为60,这是检测的时间, pings 从20 改为60, 即60秒ping 60次
(5) .配置完成之后修改密码文件权限
chmod 600 /usr/local/smokeping/etc/smokeping_secrets.dist
3. 修改apache的配置
vi /etc/httpd/conf/httpd.conf
在DocumentRoot "/var/www/html" 这一行之下添加如下内容:
Alias /cache "/usr/local/smokeping/htdocs/cache"
Alias /cropper "/usr/local/smokeping/htdocs/cropper"
Alias /smokeping "/usr/local/smokeping/htdocs"
<Directory "/usr/local/smokeping/htdocs">
AllowOverride None
AddHandler cgi-script .fcgi .cgi
Options ExecCGI
<IfModule dir_module>
DirectoryIndex smokeping.fcgi
</IfModule>
Order allow,deny
Allow from all
</Directory>
4. 启动httpd服务并设置httpd开机启动及关闭防火墙
/etc/init.d/httpd start #启动httpd服务或 service httpd start
chkconfig httpd on #开机启动httpd进程
service iptables stop #关闭防火墙
chkconfig iptables off #开机不启动iptables服务
四、添加smokeping中文支持及rrd图片支持中文
1. 页面支持中文 vi /usr/local/smokeping/etc/config
在配置文件的*** Presentation ***下添加(红色部分为添加内容)
*** Presentation ***
charset = utf-8
template = /usr/local/smokeping/etc/basepage.html.dist
vi basepage.html.dist
2. 如页面左侧层里文字依然是乱码 vi /usr/local/smokeping/etc/basepage.html.dist
可在basepage.html.dist文件头部位置中添加一句。
<HEAD>
<META charset="utf-8" />
<META HTTP-EQUIV="Cache-Control" content="no-cache">
3. 添加rrd图片支持中文,安装中文字库
yum -y install wqy-zenhei-fonts.noarch
修改配置文件 vi /usr/local/smokeping/lib/Smokeping/Graphs.pm
My ($graphret,$xs,$ys) = RRDs::graph
("dummy",
'--start', $tasks[0][1],
'--end', $tasks[0][2],
'--font TITLE:20:"WenQuanYi Zen Hei Mono"',
"DEF:maxping=$cfg->{General}{datadir}${host}.rrd:median:AVERAGE",
'PRINT:maxping:MAX:%le' );
4. 重启smokeping服务service smokeping restart 或者/etc/init.d/smokeping restart
修改/usr/local/smokeping/etc/config 文件的配置参数,必须重启动smokeping程序。
如果重启动smokeping程序失败,根据报错提示删除/usr/local/smokeping/data子文件夹的rrd文件。
七、打开检测主机的Web页面
在Web浏览器里输入http://您的监控主机IP/smokeping
如果遇到500错误:
Internal Server Error
The server encountered an internal error or misconfiguration and was unable to complete your request.
Please contact the server administrator, root@localhost and inform them of the time the error occurred, and anything you might have done that may have caused the error.
More information about this error may be available in the server error log.
--------------------------------------------------------------------------------
Apache/2.2.15 (CentOS) Server at 192.168.2.101 Port 80
说明没有关闭SElinux 选项,关闭就正常setenforce 0
vi /etc/sysconfig/selinux
SELINUX=permissive
[root@localhost ~]# getenforce #查看SElinux 的命令
Permissive #返回的结果是Permissive, 表示已经关闭SElinux了
八、在Web页面增加验证用户名和密码(可选步骤)
1. 修改httpd.conf里的内容
vi /etc/httpd/conf/httpd.conf
<Directory "/usr/local/smokeping">
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>
注:上面的内容部分已经添加,这里仅添加红色字体内容即可。
2. 设置登录账户与密码
进入cd /usr/local/smokeping/htdocs目录, 执行命令:
htpasswd -c /usr/local/smokeping/htdocs/htpasswd admin
这个是设置登录账户为admin,密码在后面输入,然后重启httpd就可以实现密码验证登录。
service httpd restart
重新登录web页面,会要求输入用户名和密码。
- 基于Apache搭建的smokeping监控及配置
- 基于Nginx搭建的smokeping监控及配置
- 基于Nginx搭建的Cacti监控及配置
- centos搭建SmokePing监控IDC丢包延迟
- smokeping网络监控
- PHP Apache Mysql的配置搭建及多站点配置
- Smokeping安装及问题解决
- Nagios搭建配置及监控脚本开发
- smokeping告警配置
- 基于注解的Spring MVC 框架搭建及配置详解
- Centos6.5搭建smokeping服务
- Apache mod_cband 站点流量监控软件安装及配置
- smokeping
- Linux运维之加密/解密原理、自建CA及搭建基于https的Apache
- Tomcat:基于Apache+Tomcat的集群搭建
- 基于Apache的Apusic集群搭建
- 基于Windows的Apache+Git服务器搭建
- centos smokeping nginx 部署,监控网络状况
- 【链接】2015寒假针对省选信息学网络课程
- 由文件路径获得扩展名
- python装饰器与面向切面编程
- VMWare 10 安装 10.9 Mac OS 如何调整分辨率为 1920 * 1200?
- WPF Binding相关的一些常见方式总结(七)
- 基于Apache搭建的smokeping监控及配置
- 哈希函数处理
- 收藏一些对开发有帮助的网站
- SQL基础第五章通过视图修改数据
- android 日期滑动选择器
- Neural Networks 神经网络的表示和 back propagation 的学习方法
- 《设计原本》读书笔记
- java source debug
- CREATE PROCEDURE