Skip to content
This repository has been archived by the owner on Mar 30, 2022. It is now read-only.

All in One Setup Guide

Jerry Lundström edited this page Oct 25, 2016 · 5 revisions

This setup guide will instruct you on how to setup the DNS Statistics Collector (DSC) and Presenter (DSP) on either a Debian or Ubuntu distribution as a All-in-One solution meaning it will run the Collector and Presenter on the same host and only collect and present DNS statistics for that host.

If you are looking for a multi node setup please read Multi Node Setup Guide.

Install Software

Install the required DSC software, see Packages for information about which distribution releases are supported.

Debian

DISTRIBUTION=`lsb_release -sc` # or set to your distribution of Debian
wget -O - https://pkg.dns-oarc.net/dns-oarc.distribution.key.gpg | sudo apt-key add -
echo "deb http://pkg.dns-oarc.net/debian $DISTRIBUTION main" | sudo tee /etc/apt/sources.list.d/dns-oarc.list
sudo apt-get update
sudo apt-get install dsc dsp

Ubuntu

sudo add-apt-repository ppa:dns-oarc/dsc
sudo apt-get update
sudo apt-get install dsc dsp

Setup Collector

cd /etc/dsc
sudo cp dsc.conf.sample dsc.conf
sudo vi dsc.conf

When editing dsc.conf do:

  • Change run_dir to "/var/lib/dsc/localhost/localnode", the format is DSP specific
  • Uncomment any of the bpf_program to limit the packet capturing (optional)
  • Uncomment one interface setting, change the interface name if it is not correct

Create the localhost and localnode directory:

sudo mkdir -p /var/lib/dsc/localhost/localnode

Start DSC

DSC is currently not installed as a service so we need to start it.

sudo dsc /etc/dsc/dsc.conf

DSC writes it's data files every minute (default settings) but writing the first data file after start up can take up to 2 minutes, wait and check that you get data files. Consult log files if there are none after a while.

ls /var/lib/dsc/localhost/localnode

Setup Extractor

The Extractor is the part of DSP that prepares the DSC data into DAT files for the Grapher to read, schedule refile-and-grok.sh to run each minute.

sudo crontab -e

Example crontab:

* * * * * nice /usr/lib/dsp/refile-and-grok.sh

Setup Presenter

We create a minimal configuration for the Presenter with just our localhost and localnode.

cd /etc/dsp
sudo vi dsc-grapher.cfg

Add the following to dsc-grapher.cfg:

server localhost localnode
trace_windows 1hour 4hour 1day 1week
accum_windows 1day 2days 3days 1week

Setup Nginx and Fastcgi

DSP is a Perl script along with a Perl library that needs to run as a CGI application, for this guide we use Nginx and Fastcgi but other solutions are also possible.

sudo apt-get install nginx fcgiwrap
sudo vi /etc/nginx/sites-available/default

When editing default add the following to the server section:

    location = /dsc-grapher.pl {
        gzip            off;
        root            /usr/lib/cgi-bin/dsp;
        include         fastcgi_params;
        fastcgi_param   DOCUMENT_ROOT $document_root;
        fastcgi_param   SCRIPT_FILENAME $document_root$fastcgi_script_name;
        fastcgi_param   SCRIPT_NAME $fastcgi_script_name;
        fastcgi_param   AUTH_USER $remote_user;
        fastcgi_param   REMOTE_USER $remote_user;
        fastcgi_pass    unix:/var/run/fcgiwrap.socket;
    }

    location ~ ^/dsc/(.+\.png)$ {
        alias   /usr/share/dsp/html/$1;
    }

Make sure both services are started and configuration refreshed:

sudo service fcgiwrap restart
sudo service nginx restart

Setup Presenter Cache

The Presenter puts it's generated graphs in a cache and we need to create the directory and set the permissions to be the same as Nginx uses, this can be different depending on what web server and CGI you use.

sudo mkdir /var/cache/dsp
sudo chown www-data:www-data /var/cache/dsp/

All Done!

You should now be able to access DSP at http://localhost/dsc-grapher.pl .