summarylogtreecommitdiffstats
diff options
context:
space:
mode:
authorshulhan2020-12-01 12:09:30 +0000
committershulhan2020-12-01 12:11:39 +0000
commit5bbde580dea9175abe4cec4d9b5144524abdeca1 (patch)
treecf55b229e74edfaa13db0d99589bf56beb1a726f
downloadaur-5bbde580dea9175abe4cec4d9b5144524abdeca1.tar.gz
stackdriver-collectd: new package for v6.1.0
This is the Stackdriver's monitoring agent based on collectd for monitoring VMs on GCP.
-rw-r--r--.INSTALL10
-rw-r--r--.SRCINFO35
-rw-r--r--.gitignore4
-rw-r--r--Makefile15
-rw-r--r--PKGBUILD74
-rw-r--r--collectd.conf119
-rw-r--r--stackdriver-collectd.service12
-rw-r--r--stackdriver-collectd.sh1
8 files changed, 270 insertions, 0 deletions
diff --git a/.INSTALL b/.INSTALL
new file mode 100644
index 000000000000..890c2992d4b0
--- /dev/null
+++ b/.INSTALL
@@ -0,0 +1,10 @@
+pre_upgrade() {
+ echo ">>> Restarting collectd service ..."
+ systemctl restart stackdriver-collectd.service
+}
+
+pre_remove() {
+ echo ">>> Stopping collectd service ..."
+ systemctl stop stackdriver-collectd.service
+ systemctl disable stackdriver-collectd.service
+}
diff --git a/.SRCINFO b/.SRCINFO
new file mode 100644
index 000000000000..1a1a598b7738
--- /dev/null
+++ b/.SRCINFO
@@ -0,0 +1,35 @@
+pkgbase = stackdriver-collectd
+ pkgdesc = Stackdriver's monitoring agent based on collectd
+ pkgver = 6.1.0
+ pkgrel = 1
+ url = https://github.com/Stackdriver/collectd
+ arch = x86_64
+ license = MIT
+ makedepends = autoconf
+ makedepends = automake
+ makedepends = bison
+ makedepends = flex
+ makedepends = gcc
+ makedepends = libtool
+ makedepends = pkg-config
+ depends = curl
+ depends = iptables
+ depends = libxml2
+ depends = lua
+ depends = systemd-libs
+ depends = yajl
+ optdepends = mariadb-libs
+ provides = stackdriver-collectd
+ conflicts = collectd
+ backup = etc/collectd.conf
+ source = stackdriver-collectd-v6.1.0.tar.gz::https://github.com/Stackdriver/collectd/archive/6.1.0.tar.gz
+ source = collectd.conf
+ source = stackdriver-collectd.service
+ source = stackdriver-collectd.sh
+ md5sums = fef6db9b22153903ed98d4c888ccc35a
+ md5sums = 7a2c4528d4ff161d7ac665daedc5fb3c
+ md5sums = 251922321b6d566c8f1750402e4cfd21
+ md5sums = e4da9e61c35f6d74d3d76a02eb441ff2
+
+pkgname = stackdriver-collectd
+
diff --git a/.gitignore b/.gitignore
new file mode 100644
index 000000000000..4a595dcdcc28
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,4 @@
+*.tar.gz
+*.zst
+pkg/
+src/
diff --git a/Makefile b/Makefile
new file mode 100644
index 000000000000..664060f6d125
--- /dev/null
+++ b/Makefile
@@ -0,0 +1,15 @@
+.PHONY: all check gensign release
+
+all:
+ makepkg -f
+
+check:
+ namcap PKGBUILD
+ namcap *.zst
+
+geninteg:
+ makepkg --geninteg
+
+release:
+ makepkg --printsrcinfo > .SRCINFO
+ git add PKGBUILD .SRCINFO
diff --git a/PKGBUILD b/PKGBUILD
new file mode 100644
index 000000000000..e51aa81e0933
--- /dev/null
+++ b/PKGBUILD
@@ -0,0 +1,74 @@
+# Maintainer: shulhan <ms@kilabit.info>
+
+pkgname=stackdriver-collectd
+pkgver=6.1.0
+pkgrel=1
+
+pkgdesc="Stackdriver's monitoring agent based on collectd"
+arch=(x86_64)
+url='https://github.com/Stackdriver/collectd'
+license=('MIT')
+groups=()
+
+depends=(
+ 'curl'
+ 'iptables'
+ 'libxml2'
+ 'lua'
+ 'systemd-libs'
+ 'yajl'
+)
+makedepends=(
+ 'autoconf'
+ 'automake'
+ 'bison'
+ 'flex'
+ 'gcc'
+ 'libtool'
+ 'pkg-config'
+)
+optdepends=(
+ 'mariadb-libs'
+)
+
+provides=('stackdriver-collectd')
+conflicts=('collectd')
+
+backup=('etc/collectd.conf')
+source=(
+ "${pkgname}-v${pkgver}.tar.gz::https://github.com/Stackdriver/collectd/archive/${pkgver}.tar.gz"
+ "collectd.conf"
+ "stackdriver-collectd.service"
+ "stackdriver-collectd.sh"
+)
+md5sums=('fef6db9b22153903ed98d4c888ccc35a'
+ '7a2c4528d4ff161d7ac665daedc5fb3c'
+ '251922321b6d566c8f1750402e4cfd21'
+ 'e4da9e61c35f6d74d3d76a02eb441ff2')
+
+prepare() {
+ cd collectd-${pkgver}
+ ./build.sh
+}
+
+build() {
+ cd collectd-${pkgver}
+ ./configure
+ make
+}
+
+package() {
+ cd collectd-${pkgver}
+
+ # install binaries and libraries
+ make DESTDIR="${pkgdir}/" install
+
+ # install license file and documentation
+ cd "${srcdir}/collectd-${pkgver}"
+ install -Dm 644 COPYING -t "${pkgdir}/usr/share/licenses/${pkgname}/"
+
+ cd ${srcdir}
+ install -Dm 644 collectd.conf -t "${pkgdir}/opt/collectd/etc/"
+ install -Dm 644 stackdriver-collectd.service -t "${pkgdir}/usr/lib/systemd/system/"
+ install -Dm 644 stackdriver-collectd.sh -t "${pkgdir}/etc/profile.d/"
+}
diff --git a/collectd.conf b/collectd.conf
new file mode 100644
index 000000000000..f826e52e39df
--- /dev/null
+++ b/collectd.conf
@@ -0,0 +1,119 @@
+Interval 60
+
+# Explicitly set hostname to "" to indicate the default resource.
+Hostname ""
+
+# The Stackdriver agent does not use fully qualified domain names.
+FQDNLookup false
+
+WriteThreads 1
+
+LoadPlugin syslog
+<Plugin "syslog">
+ LogLevel "warning"
+</Plugin>
+
+# if you uncomment this, you will get collectd logs separate from syslog
+#LoadPlugin logfile
+#<Plugin "logfile">
+# LogLevel "info"
+# File "/var/log/collectd.log"
+# Timestamp true
+#</Plugin>
+
+LoadPlugin df
+<Plugin "df">
+ FSType "devfs"
+ IgnoreSelected true
+ ReportByDevice true
+ ValuesPercentage true
+</Plugin>
+
+LoadPlugin cpu
+<Plugin "cpu">
+ ValuesPercentage true
+ ReportByCpu false
+</Plugin>
+
+LoadPlugin swap
+<Plugin "swap">
+ ValuesPercentage true
+</Plugin>
+
+LoadPlugin interface
+LoadPlugin disk
+LoadPlugin load
+
+LoadPlugin memory
+<Plugin "memory">
+ ValuesPercentage true
+</Plugin>
+LoadPlugin processes
+LoadPlugin tcpconns
+LoadPlugin write_gcm
+LoadPlugin match_regex
+LoadPlugin match_throttle_metadata_keys
+LoadPlugin stackdriver_agent
+
+<Plugin "processes">
+ ProcessMatch "all" ".*"
+ Detail "ps_cputime"
+ Detail "ps_disk_octets"
+ Detail "ps_rss"
+ Detail "ps_vm"
+</Plugin>
+
+<Plugin "disk">
+ # No config - collectd fails parsing configuration if tag is empty.
+</Plugin>
+
+<Plugin "tcpconns">
+ AllPortsSummary true
+</Plugin>
+
+LoadPlugin aggregation
+
+<Plugin "write_gcm">
+ PrettyPrintJSON false
+ # EnableMetadataAgent true
+</Plugin>
+
+PostCacheChain "PostCache"
+<Chain "PostCache">
+ <Rule "processes">
+ <Match "regex">
+ Plugin "^processes$"
+ Type "^(ps_cputime|disk_octets|ps_rss|ps_vm)$"
+ </Match>
+ <Target "jump">
+ Chain "MaybeThrottleProcesses"
+ </Target>
+ Target "stop"
+ </Rule>
+
+ <Rule "otherwise">
+ <Match "throttle_metadata_keys">
+ OKToThrottle false
+ HighWaterMark 5700000000 # 950M * 6
+ LowWaterMark 4800000000 # 800M * 6
+ </Match>
+ <Target "write">
+ Plugin "write_gcm"
+ </Target>
+ </Rule>
+</Chain>
+
+<Chain "MaybeThrottleProcesses">
+ <Rule "default">
+ <Match "throttle_metadata_keys">
+ OKToThrottle true
+ TrackedMetadata "processes:pid"
+ TrackedMetadata "processes:command"
+ TrackedMetadata "processes:command_line"
+ TrackedMetadata "processes:owner"
+ </Match>
+ <Target "write">
+ Plugin "write_gcm"
+ </Target>
+ </Rule>
+</Chain>
diff --git a/stackdriver-collectd.service b/stackdriver-collectd.service
new file mode 100644
index 000000000000..9aa935b590b4
--- /dev/null
+++ b/stackdriver-collectd.service
@@ -0,0 +1,12 @@
+[Unit]
+Description=Stackdriver collectd agent
+After=syslog.target network.target
+
+[Service]
+Type=forking
+ExecStart=/opt/collectd/sbin/collectd
+PIDFile=/opt/collectd/var/run/collectd.pid
+Restart=on-failure
+
+[Install]
+WantedBy=multi-user.target
diff --git a/stackdriver-collectd.sh b/stackdriver-collectd.sh
new file mode 100644
index 000000000000..98b346715a86
--- /dev/null
+++ b/stackdriver-collectd.sh
@@ -0,0 +1 @@
+export PATH=/opt/collectd/bin:/opt/collectd/sbin:${PATH}