标签:过程 目录 ret Fix 图像 监控 serve proc adb
本文为个人思路,并非官方文档(其实是找不到文档自己琢磨出来的),如需转载注明出处。
Author:aoxs
smokeping主从的作用就不做介绍了,可以百度查一下
下面直接上安装过程
一、环境部署(准备两台Centos虚拟机,两台的安装方法相同)
1.关闭防火墙和SElinux
# systemctl stop firewalld.service
# systemctl disable firewalld.service
# sed -i ‘s/SELINUX=enforcing/SELINUX=disabled/‘ /etc/selinux/config
# grep SELINUX=disabled /etc/selinux/config
# setenforce 0
2.安装EPEL源
# yum -y install epel-release
3.安装绘图工具、web服务、及Smokeping扩展包
# yum -y install rrdtool perl-rrdtool fping httpd openssl-devel
# yum -y install perl-core curl gcc gcc-c++ wget
二、安装Smokeping服务
×××
# wget https://oss.oetiker.ch/smokeping/pub/smokeping-2.6.11.tar.gz
源码编译安装Smokeping
# tar -xzvf smokeping-2.6.11.tar.gz
# cd smokeping-2.6.11
# ./setup/build-perl-modules.sh /usr/local/smokeping/thirdparty //用Smokeping自脚本安装依赖包
# ./configure --prefix=/usr/local/smokeping //指定安装路径
# /usr/bin/gmake install
三、配置主从
·master端配置
1.配置web页面支持中文
安装一个中文字体
# yum -y install wqy-zenhei-fonts.noarch
2.创建相关文件夹个日志文件(有部分在配置的时候会用到)
# cd /usr/local/smokeping
# mkdir cache data var //建立存放图像、数据、日志的目录
# touch /var/log/smokeping.log //建立日志文件
# chown apache.apache cache/ data/ var/ /var/log //更改权限
# cd /usr/local/smokeping/htdocs
# cp /smokeping.fcgi.dist smokeping.fcgi //将目录内的fcgi文件重命名
# cd /usr/local/smokeping/etc
# cp config.dist config //复制一份配置文件
# echo swbooo:123456 > /usr/local/smokeping/etc/smokeping_secrest.dist //指定slave的用户名和密码
# chmod 600 smokeping_secrets.dist //修改密码文件权限
3.编辑SmokePing文件config
3.1 添加支持中文代码
# vi /usr/local/smokeping/etc/config
charset = utf-8
3.2 修改配置文件中刷新时间 60秒ping20次
# vi /usr/local/smokeping/etc/config
3.3 添加监控项(此处可以用@include添加)
# vi /usr/local/smokeping/etc/config
eg:
***Slaves***
secrets=/usr/local/smokeping/etc/smokeping_secrets.dist
+swbooo #这里设置Slave的名字,颜色等
display_name=swbooo
color=0000ff
*** Targets ***
+MasterTest
menu = test本机
++localhost
menu = 本机
title = localhost
host = 127.0.0.1
+slaves #配置Slave监控节点
menu = slave
++swbooo1
menu = 腾讯
title = 腾讯
slaves = swbooo
host = qq.com
++ swbooo2
menu = 百度
title = 百度
slaves = swbooo
host = baidu.com
4.配置apache服务(master端)
4.1修改配置文件
#末尾添加如下内容(此处其实就是做httpd开放访问,环境不同可能会影响)
# vim /etc/httpd/conf/httpd.conf
·slave端配置(不需要修改配置文件)
1.创建相关文件夹个日志文件
# cd /usr/local/smokeping
# mkdir cache data var //建立存放图像、数据、日志的目录
# touch slave.log //建立日志文件
# chown apache.apache cache/ data/ var/ slave.log //更改权限
# cd /usr/local/smokeping/htdocs
# cp smokeping.fcgi.dist smokeping.fcgi //将目录内的fcgi文件重命名
# cp etc/smokeping_secrets.dist etc/smokeping_slave_secrets
# echo 123456 > etc/smokeping_slave_secrets //slave端只需要写入密码
# chmod 600 etc/smokeping_slave_secrets //修改密码文件权限
·启动服务(关键一步就在启动服务)
master:
# /usr/local/smokeping/bin/smokeping restart
Note: logging to syslog as local0/info.
Daemonizing /usr/local/smokeping/bin/smokeping ...
slave:
# /usr/local/smokeping/bin/smokeping --master-url=http://masterIP/smokeping --cache-dir=/usr/local/smokeping/cache/ --shared-secret=/usr/local/smokeping/etc/smokeping_slave_secrets --slave-name=swbooo --logfile=/usr/local/smokeping/slave.log
Sent data to Server and got new config in response.
Note: logging to syslog as local0/info.
Daemonizing /usr/local/smokeping/bin/smokeping ...
最后确保master端的slave rrd文件,使apache有写入权限
四、完成
浏览器访问http://IP/smokeping
最终附上效果图,会有两行数据,一个主一个从
标签:过程 目录 ret Fix 图像 监控 serve proc adb
原文地址:http://blog.51cto.com/13601331/2299241