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监控及配置相关推荐

  1. 基于apache搭建文件下载服务器

    CentOS6下使用Apache部署HTTP服务 [日期:2018-05-08] 来源:Linux社区  作者:火星的小白 [字体:大 中 小] Apache--目前用于实现http服务的软件有许多, ...

  2. 基于Mirai搭建QQ机器人监控B站直播

    搭建自定义Mirai机器人 周末本来想继续学Vue来着,这不又搞这个了,唉,这计划赶不上变化啊. 参考文档 mamoe/mirai: 高效率 QQ 机器人支持库 Gradle 下载的依赖jar包在哪? ...

  3. 基于docker 搭建Prometheus+Grafana监控

    一.prometheus介绍 1.什么是prometheus? Prometheus是由SoundCloud开发的开源监控报警系统和时序列数据库(TSDB). Prometheus使用Go语言开发,是 ...

  4. 基于Zero-Ice搭建的物联网监控平台

    [P1] 项目初始态势 开始接手项目时,领导要求很简单,就是做一个本地服务,手机连接上服务,能控制本地系统内的各种设备,至于设备状态如何采集与控制,数据如何分析和存储这里略过,其通信机制类似于下图: ...

  5. 远程视频监控php,基于 CentOS 搭建远程视频监控系统

    妹子说想看一下没人在家的时候小狗在干嘛,于是我就开始寻找开源的远程视频监控系统.经常一翻查找.对比,最后选定了 Zoneminder. A full-featured, open source, st ...

  6. 基于sentry的前端错误监控日志系统(部署sentry服务器/前端项目部署)-让前端最快的定位到生产问题...

    背景 在这越来越发达的网络时代,web应用也是越来越复杂,尤其是前端的开发,也是越来越受重视. 所以在我们前端开发完成后,会有一些列的web应用的上线验证,如自测.QA测试.code review 等 ...

  7. 基于sentry的前端错误监控日志系统(部署sentry服务器/前端项目部署)-让前端最快的定位到生产问题

    基于sentry的前端错误监控日志系统(部署sentry服务器/前端项目部署)-让前端最快的定位到生产问题 背景 在这越来越发达的网络时代,web应用也是越来越复杂,尤其是前端的开发,也是越来越受重视 ...

  8. 实操:基于LNMP搭建zabbix监控

    文章目录 一:环境准备: 二:zabbix概述 2.1 查看官网 2.2 zabbix与nagios 2.3 zzbbix介绍 2.4 zabbix软件包 三:基于LNMP搭建zabbix 3.1 创 ...

  9. Linux Zabbix——zabbix可视化、监控模板配置、自定义监控参数、自动发现监控下设备、数据库监控、企业proxy分布式监控搭建配置...

    Zabbix可视化.监控模板配置.自定义监控参数.自动发现监控下设备.数据库监控.proxy分布式监控搭建配置- 文章篇幅较长,可以选择目录查看感兴趣的模块. 1.Zabbix可视化 1. 简介 企业 ...

最新文章

  1. Urllib库函数、代理、爬取案例
  2. Blender从头到尾创建低多边形角色学习教程 Low Poly Characters – Blender Bitesize Course
  3. Facebook爆锤深度度量学习:该领域13年来并无进展!网友:沧海横流,方显英雄本色...
  4. 【实践】简洁大方的summernote 富文本编辑器插件的用发——导入篇
  5. 深度学习:从MLP到朴素的神经网络
  6. 【转】Memcached管理与监控工具----MemAdmin
  7. Winrunner经验总结
  8. 编译原理-第一章:引论
  9. Symbian操作系统
  10. 计算机网页文档无法复制怎么办,电脑网页不能右键复制怎么办|电脑无法复制网页内容的解决方法...
  11. 投票系统C语言程序,C语言课程投票程序系统.doc
  12. Using RCU‘s CPU Stall Detector(待更新)
  13. 创维电视显示无服务器,常见创维电视机故障及维修方法【详解】
  14. pox.xml有些包下载不了的原因
  15. js快速获取当前链接和域名
  16. 调色板v3.0 for PPTs
  17. spring自动装配原理
  18. 如何安装关于编程类软件
  19. 全国省市区邮编等信息入库API-JAVA
  20. 这本PyTorch官方出品的Deep Learning With PyTorch终于有了中文版

热门文章

  1. mysql日志文件在哪_linux中mysql日志文件在哪里?
  2. 新书《路由器配置与管理完全手册——H3C篇》目录抢鲜暴光
  3. 流媒体服务(一)流媒体服务器搭建 win10+ngnix+rtmp+ffmpg播放rtmp和HLS/m3u8
  4. torch中的spmm
  5. 九、Kafka 消费位点
  6. 写手们要下岗了?百度开启AI智能写作平台
  7. EasyAdmin CURD命令大全
  8. iOS开发里的线程安全机制
  9. python 从大到小循环_python-小进阶之循环语句
  10. CRect类(矩形类)