Business Hosting Experts

RSS    |    Curious About Us?    |    Archives
 
 

Smokeping on FreeBSD 7

Thursday, April 24, 2008 at 3:56 pm by Brady Wilson

This write-up assumes a working copy of FreeBSD 7.0.  It was built using 7.0-RELEASE.  It should work on FreeBSD 6.x-STABLE and future versions of FreeBSD 7.  The package versions listed were current as of this writing but may have been updated by the time someone uses this howto.

This is a basic setup of Smokeping.  There are many extra features that I do not touch on here such as multi-target graphs, alerting, slaves, agents and additional probe types.  Check the online documentation for further info.

Please let me know if you run into typos or other technical issues when implementing this.

1.) First let’s update the ports collection.

Setup the update:


# cd /usr/ports/ports-mgmt/portupgrade
# make install clean
# cd /usr/ports/net/cvsup
# make install clean
# cp /usr/share/examples/cvsup/ports-supfile /root/ports-supfile
# pico /root/ports-supfile

Make it look something like this:


#######################################################
*default host=cvsup1.us.FreeBSD.org
*default base=/var/db
*default prefix=/usr
*default release=cvs  tag=.
*default delete use-rel-suffix
#comment the below line if you don't want to update the /src directory
#src-all
#update /usr/ports
ports-all tag=.
#######################################################

Run the update:


# cvsup -L 2 /root/ports-supfile
# portsdb -Uu

Update installed ports:


# portversion -l "<"
# portupgrade -arR
# pkgdb -F

2.) Install the necessary packages.

Descriptions of packages and uses here: http://oss.oetiker.ch/smokeping/doc/smokeping_install.en.html

  •          Perl 5.8:
  • Installed by default with FreeBSD install

  •          RRDTool 1.2.26:

  • # cd /usr/ports/databases/rrdtool
    # make install clean

     

  •          Fping 2.4b2_to-ipv6:

  • # cd /usr/ports/net/fping
    # make install clean

     

  •          EchoPing 6.0.0:

  • # cd /usr/ports/net/echoping
    # make install clean

  •          Dig:
  • Installed by default with FreeBSD install

  •         Perl modules:
  • Socket6

    # cpan
    # install Socket6

    Net:DNS

    # install Net::DNS
    # quit

  •          Apache 2.2.8:

  • # cd /usr/ports/www/apache22
    # make install clean

  •          SpeedyCGI 2.22_4:

  • # cd /usr/ports/www/p5-CGI-SpeedyCGI/
    # make install clean

  •          Smokeping 2.2.7_2:

  • # cd /usr/ports/net-mgmt/smokeping
    # make install clean

    3.) Configure the packages.

  •          Configure Apache:

  • # pico /usr/local/etc/apache22/httpd.conf

    Add:

    (within the <IfModule alias_module> section)


    <Directory "/usr/local/smokeping/htdocs">

    Add:

    (within the <IfModule dir_module> section)

    Add smokeping.cgi after index.html on the DirectoryIndex line to allow smokeping.cgi to load as a default document.

    It should look like:

    DirectoryIndex index.html smokeping.cgi

    Allow the startup of Apache:

    Add the following to /etc/rc.conf

    apache22_enable="YES"           # enable Apache 2.2

    Start Apache:

    # /usr/local/etc/rc.d/apache22 start

  •          Configure Smokeping:
  • Edit the variables in the following files appropriately

    # pico /usr/local/etc/smokeping/config

    Variable example settings in the first section:


    owner    = Systems Administrator
    contact  = sysadmin@domain.com
    mailhost = localhost
    sendmail = /usr/sbin/sendmail
    imgcache = /usr/local/smokeping/htdocs/img
    imgurl   = /smokeping/img
    datadir  = /usr/local/var/smokeping
    piddir  = /usr/local/var/smokeping
    cgiurl   = http://server.domain.com/smokeping/smokeping.cgi
    smokemail = /usr/local/etc/smokeping/smokemail
    tmail = /usr/local/etc/smokeping/tmail

    *** Alerts ***

    The “*** Targets ***” section is where you define your Smokeping targets and build the navigation menu.  It is a little too in depth to cover here.  Play around with it to figure out how it works.

    In depth configuration info is here: http://oss.oetiker.ch/smokeping/doc/smokeping_config.en.html

    There are some configuration samples here: http://oss.oetiker.ch/smokeping/doc/smokeping_examples.en.html

    Verify the path to Speedy:

    # pico /usr/local/smokeping/htdocs/smokeping.cgi

    -first line pointing to full path of speedy

    Customizations to the Smokeping web page templates can be made in the following config files:


    /usr/local/etc/smokeping/smokemail
    /usr/local/etc/smokeping/basepage.html
    /usr/local/etc/smokeping/tmail

    Set file system permissions to make the img folder and files writeable:

    # find /usr/local/smokeping/htdocs/img -type d -exec chmod 777 {} \;
    # find /usr/local/smokeping/htdocs/img -type f -exec chmod 666 {} \;

    Allow the startup of Smokeping:

    Add the following to /etc/rc.conf

  • smokeping_enable=”YES”          # enable smokeping
  • Start Smokeping:


    # /usr/local/etc/rc.d/smokeping start

    Operational Notes:

  •          You should now be able to browse to http://www.yourdomain.com/smokeping/ to view your Smokeping statistics.
  •          You may want to consider securing the Smokeping page with .htaccess users, a firewall or other form of authentication.
  •          I updated the index.html page in the root of the default Apache site:
  •  index.html at /usr/local/www/apache22/data/

    <meta http-equiv="refresh" content="0;url=http://www.someotherdomain.com"/>

    This redirects traffic sent to the root of your server to a different domain since this traffic obviously doesn’t need to be hitting the Smokeping server.

  •          When you add new targets or change targets in the /usr/local/etc/smokeping/config file you will need to restart Smokeping:
  • #/usr/local/etc/rc.d/smokeping restart

     

    Past Articles

    • Update on Our New Data Center
      February 24th, 2010

      Many of you may know that we’re gearing up for growth in 2010 and to accommodate that growth, we’ve signed a lease on a 20,000 foot building that will house our new data center. Phase one will by just under 6,000 square feet of data center floor not including the NOC, provisioning and power room.
      -
      The [...]

    • Second Annual Gutterball Ball is a Strike
      December 23rd, 2009

      And that’s a good thing! It seemed that this year things went a little smoother than last years’ festivities. For starters, we didn’t have to postpone it. Last year during the holidays we Portlanders were dealing with the “Artic Blast” that dumped almost 14 inches of snow on us – and effectively kept everyone at [...]

    • Inside Business Report to Feature Opus Interactive
      December 4th, 2009

      About three weeks ago, a film crew from the news segment Inside Business Report came to Portland to film a feature on emerging data center technologies. Not familiar with Inside Business Report? It’s a 5 minute news segment that plays several times a day on television networks such as Discovery Channel, CNN Headline News, and [...]

    Leave a Comment

    You must be logged in to post a comment.

    Article Comments:

    2 Comments
     

    Could you please provide the pertinent sections of your httpd.conf?
    I’m not getting this to work, though it may be that speedyCGI is not
    working.

    Bub

    Posted by Bubnoff
    Tuesday, May 05, 2009 at 6:38 pm

    Here are the sections from the apache config that apply to smokeping:

    (I can’t seem to post the code properly so change the “[” chars to “>”)


    [IfModule dir_module>
    DirectoryIndex index.html smokeping.cgi
    [/IfModule>


    [Directory "/usr/local/smokeping/htdocs">
    AllowOverride None
    Options None
    Order allow,deny
    Allow from all
    [Directory>

    What part is not working – do you get an error browsing to the site, or an error starting Apache, or ?

    -b

    Posted by Opus Interactive
    Thursday, May 07, 2009 at 8:06 am