Ben Stienstra

Linux, Unix, network, radio and more...

User Tools

Site Tools


lxd_smokeping

LXD container - SmokePing 2.7.3

Install SmokePing inside LXD OS-container.

Install

SmokePing

  • Create debian container:
    lxc launch images:debian/stretch/amd64 smokeping
  • Configure container to start at boot:
    lxc config set smokeping boot.autostart true
  • Enter container:
    lxc exec smokeping bash
  • Install required packages:
    apt update
    apt install curl rrdtool perl librrds-perl build-essential libssl-dev zlib1g-dev fping
  • Download latest version:
    curl -OL https://oss.oetiker.ch/smokeping/pub/smokeping-2.7.3.tar.gz
  • Extract:
    tar zxvf smokeping-2.7.3.tar.gz
  • Configure:
    cd smokeping-2.7.3
    ./configure --prefix=/opt/smokeping
  • Compile and install:
    make install

Lighttpd / fcgi

  • Install required packages:
    apt install lighttpd

fping

  • Download fping:
    curl -OL http://www.fping.org/dist/fping-4.1.tar.gz
  • Extract:
    tar zxvf fping-4.1.tar.gz
  • Compile:
    cd fping-4.1
    ./configure
    make -j4
    make install

Configure

  • Configure lighttpd:
    cd /etc/lighttpd/conf-enabled
    ln -s ../conf-available/10-fastcgi.conf .
    ln -s ../conf-available/10-accesslog.conf .
    mv /opt/smokeping/htdocs/smokeping.fcgi.dist /opt/smokeping/htdocs/smokeping.fcgi
  • Edit /etc/lighttpd/lighttpd.conf
    server.modules = (
    #        "mod_access",
            "mod_alias",
    #        "mod_compress",
    #        "mod_redirect",
    )
    
    server.document-root        = "/opt/smokeping/htdocs"
    server.errorlog             = "/var/log/lighttpd/error.log"
    server.pid-file             = "/var/run/lighttpd.pid"
    server.username             = "www-data"
    server.groupname            = "www-data"
    server.port                 = 80
    
    index-file.names            = ( "index.php", "index.html", "index.lighttpd.html" , "smokeping.fcgi" )
    #url.access-deny             = ( "~", ".inc" )
    static-file.exclude-extensions = ( ".php", ".pl", ".fcgi" )
    
    fastcgi.server = (
            ".fcgi" =>
            ((
                    "bin-path" => "/opt/smokeping/htdocs/smokeping.fcgi",
                    "host" => "127.0.0.1",
                    "port" => 8001,
            )),
    )
    
    alias.url = ( "/cache/" => "/opt/smokeping/cache/" )
    alias.url += ( "/data/" => "/opt/smokeping/data/" )
    
    # default listening port for IPv6 falls back to the IPv4 port
    include_shell "/usr/share/lighttpd/use-ipv6.pl " + server.port
    include_shell "/usr/share/lighttpd/create-mime.assign.pl"
    include_shell "/usr/share/lighttpd/include-conf-enabled.pl"
    
  • Create directories:
    mkdir /opt/smokeping/{cache,data,var}
  • Modify rights:
    chown -R www-data. /opt/smokeping
  • Enable and start lighttpd:
    systemctl start lighttpd
    systemctl enable lighttpd
  • Add systemd service in: /etc/systemd/system/smokeping.service:
    [Unit]
    Description=Latency Logging and Graphing System
    After=syslog.target network.target
    
    [Service]
    ExecStart=/opt/smokeping/bin/smokeping --config=/opt/smokeping/etc/config 
    ExecReload=/bin/kill -HUP $MAINPID
    StandardError=syslog
    Type=forking
    PIDFile=/opt/smokeping/var/smokeping.pid
    
    [Install]
    WantedBy=multi-user.target
    systemctl enable smokeping
    systemctl start smokeping

Troubleshooting

  • Error IO-Tty-1.12 → FAIL Timed out (> 60s). Add --verbose to cpanm command. Edit ./smokeping-2.7.3/thirdparty/Makefile:
    touch: CPAN/touch ../config.status ../PERL_MODULES 
            $(AM_V_GEN)cat ../PERL_MODULES  | grep -v '#' | PERL_CPANM_HOME=$(THIRDPARTY_DIR) xargs $(PERL) $(THIRDPARTY_DIR)/bin/cpanm --verbose -q --notest --local-lib-contained $(THIRDPARTY_DIR)  --mirror file://$(THIRDPARTY_DIR)/CPAN --mirror-only 
            $(AM_V_GEN)touch touch
lxd_smokeping.txt · Last modified: 2019/02/17 20:25 by admin