aboutsummaryrefslogtreecommitdiff
path: root/Tools
diff options
context:
space:
mode:
authorKris Kennaway <kris@FreeBSD.org>2008-07-26 15:09:00 +0000
committerKris Kennaway <kris@FreeBSD.org>2008-07-26 15:09:00 +0000
commit9ed197c29c3236c0932e448db8be9dde2d016061 (patch)
treea486d16d7cb1ec773851a353ee2c0759e617aaf1 /Tools
parent4663e0b500fac5b8bc8a79476e2e226162dc76cb (diff)
downloadports-9ed197c29c3236c0932e448db8be9dde2d016061.tar.gz
ports-9ed197c29c3236c0932e448db8be9dde2d016061.zip
Notes
Diffstat (limited to 'Tools')
-rwxr-xr-xTools/portbuild/scripts/client-metrics35
1 files changed, 35 insertions, 0 deletions
diff --git a/Tools/portbuild/scripts/client-metrics b/Tools/portbuild/scripts/client-metrics
new file mode 100755
index 000000000000..34867a312e49
--- /dev/null
+++ b/Tools/portbuild/scripts/client-metrics
@@ -0,0 +1,35 @@
+#!/bin/sh
+
+# Collect metrics for ganglia:
+# - current vnodes
+# - max vnodes
+# - number of packages built in the past hour
+
+pb=/var/portbuild
+
+arch=$(uname -m)
+me=$(hostname)
+
+export PATH=/sbin:/bin:/usr/sbin:/usr/bin:/usr/local/sbin:/usr/local/bin
+
+gmetric --name="maxvnodes" --value=`sysctl -n kern.maxvnodes` --tmax=120 --dmax=0 --type=uint32 --units="# vnodes"
+gmetric --name="vnodes" --value=`sysctl -n vfs.numvnodes` --tmax=120 --dmax=0 --type=uint32 --units="# vnodes"
+
+if [ -f ${pb}/${arch}/portbuild.conf -a -f ${pb}/${arch}/portbuild.${me} ]; then
+ . ${pb}/${arch}/portbuild.conf
+ . ${pb}/${arch}/portbuild.${me}
+else
+ exit 1
+fi
+
+if [ ! -d ${scratchdir}/stamp ]; then
+ exit 1
+fi
+
+cd ${scratchdir}/stamp || exit 1
+
+new=$(find . -mmin -60 | wc -l)
+new=$((${new} + 0))
+find . \! -mmin -60 -delete
+
+gmetric --name="packages" --value="${new}" --tmax=120 --dmax=0 --type=int16 --units="Packages/hour" --conf="/usr/local/etc/gmond.conf"