summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBritney Fransen <brfransen@gmail.com>2023-04-11 03:06:21 (GMT)
committerBritney Fransen <brfransen@gmail.com>2023-04-11 03:06:21 (GMT)
commit27c42e54adc59fd935a3b94c9196195890a8c634 (patch)
tree7e8b12a92fcaac7531cf6bf48d18ab1293eff20b
parent2974e636424ba21eb481b011ce6f70fd8e2c8731 (diff)
downloadlinhes_pkgbuild-27c42e54adc59fd935a3b94c9196195890a8c634.zip
linhes_pkgbuild-27c42e54adc59fd935a3b94c9196195890a8c634.tar.gz
linhes_pkgbuild-27c42e54adc59fd935a3b94c9196195890a8c634.tar.bz2
zabbix: initial include
-rw-r--r--linhes/zabbix/PKGBUILD212
-rw-r--r--linhes/zabbix/zabbix-agent.service11
-rw-r--r--linhes/zabbix/zabbix-agent.sysusers1
-rw-r--r--linhes/zabbix/zabbix-agent.tmpfiles1
-rw-r--r--linhes/zabbix/zabbix-agent2.service11
-rw-r--r--linhes/zabbix/zabbix-proxy-mysql.service18
-rw-r--r--linhes/zabbix/zabbix-proxy.sysusers1
-rw-r--r--linhes/zabbix/zabbix-proxy.tmpfiles1
-rw-r--r--linhes/zabbix/zabbix-server-mysql.service19
-rw-r--r--linhes/zabbix/zabbix-server.sysusers1
-rw-r--r--linhes/zabbix/zabbix-server.tmpfiles1
11 files changed, 277 insertions, 0 deletions
diff --git a/linhes/zabbix/PKGBUILD b/linhes/zabbix/PKGBUILD
new file mode 100644
index 0000000..e06a32a
--- /dev/null
+++ b/linhes/zabbix/PKGBUILD
@@ -0,0 +1,212 @@
+# Maintainer: Bartłomiej Piotrowski <bpiotrowski@archlinux.org>
+# Maintainer: Florian Pritz <bluewind@xinu.at>
+
+pkgbase=zabbix
+pkgname=(zabbix-server zabbix-agent{,2} zabbix-proxy zabbix-frontend-php)
+pkgver=6.4.1
+pkgrel=2
+arch=(x86_64)
+url='https://www.zabbix.com/'
+license=(GPL)
+makedepends=(libxml2 unixodbc net-snmp mariadb-libs libldap libevent go pkgconfig)
+source=("https://cdn.zabbix.com/zabbix/sources/stable/${pkgver%.*}/zabbix-${pkgver}.tar.gz"
+ zabbix-agent.{service,sysusers,tmpfiles}
+ zabbix-agent2.service
+ zabbix-server-mysql.service zabbix-server.{sysusers,tmpfiles}
+ zabbix-proxy-mysql.service zabbix-proxy.{sysusers,tmpfiles})
+
+sha512sums=('4f82cdbf527b34e3689b280e8a0405faa1d9066a6288b273ac50f3b3008c0a6b8fcc325b760de4204dbf52a1301d7e59eadbe74a3f7a5fc3e26d6eb2f7a5c17f'
+ '8c1fa2676bc0ef91bc39ec5f97b4d3ba5c365d063420455a3785121a54e120bc5afeacde42a48f4509c115f940dcc3b6c2f43044a7fbfb421182fc93b22a2444'
+ '3ab3ac1acc7e35c8896157aef601ebc30815237ac5252cbd0c1ecb26eeaf9eccf5c49938ae8c85bb79a6f95f607f082f6b80ed660829599ec03aa626cca6d3dc'
+ 'ca6b4779de23829dfdd80ee21e924fbe4e2754f4e693bed4b1a2aa846cd87d150e399b1169d7fe58d30c50ed837c1b8254e580de420267d0a1834d6dc409c43d'
+ 'c57dfcc13b290f4120d1185339bd2d6b1ea7a2ca0c98dca8632d4fd8fe462a42cb35e8a88895eb8ee390c55cf0ffb90b544f23fefbf059b49c06e5373d0b8af2'
+ '87a24b2616d5d55511147b9157e9f0038ba963322b25d8723587f0cceb56eb87a6630a8eda39caf268bd4fe88892a37c9664d528811b3299b7689006656fb578'
+ '4254d3b13ff0d19a8e207f709c10ea59dbb6d4f333d862b1611a0fa4ced199e9a32313e88d8abadc129c1e4001b182c0545bcc84117d218116a8c524de88850e'
+ 'b6d548a26f845ef1a39724e3273aa521715272e20a0038144f86d377a26dfec6e3e129404cfda77632cad2f5cd6bab4a33f70a26c8c67b0d0b2abb3678ad2d83'
+ '94701f34fe5df4859c6a4d0459c16062374e8f89f4f51c414e71c9c2db14f61e087721e68dddb3e8d88bf1c097477c1a21e27ba4705fd07d88c60adb41acc1be'
+ '7c1072a8cd5837095f857b50124cb45d1bdbddbce108f6f067a35c3c9ebb1ad0502ef617dfa10f9c843631220177a6286a97b1c2a46539200be72fa83cb23b99'
+ '64042ddf511b56b2a5a311e34643f4e049c09d909ea65b7343a8a9637f33dc59f2b1342201290ca0774cbcbf616096b3696982047fb622b7d51afb5eceb298dd')
+
+prepare() {
+ cd $pkgbase-$pkgver
+ sed -i \
+ -e '/^LogFile=.*/d' \
+ -e 's/# LogType=file/LogType=system/' \
+ conf/zabbix_{agentd,proxy,server}.conf
+
+ autoreconf -fi
+}
+
+build() {
+ export GOPATH="$srcdir"/go
+ export AGENT_LDFLAGS="${LDFLAGS}"
+
+ _configure_flags=(
+ --disable-static
+ --prefix=/usr
+ --infodir=/usr/share/info
+ --mandir=/usr/share/man
+ --sysconfdir=/etc/zabbix
+ --enable-agent
+ --enable-agent2
+ --enable-ipv6
+ --with-ldap
+ --with-libcurl
+ --with-libxml2
+ --with-net-snmp
+ --with-openssl
+ --with-ssh2
+ --with-unixodbc
+ )
+
+ cd $pkgbase-$pkgver
+
+ # Make copies since `make clean` removes the files and they cannot be rebuilt easily
+ for db in mysql; do
+ mkdir -p ../copies/database/$db
+ cp database/$db/*.sql ../copies/database/$db/
+ done
+
+ for db in mysql; do
+ ./configure ${_configure_flags[@]} --enable-server --with-$db
+ make clean
+ make
+ mv src/zabbix_server/zabbix_server{,_$db}
+ done
+
+ for db in mysql; do
+ ./configure ${_configure_flags[@]} --enable-proxy --with-$db
+ make clean
+ make
+ mv src/zabbix_proxy/zabbix_proxy{,_$db}
+ done
+}
+
+package_zabbix-server() {
+ pkgdesc='Monitoring software for networks and applications'
+ depends=(net-snmp curl libxml2 unixodbc libldap libevent pcre)
+ optdepends=('mariadb-libs: for MariaDB support')
+ backup=(etc/zabbix/zabbix_server.conf)
+
+ cd $pkgbase-$pkgver
+
+ for db in mysql; do
+ install -Dm755 src/zabbix_server/zabbix_server_$db \
+ "$pkgdir/usr/bin/zabbix_server_$db"
+
+ install -d "$pkgdir/usr/share/$pkgname/$db"
+ install -m644 ../copies/database/$db/*.sql -t "$pkgdir/usr/share/$pkgname/$db"
+ done
+ install -Dm755 src/zabbix_get/zabbix_get "$pkgdir/usr/bin/zabbix_get"
+
+ install -Dm644 man/zabbix_server.man "$pkgdir/usr/share/man/man8/zabbix_server.8"
+ install -Dm644 man/zabbix_get.man "$pkgdir/usr/share/man/man1/zabbix_get.1"
+
+ install -Dm644 conf/zabbix_server.conf "$pkgdir/etc/zabbix/zabbix_server.conf"
+ chown 170:170 "$pkgdir/etc/zabbix/zabbix_server.conf"
+
+ install -Dm644 "$srcdir/zabbix-server-mysql.service" \
+ "$pkgdir/usr/lib/systemd/system/zabbix-server-mysql.service"
+
+ install -Dm644 "$srcdir/zabbix-server.sysusers" \
+ "$pkgdir/usr/lib/sysusers.d/zabbix-server.conf"
+ install -Dm644 "$srcdir/zabbix-server.tmpfiles" \
+ "$pkgdir/usr/lib/tmpfiles.d/zabbix-server.conf"
+
+ # Fix socket paths to avoid 10 day cleanup in /tmp
+ echo "d /run/$pkgname 750 $pkgname $pkgname" >> "$pkgdir/usr/lib/tmpfiles.d/$pkgname.conf"
+ sed -i \
+ -e "s/# SocketDir=\/tmp/SocketDir=\/run\/$pkgname/" \
+ "$pkgdir/etc/zabbix/"*.conf
+}
+
+package_zabbix-agent() {
+ pkgdesc='Monitoring agent for Zabbix'
+ depends=(curl pcre)
+ backup=(etc/zabbix/zabbix_agentd.conf)
+
+ cd $pkgbase-$pkgver
+ install -Dm755 src/zabbix_agent/zabbix_agentd "$pkgdir/usr/bin/zabbix_agentd"
+ install -Dm755 src/zabbix_sender/zabbix_sender "$pkgdir/usr/bin/zabbix_sender"
+
+ install -Dm644 conf/zabbix_agentd.conf "$pkgdir/etc/zabbix/zabbix_agentd.conf"
+ chown 172:172 "$pkgdir/etc/zabbix/zabbix_agentd.conf"
+
+ install -Dm644 conf/zabbix_agentd/userparameter_examples.conf \
+ "$pkgdir/usr/share/zabbix-agent/userparameter_examples.conf"
+ install -Dm644 conf/zabbix_agentd/userparameter_mysql.conf \
+ "$pkgdir/usr/share/zabbix-agent/userparameter_mysql.conf"
+
+ install -Dm644 man/zabbix_agentd.man \
+ "$pkgdir/usr/share/man/man8/zabbix_agentd.8"
+ install -Dm644 man/zabbix_sender.man \
+ "$pkgdir/usr/share/man/man1/zabbix_sender.1"
+
+ install -Dm644 "$srcdir/zabbix-agent.service" \
+ "$pkgdir/usr/lib/systemd/system/zabbix-agent.service"
+ install -Dm644 "$srcdir/zabbix-agent.sysusers" \
+ "$pkgdir/usr/lib/sysusers.d/zabbix-agent.conf"
+ install -Dm644 "$srcdir/zabbix-agent.tmpfiles" \
+ "$pkgdir/usr/lib/tmpfiles.d/zabbix-agent.conf"
+}
+
+package_zabbix-agent2() {
+ pkgdesc='Experimental monitoring agent for Zabbix (Agent 2)'
+ depends=(zabbix-agent)
+ backup=(etc/zabbix/zabbix_agent2.conf)
+
+ cd $pkgbase-$pkgver
+ install -Dm755 src/go/bin/zabbix_agent2 "$pkgdir/usr/bin/zabbix_agent2"
+ install -Dm644 src/go/conf/zabbix_agent2.conf "$pkgdir/etc/zabbix/zabbix_agent2.conf"
+ chown 172:172 "$pkgdir/etc/zabbix/zabbix_agent2.conf"
+ mkdir -p "$pkgdir/etc/zabbix/zabbix_agent2.d/plugins.d/"
+ chown 172:172 "$pkgdir/etc/zabbix/zabbix_agent2.d/plugins.d/"
+
+ install -Dm644 man/zabbix_agent2.man \
+ "$pkgdir/usr/share/man/man8/zabbix_agent2.8"
+
+ install -Dm644 "$srcdir/zabbix-agent2.service" \
+ "$pkgdir/usr/lib/systemd/system/zabbix-agent2.service"
+}
+
+package_zabbix-proxy() {
+ pkgdesc='Data collecting proxy for Zabbix'
+ depends=(net-snmp curl libxml2 sqlite unixodbc libldap pcre libevent)
+ optdepends=('mariadb-libs: for MariaDB support')
+ backup=(etc/zabbix/zabbix_proxy.conf)
+
+ cd $pkgbase-$pkgver
+ for db in mysql; do
+ install -Dm755 src/zabbix_proxy/zabbix_proxy_$db \
+ "$pkgdir/usr/bin/zabbix_proxy_$db"
+
+ install -d "$pkgdir/usr/share/$pkgname/$db"
+ install -m644 ../copies/database/$db/schema.sql -t "$pkgdir/usr/share/$pkgname/$db"
+ done
+ install -Dm644 conf/zabbix_proxy.conf "$pkgdir/etc/zabbix/zabbix_proxy.conf"
+ chown 171:171 "$pkgdir/etc/zabbix/zabbix_proxy.conf"
+
+ install -Dm644 "$srcdir/zabbix-proxy-mysql.service" \
+ "$pkgdir/usr/lib/systemd/system/zabbix-proxy-mysql.service"
+
+ install -Dm644 "$srcdir/zabbix-proxy.sysusers" \
+ "$pkgdir/usr/lib/sysusers.d/zabbix-proxy.conf"
+ install -Dm644 "$srcdir/zabbix-proxy.tmpfiles" \
+ "$pkgdir/usr/lib/tmpfiles.d/zabbix-proxy.conf"
+
+ # Fix socket paths to avoid 10 day cleanup in /tmp
+ echo "d /run/$pkgname 750 $pkgname $pkgname" >> "$pkgdir/usr/lib/tmpfiles.d/$pkgname.conf"
+ sed -i \
+ -e "s/# SocketDir=\/tmp/SocketDir=\/run\/$pkgname/" \
+ "$pkgdir/etc/zabbix/"*.conf
+}
+
+package_zabbix-frontend-php() {
+ pkgdesc='PHP frontend for Zabbix'
+ depends=(zabbix-server php php-gd)
+
+ cd $pkgbase-$pkgver
+ install -d "$pkgdir/usr/share/webapps/zabbix"
+ cp -a ui/* "$pkgdir/usr/share/webapps/zabbix"
+ chown 33:33 ${pkgdir}/usr/share/webapps/zabbix/conf/ # write access for http user
+}
diff --git a/linhes/zabbix/zabbix-agent.service b/linhes/zabbix/zabbix-agent.service
new file mode 100644
index 0000000..98fb499
--- /dev/null
+++ b/linhes/zabbix/zabbix-agent.service
@@ -0,0 +1,11 @@
+[Unit]
+Description=Zabbix Agent
+After=network.target
+
+[Service]
+Type=simple
+ExecStart=/usr/bin/zabbix_agentd -f
+User=zabbix-agent
+
+[Install]
+WantedBy=multi-user.target
diff --git a/linhes/zabbix/zabbix-agent.sysusers b/linhes/zabbix/zabbix-agent.sysusers
new file mode 100644
index 0000000..1e46401
--- /dev/null
+++ b/linhes/zabbix/zabbix-agent.sysusers
@@ -0,0 +1 @@
+u zabbix-agent 172 - /var/lib/zabbix-agent
diff --git a/linhes/zabbix/zabbix-agent.tmpfiles b/linhes/zabbix/zabbix-agent.tmpfiles
new file mode 100644
index 0000000..ffacad7
--- /dev/null
+++ b/linhes/zabbix/zabbix-agent.tmpfiles
@@ -0,0 +1 @@
+d /var/lib/zabbix-agent 0750 zabbix-agent zabbix-agent -
diff --git a/linhes/zabbix/zabbix-agent2.service b/linhes/zabbix/zabbix-agent2.service
new file mode 100644
index 0000000..02e340b
--- /dev/null
+++ b/linhes/zabbix/zabbix-agent2.service
@@ -0,0 +1,11 @@
+[Unit]
+Description=Zabbix Agent 2
+After=network.target
+
+[Service]
+Type=simple
+ExecStart=/usr/bin/zabbix_agent2
+User=zabbix-agent
+
+[Install]
+WantedBy=multi-user.target
diff --git a/linhes/zabbix/zabbix-proxy-mysql.service b/linhes/zabbix/zabbix-proxy-mysql.service
new file mode 100644
index 0000000..16b9c7f
--- /dev/null
+++ b/linhes/zabbix/zabbix-proxy-mysql.service
@@ -0,0 +1,18 @@
+[Unit]
+Description=Zabbix proxy with MySQL
+After=network.target mysql.service
+Conflicts=zabbix-proxy.service zabbix-proxy-pgsql.service
+
+[Service]
+Type=simple
+ExecStart=/usr/bin/zabbix_proxy_mysql -f
+User=zabbix-proxy
+PrivateDevices=yes
+PrivateTmp=yes
+ProtectSystem=full
+ProtectHome=yes
+CapabilityBoundingSet=cap_net_raw
+AmbientCapabilities=cap_net_raw
+
+[Install]
+WantedBy=multi-user.target
diff --git a/linhes/zabbix/zabbix-proxy.sysusers b/linhes/zabbix/zabbix-proxy.sysusers
new file mode 100644
index 0000000..f02825c
--- /dev/null
+++ b/linhes/zabbix/zabbix-proxy.sysusers
@@ -0,0 +1 @@
+u zabbix-proxy 171 - /var/lib/zabbix-proxy
diff --git a/linhes/zabbix/zabbix-proxy.tmpfiles b/linhes/zabbix/zabbix-proxy.tmpfiles
new file mode 100644
index 0000000..2b4100b
--- /dev/null
+++ b/linhes/zabbix/zabbix-proxy.tmpfiles
@@ -0,0 +1 @@
+d /var/lib/zabbix-proxy 0750 zabbix-proxy zabbix-proxy -
diff --git a/linhes/zabbix/zabbix-server-mysql.service b/linhes/zabbix/zabbix-server-mysql.service
new file mode 100644
index 0000000..26e96cf
--- /dev/null
+++ b/linhes/zabbix/zabbix-server-mysql.service
@@ -0,0 +1,19 @@
+
+[Unit]
+Description=Zabbix Server with MySQL
+After=network.target mysql.service
+Conflicts=zabbix-server.service zabbix-server-pgsql.service
+
+[Service]
+Type=simple
+ExecStart=/usr/bin/zabbix_server_mysql -f
+User=zabbix-server
+PrivateDevices=yes
+PrivateTmp=yes
+ProtectSystem=full
+ProtectHome=yes
+CapabilityBoundingSet=cap_net_raw
+AmbientCapabilities=cap_net_raw
+
+[Install]
+WantedBy=multi-user.target
diff --git a/linhes/zabbix/zabbix-server.sysusers b/linhes/zabbix/zabbix-server.sysusers
new file mode 100644
index 0000000..82bb6dc
--- /dev/null
+++ b/linhes/zabbix/zabbix-server.sysusers
@@ -0,0 +1 @@
+u zabbix-server 170 - /var/lib/zabbix-server
diff --git a/linhes/zabbix/zabbix-server.tmpfiles b/linhes/zabbix/zabbix-server.tmpfiles
new file mode 100644
index 0000000..c278a2f
--- /dev/null
+++ b/linhes/zabbix/zabbix-server.tmpfiles
@@ -0,0 +1 @@
+d /var/lib/zabbix-server 0750 zabbix-server zabbix-server -