Install and configure Smokeping in CentoOS
As the company needs to monitor the network quality of the data center, it is helpless to install smokeping. Since most of the online tutorials are in the old version, today I will discuss the process of installing the new version on centos, forgive me for some bad things.
Please download all of the following installation packages here: http://download.chinaunix.net/
1. Disable selinux and clear iptables first.
Vim/etc/selinux/config
SELINUX = disabled
Iptables-F
2. Change the yum source, which is faster in China. I changed it to ustc.
Cd/etc/yum. repos. d/
Mv CentOS-Base.repo CentOS-Base.repo.bak
Vim CentOS-Base.repo.
# CentOS-Base.repo
#
# The mirror system uses the connecting IP address of the client and
# Update status of each mirror to pick mirrors that are updated to and
# Geographically close to the client. You shoshould use this for CentOS updates
# Unless you are manually picking other mirrors.
#
# If the specified list = does not work for you, as a fall back you can try
# Remarked out baseurl = line instead.
# YunVN.com
#
[Base]
Name = CentOS-$ releasever-Base-mirrors.ustc.edu.cn
Baseurl = http://mirrors.ustc.edu.cn/centos/?releasever/ OS /?basearch/
# Items list = http://mirrorlist.centos.org /? Release = $ releasever & arch = $ basearch & repo = OS
Gpgcheck = 1
Gpgkey = http://mirrors.ustc.edu.cn/centos/RPM-GPG-KEY-CentOS-6
# Released updates
[Updates]
Name = CentOS-$ releasever-Updates-mirrors.ustc.edu.cn
Baseurl = http://mirrors.ustc.edu.cn/centos/?releasever/updates/?basearch/
# Items list = http://mirrorlist.centos.org /? Release = $ releasever & arch = $ basearch & repo = updates
Gpgcheck = 1
Gpgkey = http://mirrors.ustc.edu.cn/centos/RPM-GPG-KEY-CentOS-6
# Additional packages that may be useful
[Extras]
Name = CentOS-$ releasever-Extras-mirrors.ustc.edu.cn
Baseurl = http://mirrors.ustc.edu.cn/centos/?releasever/extras/?basearch/
# Items list = http://mirrorlist.centos.org /? Release = $ releasever & arch = $ basearch & repo = extras
Gpgcheck = 1
Gpgkey = http://mirrors.ustc.edu.cn/centos/RPM-GPG-KEY-CentOS-6
# Additional packages that extend functionality of existing packages
[Centosplus]
Name = CentOS-$ releasever-Plus-mirrors.ustc.edu.cn
Baseurl = http://mirrors.ustc.edu.cn/centos/?releasever/centosplus/?basearch/
# Items list = http://mirrorlist.centos.org /? Release = $ releasever & arch = $ basearch & repo = centosplus
Gpgcheck = 1
Enabled = 0
Gpgkey = http://mirrors.ustc.edu.cn/centos/RPM-GPG-KEY-CentOS-6
# Contrib-packages by Centos Users
[Contrib]
Name = CentOS-$ releasever-Contrib-mirrors.ustc.edu.cn
Baseurl = http://mirrors.ustc.edu.cn/centos/?releasever/contrib/?basearch/
# Items list = http://mirrorlist.centos.org /? Release = $ releasever & arch = $ basearch & repo = contrib
Gpgcheck = 1
Enabled = 0
Gpgkey = http://mirrors.ustc.edu.cn/centos/RPM-GPG-KEY-CentOS-6
OK. The preparation is complete. Now we have started to install it.
3. The yum package required for the installation environment
Yum-y install libxml2-devel libpng-devel glib pango-devel freetypefreetype-devel fontconfig cairo-devel libart_lgpl libart_lgpl-devel perl-Net-Telnet perl-Net-DNSperl-LDAP perl-libwww- perl-RadiusPerl perl-IO-Socket-SSL perl-Socket6perl-CGI-SpeedyCGI rrdtool-perl
4. Install rrdtool
Wgethttp: // down1.chinaunix.net/distfiles/rrdtool-1.4.5.tar.gz
Tar zxvf rrdtool-1.4.7.tar.gz
Cd rrdtool-1.4.7
./Configure -- prefix =/usr/local/rrdtool
Make & make install
5. install the software on which smokeping depends
[Cgilib]
Wget http://down1.chinaunix.net/distfiles/cgilib-0.5.tar.gz
Tar zxvf cgilib-0.5.tar.gz
Cd cgilib-0.5
Make
Cp libcgi. a/usr/local/lib
Cp cgi. h/usr/include
Fping-2.4b2_to]
Tar zxvf fping.tar.gz
Cd fping-2.4b2_to
./Configure
Make
Make check
Make install
Whereis fping
Fping:/usr/local/sbin/fping
5. Install echoping
Wgethttp: // down1.chinaunix.net/distfiles/echoping-5.2.0.tar.gz
Tar zxvf echoping-5.2.0.tar.gz
Cd echoping-5.2.0
Error message:
./Configure
Configure: error: Popt libraries is required
Yum install popt-devel gettext
./Configure
Echo $?
Configure: error: GNU -- without-libidn
./Configure -- without-libidn
Echo $?
Make & make install
6. Install smokeping
Wgethttp: // oss. oetiker. ch/smokeping/pub/smokeping-2.6.8.tar.gz
Tar zxvf smokeping-2.6.8.tar.gz
Cd smokeping-2.6.8
./Configure-prefix =/usr/local/smokeping
During compilation, an error is reported, indicating that many extensions are missing. At this time, we only need to execute an installation script.
./Setup/build-perl-modules.sh/usr/local/smokeping/thirdparty
After installation, continue compilation and installation.
./Configure-prefix =/usr/local/smokeping
Make & make install
/Usr/bin/gmake install
After the installation is complete, modify the configuration file below.
/Usr/local/smokeping/bin
Go to the bin directory and modify the smokeping file.
# Vim smokeping
Row 8: use lib qw (); # PERL5LIB
Change to: use lib qw (/usr/local/rrdtool/lib/perl );
Go to the htdocs directory
# Mv smokeping. fcgi. dist smokeping. fcgi
Enter the etc directory
Cp config. dist config
Modify the config file
# Vim config
Modify the following as needed
Owner = sundong
Contact =
Mailhost =
Modify alert email
* ** Alerts ***
To = 1578980735@qq.com
From = 18062069926@163.com
* ** Probes ***
+ FPing
Binary =/usr/sbin/fping # change to the actual path
Binary =/usr/local/sbin/fping
The monitoring host is layered and expressed with a + number.
For example, + layer 1 ++ Layer 2 ++ Layer 3 can be modified based on your own situation;
Here, the device name cannot contain "." or "-", and there should be other characters that I have not met.
The master/slave Mode and other functions will be supplemented later
+ Test
Menu = local
# Parents = owner:/Test/James location :/
++ Yunvn
Menu = localhost
Title = localhost
Host = localhost
The configuration file in the appendix below is for reference only.
Create a directory for storing data files
Mkdir-p/usr/local/smokeping/data/usr/local/smokeping/var/usr/local/smokeping/cache
Modify the directory of smokeping to the owner and group of apache running users.
Chown-R daemon. daemon smokeping/
Chmod 600/usr/local/smokeping/etc/smokeping_secrets.dist
Chmod 777/usr/local/smokeping/cache/usr/local/smokeping/data/usr/local/smokeping/var
Create a log file for smokeping
Touch/var/log/smokeping. log
Chown daemon. daemon/var/log/smokeping. log
Start smokeping
Perl/usr/local/smokeping/bin/smokeping -- logfile =/var/log/smokeping. log
Create a smokeping STARTUP script for easy startup
Vim/etc/init. d/smokeping
Add as follows:
#! /Bin/bash
#
# Chkconfig: 2345 80 05
# Description: Smokeping init. d script
# Hacked by: sundong
# Get function from functions library
./Etc/init. d/functions
# Start the service Smokeping
Start (){
Echo-n "Starting Smokeping :"
/Usr/local/smokeping/bin/smokeping>/dev/null 2> & 1
### Create the lock file ###
Touch/var/lock/subsys/smokeping
Success $ "Smokeping startup"
Echo
}
# Restart the service Smokeping
Stop (){
Echo-n "Stopping Smokeping :"
Kill-9 'ps ax | grep "/usr/local/smokeping/bin/smokeping" | grep-v grep | awk' {print $1} ''>/dev/null 2> & 1
### Now, delete the lock file ###
Rm-f/var/lock/subsys/smokeping
Success $ "Smokeping shutdown"
Echo
}
### Main logic ###
Case "$1" in
Start)
Start
;;
Stop)
Stop
;;
Status)
Status Smokeping
;;
Restart | reload | condrestart)
Stop
Start
;;
*)
Echo $ "Usage: $0 {start | stop | restart | reload | status }"
Exit 1
Esac
Exit 0
Execute the script
# Chmod 755/etc/init. d/smokeping
Set startup smokeping
Chkconfigure smokeping on
Configure apache
# Vim/etc/httpd/conf/httpd. conf
Last join
Alias/smokeping "/usr/local/smokeping/htdocs/smokeping. fcgi"
Alias/cache "/usr/local/smokeping/cache"
Alias/cropper "/usr/local/smokeping/htdocs/cropper /"
<Directory/usr/local/smokeping>
AllowOverride None
AddHandler cgi-script cgi fcgi
Options ExecCGI
Order allow, deny
Allow from all
DirectoryIndex smokeping. cgi
</Directory>
Save
Error Message
[Root @ Cactilocal] # servicehttpdstart
Startinghttpd: httpd: apr_sockaddr_info_get () failedforCacti
Httpd: Couldnotreliablydeterminetheserver 'sfullyqualifieddomainname, using127.0.0.1forServerName
Modify ServerName localhost: 80 in httpd. conf
Enable httpd at startup
Chkconfigurehttpd on
Now the installation and configuration are complete;
Access http: // IP/smokeping
Error Message
Can 'tlocaterrds. pmin @ INC (@ INCcontains :.............................
Run yuminstallperl-rrdtool