Install and configure the network detection tool smokeping

Source: Internet
Author: User
Tags pings rrdtool install perl smokeping

Smokeping is the work of Tobi oetiker by MRTG and rrdtool. It is mainly used to check the network quality and stability of the IDC. Its main functions include general Ping, dig, echoping, and curl, use rrdtool to draw images. I think there are the following reasons for choosing smokeping:

1. the best drawing function, latency and packet loss are intuitively indicated by color and shadow.

2. Free and open-source.

3. Supports the master-slave distributed mode.

4. You can customize the alarm function.

Smokeping Official Website: http://oss.oetiker.ch/smokeping/

The following installation and configuration systems are: RedHat 5.8 + Perl 5.8.8

Smokeping official Perl version requirements: Perl 5.8.8 or later

1. Installation

Http://oss.oetiker.ch/smokeping/pub/

1. Install the yum source. The rpmforge source has the dependent packages required for smokeping:

# Rpm-UHV http://apt.sw.be/redhat/el5/en/i386/rpmforge/RPMS/rpmforge-release-0.3.6-1.el5.rf.i386.rpm

After the installation is successful, one more repo file is configured in the yum Repository:

[[Email protected] _ 82_215 soft] # ls/etc/yum. Repos. d/
5as. Repo 5asu5. Repo mirrors-rpmforge RedHat. Repo rhel-debuginfo.repo rpmforge. Repo


2. Install the dependency package:

# Yum install httpd

# Yum install rrdtool

# Yum install fping

# Yum install echoping

# Yum install curl

# Yum install Perl-net-Telnet Perl-net-DNS Perl-LDAP Perl-libwww-perl Perl-radiusperl Perl-io-socket-SSL perl-Socket6 Perl-CGI-speedycgi

3. Install the latest version of smokeping:

# Wget http://oss.oetiker.ch/smokeping/pub/smokeping-2.6.9.tar.gz

# Tar xf smokeping-2.6.9.tar.gz

# Cd smokeping-2.6.9/

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

Note:

1. After configure, if the dependent Perl module is not properly installed, a script is prompted for installation. Run the script as prompted. If there are still problems after the script is run, refer to the 2nd

2. If the following error occurs during configure, The fcgi module is not installed:

Checking for Perl module 'fcgi'... failed
Checking for Perl module 'cgi '... OK
Checking for Perl module 'cgi: quick'... failed

Install the fcgi module:

# Perl-mcpan-e 'Install fcgi'

If you are prompted that CPAN is not installed, use yum for installation.

# Yum install CPAN

Then install:

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

# Make install

View the installation directory:

[[Email protected] _ 82_215 smokeping] # ls
Bin etc htdocs lib share thirdparty

4. There are many configuration files ending with DIST in the smokeping directory. You need to rename the files ending with DIST to make the configuration take effect:

# Cd htdocs

# Cp smokeping. fcgi. Dist smokeping. fcgi

# Cp tr. cgi. Dist tr. cgi

# CD ../etc/

# Cp config. Dist config

# Cp basepage.html. Dist basepage.html

# Cp smokemail. Dist smokemail

# Cp tmail. Dist tmail

# Cp smokeping_secrets.dist smokeping_secrets

# Chmod 600/opt/smokeping/etc/smokeping_secrets

2. Modify the smokeping and Apache configuration files.

1. Modify the Binary command permission:

# Chmod 4775/bin/Traceroute

2. Create the following three directories to save the smokeping data.

# Mkdir/opt/smokeping/Data

# Mkdir/opt/smokeping/var

# Mkdir/opt/smokeping/htdocs/Cache

# Mkdir-P/opt/smokeping/htdocs/img

# Chown-r Apache: Apache/opt/smokeping

3. Specify the path to the Perl module library of rrdtool.

First, find the location of the library file on the system: (the installation method of different systems or different Perl-rrdtool will be different)

[[Email protected] _ 82_215 ~] # Rpm-Qa | grep rrdtool
Perl-rrdtool-1.4.7-1.el5.rf
Rrdtool-1.2.27-4.el5
Rrdtool-1.4.7-1.el5.rf

[[Email protected] _ 82_215 ~] # Rpm-QL perl-rrdtool-1.4.7-1.el5.rf.
/Usr/lib/perl5/vendor_perl/5.8.8/RRDP. PM
/Usr/lib64/perl5/vendor_perl/5.8.8/x86_64-linux-thread-multi/rrds. PM
/Usr/lib64/perl5/vendor_perl/5.8.8/x86_64-linux-thread-multi/auto/rrds. BS
/Usr/lib64/perl5/vendor_perl/5.8.8/x86_64-linux-thread-multi/auto/rrds. So
/Usr/share/doc/perl-rrdtool-1.4.7
/Usr/share/doc/perl-rrdtool-1.4.7/manifest
/Usr/share/doc/perl-rrdtool-1.4.7/readme
/Usr/share/man/man3/rrdp.3pm.gz
/Usr/share/man/man3/rrds.3pm.gz

# Vim/opt/smokeping/bin/smokeping_cgi

Put the following lines:

# Use lib QW (); # perl5lib

To:
Use lib QW (/usr/lib64/perl5/vendor_perl/5.8.8/x86_64-linux-thread-multi/auto/rrds); # perl5lib

4. Modify the Apache configuration file

# Vim/etc/httpd/CONF/httpd. conf

Add the following VM:

<Virtualhost *: 80>
Serveradmin [email protected]
Servername 10.13.82.215
DocumentRoot/opt/smokeping/htdocs
Errorlog logs/174-error_log
Customlog logs/174-access_log common
<Directory "/opt/smokeping/htdocs">
Options followsymlinks execcgi
AllowOverride none
Directoryindex index.html smokeping. fcgi
Addhandler CGI-script fcgi. cgi
Order allow, deny
Allow from all
</Directory>
</Virtualhost>

Restart Apache:

#/Etc/init. d/httpd restart

5. Modify the smokeping configuration file.

# Vim config
* ** General ***

Owner = shengjiali
Contact = [email protected]
Mailhost = mail.com
Sendmail =/usr/lib/sendmail

# Note: Do not put the image cache below cgi-bin
# Since all files under cgi-bin will be executed... this is not
# Good for images.
Imgcache =/opt/smokeping/htdocs/img
Imgurl = http: // 10.13.82.215/img
Datadir =/opt/smokeping/Data
Piddir =/opt/smokeping/var
Cgiurl = http: // 10.13.82.215/smokeping. cgi
Smokemail =/opt/smokeping/etc/smokemail
Tmail =/opt/smokeping/etc/tmail
# Specify this to get syslog logging
Syslogfacility = local0
# Each probe is now run in its own process
# Disable this to revert to the old behaviour
# Concurrentprobes = No

* ** Alerts ***
To = [email protected]
From = [email protected]

+ Someloss
Type = loss
# In percent
# Pattern => 0%, * 12 *,> 0%, * 12 *,> 0%
Pattern => 0%, * 10 *,> 0%, * 10 *,> 0%

Comment = loss 3 times in a row

+ Manyloss

Type = loss

Pattern => 15%, * 30 *,> 15%, * 30 *,> 15%

Comment = loss 5 packages in 30 continuous 3 times.

+ Rttbad
Type = RTT
Pattern = s,> 50,> 50 # in milliseconds
Comment = for more than two consecutive 50-millisecond delay

* ** Database ***

Step = 60
Pings = 20

# Consfn mrhb steps total

Average 0.5 1 1008
Average 0.5 12 4320
Min 0.5 12 4320
Max 0.5 12 4320
Average 0.5 144 720
Max 0.5 144 720
Min 0.5 144 720

* ** Presentation ***

Template =/opt/smokeping/etc/basepage.html
Charset = UTF-8

+ Charts

Menu = charts
Title = the most interesting destinations

++ Stddev
Sorter = stddev (entries => 4)
Title = Top Standard Deviation
Menu = STD Deviation
Format = standard deviation % F

++ Max
Sorter = max (entries => 5)
Title = top max roundtrip time
Menu = by Max
Format = max roundtrip time % F seconds

++ Loss
Sorter = loss (entries => 5)
Title = Top packet loss
Menu = loss
Format = packets lost % F

++ Median
Sorter = median (entries => 5)
Title = Top median roundtrip time
Menu = by median
Format = median RTT % F seconds

+ Overview

Width = 600
Height = 50
Range = 10 h

+ Detail

Width = 600
Height = 200
Unison_tolerance = 2

"Last 3 hours" 3 H
"Last 30 hours" 30 h
"Last 10 days" 10D
"Last 400 days" 400d


# + Hierarchies
# ++ Owner
# Title = Host owner
# ++ Location
# Title = Location

# As shown in the following figure, multiple fping are defined, and then different probe methods are used when node is defined (the red font in the following configuration) to implement multi-process detection, detection by multiple machines improves efficiency.
* ** Probes ***

+ Fping

Binary =/usr/sbin/fping
Blazemode = true

++ Fping

++ Fping1
Pings = 20
Step = 60

++ Fping2
Pings = 20
Step = 60

++ Fping3
Pings = 20
Step = 60

++ Fping4
Pings = 20
Step = 60

++ Fping5
Pings = 20
Step = 60

++ Fping6
Pings = 20
Step = 60

++ Fping7
Pings = 20
Step = 60

++ Fping8
Pings = 20
Step = 60

++ Fping9
Pings = 20
Step = 60

++ Fping10
Pings = 20
Step = 60

* ** Slaves ***
Secrets =/opt/smokeping/etc/smokeping_secrets
+ Boomer
Display_name = Boomer
Color = 0000ff

+ Slave2
Display_name = another
Color = 00ff00

* ** Targets ***

Probe = fping

Menu = Top
Title = network latency Grapher
Remark = welcome to the smokeping website of Sohu company .\
Here you will learn all about the latency of our network.

+ Net_yd_eth1
Menu = Internet of mobile IDC
Title = YD --> Internet

++ Baidu_node
Probe = fping1
Menu = Baidu _ Node
# Alerts = someloss
Title = YD ---> 61.135.169.125 (Baidu)
Host = 61.135.169.125

++ Sohu_node
Probe = fping2
Menu = Sohu _ Node
# Alerts = someloss
Title = YD ---> 123.125.116.12 (Sohu)
Host = 123.125.116.12

++ Zong_yd_eth1
Menu = Internet _ Summary of mobile IDC
Title = YD ---> Internet _ Summary of mobile IDC
Host =/net_yd_eth1/baidu_node/net_yd_eth1/sohu_node

Note:

1) the configuration file if there is Chinese, not only the above configuration file to set charset = UTF-8, the system also needs to set the Chinese Character Set in/etc/profile add export lang = zh_CN.UTF-8, in addition, all xshell or CRT interruptions must be set to UTF-8, so that the editing of Chinese in the configuration file and the display of Chinese on the access page will not be affected.

2), configuration details can refer to the official website: http://oss.oetiker.ch/smokeping/doc/smokeping_config.en.html

6. Restart script Customization

# Vim/etc/init. d/smokeping

Add the following content:

#! /Bin/bash
#
# Chkconfig: 2345 80 05
# Description: smokeping init. d script
# Hacked by: how2centos-http://www.how2centos.com
# Get function from functions library
./Etc/init. d/functions
# Start the service smokeping
Start (){
Echo-n "Starting smokeping :"
/Opt/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 "/opt/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

Add execution permission

# Chmod + x/etc/init. d/smokeping

7. Start the smokeping service.

Normal start:

#/Etc/init. d/smokeping start

Or

#/Opt/smokeping/bin/smokeping

When debugging a fault, start in debug mode:

/Opt/smokeping/bin/smokeping -- Config =/opt/smokeping/etc/config -- debug

3. Access the page

Http: // 10.13.82.215/

The page effect is as follows:


650) This. width = 650; "src =" http://s3.51cto.com/wyfs02/M00/42/62/wKioL1PXTnvDSYwlAASQtC1x9z4924.jpg "Title =" 1.png" alt = "wkiol1pxtnvdsywlaasqtc1x9z424.jpg"/>

650) This. width = 650; "src =" http://s3.51cto.com/wyfs02/M01/42/61/wKiom1PXTXTzZCcmAATc7gtUiLw231.jpg "Title =" 2.png" alt = "wkiom1pxtxtzzccmaatc7gtuilw231.jpg"/>


This article is from the "jia" blog, please be sure to keep this source http://leejia.blog.51cto.com/4356849/1532245

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.