Install smokeping on Raspbian

From KlavoWiki
Jump to navigationJump to search

Install

apt-get -y install smokeping sendmail sipsak


cgi script

a2enmod cgi

smokeping web

vi /etc/smokeping/apache2.conf

add

DirectoryIndex smokeping.cgi

example

<Directory "/usr/share/smokeping/www">
    Options FollowSymLinks
    DirectoryIndex smokeping.cgi
</Directory>

enable web

ln -s /etc/apache2/conf-available/smokeping.conf /etc/apache2/sites-enabled/001-smokeping.conf

redirection

If you want to redirect your root web site to /smokeping

vi /var/www/html/index.html

An example is here.

<html>
<head>  <meta http-equiv="refresh" content="0; url=/smokeping" /> </head>
<body></body>
</html>

Config Files

Location

/etc/smokeping/config.d/

Alerts

This is simple enough. The email address to send alerts to and the from address.

/etc/smokeping/config.d/Alerts

Database

/etc/smokeping/config.d/Database

Smokeping has a default of 5 minute averages which I don't like. I changed mine to be 1 minute averages.

1 ping every 5 seconds.

step     = 60
pings    = 12

General

Very general stuff here. Owner, email and SMTP server.

/etc/smokeping/config.d/General

Presentation

This is how the graphs look and the default displaying of graphs.

I didn't like the default at all. I defaulted mine to be 1 Hour, 6 Hours, 1 Day, 30 Days and 1 Year.

/etc/smokeping/config.d/Presentation
"Last 1 Hour"     1h
"Last 6 Hours"    6h
"Last 1 Day"      1d
"Last 1 Week"     7d
"Last 30 Days"    30d
"Last 1 Year"     365d

I also changed the summary graphs to be double the height for easier reading.

+ overview

width = 600
height = 100
range = 6h

Slaves

I haven't played with or understand this as yet.

/etc/smokeping/config.d/Slaves

Targets

/etc/smokeping/config.d/Targets

This for me was the hardest to understand. The official example page is here. Let me start at the top of the file and try to explain each section.

Use the default probe of FPing. You can change the probe to be different for each host. Example sipsak can be use to test SIP servers.

*** Targets ***

probe = FPing

This information is displayed on the home page of smokeping.

menu = Top
title = Network Latency Grapher
remark = SmokePing website for my network. Authorised access only.


The first line will represent the URL. Example myserver.com/smokeping/?target=Menu1
The second line will represent the name of the menu item on the web page.
The third line will be a title of the graphs within this menu.

+ Menu1
menu = Menu
title = Description


This next section will ping each node.

The first line will represent the URL. Example myserver.com/smokeping/?target=Menu1.Item1
The second line will represent the name of the menu item on the wen page.
The third line will be a title of the graphs within this menu.
The fourth line will allow an email to be sent if there is any loss based on the configuration of the Alerts file.
the fifth line is only if you are not using the default probe otherwise this line is not required.
The sixth line is the host to ping. You can use IP or FQDN.

++ Item1
menu = Node1
title = Title Name
alerts = smoeloss
probe = SipSak
host = google.com

Structure

  • You can only have one probe define globally.
  • You can only define one menu, title and remark for the landing page of smokeping.
  • The menu structure is:
+url
menu
title

++ url
menu
title
host

++ url
menu
title
host
.
.
.
+url (New menu structure)
title

++ url
menu
title
host

++ url
menu
title
host
.
.
.
and so forth

This is the basics of Targets. There is a lot more that you can do. Refer to the documentation for more information.


example extract

*** Targets ***

probe = FPing

menu = Top
title = Network Latency Grapher
remark = SmokePing website for my network. Authorised access only.

+ Internode
menu= Internode
title = Internode Nodes

++ One
menu = Hop 1
title = 150.101.32.109 1st Hop to ISP
alerts = someloss
host = 150.101.32.109

++ Two
menu = Hop 2
title = 150.101.35.80 2nd Hop to ISP
alerts = someloss
host = 150.101.35.80

++ SMTP
menu = SMTP
title = SMTP Server
probe = EchoPingSmtp
host = mail.internode.on.net

+ External
menu= External
title = Internet Nodes


++ Google_NS
menu = NS Google 1
title = 8.8.8.8 Google NS Server 1
alerts = someloss
probe = DNS
host = 8.8.8.8

++ NS_OpenDNS
menu = NS OpenDNS 1
title = 208.67.222.222 OpenDNS NS Server 1
alerts = someloss
probe = DNS
host = 208.67.222.222

++ Gil
menu = gil
title = gil.com.au
alerts = someloss
host = gil.com.au

+ Internal
menu = Internal
title = Internal Servers

++ Firewall
menu = Firewall
title = Billion Router
alerts = someloss
host = 10.13.13.254

++ PBX
menu = PBX Server
title = Asterisk SIP PBX Server
alerts = someloss
host = 10.13.13.253

+ SIP
menu = sip
title = SIP Servers

++ SipTalk
menu = SipTalk
title = SipTalk SIP Server
alerts = someloss
probe = SipSak
host = sip.siptalk.com.au

++ Telecube
menu = Telecube
title = Telecube SIP Server
alerts = someloss
probe = SipSak
host = sip.telecube.net.au

++ Internode
menu = Internode
title = sip.internode.on.net
alerts = someloss
probe = SipSak
host = sip.internode.on.net

++ MyNetFonee
menu = MyNetFone
title = sip.mynetfone.com.au
alerts = someloss
probe = SipSak
host = sip.mynetfone.com.au

Probes

If you have added additional probes you will need to add them to smokeping here.

As I added sipsak I need to add the following.

/etc/smokeping/config.d/Probes
+ SipSak
binary = /usr/bin/sipsak
+DNS
binary = /usr/bin/dig
+EchoPingSmtp
binary = /usr/bin/echoping

Note: dig and echoping binaries are already installed from Raspberry image.

rrd files

/var/lib/smokeping/

enable changes

Reboot or restart apache and smokeping

systemctl restart apache2
systemctl restart smokeping

Notes

I installed sipsak so I can do a sip ping rather than an ICMP ping to SIP servers. There are other modules you can install like DNS, HTTP, HTTPS, SSH, CISCO and others. Refer to smokeping probes.

I noticed the latency was 1 to 10 ms higher when using application probes. Probably because it takes that bit long for a reply to come form the application.

Documentation

http://oss.oetiker.ch/smokeping/doc/