Deploy smokeping

简介:

Deploy smokeping





About SmokePing

SmokePing keeps track of your network latency:

Best of breed latency visualisation.

Interactive graph explorer.

Wide range of latency measurement plugins.

Master/Slave System for distributed measurement.

Highly configurable alerting system.

Live Latency Charts with the most 'interesting' graphs.

Free and OpenSource Software written in Perl written by Tobi Oetiker, the 

creator of MRTG and RRDtool



Official Link

oss.oetiker.ch




部署原因

监控内网环境,即使用ping来检测是否丢包,或丢失包率等,并可实现邮件式报警

即当丢包率达到所设定的值时自动给某个邮箱发送报警(当然要有mail服务器)




部署环境

CentOS 7.2

fping 3.10

perl v5.16.3

smokeping 2.6.10



安装包下载

CentOS (官方下载)

fping (EPEL)

perl (CentOS自带)

smokeping (官方下载 地址上边已经附加)





安装步骤


1.安装依赖包

# yum install -y rrdtool rrdtool-perl perl-libwww-perl perl-CGI perl-FCGI 

perl-Digest-MD5 perl-Digest-HMAC perl-CPAN perl-ExtUtils-CBuilder 

perl-ExtUtils-MakeMaker perl-Sys-Syslog fping (上边一行命令)


(注如果出现某些包无法安装,需要添加EPEL的yum源,这里不做详细介绍,可百度)



2.安装perl插件

# perl -MCPAN -e "install Config::Grammar"  (这里会进入交互界面)

yes  表示选择自动配置

回车 这步含义是安装perl模块路径,我使用的root所以直接回车,其它用户可选其它

no   不让他自动选择获取perl模块源连接

yes  列出CPAN mirror list

2    选择离你最近的源站点,我是Asia

8  我先的163的源站

回车 不自行手动设置cpan源站点

(此时便开始安装Config::Grammar 时间可能会长一点) 

快到结束的时候会提示是否添加环境变量到~/.bashrc  我选的yes



3.编译安装smokeping

从官方下载smokeping-2.6.10.tar.gz   (个人放置在/root目录下)

地址: oss.oetiker.ch


# tar -xf /root/smokeping-2.6.10.tar.gz 

# cd /root/smokeping-2.6.10

# ./configure --prefix=/opt/smokeping  

(这里指的是安装路径建议这个如果想改注意配置文件等也要相应的做更改)

# make install


smokeping(安装结束)



4.配置smokeping

# cd /opt/smokeping

# mkdir cache data var

# chown apache.apache cache/ data/ var/

# cd /opt/smokeping/etc

# cp config.dist config

# chmod 600 smokeping_secrets.dist

# cd /opt/smokeping/htdocs

# cp smokeping.fcgi.dist smokeping.fcgi

# vi config

  更改下边的链接,我这个是改过的,前边的IP改一下就OK了

  cgiurl   = http://10.10.128.128/smokeping.cgi


测试配置是否正常

# cd /opt/smokeping/bin

# ./smokeping --config=/opt/smokeping/etc/config --debug


如提示 Daemonizing ./bin/smokeping ...

表示没有大问题了呵呵 


注意如果想开机启动需要制作服务脚本呵呵

此时便可启动了,把后边的debug去掉就可以直接启动了




5.安装httpd并配置添加smokeping基于网页式浏览监控

# yum install httpd

配置访问smokeping目录时需要输入用户密码

# htpasswd -c /opt/smokeping/htdocs/htpasswd smokeping

# chown apache.apache /opt/smokeping/htdocs/htpasswd

# chmod 600 /opt/smokeping/etc/smokeping_secrets.dist



配置http网页式访问smokeping监控

# vi /etc/httpd/conf/httpd.conf

在配置文件最后添加

Alias /cache "/opt/smokeping/cache/"

Alias /cropper "/opt/smokeping/htdocs/cropper/"

Alias /smokeping "/opt/smokeping/htdocs/smokeping.fcgi"

<Directory "/opt/smokeping">

AllowOverride None

Options all

AddHandler cgi-script .fcgi .cgi

AllowOverride AuthConfig

Order allow,deny

Allow from all

AuthName "Smokeping"

AuthType Basic

AuthUserFile /opt/smokeping/htdocs/htpasswd

Require valid-user

DirectoryIndex smokeping.fcgi

</Directory>


此时便可启动httpd服务

# systemctl start httpd.service


此时使用浏览器访问http://IP/smokeping 即可查看smokeping

IP要替换成服务器的IP




6.添加监控节点

直接在/opt/smokeping/etc/config的后部直接添加即可

如我想监控192.168.1.1 则在其最后添加此几行,即可实现监控

+IP1.1 (可自己定义,注意有可能特殊字符不支持)

menu = 1-1 (可自己定义,注意有可能特殊字符不支持)

title = 1-1 (可自己定义,注意有可能特殊字符不支持)

host = 192.168.1.1



部署总结

1. http服务里的Alias 那几个目录都是被smokeping所用到的

2. smokeping目录里bin smokeping --debug可以查看到错误

3. smokeinfo /path/config-file 可以简单查看监控节点的状态

4. 密钥文件不可以让组和其它有任何的权限


本文转自Winthcloud博客51CTO博客,原文链接http://blog.51cto.com/winthcloud/1948167如需转载请自行联系原作者


Winthcloud

相关文章
|
1天前
|
应用服务中间件 Linux nginx
【nginx】[emerg] "server" directive is not allowed here in /usr/local/nginx/conf/nginx.conf:45
【nginx】[emerg] "server" directive is not allowed here in /usr/local/nginx/conf/nginx.conf:45
4 0
|
4月前
|
Ubuntu 应用服务中间件 网络安全
|
4月前
|
应用服务中间件 nginx
nginx中alias
nginx中alias
31 0
|
5月前
|
Ubuntu
./autogen.sh: 5: ./autogen.sh: autoreconf: not found
./autogen.sh: 5: ./autogen.sh: autoreconf: not found
|
10月前
|
应用服务中间件 nginx
nginx config
主nginx.conf 子域名 conf 一般放在nginx 的conf目录下的include目录 在主conf nginx.conf中指定 include位置。
69 0
|
容器 Perl
kubectl -- cp
kubectl -- cp 将文件和目录复制到容器和从容器复制文件和目录。
486 0
|
应用服务中间件 nginx
nginx: [error] open() “/usr/local/nginx/logs/nginx.pid“ failed (2: No such file or directory)
nginx: [error] open() “/usr/local/nginx/logs/nginx.pid“ failed (2: No such file or directory)
263 0
nginx: [error] open() “/usr/local/nginx/logs/nginx.pid“ failed (2: No such file or directory)
|
数据建模 应用服务中间件 nginx
Docker - 解决创建 nginx 容器尝试挂载 nginx.conf 文件时报错: mounting "/root/nginx.conf" to rootfs at "/etc/nginx/nginx.conf" caused: mount through procfd: not a directory:
Docker - 解决创建 nginx 容器尝试挂载 nginx.conf 文件时报错: mounting "/root/nginx.conf" to rootfs at "/etc/nginx/nginx.conf" caused: mount through procfd: not a directory:
2733 0
|
应用服务中间件 网络安全 nginx
nginx: [emerg] unknown directive "ssl" in /usr/local/nginx/conf/nginx.con
[root@jiaxin-ceshi ca]# nginx -t nginx: [emerg] unknown directive "ssl" in /usr/local/nginx/conf/nginx.
7317 0