DFQ

How to Install and Configure SmokePing on Ubuntu 14.04

This is my first guide in a series for DFQ (Done [Flippin] Quick). Read about it here!

Much of this guide will quote the main guide but in a more concise format.

The purpose of this guide is to provide an abridged set of instructions for people that want to get set-up quickly and go.

This guide assumes you have Apache configured and ready for hosting a new virtual server and will only cover configuring SmokePing and the front-end site for SmokePing.

  1. Download the latest version of SmokePing and place it in your home(~) folder.
    1. cd ~
    2. wget http://oss.oetiker.ch/smokeping/pub/smokeping-2.6.11.tar.gz
  2. Extract the file in your home directory (where X.X.XX are version numbers)
    1. tar -xvf ./smokeping-X.X.XX.tar.gz
  3. Navigate into the newly extracted directory
    1. cd ./smokeping-X.X.XX
  4. Configure
    1. ./configure –prefix=/opt/smokeping
    2. If there is an error about missing modules
      1. sudo ./setup/build-perl-modules.sh /opt/smokeping/thirdparty
      2. Repeat the command in step 4.A
  5. Install (to /opt/smokeping; defined in step 4.A)
    1. sudo /usr/bin/make install
  6. Get the DNS Utils, and Apache2 FastCGI Mod
    1. sudo apt-get update
    2. sudo apt-get install dnsutils libapache2-mod-fcgid
  7. Give your Apache2 user ownership of the smokeping directory
    1. sudo chown wwwdata.wwwdata smokeping/ -R
  8. Copy and modify config.multiple-probes
    1. sudo cp /opt/smokeping/etc/examples/config.multiple-probes /opt/smokeping/etc/config
    2. sudo nano /opt/smokeping/etc/config
      1. Line 10 – 12: Fill out your information (optional)
      2. Line 13: Disable sendmail by putting a # at the start of the line
      3. Line 129: Ensure it points to our fping executable
        1. binary = /usr/bin/fping
      4. Line 133: Ensure it points to our dig executable
        1. binary = /usr/bin/dig
      5. Line 140: Set this line to a website site with quick response time
        1. url = http://www.msn.com
      6. Line 157 – 160: Set these targets to more sites/servers you want to test your connectivity to
        1. ++ Cisco
          host = www.cisco.com
          ++ Amazon
          host = www.amazon.com
      7. Line 171 – 175: Set these to your DNS hosts
        1. +++ GoogleDNS
          host = 8.8.8.8
          
          +++ GoogleDNS-Alt
          host = 8.8.4.4
      8. Line 181 – 185: Set these targets to http websites that you normally have a fast response from
        1. +++ Twitter
          host = www.twitter.com
          
          +++ FaceBook
          host = www.facebook.com
  9. Chmod the secrets file
    1. sudo chmod 640 smokeping_secrets.dist
  10. Start smokeping in debug
    1. sudo /opt/smokeping/bin/smokeping –config=/opt/smokeping/etc/config --debug
  11. You should at this point get quite a few lines from RRDs calls and it should pause for a moment; execution will continue, then gracefully exit.
  12. Now that you have confirmed it is working, run the script normally for the frontend site
    1. ./bin/smokeping –config=/opt/smokeping/etc/config –logfile=smoke.log
  13. Setup the website (HOSTNAME is the name of your machine)
    1. Copy the files needed for the web interface
      1. sudo cp /opt/smokeping/htdocs/* /var/www/sp.HOSTNAME/htdocs/ -R
    2. Rename the main FastCGI file (remove the .dist extention)
      1. sudo mv /var/www/sp.HOSTNAME/htdocs/smokeping.fcgi.dist /var/www/sp.HOSTNAME/htdocs/smokeping.fcgi
    3. Give your webhost ownership of the www data directory (again, mine is www-data, yours might be different)
      1. sudo chown www-data.www-data /var/www/sp.HOSTNAME -R
    4. Create the config for apache and enable it (provided config is only accessible from LAN!)
      1. Use provided site conf here
      2. sudo nano /etc/apache2/sites-available/sp.HOSTNAME.conf
      3. a2ensite sp.HOSTNAME.conf
    5. Restart apache
      1. sudo service apache2 restart
    6. You must modify your hosts file on your client machine (the one running the browser to view the smokeping frontend)
      1. If viewing from windows, open “C:\Windows\System32\drivers\etc\hosts”
      2. Add the line “YOUR-HOST-IP-ADDRESS sp.HOSTNAME”
        1. Where YOUR-HOST-IP-ADDRESS is the ip address listed by “inet addr:” on your host under you main network adapter (usually eth0) when you run ifconfig
        2. Where sp.HOSTNAME is the ServerName assigned in sp.HOSTNAME.conf
    7. Site should now be accessible from any pc on the 192.168.*.* subnet by navigating to http://sp.HOSTNAME/htdocs/smokeping.fcgi in your browser.
  14. SmokePing start script
    1. Assuming you are in the home directory
      1. wget https://oss.oetiker.ch/smokeping/pub/contrib/smokeping-start-script
    2. Place the file in the smokeping base directory
      1. mv ~/smokeping-start-script /opt/smokeping/smokeping_startscript.sh
    3. Line 8: Point this to the smokeping pid file
      1. PIDFILE=/var/run/smokeping/smokeping.pid
    4. Line 10: Point this to the smokeping script
      1. SMOKEPING=/opt/smokeping/bin/smokeping
    5. Place it in the /etc/init.d/ directory and update so it starts with the system
      1. sudo ln -s /opt/smokeping/smokeping_startscript.sh /etc/init.d/smokeping
      2. sudo update-rc.d smokeping defaults
      3. sudo service smokeping start

Leave a Reply

Your email address will not be published. Required fields are marked *