Commit eaafb687 authored by Kevin Daudt's avatar Kevin Daudt 💻
Browse files

community/zabbix: enable zabbix-agent2

This is a new agent written in go.

A patch is necessary to build for ppc64le and s390x. x86 is not working
yet, so the agent is not there.
parent f29c859c
Pipeline #1612 passed with stages
in 22 minutes and 49 seconds
......@@ -4,7 +4,7 @@
# Maintainer: Natanael Copa <ncopa@alpinelinux.org>
pkgname=zabbix
pkgver=4.4.0
pkgrel=1
pkgrel=2
pkgdesc="Enterprise-class open source distributed monitoring"
url="http://www.zabbix.com"
arch="all"
......@@ -29,16 +29,29 @@ source="https://downloads.sourceforge.net/$pkgname/$pkgname-$pkgver.tar.gz
zabbix-server.initd
zabbix-server.confd
zabbix-agentd.initd
zabbix-agent2.initd
zabbix-proxy.initd
zabbix-getloadavg.patch
automake.patch
musl-fix-includes.patch
zabbix_server.conf.patch
zabbix_agent2.conf.patch
zabbix_agent2-uname-linux.patch
"
builddir="$srcdir"/$pkgname-$pkgver
# Agent2 does not build on x86 atm
case $CARCH in
x86)
_build_agent2=false;;
*)
subpackages="$subpackages $pkgname-agent2 $pkgname-agent2-openrc:agent2_openrc"
makedepends="$makedepends go"
_build_agent2=true;;
esac
# security fixes:
# 3.0.4-r0:
# - CVE N/A ZBX-11023
......@@ -73,6 +86,12 @@ build() {
--with-ssh2 \
--with-gnutls
"
if $_build_agent2; then
_configure="$_configure --enable-agent2"
fi
export GOPATH="$builddir"
# pass --export-dynamic to the linker
# to make zabbix loadable modules work
LDFLAGS="$LDFLAGS -Wl,--export-dynamic"
......@@ -106,7 +125,13 @@ build() {
package() {
# doing manual install
for i in agentd proxy server; do
components="agentd proxy server";
if $_build_agent2; then
msg2 "Packaging agen2"
components="$components agent2"
fi
for i in $components; do
install -D -m755 "$builddir"/man/zabbix_$i.man \
"$pkgdir"/usr/share/man/man8/zabbix_$i.8
done
......@@ -201,12 +226,39 @@ agent_openrc() {
"$subpkgdir"/etc/init.d/zabbix-agentd
}
agent2() {
pkgdesc="Zabbix Network Monitoring Agent (version 2)"
depends=
install="$subpkgname.pre-install"
install -d -m0750 -o zabbix -g zabbix \
"$subpkgdir"/var/run/zabbix "$subpkgdir"/var/log/zabbix
mkdir -p "$subpkgdir"/usr/sbin
cp "$builddir-postgresql"/go/src/zabbix/cmd/zabbix_agent2/zabbix_agent2 \
"$subpkgdir"/usr/sbin
install -D -m0644 "$builddir"/go/src/zabbix/conf/zabbix_agent2.conf \
"$subpkgdir"/etc/zabbix/zabbix_agent2.conf
}
agent2_openrc() {
pkgdesc="Zabbix Network Monitoring Agent 2 (OpenRC init scripts)"
depends=openrc
install_if="openrc $pkgname-agent2=$pkgver-r$pkgrel"
install -D -m0755 "$srcdir"/zabbix-agent2.initd \
"$subpkgdir"/etc/init.d/zabbix-agent2
}
sha512sums="021e7454decb885065417f6f6a0ecc8a9d4f184f68da6ab4efea68280b3a0c0641eab05620ce14016b6e57ce32c44075e53b45f03e764e8726c00bfdd6039406 zabbix-4.4.0.tar.gz
9998ee172a28002d98bacc3f76038ff52b8cf2b206e101418d76b4ca3de94afaf92cb4f7a6235ecf177f74beb9dd3ea1f3983c4f164b4f60bb601acba65aa175 zabbix-server.initd
9c06527bf653c40585fa7eeb3f7a0b2fc454031d24cd0d1633aed87b78a681c5227a193c5b9fcfcea0839135874e27ba7dd9b198573f905f680a2856f79e9512 zabbix-server.confd
0d50795233ee469e36e9788f8685b16207a37f8a9370e6591688906176e7cb8387ce06f132d7e582a1757fdea7c584a70ccfac39a604da315d71121fa629cbb7 zabbix-agentd.initd
fad1bbe50ae42e02b73bcae8f7d91c7e18fb387eba551f9216c844c298003290aaec3bc17239590210cc100d6f39e25a5bba539e99df605de9a98abf5418be66 zabbix-agent2.initd
a26e7ac422ff60a4b8eed3603022c3a1bde640870bb9286ab061c3cb5c2fd7e91ddb317cb3d1cf61034adda0a080fc212ad416c9e2853a1deb03c5279753f4e2 zabbix-proxy.initd
9fc413b11a01c8202c7ee1c7950d6ca3de2d2d6cd01bea994cd4bc412533b53c4e4b1f58fc3c8df16ea70902053e278e2c5dcc936ce3e0a686a6eac62310ef53 zabbix-getloadavg.patch
7f70dfd602aa164ec8cc65ebb7e8274c685975f6aea9051933928051b8d9b6e368e5a673a07e7084a2105468c5085d72fa7b9f934460f10648d594f28f031a91 automake.patch
72709df7624d99b2eaab8d91d95167580e80da10b3ac65b7f27f12d858f0d051d4f9143bcabceae2bfd51aeb7c4ca93e2b74670637ec0925b026e3c52475d52b musl-fix-includes.patch
183e2d99800d8eebb932cb31c5a3e8742ce6a15e87aec50dc49d9c20b35840eb7ede9920aa62d2c7a5e3f584f5c3df398aa08e93f98fa537a3ba6db63b472a1f zabbix_server.conf.patch"
183e2d99800d8eebb932cb31c5a3e8742ce6a15e87aec50dc49d9c20b35840eb7ede9920aa62d2c7a5e3f584f5c3df398aa08e93f98fa537a3ba6db63b472a1f zabbix_server.conf.patch
4478e52d044d6cd888084d2cdfc77883ae7c90f3494b52a511445776a2a851d6bc25ed7d7a196e35b826ba10b3dcca2f762adc7c52727b07254d02aaa04d319b zabbix_agent2.conf.patch
e04fc508ab91effea43b0f631051dd8f63b219d72002e39117b58af286bd6f451702f84a7a1083d7dab6fa294725b390e2f515ca1432a241a321a763570f5d1a zabbix_agent2-uname-linux.patch"
#!/sbin/openrc-run
command=/usr/sbin/zabbix_agent2
supervisor="supervise-daemon"
pre_start() {
checkpath --directory --owner zabbix:zabbix /var/log/zabbix
}
zabbix-agent.pre-install
\ No newline at end of file
diff --git a/go/src/zabbix/plugins/system/uname/uname_int8.go b/go/src/zabbix/plugins/system/uname/uname_int8.go
new file mode 100644
index 0000000..5bad4ca
--- /dev/null
+++ b/go/src/zabbix/plugins/system/uname/uname_int8.go
@@ -0,0 +1,15 @@
+// +build linux,386 linux,amd64 linux,arm64
+
+package uname
+
+func arrayToString(unameArray *[65]int8) string {
+ var byteString [65]byte
+ var indexLength int
+ for ; indexLength < len(unameArray); indexLength++ {
+ if 0 == unameArray[indexLength] {
+ break
+ }
+ byteString[indexLength] = uint8(unameArray[indexLength])
+ }
+ return string(byteString[:indexLength])
+}
diff --git a/go/src/zabbix/plugins/system/uname/uname_linux.go b/go/src/zabbix/plugins/system/uname/uname_linux.go
index 874569f..6dac18b 100644
--- a/go/src/zabbix/plugins/system/uname/uname_linux.go
+++ b/go/src/zabbix/plugins/system/uname/uname_linux.go
@@ -24,18 +24,6 @@ import (
"syscall"
)
-func arrayToString(unameArray *[65]int8) string {
- var byteString [65]byte
- var indexLength int
- for ; indexLength < len(unameArray); indexLength++ {
- if 0 == unameArray[indexLength] {
- break
- }
- byteString[indexLength] = uint8(unameArray[indexLength])
- }
- return string(byteString[:indexLength])
-}
-
func getUname() (uname string, err error) {
var utsname syscall.Utsname
if err = syscall.Uname(&utsname); err != nil {
diff --git a/go/src/zabbix/plugins/system/uname/uname_uint8.go b/go/src/zabbix/plugins/system/uname/uname_uint8.go
new file mode 100644
index 0000000..893d6c5
--- /dev/null
+++ b/go/src/zabbix/plugins/system/uname/uname_uint8.go
@@ -0,0 +1,15 @@
+// +build linux,arm linux,ppc64le linux,s390x
+
+package uname
+
+func arrayToString(unameArray *[65]uint8) string {
+ var byteString [65]byte
+ var indexLength int
+ for ; indexLength < len(unameArray); indexLength++ {
+ if 0 == unameArray[indexLength] {
+ break
+ }
+ byteString[indexLength] = uint8(unameArray[indexLength])
+ }
+ return string(byteString[:indexLength])
+}
diff --git a/go/src/zabbix/conf/zabbix_agent2.conf b/go/src/zabbix/conf/zabbix_agent2.conf
index c635f2069d..d75b925d72 100644
--- a/go/src/zabbix/conf/zabbix_agent2.conf
+++ b/go/src/zabbix/conf/zabbix_agent2.conf
@@ -27,7 +27,7 @@
# Default:
# LogFile=
-LogFile=/tmp/zabbix_agentd.log
+LogFile=/var/log/zabbix/zabbix_agent2.log
### Option: LogFileSize
# Maximum size of log file in MB.
@@ -142,7 +142,7 @@ ServerActive=127.0.0.1
# Default:
# Hostname=
-Hostname=Zabbix server
+# Hostname=Zabbix server
### Option: HostnameItem
# Item used for generating Hostname if it is undefined. Ignored if Hostname is defined.
@@ -150,7 +150,7 @@ Hostname=Zabbix server
#
# Mandatory: no
# Default:
-# HostnameItem=system.hostname
+HostnameItem=system.hostname
### Option: HostMetadata
# Optional parameter that defines host metadata.
@@ -276,7 +276,7 @@ Hostname=Zabbix server
# Default:
# ControlSocket=
-ControlSocket=/tmp/agent.sock
+ControlSocket=/run/zabbix/zabbix_agent2.sock
####### TLS-RELATED PARAMETERS #######
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment