04 Jun

Step-by-Step guide to installing Smokeping on Ubuntu 14.04 LTS

Installing Smokeping on Ubuntu used to be a total breeze. Since 14.04 however, it’s been a bit of a mission.

This guide assumes a fresh out of the box Ubuntu install. I’m using the 64bit Server variety, but this should work on any 14.04 system.

UPDATE – It also works perfectly on Ubuntu 16.04 LTS Server :~)

Note – I am a noob with Apache and a relative noob with Linux, but even I got it to work fairly painlessly.

Step 1: install smokeping (aaand you’re done).
 sudo apt-get install smokeping -y

Step 2:  normally, you’d be done by now.. But things have changed.
 sudo nano /etc/smokeping/config.d/pathnames

You’re going to want to go into the pathnames file and comment out the line about mail. Setting up mail to work with smokeping is outside the scope of this post. Because I’m lazy.

Do this: #sendmail = /usr/sbin/sendmail
Then hit CTRL-O, Enter, CTRL-X. That’s how you save a file in Nano, I won’t stick that bit in again.

Step 3: If you made it this far, you’re going to be fine. Start ‘er up…
sudo service smokeping start

Step 4: Head over to a web browser and enter the IP of your server/cgi-bin/smokeping.cgi
(Hint: it will fail, giving you a 404 error).
(Hint 2: you can find the IP address of your server by entering ifconfig, it’s typically eth0)

Step 5: It’s not working because you’re missing a couple of things. One is a slight config change in a smokeping config file,  one is some missing symlinks.. the other is (likely) the cgi module for Apache2 isn’t enabled. Fix it!

sudo nano /etc/smokeping/config.d/General

Edit the line that has cgiurl in it to read like:
cgiurl = http://10.10.10.10/cgi-bin/smokeping.cgi

Save and quit nano.

Next you want to edit the following Apache config file:
sudo nano /etc/apache2/conf-available/serve-cgi-bin.conf

Under the lines

“Require all granted
     </Directory>”

You want to add:

ScriptAlias /smokeping/smokeping.cgi /usr/lib/cgi-bin/smokeping.cgi
 Alias /smokeping /usr/share/smokeping/www
 <Directory “/usr/share/smokeping/www”>
 Options FollowSymLinks
 </Directory>

(Save and quit editing the file)

Finally, enable CGI:
sudo a2enmod cgi

Step 6: Kind of threw 3 things into step 5 there, whoops. Anyway now you want to restart smokeping and apache, just to see if you broke anything:
sudo service apache2 restart
sudo service smokeping restart

Now head back to your browser, throw in 10.10.10.10/cgi-bin/smokeping.cgi

It should work… If not, drop me a line.

 

80 thoughts on “Step-by-Step guide to installing Smokeping on Ubuntu 14.04 LTS

    • Glad it helped. I re-read this post just now and I can’t even remember writing it. I must have been deep in Smokeping research mode 🙂

  1. after steps 6 it gives the same result.

    ERROR: I Quit! Another copy of /usr/sbin/smokeping (18792) seems to be running.
    Check /var/run/smokeping/smokeping.pid

    • Sorry it took me a while to reply.

      If you run this (without the quotes): ‘ps aux | grep smokeping’ after step 6, what is the output?

      Do you have an older version installed?

  2. Thank you for this, i have installed Smokeping on CentOS and it was a bit more cumbersome. This was pretty easy and quick.

  3. Awesome guide, especially for a non-linux person like myself!

    I’ve been trying other distros for the last few days without any success. This one had me up and running, including the loading of Ubuntu, in about 30 minutes.

    I have one question now. What’s the easiest way to redirect the URL in Apache from “http://some.ip/cgi-bin/smokeping.cgi” to something like “http://some.ip/” ?

    It’s the only web server running on this host.

    Thanks in advance!

    • You’re welcome, glad it worked. I used this guide again for myself the other day and was very glad to see it still works..

  4. Hi James,
    Thank you for this guide !
    But I can’t upload these images on smokeping web interface (no graphs)
    root:/# ls /var/cache/smokeping/images/Local/
    LocalMachine_last_108000.png
    LocalMachine_last_31104000.png
    LocalMachine.maxheight
    LocalMachine_last_10800.png
    LocalMachine_last_864000.png
    LocalMachine_mini.png

    thnak you for your help.

    • Hi Malik,

      The files are generated by the Smokeping software, iirc. Why are you trying to upload them? Have you enabled CGI in Apache?

  5. Yes, I have Enabled CGI in appache with : a2enmod cgi
    I don’t have graphs on my web interface, perhaps there is no image files …

    • That doesn’t sound right to me Malik – as I say the CGI generates the files itself, whenever it generates them from the RRD files where the graph data is stored. I see you were running this as root – perhaps it’s a permissions error. Can you take a look in your /var/log/apache folder for some error logs?

  6. Below an example of appach error when I refresh smokepign web interface :

    server# tail -f /var/log/apache2/access.log

    10.8.200.37 – – [26/Apr/2016:16:06:02 +0200] “GET /smokeping/images/__chartscache/Local.LocalMachine_last_3600.png HTTP/1.1” 404 556 “http://10.184.20.202/cgi-bin/smokeping.cgi?target=_charts” “Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/49.0.2623.112 Safari/537.36”

    thank you for your help

    • Ok – did you set up the symlinks as I said in the guide?

      I suspect the link is missing in the apache config files – so the files are being generated but not properly pointed at. Are you using Ubuntu 14.04 LTS? I did this guide a few times following my own steps and it’s worked each time.

  7. I think i got it !

    Just you add the contents of /etc/smokeping/apache2.conf in /etc/apache2/conf-available/serve-cgi-bin.conf and you restart apache service.

    Thank you for your help James.

    • Oh yes very good – that shows there are differences between where Debian and Ubuntu put things. I was about to run up a debian VM to test it out for you, glad you sorted it by yourself!

  8. Oh wow, thank you a lot for this, after finding a hundred installation tutorials that did NOT work, this one is “THE ONE”, easy and works first try. God bless.

  9. Great write up, but its not working for me. I have double checked that i followed your steps correctly. I am running ubuntu mate 16.04, I still get a 404 error when trying to go to serverip/smokeping.cgi i still get a 404. If i go to serverip/smokeping i get a forbiddin message.

    Not sure what else to try at this point

    • I think the clue could be you using a version of Ubuntu, 2 releases beyond what I wrote the guide on 🙂

      I suspect something has changed, let me fire up a 16 VM and see where I get to.

      • Well, I just ran up Ubuntu 16.04 LTS Server 64 bit and ran my own instructions and… it worked just fine. I suspect your problem is in the file:

        /etc/smokeping/config.d/General

        And that you have missed /cgi-bin/ or something similar from the path to CGI. Have another close look and see how you go.

        FYI:

        james@ubuntu:~$ apache2 -v
        Server version: Apache/2.4.18 (Ubuntu)
        Server built: 2016-04-15T18:00:57

      • I’m aware that Smokeping works with it, also I’m having problems with my installation, from the start of the request to the HTML response there’s more than a minute of time and I can’t figure out why.

        • OK well I found a good guide on Stack Overflow to enable FastCGI/PHP-FPM. I did it at home but I’m now using NGINX so I can’t really relay how I did it. The fact it takes > 1 minute seems majorly wrong, even without FastCGI it should be less than 10 seconds. Can you check your syslogs? It might also be a DNS query issue, that tends to slow things down..

  10. Pingback: Set up Smokeping in 20 mins.. | Anyone can route!

  11. Awesome guide!! thanks a lot. I have a doubt is it ok this output ?

    gabox@mintsrv ~ $ sudo a2enmod cgi
    [Fri Dec 09 11:52:03.388146 2016] [alias:warn] [pid 13253:tid 140078099638144] AH00671: The ScriptAlias directive in /etc/apache2/conf-enabled/smokeping.conf at line 1 will probably never match because it overlaps an earlier ScriptAlias.
    [Fri Dec 09 11:52:03.388146 2016] [alias:warn] [pid 13253:tid 140078099638144] AH00671: The Alias directive in /etc/apache2/conf-enabled/smokeping.conf at line 2 will probably never match because it overlaps an earlier Alias.
    AH00558: apache2: Could not reliably determine the server’s fully qualified domain name, using 127.0.1.1. Set the ‘ServerName’ directive globally to suppress this message
    Your MPM seems to be threaded. Selecting cgid instead of cgi.
    Module cgid already enabled

  12. Got this running on a Pi3 under Jessie, with a WD hard drive, but only with YOUR help – so many thanks. Fed up of a glacial internet and not knowing whether its up or down, or merely SLOW.

  13. Hi James thanks for the tutorial but
    after “Next you want to edit the following Apache config file:
    sudo nano /etc/apache2/conf-available/serve-cgi-bin.conf”
    i get:
    root@vpn-srv0-main:/etc/smokeping# a2enmod cgi
    AH00526: Syntax error on line 16 of /etc/apache2/conf-enabled/serve-cgi-bin.conf:
    ScriptAlias not allowed here
    Your MPM seems to be threaded. Selecting cgid instead of cgi.
    Module cgid already enabled

    • Hi David,

      I think the problem might be a version inconsistency – which version of Apache and which OS are you using? These instructions will pretty much only work as prescribed on the versions I was using.

  14. Hi James thanks for the guide, which help me out to successfully configure the smoke ping but… now I am want to apply authentication but till yet not succeed.

    BEFORE:
    ScriptAlias /smokeping/smokeping.cgi /usr/lib/cgi-bin/smokeping.cgi
    Alias /smokeping /usr/share/smokeping/www

    Options FollowSymLinks

    I add following authentication lines
    ScriptAlias /smokeping/smokeping.cgi /usr/lib/cgi-bin/smokeping.cgi
    Alias /smokeping /usr/share/smokeping/www

    Options FollowSymLinks
    AllowOverride AuthConfig
    AuthType Basic
    AuthName “Password Required”
    AuthUserFile /etc/passwd

    But didn’t work out…kindly assist me in this regard ..

  15. I’ve got it working. Thank you very much.

    However, when I go to the ip/cgi-bin/smokeping.cgi I get a ‘Logged in as guest’ page.
    Can I assume there is an ‘Administrator’ page that can be used to configure targets and other things?
    If so, how do you access it? Change admin password etc?
    Thanks

  16. Following this guide was very useful, thanks.
    Just to note from my experience:
    Ubuntu 16 does not seem to require the serve-cgi-bin.conf adds.
    “/etc/apache2/conf-available/smokeping.conf” included in the package.
    Remember to allow web access through firewall “UFW sudo ufw allow http”

    • Thanks Rafe – not quite sure I follow – what is missing?

      In my example I am behind an external firewall, but yes if you are using UFW or iptables the appropriate rules will be required.

  17. Hi James,

    First of all, thank you for your excellent tutorial.

    I am installing smokeping onto an ubuntu 14.04 system just like this.
    Your steps are very clearly laid out, though when I go to “10.10.10.10/cgi-bin/smokeping.cgi” it just hangs without any response.

    I have a couple of questions:

    1) When you add the line “cgiurl = http://10.10.10.10/cgi-bin/smokeping.cgi“, should “10.10.10.10” be replaced with the ip address found in eth0 using ifconfig?

    2) When I restart the apache2 service, I receive this message:
    “AH00558: apache2: Could not reliably determine the server’s fully qualified domain name”

    • Hi Sol, thanks for saying so.

      Yes, you need to replace the 10.10.10.10 with your servers own IP, that is just the example I used for this post.

      Apache will always give that harmless warning when you start/restart it when you haven’t set up a DNS name for the enabled site (in this case Smokeping did the apache setup for us). There are lots of great docs about resolving this issue if you Google, I don’t cover it as it is a vast topic I can’t devote the energy to, but setting a host name and a quick edit of the apache main configuration should be all you need to nullify the error message.

  18. Hi James,
    Thanks a lot for your guide. I followed all the steps but still doesn’t work for me. The error is as follow:
    Software error:
    ERROR: /etc/smokeping/config.d/Targets, line 2: unknown variable ‘probe’

    and my /etc/smokeping/config.d/Targets is:

    probe = Fping

    menu = Top
    title = Network Latency Grapher
    remark = Welcome to the SmokePing website of xxx company. \
    Here you will learn all about the latency of our network.

    + Local

    menu = Local
    title = Local Network
    #parents = owner:/Test/James location:/

    ++ LocalMachine

    menu = Local Machine
    title = This host
    host = localhost
    #alerts = someloss

    Would you please help?
    Thanks in advance, Amir

  19. Hi Amir

    Is the first line of your ‘Targets’ file “*** Targets ***” ?

    Otherwise it won’t parse correctly. You should also check that your os has fping installed with ‘which fping’. Mine is in /usr/bin/fping

  20. Hey there,
    I reached step 6 and the sudo service apache2 restart
    But faced below error:

    Job for apache2.service failed because the control process exited with error code. See "systemctl status apache2.service" and "journalctl -xe" for details.

    and the below, too

    AH00526: Syntax error on line 16 of /etc/apache2/conf-enabled/serve-cgi-bin.conf:
    ScriptAlias not allowed here
    Action 'configtest' failed.
    The Apache error log may have more information.

    • From that it looks like there’s a difference between when I wrote this guide and now. The commentor Rafe (earlier) identifies that the edits I suggest to make to serve-cgi-bin.conf are no longer needed. Can you try and remove them and try again?

      Which version of Ubuntu and Apache are you using?

      • Pardon me for delay,
        Actually I run the service smokeping on a server with ubuntu 16.04 installed while I have ssh access to it. I didn’t note all the comments before but now the prior problem with serve-cgi-bin.conf is solved.
        Now, when I open the browser
        10.10.10.10/cgi-bin/smokeping.cgi
        nothing achieved!

  21. Even I want to add any new hosts to have ping latency, I have to add them to the file below:
    vim /etc/smokeping/config.d/General
    Am I right?

    • Yes that’s the general idea – I think the ‘Targets’ file is what you actually want to edit. Check out the smokeping docs for more examples 🙂

  22. Pingback: Smokeping to Monitor Network Latency in UBUNTU | Syed Jahanzaib Personal Blog to Share Knowledge !

Leave a Reply

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

This site uses Akismet to reduce spam. Learn how your comment data is processed.