-
Notifications
You must be signed in to change notification settings - Fork 56
Building cAdvisor
Below versions of cAdvisor are available in respective distributions at the time of creation of these build instructions:
- Ubuntu 16.04 has
0.20.5
- Ubuntu 18.04 has
0.27.1
The instructions provided below specify the steps to build cAdvisor version 0.33.0 on Linux on IBM Z for the following distributions:
- RHEL (7.4, 7.5, 7.6)
- SLES (12 SP3, 15)
- Ubuntu (16.04, 18.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 writeable directory anywhere you'd like to place it. - It is recommended to use cadvisor >= 0.23.9 on Kernel version >= 4.4 for SLES & Ubuntu, Kernel version >= 3.10.0-366 for RHEL in order to avoid inconsistent fs usage data from device thin pool. Click here for details.
If you want to build cAdvisor using manual steps, go to STEP 2.
Use the following commands to build cAdvisor using the build script. Please make sure you have wget installed.
wget -q https://raw.githubusercontent.com/linux-on-ibm-z/scripts/master/cAdvisor/0.33.0/build_cadvisor.sh
# Build cAdvisor
bash build_cadvisor.sh [Provide -t option for executing build with tests]
If the build completes successfully, go to STEP 9. In case of error, check logs
for more details or go to STEP 2 to follow manual build steps.
export SOURCE_ROOT=/<source_root>/
-
RHEL (7.4, 7.5, 7.6)
sudo yum install -y curl git libseccomp-devel golang
-
SLES (12 SP3, 15)
sudo zypper install -y curl git libseccomp-devel wget tar gcc
- Install Go 1.10.5
Note: Make sure to set
cd $SOURCE_ROOT wget https://dl.google.com/go/go1.10.5.linux-s390x.tar.gz sudo tar -C /usr/local -xzf go1.10.5.linux-s390x.tar.gz export PATH=$PATH:/usr/local/go/bin sudo ln /usr/bin/gcc /usr/bin/s390x-linux-gnu-gcc
GOROOT
environment variable to point to GO Installation directory.
- Install Go 1.10.5
-
Ubuntu (16.04, 18.04)
sudo apt-get update sudo apt-get install -y curl git golang-1.10 libseccomp-dev export PATH=/usr/lib/go-1.10/bin/:$PATH
export GOPATH=$SOURCE_ROOT
export PATH=$PATH:$GOPATH/bin
cd $SOURCE_ROOT
go get github.com/tools/godep
mkdir -p $GOPATH/src/github.com/google
cd $GOPATH/src/github.com/google
git clone https://github.com/google/cadvisor.git
cd cadvisor
git checkout v0.33.0
- Append changes to the file
$GOPATH/src/github.com/google/cadvisor/vendor/github.com/klauspost/crc32/crc32.go
Note: cAdvisor uses 'klauspost/crc32' over standard crc32 library of golang which is optimized for x64 platform. We add the above code to align it with Go standard library hash/crc32.func updateCastagnoli(crc uint32, p []byte) uint32 { // only use slicing-by-8 when input is >= 16 Bytes if len(p) >= 16 { return updateSlicingBy8(crc, castagnoliTable8, p) } return update(crc, castagnoliTable, p) } func updateIEEE(crc uint32, p []byte) uint32 { // only use slicing-by-8 when input is >= 16 Bytes if len(p) >= 16 { iEEETable8Once.Do(func() { iEEETable8 = makeTable8(IEEE) }) return updateSlicingBy8(crc, iEEETable8, p) } return update(crc, IEEETable, p) }
cd $GOPATH/src/github.com/google/cadvisor
godep go build .
sudo cp ${GOPATH}/src/github.com/google/cadvisor/cadvisor /usr/bin/
cd $GOPATH/src/github.com/google/cadvisor
go test -short `go list ./... | grep -v Microsoft`
Notes:
- Microsoft related tests will be skipped.
- Ignore
TestTopology
failure as it is known issue on system Z.
sudo cadvisor
http://<host-ip>:<http-port>/
Note:
Default port number for cAdvisor is 8080
The information provided in this article is accurate at the time of writing, but on-going development in the open-source projects involved may make the information incorrect or obsolete. Please open issue or contact us on IBM Z Community if you have any questions or feedback.