Smokeping

Smokeping allows you to probe a list of servers, store that data using RRDtool, and generate statistical charts based on RRDtool's output. Smokeping consists of two parts. A daemon runs in the background pinging and collecting data at set intervals. A web interface displays that data in the form of graphs.

This wiki page covers a basic setup of the smokeping daemon and the CGI webinterface.

Installation

This section covers the installation of Smokeping using the smokeping package. FastCGI on Apache will be setup as described in Apache and FastCGI.

The smokeping package consists of two parts:

  • The smokeping daemon and configs in /etc/smokeping/. This daemon performs the monitoring.
  • The smokeping "htdocs" in /srv/http/smokeping. These will be used by the web interface.

In addition to the smokeping package, you will need:

  • A tool that smokeping can use for monitoring. fping is the simplest and default method for simple ping probes.
  • apache and mod_fcgidAUR for the web interface if you are using Apache.
  • fcgiwrap and start and enable fcgiwrap.socket if you are using Nginx
  • 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 configuration file is readable by the smokeping daemon.

Optional Prerequisites

If you want to use other probes such as the DNS or http probe you will need other packages as shown below. The configuration of these will is not covered by this wiki page.

ProbePackage Needed
Curlcurl
DNSbind (for the dig utility)
EchoPing
SSH
TelnetIOSPing
AnotherDNS
LDAPperl-ldap
LDAP (tls)perl-io-socket-ssl
Authen

Configuration

Smokeping requires you to edit a few files. The unedited files end with the extension. Rename the files in to remove the suffix. The find command does this and prints out each file that is being renamed and needs editing:

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

Editing the configuration file

Next, edit the file; this is smokeping's main configuration file. A brief description of the sections is followed by a complete example.

The General section of the file is the easiest to edit. Personalize the top of the configuration file to match your information. The comments describe each field. Note that if you do not have the program installed (ie from postfix or sendmail) then use something else instead like . The file you specify must exist or smokeping will error out.

The Alerts section is not needed in this minimal example, so it can be either commented out or removed.

The Database section does not require any changes.

In the Presentation section the path to the template filename needs to be updated.

The Probes section specifies which probes are active. By default only the FPing probe is enabled. This section does not require any changes.

The Slaves section is not needed in this minimal example, so it can be either commented out or removed. Note that if you use the setting in the Slaves section, you will have to make that file unreadable to the rest of the world, or else smokeping will error: .

The Targets section specifies which hosts will be probed (pinged in our example). Customize it so that it probes the host(s) you would like to collect statistics on, as shown in the example below.

You can learn more about the Smokeping configuration file with the examples at https://oss.oetiker.ch/smokeping/doc/smokeping_examples.en.html

Notes on the smokeping configuration file syntax

Each + character defines a section in the hierarchy. Spaces are not allowed in the section names. Period and forward slashes should probably also be avoided in section names. This is probably because the RRD files are stored under the data directory with the same exact names as the sections.

In the Targets section, you can define host as either a real host name or the path to another section to generate a multiple host chart, as shown in the example above.

Setup the rest of the system

Setup the extra directories referenced by the configuration file:

# 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

Since 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

Start and enable daemon

Start and enable smokeping.service. Then check that it is running.

Setup web frontend

Apache

Edit so that it includes:

LoadModule fcgid_module modules/mod_fcgid.so
<IfModule fcgid_module>
  AddHandler fcgid-script .fcgi
</IfModule>

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

<Directory "/srv/smokeping/imgcache">
  AllowOverride all
  Require all granted
</Directory>

<Directory "/srv/http/smokeping">
 Options FollowSymLinks ExecCGI
 AllowOverride all
 Require all granted
</Directory>

Start Apache via the .

Check that http://localhost/smokeping/smokeping.fcgi loads. The first data should appear after a couple of minutes.

If the fonts in the graphs are unreadable, you may need to install the package.

Caddy

Thanks to the Caddy community and with this configuration file /etc/smokeping/config and with enable

An updated version of this Caddy configuration for smokeping - https://gist.github.com/Strykar/4df1eb8aebc4d5f7039f6045301352c7

Caddy 2

Thanks to the francislavoie and Caddy community and to the Caddy docs. Start and enable fcgiwrap.socket!

Lighttpd

First install and fcgi.

Edit the Lighttpd configuration file and ensure you have at least all of the following configuration directives:

Start/enable the

Systemd should show being managed by .

$ systemctl status lighttpd
● lighttpd.service - Lighttpd Web Server
   Loaded: loaded (/usr/lib/systemd/system/lighttpd.service; enabled; vendor preset: disabled)
   Active: active (running) since Wed 2018-12-26 14:34:42 PST; 1 day 7h ago
  Process: 17117 ExecReload=/bin/kill -HUP $MAINPID (code=exited, status=0/SUCCESS)
 Main PID: 28321 (lighttpd-angel)
    Tasks: 6 (limit: 4915)
   Memory: 128.9M
   CGroup: /system.slice/lighttpd.service
           ├─17119 /usr/bin/lighttpd -D -f /etc/lighttpd/lighttpd.conf
           ├─17126 /usr/bin/perl /usr/bin/smokeping_cgi /etc/smokeping/config
           ├─17127 /usr/bin/perl /usr/bin/smokeping_cgi /etc/smokeping/config
           ├─17128 /usr/bin/perl /usr/bin/smokeping_cgi /etc/smokeping/config
           ├─17129 /usr/bin/perl /usr/bin/smokeping_cgi /etc/smokeping/config
           └─28321 /usr/bin/lighttpd-angel -D -f /etc/lighttpd/lighttpd.conf

Finally, add a symbolic link to allow images to load:

Nginx

Ensure that and are both running via systemctl.

Add a server block for smokeping to , following is an example for a TLS enabled block.

   server {
       server_name smokeping.example.com;
       listen 443 ssl http2;
       listen [::]:443 ssl http2;
       root /srv/http/smokeping/;
       index smokeping.fcgi;
       gzip off;
       location ~ \.fcgi$ {
           fastcgi_intercept_errors on;
           include /etc/nginx/fastcgi_params;
           fastcgi_param SCRIPT_FILENAME /srv/http/smokeping/smokeping.fcgi;
           fastcgi_pass unix:/var/run/fcgiwrap.sock;
       }
       location /imgcache {
           alias /srv/smokeping/imgcache;
           gzip off;
       }
   }

Verify that your configuration is fine via as the root user and reload the configuration via as the root user.

Advanced Configuration

Smokeping is a powerful tool that can be configured in many ways. You can setup many different types of probes. You can setup slave smokeping servers that can send their statistics and show you probes from other servers. You can also create your custom probes in perl. These options are currently not covered by this guide, please consult the documentation on the Smokeping website instead. Also see - https://github.com/oetiker/SmokePing/wiki/FAQ

Notes

Smoketrace (Tr.cgi)

The SmokeTraceroute utility is gone since v2.5.0 according to the release notes.

gollark: I've put it on github: https://github.com/osmarks/mtmanager
gollark: ···
gollark: By copying half the code out of SPUDNET it shouldn't be *too* horrible to do.
gollark: I've decided to add another eternally unfinished™ project to my projects pile! A Minetest server management web UI.
gollark: (https://www.reddit.com/r/unix/comments/6gxduc/how_is_gnu_yes_so_fast/)
This article is issued from Archlinux. The text is licensed under Creative Commons - Attribution - Sharealike. Additional terms may apply for the media files.