Talk:Smokeping

From ArchWiki

Installation using the Arch Linux package

I propose to update the last section of the [smokeping] wiki page such that it discusses how to set it up using the smokeping package instead of another installation from source. I believe the former to be more relevant to ArchLinux. I've mostly just updated the paths. Here's what I propose it should look like:

Setup using the smokeping package with FastCGI in Apache

It is possible to trade off runtime speed for setup simplicity using the method described below. Instead of using PSGI, we setup FastCGI as described in [1].

The smokeping package consists of two parts:

  • The smokeping daemon and configs in /etc/smokeping/
  • The smokeping "htdocs" in /srv/http/smokeping

In addition, you will need:

  • an image cache directory that the FastCGI script can write to, e.g. /srv/smokeping/imgcache
  • a data directory that the smokeping daemon can write to, and the FastCGI script can read, e.g. /srv/smokeping/data
  • to ensure that the main config file is readable by the smokeping daemon.

1. Install smokeping, fping, apache and mod_fastcgi

# pacman -S smokeping apache mod_fastcgi fping

2. We remove .dist from the config files in /etc/smokeping:

# cd /etc/smokeping
# find . -name '*.dist' -print -execdir sh -c 'mv {} $(basename {} .dist)' \;
# sudo mv /srv/http/smokeping/smokeping.fcgi.dist /srv/http/smokeping/smokeping.fcgi

3. We edit the config file as described above, so that the /etc/smokeping/config file looks something like this:

/etc/smokeping/config
*** General ***

owner     = Your Name Here                            # your name
contact   = your.email@host.bla                       # your email
mailhost  = your.smtp.server.bla                      # your mail server
sendmail  = /bin/false                                # where the sendmail program is
imgcache  = /srv/smokeping/imgcache                   # filesystem directory where we store files
imgurl    = imgcache                                  # URL directory to find them
datadir   = /srv/smokeping/data                       # where we share data between the daemon and webapp
piddir    = /var/run                                  # filesystem directory to store PID file
cgiurl    = http://localhost/smokeping/smokeping.cgi  # exterior URL
smokemail = /etc/smokeping/smokemail   
tmail     = /etc/smokeping/tmail
syslogfacility = local0
# each probe is now run in its own process
# disable this to revert to the old behaviour
# concurrentprobes = no

*** Database ***

step     = 300
pings    = 20

# consfn mrhb steps total

AVERAGE  0.5   1  1008
AVERAGE  0.5  12  4320
    MIN  0.5  12  4320
    MAX  0.5  12  4320
AVERAGE  0.5 144   720
    MAX  0.5 144   720
    MIN  0.5 144   720

*** Presentation ***

template = /etc/smokeping/basepage.html

+ charts

menu = Charts
title = The most interesting destinations
++ stddev
sorter = StdDev(entries=>4)
title = Top Standard Deviation
menu = Std Deviation
format = Standard Deviation %f

++ max
sorter = Max(entries=>5)
title = Top Max Roundtrip Time
menu = by Max
format = Max Roundtrip Time %f seconds

++ loss
sorter = Loss(entries=>5)
title = Top Packet Loss
menu = Loss
format = Packets Lost %f

++ median
sorter = Median(entries=>5)
title = Top Median Roundtrip Time
menu = by Median
format = Median RTT %f seconds

+ overview 

width = 600
height = 50
range = 10h

+ detail

width = 600
height = 200
unison_tolerance = 2

"Last 3 Hours"    3h
"Last 30 Hours"   30h
"Last 10 Days"    10d
"Last 400 Days"   400d

*** Probes ***

+ FPing

binary = /usr/sbin/fping


*** Targets ***

probe = FPing

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

+ targets
menu = Targets

++ Server

menu = Arch Linux
title = Arch Linux Website
host = 66.211.214.131

++ MultiHost

menu = Multihost
title = Arch Wiki and Kernel.org
host = 5.9.250.164 149.20.4.69

Note: If we use smokeping_secrets we will have to make it unreadable to the rest, or else smokeping will eror: chmod 600 /etc/smokeping/smokeping_secrets.

4. Now setup the extra directories:

# mkdir -p /srv/smokeping/data
# mkdir -p /srv/smokeping/imgcache
# chown -R smokeping:smokeping /srv/smokeping
# chown -R http:http /srv/smokeping/imgcache
# chmod a+rx /srv/smokeping
# chmod -R a+rx /srv/smokeping/data

5. The Smokeping configuration is read by both the smokeping daemon and the FastCGI scripts, so it needs to be readable:

# chmod a+rx /etc/smokeping
# chmod a+r /etc/smokeping/config

6. Start smokeping

# systemctl start smokeping

7. We edit /etc/httpd/conf/httpd.conf so it includes

/etc/httpd/conf/httpd.conf
 LoadModule fastcgi_module modules/mod_fastcgi.so
 <IfModule fastcgi_module>
   AddHandler fastcgi-script .fcgi # you can put whatever extension you want
 </IfModule>
 #FastCgiConfig -idle-timeout 90  # try this if you hit errors about the scripts exceeding the idle timeout.
 ScriptAlias /smokeping/smokeping.cgi /srv/http/smokeping.fcgi

 Alias /smokeping/imgcache /srv/smokeping/imgcache
 Alias /smokeping /srv/http/smokeping

 <Directory "/srv/smokeping/imgcache">
   AllowOverride all
   Order Deny,Allow
   Allow from all
   Require all granted
 </Directory>

 <Directory "/srv/http/smokeping">
  Options FollowSymLinks ExecCGI
  AllowOverride all
  Order Deny,Allow
  Allow from all
  Require all granted
 </Directory>

8. Start Apache:

systemctl start httpd

9. Wait a few minutes and check the first data at http://localhost/smokeping/smokeping.cgi

M01 (talk) 22:02, 16 March 2015 (UTC)Reply

Hello, well done! I suppose you can change the wiki since it works for you. When I get some time (hopefully within 2015 :)) I'll try it in a container to check it works fine with a fresh Arch install.
Costis (talk) 18:41, 22 March 2015 (UTC)Reply
Thank you for the feedback! I've now tested the instructions in an Arch Linux Vagrant box just to be sure.
M01 (talk) 08:21, 7 April 2015 (UTC)Reply

No you shouldn't add a new section. You should rewrite the entire page :). What I wrote was for an old version of smokeping. When I wrote this, smokeping was not designed to use FastCGI. Most of what I wrote is no longer applicable.

My advice is to burn it down and rebuild it. Remove everything that doesn't use Apache and FastCGI. You're right, it's too complicated. Simplify it. Make sure older sections do not refer to other old or missing sections. You don't have to limit yourself to a new section to protect other peoples' feelings. Not mine anyways.

Juster (talk) 21:11, 22 March 2015 (UTC)Reply

I just replaced the last section, but only now noticed your comment here! Not sure how I missed it, I'm watching both the page and the talk page. Anyway:
Thanks for explaining that, I suspected that was the case but wasn't sure if FastCGI would be faster or slower than PSGI, so I didn't really dare to touch it in case it was still the superior solution. On my Raspberry Pi FastCGI is pretty slow, but in the Vagrant box where I just tested the new instructions it's pretty speedy. I'll rewrite the wiki page. Thank you for the encouragement!
M01 (talk) 08:21, 7 April 2015 (UTC)Reply
I followed your advice and rebuilt the page! M01 (talk) 12:06, 2 May 2015 (UTC)Reply
Looking good! Juster (talk) 20:40, 2 May 2015 (UTC)Reply

--Skeksi (talk) 13:34, 2 November 2016 (UTC)Reply

There is an interesting variable to hightlight on Alerts section. edgetrigger = yes (alerts will be triggered only when the alert's state is changed). See official doc: http://oss.oetiker.ch/smokeping/doc/smokeping_config.en.html

mod_fastcgi is no longer available

This wiki page is helpful in installing smokeping, however it is no longer available, so mod_fcgid has to be used instead. maybe someone wants to edit this page appopriately?