Skip to content

Building Statsd

aborkar-ibm edited this page Sep 17, 2019 · 23 revisions

Building Statsd

The instructions provided below specify the steps to build Statsd version 0.8.5 on Linux on IBM Z for the following distributions:

  • RHEL (7.5, 7.6, 7.7, 8.0)
  • Ubuntu (16.04, 18.04, 19.04)

General Notes:

  • When following the steps below please use a standard permission user unless otherwise specified

  • A directory /<source_root>/ will be referred to in these instructions, this is a temporary writable directory anywhere you'd like to place it

Step 1: Install the Dependencies

export SOURCE_ROOT=/<source_root>/
  • RHEL (7.5, 7.6, 7.7)

     sudo yum install -y git wget tar unzip hostname make gcc-c++
  • RHEL 8.0

     sudo yum install -y git wget tar unzip hostname make gcc-c++ xz gzip python2 nmap procps
  • Ubuntu (16.04, 18.04, 19.04)

     sudo apt-get update
     sudo apt-get install -y git wget tar unzip hostname python g++ make
  • Install Nodejs

    cd $SOURCE_ROOT
    wget https://nodejs.org/dist/v10.15.3/node-v10.15.3-linux-s390x.tar.xz
    chmod ugo+r node-v10.15.3-linux-s390x.tar.xz
    sudo tar -C /usr/local -xf node-v10.15.3-linux-s390x.tar.xz
    export PATH=$PATH:/usr/local/node-v10.15.3-linux-s390x/bin
    node -v
  • Install GCC (For RHEL 7.5, 7.6 and 7.7)

    sudo yum install -y wget tar make flex gcc gcc-c++ binutils-devel bzip2
    cd $SOURCE_ROOT
    wget https://ftpmirror.gnu.org/gcc/gcc-5.4.0/gcc-5.4.0.tar.gz
    tar -xf gcc-5.4.0.tar.gz && cd gcc-5.4.0/
    ./contrib/download_prerequisites && cd ..
    mkdir gccbuild && cd gccbuild
    ../gcc-5.4.0/configure --prefix=/opt/gcc-5.4.0 --enable-checking=release --enable-languages=c,c++ --disable-multilib
    make && sudo make install
    export PATH=/opt/gcc-5.4.0/bin:$PATH
    export LD_LIBRARY_PATH=/opt/gcc-5.4.0/lib64/
    gcc --version

Step 2: Install Statsd

  • Download Statsd source code

    cd $SOURCE_ROOT
    git clone https://github.com/etsy/statsd.git
    cd statsd
    git checkout v0.8.5
  • Install required npm dependencies

    sudo alternatives --set python /usr/bin/python2 (For RHEL 8.0 only)
    npm install

Note: User can run npm audit fix command to automatically install compatible updates to vulnerable dependencies.

Step 3: Testing (Optional)

  • Run test cases
    cd $SOURCE_ROOT/statsd/
    ./run_tests.js

Step 4: Run Statsd daemon

   cd $SOURCE_ROOT/statsd
   node stats.js /path/to/config

Step 5: Usage

   The basic line protocol expects metrics to be sent in the format:
   <metricname>:<value>|<type>
   e.g. echo "foo:1|c" | nc -u -w0 127.0.0.1 8125

References:

https://github.com/etsy/statsd

Clone this wiki locally