centos7下源码安装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服务

1.源码下载

#wget https://oss.oetiker.ch/smokeping/pub/smokeping-2.6.11.tar.gz

2.源码编译安装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

三、配置主从
1.master端配置
配置web页面支持中文

1.1.安装一个中文字体

#yum -y install wqy-zenhei-fonts.noarch

1.2.编辑SmokePing文件config

#vi /usr/local/smokeping/etc/config

template = /usr/local/smokeping/etc/basepage.html.dist
charset = utf-8

... ...

*** Database ***
step   = 60
pings = 60			
			
... ...

添加监控项(此处可以用@include添加)
***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

++swbooo

menu = 腾讯
title = 腾讯
slaves = swbooo
host = qq.com

++ swbooo2

menu = 百度
title = 百度
slaves = swbooo
host = baidu.com

2.配置apache服务(master端)

修改配置文件
#末尾添加如下内容(此处其实就是做httpd开放访问,环境不同可能会影响)

# vim /etc/httpd/conf/httpd.conf

centos7下源码安装Smokeping,主从部署_第1张图片

创建相关文件夹个日志文件

# 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
# chmod 600 smokeping_secrets.dist  //修改密码文件权限

3.slave端配置(不需要修改配置文件)

创建相关文件夹个日志文件

# 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
# chmod 600 etc/smokeping_slave_secrets  //修改密码文件权限

3.启动服务

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有写入权限
centos7下源码安装Smokeping,主从部署_第2张图片
四、完成
浏览器访问http://IP/smokeping
最终效果图

centos7下源码安装Smokeping,主从部署_第3张图片

你可能感兴趣的:(smokeping)