Use snap binaries to build image

Until we find a better official and publicly available
location for hosting these binaries, they will be hosted on
bintray.com

This should change when/if Intel will be providing access
to nightly binary builds. Please note that the binaries
have been produced using Intel's build scripts

The snap task file has been updated to take into account
the fact that cpu metrics are now dynamic and that due to
snap framework issue #1144 you can not request a specific
instance of dynamic metrics

The Grafana system dashboard has been updated to comply with
the snap task change above

Change-Id: I76a2eac0497c8e2024234aab5e117d173e136049
This commit is contained in:
Olivier Bourdon 2016-09-07 09:29:01 +02:00
parent 78b13b7209
commit b21cc701a0
4 changed files with 68 additions and 162 deletions

View File

@ -69,7 +69,7 @@
"type": "fill"
}
],
"measurement": "intel.procfs.cpu.all.user_percentage",
"measurement": "intel.procfs.cpu.user_percentage",
"policy": "default",
"refId": "A",
"resultFormat": "time_series",
@ -92,6 +92,12 @@
"key": "hostname",
"operator": "=~",
"value": "/^$hostname$/"
},
{
"condition": "AND",
"key": "cpuID",
"operator": "=",
"value": "all"
}
]
},
@ -112,7 +118,7 @@
"type": "fill"
}
],
"measurement": "intel.procfs.cpu.all.system_percentage",
"measurement": "intel.procfs.cpu.system_percentage",
"policy": "default",
"refId": "B",
"resultFormat": "time_series",
@ -135,6 +141,12 @@
"key": "hostname",
"operator": "=~",
"value": "/^$hostname$/"
},
{
"condition": "AND",
"key": "cpuID",
"operator": "=",
"value": "all"
}
]
},
@ -155,7 +167,7 @@
"type": "fill"
}
],
"measurement": "intel.procfs.cpu.all.idle_percentage",
"measurement": "intel.procfs.cpu.idle_percentage",
"policy": "default",
"refId": "C",
"resultFormat": "time_series",
@ -178,6 +190,12 @@
"key": "hostname",
"operator": "=~",
"value": "/^$hostname$/"
},
{
"condition": "AND",
"key": "cpuID",
"operator": "=",
"value": "all"
}
]
}
@ -3062,7 +3080,7 @@
"multi": false,
"name": "hostname",
"options": [],
"query": "show tag values from \"intel.procfs.cpu.all.user_percentage\" with key = hostname",
"query": "show tag values from \"intel.procfs.cpu.user_percentage\" with key = hostname",
"refresh": 1,
"type": "query"
},
@ -3139,6 +3157,6 @@
},
"timezone": "browser",
"title": "System",
"version": 4
"version": 5
}
}

View File

@ -3,14 +3,13 @@ MAINTAINER {{ maintainer }}
# install Go and Snap
ADD install.sh /tmp/
RUN apt-get -y -t jessie-backports --no-install-recommends install golang \
&& mkdir -p /etc/snap/auto \
RUN mkdir -p /etc/snap/auto \
&& bash /tmp/install.sh /etc/snap/auto \
&& rm /tmp/install.sh \
&& useradd --user-group snap \
&& usermod -a -G microservices snap \
&& chown -R snap: /etc/snap \
&& apt-get purge -y --auto-remove golang \
&& apt-get purge -y --auto-remove \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/*

View File

@ -4,159 +4,48 @@ set -e
AUTO_DISCOVERY_PATH="$1"
#
# Install build dependencies
#
BUILD_DEPS="debhelper fakeroot g++ git libc6-dev make cmake"
apt-get update
apt-get install -y --no-install-recommends $BUILD_DEPS
#
# Install Snap and Snap plugins
#
export GOPATH="/go"
GOPATH_ORIG=$GOPATH
# Snap release, platform and architecture
RELEASE=v0.15.0-beta-98-g0b228f5
PLATFORM=linux
ARCH=amd64
TDIR=/tmp/snap
mkdir -p "$GOPATH/src" "$GOPATH/bin"
chmod -R 777 "$GOPATH"
# Binary storage service URI components
PROTOCOL=https
HOST=bintray.com
BASEURL="olivierbourdon38/Snap/download_file?file_path="
export PATH=/usr/local/go/bin:$GOPATH/bin/:$PATH
mkdir -p $TDIR
# Retrieve archived binaries and extract them in temporary location
for a in snap snap-plugins; do
f="${a}-${RELEASE}-${PLATFORM}-${ARCH}.tar.gz"
# -L required due to potential successive redirections
curl -s -k -L -o $TDIR/$f ${PROTOCOL}://${HOST}/${BASEURL}$f
tar zxCf $TDIR $TDIR/$f --exclude '*mock[12]'
done
GIT_OPTS="-q"
# Copy retrieved binaries excluding demo plugins
install --owner=root --group=root --mode=755 $TDIR/snap-${RELEASE}/bin/* $TDIR/snap-${RELEASE}/plugin/* /usr/local/bin
# Make the plugins auto-loadable by the snap framework
for f in /usr/local/bin/snap-plugin*; do
ln -s $f $AUTO_DISCOVERY_PATH
done
go get github.com/tools/godep
# Get Snap
go get -d github.com/intelsdi-x/snap
# Get Snap plugins
# https://github.com/intelsdi-x/snap-plugin-collector-cpu/commit/c4a90ddf785835a3d6d830eb0292aa418b2bcd9e
REFSPEC="c4a90ddf785835a3d6d830eb0292aa418b2bcd9e"
go get -d github.com/intelsdi-x/snap-plugin-collector-cpu
cd $GOPATH/src/github.com/intelsdi-x/snap-plugin-collector-cpu
git checkout ${GIT_OPTS} ${REFSPEC}
make deps
# https://github.com/intelsdi-x/snap-plugin-collector-df/commit/411e248ccf2c3897548a08336470b6390e9f6e68
REFSPEC="411e248ccf2c3897548a08336470b6390e9f6e68"
go get -d github.com/intelsdi-x/snap-plugin-collector-df
cd $GOPATH/src/github.com/intelsdi-x/snap-plugin-collector-df
git checkout ${GIT_OPTS} ${REFSPEC}
make deps
# https://github.com/intelsdi-x/snap-plugin-collector-disk/commit/8af1b89502c584aba37c18da1d12313cee53f8a0
REFSPEC="8af1b89502c584aba37c18da1d12313cee53f8a0"
go get -d github.com/intelsdi-x/snap-plugin-collector-disk
cd $GOPATH/src/github.com/intelsdi-x/snap-plugin-collector-disk
git checkout ${GIT_OPTS} ${REFSPEC}
make deps
# https://github.com/intelsdi-x/snap-plugin-collector-interface/commit/d2c8ff6bdf6277b4d2f3c653d603fe6b65d3196a
REFSPEC="d2c8ff6bdf6277b4d2f3c653d603fe6b65d3196a"
go get -d github.com/intelsdi-x/snap-plugin-collector-interface
cd $GOPATH/src/github.com/intelsdi-x/snap-plugin-collector-interface
git checkout ${GIT_OPTS} ${REFSPEC}
make deps
# https://github.com/intelsdi-x/snap-plugin-collector-load/commit/dc0b214ace415f31093fea2ba89384c7f994102e
REFSPEC="dc0b214ace415f31093fea2ba89384c7f994102e"
go get -d github.com/intelsdi-x/snap-plugin-collector-load
cd $GOPATH/src/github.com/intelsdi-x/snap-plugin-collector-load
git checkout ${GIT_OPTS} ${REFSPEC}
make deps
# https://github.com/intelsdi-x/snap-plugin-collector-meminfo/commit/983c4ae32ef38cb1acd886309f97a389a264179b
REFSPEC="983c4ae32ef38cb1acd886309f97a389a264179b"
go get -d github.com/intelsdi-x/snap-plugin-collector-meminfo
cd $GOPATH/src/github.com/intelsdi-x/snap-plugin-collector-meminfo
git checkout ${GIT_OPTS} ${REFSPEC}
make deps
# https://github.com/intelsdi-x/snap-plugin-collector-processes/commit/c07278cdbe8126ea5a32db7442796cde575070a0
REFSPEC="c07278cdbe8126ea5a32db7442796cde575070a0"
go get -d github.com/intelsdi-x/snap-plugin-collector-processes
cd $GOPATH/src/github.com/intelsdi-x/snap-plugin-collector-processes
git checkout ${GIT_OPTS} ${REFSPEC}
make deps
# https://github.com/intelsdi-x/snap-plugin-collector-swap/commit/4afdd8658cef1bb5744b38c9a77aa4589afd5f8d
REFSPEC="4afdd8658cef1bb5744b38c9a77aa4589afd5f8d"
go get -d github.com/intelsdi-x/snap-plugin-collector-swap
cd $GOPATH/src/github.com/intelsdi-x/snap-plugin-collector-swap
git checkout ${GIT_OPTS} ${REFSPEC}
make deps
# https://github.com/intelsdi-x/snap-plugin-publisher-heka/commit/e95f8cc48edf29fc8fd8ab2fa3f0c6f6ab054674
REFSPEC="e95f8cc48edf29fc8fd8ab2fa3f0c6f6ab054674"
go get -d github.com/intelsdi-x/snap-plugin-publisher-heka
cd $GOPATH/src/github.com/intelsdi-x/snap-plugin-publisher-heka
git checkout ${GIT_OPTS} ${REFSPEC}
make deps
# Build Snap
# https://github.com/intelsdi-x/snap/commit/4e6b19df7b7b7d4300429ba22b766c2ac70d2e29
REFSPEC="4e6b19df7b7b7d4300429ba22b766c2ac70d2e29"
cd $GOPATH/src/github.com/intelsdi-x/snap
git checkout ${GIT_OPTS} ${REFSPEC}
make deps all install
cp build/plugin/* /usr/local/bin/
ln -s /usr/local/bin/snap-plugin-processor-passthru $AUTO_DISCOVERY_PATH
# the mock-file publisher plugin may be useful for debugging
ln -s /usr/local/bin/snap-plugin-publisher-mock-file $AUTO_DISCOVERY_PATH
# Build Snap plugins
cd $GOPATH/src/github.com/intelsdi-x/snap-plugin-collector-cpu
make all
cp build/rootfs/snap-plugin-collector-cpu /usr/local/bin
ln -s /usr/local/bin/snap-plugin-collector-cpu $AUTO_DISCOVERY_PATH
cd $GOPATH/src/github.com/intelsdi-x/snap-plugin-collector-df
make all
cp build/rootfs/snap-plugin-collector-df /usr/local/bin
ln -s /usr/local/bin/snap-plugin-collector-df $AUTO_DISCOVERY_PATH
cd $GOPATH/src/github.com/intelsdi-x/snap-plugin-collector-disk
make all
cp build/rootfs/snap-plugin-collector-disk /usr/local/bin
ln -s /usr/local/bin/snap-plugin-collector-disk $AUTO_DISCOVERY_PATH
cd $GOPATH/src/github.com/intelsdi-x/snap-plugin-collector-interface
make all
cp build/rootfs/snap-plugin-collector-interface /usr/local/bin
ln -s /usr/local/bin/snap-plugin-collector-interface $AUTO_DISCOVERY_PATH
cd $GOPATH/src/github.com/intelsdi-x/snap-plugin-collector-load
make all
cp build/rootfs/snap-plugin-collector-load /usr/local/bin
ln -s /usr/local/bin/snap-plugin-collector-load $AUTO_DISCOVERY_PATH
cd $GOPATH/src/github.com/intelsdi-x/snap-plugin-collector-meminfo
make all
cp build/rootfs/snap-plugin-collector-meminfo /usr/local/bin
ln -s /usr/local/bin/snap-plugin-collector-meminfo $AUTO_DISCOVERY_PATH
cd $GOPATH/src/github.com/intelsdi-x/snap-plugin-collector-processes
make all
cp build/rootfs/snap-plugin-collector-processes /usr/local/bin
ln -s /usr/local/bin/snap-plugin-collector-processes $AUTO_DISCOVERY_PATH
# the "processes" plugin accesses files like /proc/1/io which
# only the "root" can read
chmod u+s /usr/local/bin/snap-plugin-collector-processes
cd $GOPATH/src/github.com/intelsdi-x/snap-plugin-collector-swap
make all
cp build/rootfs/snap-plugin-collector-swap /usr/local/bin
ln -s /usr/local/bin/snap-plugin-collector-swap $AUTO_DISCOVERY_PATH
cd $GOPATH/src/github.com/intelsdi-x/snap-plugin-publisher-heka
make all
cp build/rootfs/snap-plugin-publisher-heka /usr/local/bin
ln -s /usr/local/bin/snap-plugin-publisher-heka $AUTO_DISCOVERY_PATH
# Update some permissions for plugins which require privileged access to filesystem
#
# the processes snap plugin accesses files like /proc/1/io which
# only the root user can read
#
# the smart snap plugin accesses files in /host-proc and /host-dev (/proc and /dev
# from the host) which also requires root user access
#
for f in snap-plugin-collector-processes snap-plugin-collector-smart; do
chmod u+s /usr/local/bin/$f
done
#
# Clean up
@ -164,6 +53,6 @@ ln -s /usr/local/bin/snap-plugin-publisher-heka $AUTO_DISCOVERY_PATH
apt-get purge -y --auto-remove $BUILD_DEPS
apt-get clean
rm -rf /var/lib/apt/lists/*
rm -rf $GOPATH_ORIG
rm -rf $TDIR
exit 0

View File

@ -18,14 +18,14 @@
}
},
"metrics": {
"/intel/procfs/cpu/all/idle_percentage": {},
"/intel/procfs/cpu/all/iowait_percentage": {},
"/intel/procfs/cpu/all/irq_percentage": {},
"/intel/procfs/cpu/all/nice_percentage": {},
"/intel/procfs/cpu/all/softirq_percentage": {},
"/intel/procfs/cpu/all/steal_percentage": {},
"/intel/procfs/cpu/all/system_percentage": {},
"/intel/procfs/cpu/all/user_percentage": {},
"/intel/procfs/cpu/*/idle_percentage": {},
"/intel/procfs/cpu/*/iowait_percentage": {},
"/intel/procfs/cpu/*/irq_percentage": {},
"/intel/procfs/cpu/*/nice_percentage": {},
"/intel/procfs/cpu/*/softirq_percentage": {},
"/intel/procfs/cpu/*/steal_percentage": {},
"/intel/procfs/cpu/*/system_percentage": {},
"/intel/procfs/cpu/*/user_percentage": {},
"/intel/procfs/filesystem/*/inodes_free": {},
"/intel/procfs/filesystem/*/inodes_reserved": {},
"/intel/procfs/filesystem/*/inodes_used": {},