Install TCPPing
1: Install tcptraceroute
shell> sudo yum install tcptraceroute
2: Download TCPPing and set permissions
shell> sudo cd /usr/bin/
shell> sudo wget https://pingpros.com/pub/tcpping
shell> sudo chmod 755 tcpping
Install HPing
1: Install EPEL Repository
shell> sudo yum install epel-release
2: Install HPing3
shell> sudo yum install hping3
Credits:
TCPPING – http://www.vdberg.org/~richard/tcpping
yum install rsyslog
yum install postfix
chkconfig rsyslog on
sudo mkdir /var/log/syslog
vim /etc/rsyslog.conf
Uncomment the UDP and TCP syslog reception items to match below:
# Provides UDP syslog reception
$ModLoad imudp
$UDPServerRun 514
# Provides TCP syslog reception
$ModLoad imtcp
$InputTCPServerRun 514
Add Template before GLOBAL DIRECTIVES
$template RemoteLogs,”/var/log/syslog/%HOSTNAME%/%$now%.log” *
*.* ?RemoteLogs
& ~
Make sure rsyslog is on on boot and restart it
systemctl enable rsyslog.service
systemctl restart rsyslog.service
Setup Email Alerting
$ModLoad ommail
$ActionMailSMTPServer localhost
$ActionMailFrom networkteam@pingpros.com
$ActionMailTo networkteam@pingpros.com
$template mailSubject,”Network Issue on %hostname%”
$template mailBody,”RSYSLOG Alert\nmsg=’%msg%'”
$ActionMailSubject mailSubject
# make sure we receive a mail only once in an
# hours (3600 seconds)
$ActionExecOnlyOnceEveryInterval 3600
# the if … then … mailBody must be on one line!
if ($msg contains ‘BGP’ or $msg contains ‘bgp’ or $msg contains ‘OSPF’ or $msg contains ‘ospf’ or $msg contains ‘FLAP’ or $msg contains ‘down’ or $msg contains ‘DOWN’ or $msg contains ‘SPAN’ or $msg contains ‘span’ or $msg contains ‘loop’ or $msg contains ‘LOOP’ or $msg contains ‘up’ or $msg contains ‘UP’) then :ommail:;mailBody
# re-set interval so that other actions are not affected
$ActionExecOnlyOnceEveryInterval 0
Setup logrotate
sudo vim /etc/logrotate.conf
At very bottom of the file do the following
# Rotate the log daily up to 5 years of retention 365 times 5
/var/log/syslog/*.log /var/log/syslog/*/*.log {
dateext
dateformat .%Y-%m-%d
daily
rotate 1825
compress
}
Test the rotations
logrotate -d /etc/logrotate.conf
Linux ifconfig commands are being deprecated. Here is a quick overview.
Deprecated command
|
Replacement command(s)
|
arp |
ip n (ip neighbor) |
ifconfig |
ip a (ip addr), ip link, ip -s (ip -stats) |
iptunnel |
ip tunnel |
iwconfig |
iw |
nameif |
ip link, ifrename |
netstat |
ss, ip route (for netstat-r), ip -s link (for netstat -i), ip maddr (for netstat-g) |
route |
ip r (ip route) |
NOTE: THIS INSTALLATION HAS BEEN TESTED TO BE WORKING WITH CENTOS 5.X – 6.x
shell> setenforce 0
shell> yum install http://packages.sw.be/rpmforge-release/rpmforge-release-0.5.2-2.el6.rf.x86_64.rpm
- Step 3: Install Required Packages
shell> yum install mod_fcgid httpd httpd-devel rrdtool fping wget curl bind-utils gcc make gcc-c++
- Step 4: Install Perl based packages
shell> yum 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-RRD-Simple perl-CGI-SpeedCGI perl-ExtUtils-MakeMaker
Install Apache
- Step 1: Install Apache and ensure it runs on startup
shell> yum install httpd
shell> chkconfig httpd on
shell> /etc/init.d/httpd start
Install Smokeping
- Step 1: Download latest version of smokeping on website at http://oss.oetiker.ch/smokeping/pub
shell> wget http://oss.oetiker.ch/smokeping/pub/smokeping-2.6.9.tar.gz
- Step 2: Extract and install smokeping
shell> tar -zxvf smokeping-2.6.9.tar.gz -C /opt/
shell> mkdir /opt/smokeping
shell> cd /opt/smokeping-2.6.9/setup
shell> ./build-perl-modules.sh
shell> cp -r ../thirdparty /opt/smokeping/
shell> cd ..
shell> ./configure –prefix=/opt/smokeping
shell> make install
- Step 3: Create missing folders needed
shell> cd /opt/smokeping
shell> mkdir data
shell> mkdir var
- Step 4: Add Smokeping Start/Stop Script
shell> wget https://pingpros.com/pub/smokeping
shell> mv smokeping /etc/init.d/smokeping
shell> chmod 755 /etc/init.d/smokeping
Configure Smokeping Application
- Step 1: Rename Config Files and set file permissions
shell> cd /opt/smokeping/etc/
shell> for foo in *.dist; do cp $foo `basename $foo .dist`; done
shell> chmod 600 /opt/smokeping/etc/smokeping_secrets.dist
- Step 2: Change Default Config
shell> cd /opt/smokeping/etc/
shell> vim config
Change the values in bold to something that fit your needs
owner = Peter Random
contact = some@address.nowhere
mailhost = my.mail.host
sendmail = /usr/sbin/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/cache
imgurl = cache
datadir = /opt/smokeping/data
piddir = /opt/smokeping/var
cgiurl =
http://some.url/smokeping.cgi
smokemail = /opt/smokeping/etc/smokemail.dist
tmail = /opt/smokeping/etc/tmail.dist
Here is an example change in bold
owner = PingPros.com
contact = something@pingpros.com
mailhost = mail.pingpros.com
sendmail = /usr/sbin/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/cache
imgurl = /cache
datadir = /opt/smokeping/data
piddir = /opt/smokeping/var
cgiurl = http://(IP or Hostname)/cgi-bin/smokeping.fcgi
smokemail = /opt/smokeping/etc/smokemail.dist
tmail = /opt/smokeping/etc/tmail.dist
- Step 3: Copy Smokeping files into web server
shell> cp -r /opt/smokeping/htdocs/cropper /var/www/cgi-bin/
shell> cp /opt/smokeping/htdocs/smokeping.fcgi.dist /var/www/cgi-bin/smokeping.fcgi
shell> cd /var/www/html/
shell> mkdir cache
shell> chown apache cache
shell> ln -s /var/www/html/cache /opt/smokeping/cache
shell> /etc/init.d/httpd start
shell> /etc/init.d/smokeping start
- Step 5: Test Smokeping Link for errors
- Visit the cgi-url you configured above. IE: cgiurl = http://(IP or Hostname)/cgi-bin/smokeping.fcgi
- Step6: Clean Up Smokeping Installation Files
shell> rm -rf /opt/smokeping-2.6.9
- Enable smokeping to start during boot
shell> chkconfig –add smokeping
shell> chkconfig httpd on
shell> chkconfig smokeping on
Install TCPPing and Change TCPPing/FPing Intervals – Recommended
shell> yum install tcptraceroute
shell> cd /usr/bin/
shell> wget https://pingpros.com/pub/tcpping
shell> chmod 755 tcpping
- Configure Probe into Smokeping
shell> vim /opt/smokeping/etc/config
Add Below under *** Probes *** (note: I prefer setting it up to ping every 60 second interval in this example…FPING will already be there just add the step = 60 configlet)
+ FPing
binary = /usr/sbin/fping
step = 60
+ TCPPing
binary = /usr/bin/tcpping
step = 60
- Restart smkeping to use new config
shell> /etc/init.d/smokeping restart
Configure Smokeping to monitoring your targets
- Step 1: Add your own hosts in the config file
shell> vim /opt/smokeping/etc/config
Example config file below in bold
*** Targets ***
probe = FPing
menu = Top
title = Network Latency Grapher
remark = Welcome to the SmokePing website of PingPros. \
Here you will learn all about the latency of our network.
+ Targets
menu = Network
title = Ping Network Equipment
++ rchicago1
menu = ChicagoR1
title =Chicago Router 1
host = 10.1.1.1
++ schicago1
menu = ChicagoS1
title = Chicago Switch 1
probe = TCPPing
port = 80
host = 10.1.1.254
- Restart smkeping to use new config
shell> /etc/init.d/smokeping restart
NOTE ABOVE: rchicago1 is using FPing by default as is configured to be the default, schicago1 is using TCPPING because we specified it. It is recommended to utilize TCPPING whenever possible! It is also best practice to put in the probe parameters for each host!
END OF TUTORIAL
Credits:
TCPPING – http://www.vdberg.org/~richard/tcpping
Smokeping – http://oss.oetiker.ch/smokeping/