Smokeping for Network Monitoring
Smokeping can be used to check the network status and stability.
1. Adjust firewall settings
[Root @ C65-A1 ~] #/Etc/init. d/iptables stop
Iptables: Setting chains to policy ACCEPT: filter [OK]
Iptables: Flushing firewall rules: [OK]
Iptables: Unloading modules: [OK]
[Root @ C65-A1 ~] # Chkconfig iptables off
[Root @ C65-A1 ~] # Getenforce
Enforcing
[Root @ C65-A1 ~] # Setenforce 0
[Root @ C65-A1 ~] # Vim/etc/sysconfig/selinux
Change "SELINUX = enforcing" to "SELINUX = disabled"
2. Modify the yum installation Source
[Root @ C65-A1 ~] # Vim/etc/sysconfig/selinux
[Root @ C65-A1 ~] # Rpm-Uvh http://apt.sw.be/RedHat/el6/en/x86_64/rpmforge/RPMS/rpmforge-release-0.5.3-1.el6.rf.x86_64.rpm
Retrieving http://apt.sw.be/redhat/el6/en/x86_64/rpmforge/RPMS/rpmforge-release-0.5.3-1.el6.rf.x86_64.rpm
Warning:/var/tmp/rpm-tmp.7A2TOZ: Header V3 DSA/SHA1 Signature, key ID 6b8d79e6: NOKEY
Preparing... ######################################## ### [100%]
1: rpmforge-release ##################################### ###### [100%]
3. Install rrdtool and dependent Libraries
[Root @ C65-A1 ~] # Yum-y install perl-Net-Telnet perl-Net-DNS perl-LDAP perl-libwww-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-perl curl fping echoping httpd-devel gcc make wget libxml2-devel libpng- devel glib pango-devel freetype-devel fontconfig cairo-devel libart_lgpl libart_lgpl-devel mod_fastcgi
4. Install smokeping
123456 [root @ C65-A1 ~] # Tar zxvf smokeping-2.6.9.tar.gz
[Root @ C65-A1 ~] # Cd smokeping-2.6.9
The problem occurs because the perl module needs to be installed, so run the following content.
[Root @ C65-A1 ~] #./Setup/build-perl-modules.sh/usr/local/smokeping/thirdparty
[Root @ C65-A1 ~] #./Configure -- prefix =/usr/local/smokeping
[Root @ C65-A1 ~] #/Usr/bin/gmake install
5. Configure smokeping
[Root @ C65-A1 smokeping-2.6.9] # cd/usr/local/smokeping/
[Root @ C65-A1 smokeping] # mkdir-p var cache data
[Root @ C65-A1 smokeping] # touch/var/log/smokeping. log
[Root @ C65-A1 smokeping] # chown apache: apache var cache data
[Root @ C65-A1 smokeping] # chown apache: apache/var/log/smokeping. log
[Root @ C65-A1 smokeping] # ls
Bin cache data etc htdocs lib share thirdparty var
[Root @ C65-A1 smokeping] # cd/usr/local/smokeping/htdocs/
[Root @ C65-A1 htdocs] # ls
Cropper smokeping. fcgi. dist
[Root @ C65-A1 htdocs] # cp-p smokeping. fcgi. dist/tmp/
[Root @ C65-A1 htdocs] # mv smokeping. fcgi. dist smokeping. fcgi
[Root @ C65-A1 htdocs] # cd/usr/local/smokeping/etc/
[Root @ C65-A1 etc] # ls
Basepage.html. dist examples smokeping_secrets.dist
Config. dist smokemail. dist tmail. dist
[Root @ C65-A1 etc] # cp-p config. dist/tmp/
[Root @ C65-A1 etc] # mv config. dist config
[Root @ C65-A1 etc] # vim config
A. modify "cgiurl = http://some.url/smokeping.cgi.pdf to" Export cgiurl = http: // 192.168.1.14/smokeping. cgi"
B. Change "step = 300" in ** Database ** to "step = 60". sampling is performed once per minute.
Step = 300
Pings = 20
[Root @ C65-A1 etc] # chmod 600/usr/local/smokeping/etc/smokeping_secrets.dist
Remarks: Change Password File Permissions
6. Adjust apache configuration
123456789101112131415161718192021222324 [root @ C65-A1 etc] # vim/etc/httpd/conf/httpd. conf
Add the following information:
### Set for smokeping ###
Alias/cache "/usr/local/smokeping/cache /"
Alias/cropper "/usr/local/smokeping/htdocs/cropper /"
Alias/smokeping "/usr/local/smokeping/htdocs/smokeping. fcgi"
<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>
[Root @ C65-A1 etc] # cd/usr/local/smokeping/htdocs/
[Root @ C65-A1 htdocs] # htpasswd-c/usr/local/smokeping/htdocs/htpasswd admin
New password:
Re-type new password:
Adding password for user admin
7. Set the startup of smokeping
[Root @ C65-A1 etc] # echo "/usr/local/smokeping/bin/smokeping -- logfile =/var/log/smokeping. log 2> & 1 & ">/etc/rc. local
8. Add the smokeping boot script
Create a smokeing file in the/etc/init. d directory. The content is as follows:
#! /Bin/bash
#
# Chkconfig: 2345 80 05
# Description: Smokeping init. d script
# Hacked by: jeff kang-http://www.jffnms.net
# 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
9. Enable the smokeping Service
[Root @ C65-A1 init. d] #/etc/init. d/smokeping start
Starting Smokeping: [OK]
[Root @ C65-A1 init. d] # ps-ef | grep smokeping
Root 9670 1 0 :42? 00:00:00/usr/local/smokeping/bin/smokeping [FPing]
Root 9673 1264 0 00:00:00 pts/0 grep smokeping
Then we can enter the smokeping user name and password through http: // 192.168.1.144/smokeping. cgi.
10. Enable Chinese support and install Chinese fonts in smokeping
[Root @ C65-A1 htdocs] # vim/usr/local/smokeping/etc/config
To display Chinese characters on the webpage, modify the/usr/local/smokeping/etc/config file.
* ** Presentation ***
Charset = UTF-8 // Note: add
[Root @ C65-A1 htdocs] # yum-y install wqy *
11. Add monitoring information and restart the service to make the configuration take effect.
[Root @ C65-A1 htdocs] # vim/usr/local/smokeping/etc/config
[Root @ C65-A1 htdocs] #/etc/init. d/smokeping stop
Stopping Smokeping: [OK]
[Root @ C65-A1 htdocs] #/etc/init. d/smokeping start
Starting Smokeping: [OK]
[Root @ C65-A1 htdocs] # ps-ef | grep smokeping
Root 9861 1 0 18:04? 00:00:00/usr/local/smokeping/bin/smokeping [FPing]
Root 9864 1442 0 00:00:00 pts/1 grep smokeping
12. Other materials
Check the configuration file of smokeping.
[Root @ C65-A1 htdocs] #/usr/local/smokeping/bin/smokeping -- check
Configuration file '/usr/local/smokeping/bin/../etc/config' syntax OK.
[Root @ C65-A1 htdocs] #/usr/local/smokeping/bin/smokeping -- help
Note:
+ Gansu // note that the plus sign must be followed by English, not Chinese
Menu = Gansu
Title = Gansu
+ + Daliang // Similarly, the content after '+ +' must be in English. The content after ++ and ++ will not be realistic, but will only serve as a name.
Menu = Girders
Title = Daliang: 10.138.1.11
Host = 10.138.1.11
Alerts = someloss
Structure of level 1, level 2, and level 3 directories:
+ Yiji
Menu = level 1
Title = level 1
++ Erji
Menu = level 2
Title = level 2
++ Sanji
Menu = sanji
Title = sanji: 10.138.16.54
Host = 10.138.16.54
Alerts = someloss
Title indicates the title displayed in the right image, and memu indicates the menu on the left.
This article permanently updates the link address: