Skip to content

Building Statsd

aborkar-ibm edited this page Mar 11, 2020 · 23 revisions

Building Statsd

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

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

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: Build using script

If you want to build Statsd using manual steps, go to STEP 2.

Use the following commands to build Statsd using the build script. Please make sure you have wget installed.

wget -q https://raw.githubusercontent.com/linux-on-ibm-z/scripts/master/Statsd/0.8.6/build_statsd.sh

# Build Statsd
bash build_statsd.sh    [Provide -t option for executing build with tests]

If the build completes successfully, go to STEP 5. In case of error, check logs for more details or go to STEP 2 to follow manual build steps.

Step 2: 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, 8.1)

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

     sudo apt-get update
     sudo apt-get install -y git wget tar unzip hostname python g++ make
  • 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
  • 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

Step 3: Install Statsd

  • Download Statsd source code

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

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

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

Step 4: Testing (Optional)

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

Step 5: Run Statsd daemon

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

Step 6: Usage

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

References:

https://github.com/etsy/statsd

Clone this wiki locally