Archived
1
0
This repository has been archived on 2023-11-17. You can view files and clone it. You cannot open issues or pull requests or push a commit.
Files
linux/smokeping-setup.md

4.9 KiB

Setup Smokeping

Intructions for setting up SmokePing on Alpine Linux

Main(Master)

Needed packages: smokeping lighttpd

make sure to empty the remote secret file (/etc/smokeping/smokeping_secrets),
you also need to correct the permissions chown smokeping:smokeping /etc/smokeping/smokeping_secrets

Lighttpd (/etc/lighttpd/lighttpd.conf)

# {{{ modules
server.modules = (
#    "mod_accesslog",
     "mod_cgi"
)
# }}}

# {{{ includes
include "mime-types.conf"
# }}}

# {{{ CGI
cgi.assign = (
".cgi" => "/usr/bin/perl"
)
# }}}

# {{{ server settings
server.username      = "smokeping"
server.groupname     = "smokeping"
server.document-root = "/usr/share/webapps/smokeping"
server.pid-file      = "/run/lighttpd.pid"
server.errorlog-use-syslog = "enable"
server.indexfiles    = ("smokeping.cgi")
server.follow-symlink = "enable"
static-file.exclude-extensions = (".cgi")
# }}}

# {{{ mod_accesslog
#accesslog.filename   = "/var/log/lighttpd-access.log"
# }}}

# vim: set ft=conf foldmethod=marker et :

Smokeping config (/etc/smokeping/config)

*** General ***

owner    = MaintainerName
contact  = some@address.nowhere
mailhost = my.mail.host
sendmail = /usr/sbin/sendmail
imgcache = /var/lib/smokeping/.simg
imgurl   = img
datadir  = /var/lib/smokeping
piddir   = /var/run/smokeping
cgiurl   = http://some.url/smokeping.cgi
tmail = /etc/smokeping/tmail
smokemail = /etc/smokeping/smokemail
syslogfacility = local0

#Use to overwrite system hostname
#display_name = HostName

*** 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
htmltitle = yes
graphborders = no

+ 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 hour"   1h
"Last day"    24h
"Last week"   7d
"Last month"  30d
"Last year"   365d


*** Probes ***

+FPing
binary = /usr/sbin/fping
step = 60

*** Slaves  ***
secrets=/etc/smokeping/smokeping_secrets


*** Targets ***

probe = FPing

menu = Top
title = Network Latency Grapher
remark = Welcome to SmokePing.

+ Internet
menu = Internet
title = Hosts on the internet

++ cloudflare
#slaves = 
host = 1.1.1.1

++ google
#slaves = 
host = 8.8.8.8

Start and Enable services on boot service smokeping start && service lighttpd start && rc-update add smokeping default && rc-update add lighttpd default

Remote(Slave)

On Main

Add the name and a secret in in the secrets file/etc/smokeping/smokeping_secrets using the following format (one per line) remotehostname:Secret
Add the host to the slaves section using the following example:

+remotehostname                           
display_name=Remote-Hostname              
color=00ffff          

Add the host to the slaves section of the targets (should be seperated with a space)
Last step on main is to restart smokeping service smokeping restart

On Remote

Needed packages: smokeping

Put a secret in /etc/smokeping/secret.txt
set its permissions chown smokeping:smokeping /etc/smokeping/secret.txt && chmod 600 /etc/smokeping/secret.txt

Service file(/etc/init.d/smokeping-remote)

#!/sbin/openrc-run
HostName=host1
MainURL="http://<MainHost>/smokeping.cgi"

depend() {
        need net
}

start() {
        checkpath --directory --owner smokeping:smokeping /var/run/smokeping

        ebegin "Starting smokeping remote"
        LC_ALL=C \
        start-stop-daemon --start --name smokeping \
                --pidfile /var/run/smokeping/smokeping.pid \
                --exec /usr/bin/smokeping \
                --user smokeping:smokeping \
                -- --master-url=$MainURL --cache-dir=/var/lib/smokeping --pid-dir=/var/run/smokeping --shared-secret=/etc/smokeping/secret.txt --slave-name=$HostName
        eend $?
}

stop() {
        ebegin "Stopping smokeping Remote"
        start-stop-daemon --stop \
                --pidfile /var/run/smokeping/smokeping.pid
        eend $?
}

Set permissions service file chmod +x /etc/init.d/smokeping-remote
Start and Enable service on boot service smokeping-remote start && rc-update add smokeping-remote default
Add to Root cron tab to auto reload after crash (/etc/crontabs/root) echo '* * * * * openrc --no-stop' >> /etc/crontabs/root