]> TLD Linux GIT Repositories - packages/zabbix.git/commitdiff
- build and package PostgreSQL plugin for Agent 2 master
authorMarcin Krol <hawk@tld-linux.org>
Sun, 25 Jan 2026 11:53:28 +0000 (12:53 +0100)
committerMarcin Krol <hawk@tld-linux.org>
Sun, 25 Jan 2026 11:53:28 +0000 (12:53 +0100)
agent2-postgresql-plugin-go.patch [new file with mode: 0644]
agent2-postgresql-plugin-path.patch [new file with mode: 0644]
zabbix.spec

diff --git a/agent2-postgresql-plugin-go.patch b/agent2-postgresql-plugin-go.patch
new file mode 100644 (file)
index 0000000..596517f
--- /dev/null
@@ -0,0 +1,11 @@
+--- Makefile.orig      2025-12-16 20:10:27.000000000 +0100
++++ Makefile   2026-01-25 11:50:10.059188773 +0100
+@@ -89,7 +89,7 @@
+       set GOARCH=$(GOARCH)
+       go build -o "$(TOPDIR)/$(PACKAGE)"
+ else
+-      GOOS="$(GOOS)" GOARCH="$(GOARCH)" go build -o "$(TOPDIR)/$(PACKAGE)"
++      GOOS="$(GOOS)" GOARCH="$(GOARCH)" go build -mod=vendor -o "$(TOPDIR)/$(PACKAGE)"
+ endif
+ clean:
diff --git a/agent2-postgresql-plugin-path.patch b/agent2-postgresql-plugin-path.patch
new file mode 100644 (file)
index 0000000..cf4c8b9
--- /dev/null
@@ -0,0 +1,11 @@
+--- postgresql.conf.orig       2025-12-16 20:10:27.000000000 +0100
++++ postgresql.conf    2026-01-25 01:41:36.102872972 +0100
+@@ -5,6 +5,8 @@
+ # Default:
+ # Plugins.PostgreSQL.System.Path=
++Plugins.PostgreSQL.System.Path=/usr/libexec/zabbix-agent2/postgresql
++
+ ### Option: Plugins.PostgreSQL.CallTimeout
+ #     The maximum time in seconds for waiting when a request has to be done.
+ #   Global item-type timeout (or individual item timeout) will override this value if it is greater.
index 8609bc46e666931819d287fced8289bcd2c7b44c..a93f02545f9390616aa23ff1d998182a0873c2b5 100644 (file)
@@ -25,22 +25,26 @@ Summary:    Zabbix - network monitoring software
 Summary(pl.UTF-8):     Zabbix - oprogramowanie do monitorowania sieci
 Name:          zabbix
 Version:       7.0.22
-Release:       1
+Release:       2
 License:       GPL v2+
 Group:         Networking/Utilities
 Source0:       https://cdn.zabbix.com/zabbix/sources/stable/7.0/%{name}-%{version}.tar.gz
 # Source0-md5: 42f8eedcc9ee2d36e57dc4715126d276
-Source1:       %{name}-apache.conf
-Source2:       %{name}_agentd.init
-Source3:       %{name}_server.init
-Source4:       %{name}_proxy.init
-Source5:       %{name}_agent2.init
-Source6:       %{name}_agent2.sysconfig
+Source1:       https://cdn.zabbix.com/zabbix-agent2-plugins/sources/postgresql/zabbix-agent2-plugin-postgresql-%{version}.tar.gz
+# Source1-md5: e7fcc78f22e93a6900f37c074ce4eb20
+Source2:       %{name}-apache.conf
+Source3:       %{name}_agentd.init
+Source4:       %{name}_server.init
+Source5:       %{name}_proxy.init
+Source6:       %{name}_agent2.init
+Source7:       %{name}_agent2.sysconfig
 Patch0:                tld.patch
 Patch1:                sqlite3_dbname.patch
 Patch2:                always_compile_ipc.patch
 Patch3:                agent2.patch
 Patch4:                go.patch
+Patch5:                agent2-postgresql-plugin-path.patch
+Patch6:                agent2-postgresql-plugin-go.patch
 URL:           https://www.zabbix.com/
 BuildRequires: OpenIPMI-devel
 BuildRequires: autoconf
@@ -130,6 +134,18 @@ Zabbix agent collects data from the local system for a Zabbix server.
 %description agent2 -l pl.UTF-8
 Agent zbiera dane z lokalnej maszyny dla serwera Zabbix.
 
+%package agent2-plugin-postgresql
+Summary:       Zabbix Agent 2 - PostgreSQL plugin
+Summary(pl.UTF-8):     Agent 2 Zabbixa - wtyczka PostgreSQL
+Group:         Networking/Utilities
+Requires:      %{name}-agent2 = %{version}-%{release}
+
+%description agent2-plugin-postgresql
+Zabbix Agent2 - plugin for monitoring of PostgreSQL databases.
+
+%description agent2-plugin-postgresql -l pl.UTF-8
+Wtyczka Zabbix Agent2 do monitorowania baz danych PostgreSQL.
+
 %package web
 Summary:       Web frontend for Zabbix
 Summary(pl.UTF-8):     Interfejs Web dla Zabbixa
@@ -276,7 +292,7 @@ Requires:   %{name} = %{version}-%{release}
 This package provides the Zabbix Java Gateway.
 
 %prep
-%setup -q
+%setup -q -a1
 
 %patch -P0 -p1
 %patch -P1 -p1
@@ -284,6 +300,10 @@ This package provides the Zabbix Java Gateway.
 %patch -P3 -p1
 %patch -P4 -p1
 
+cd zabbix-agent2-plugin-postgresql-%{version}
+%patch -P5 -p0
+%patch -P6 -p0
+
 %build
 %{__libtoolize}
 %{__aclocal} -I m4
@@ -342,10 +362,13 @@ for database in %{databases} ; do
                DESTDIR=$PWD/install-${database}
 done
 
+cd zabbix-agent2-plugin-postgresql-%{version}
+%{__make}
+
 %install
 rm -rf $RPM_BUILD_ROOT
 install -d $RPM_BUILD_ROOT{%{_sysconfdir}/zabbix_agent2.conf.d,/etc/{rc.d/init.d,sysconfig},/etc/webapps/%{_webapp},%{_appdir}} \
-       $RPM_BUILD_ROOT{/var/run/zabbix,/var/log/zabbix}
+       $RPM_BUILD_ROOT{%{_libexecdir}/zabbix-agent2,/var/run/zabbix,/var/log/zabbix}
 
 %{__make} install \
        DESTDIR=$RPM_BUILD_ROOT \
@@ -365,16 +388,19 @@ if [ -n "$database" ] ; then
        ln -sf %{_sbindir}/zabbix_proxy-$database $RPM_BUILD_ROOT%{_sbindir}/zabbix_proxy
 fi
 
+cp zabbix-agent2-plugin-postgresql-%{version}/zabbix-agent2-plugin-postgresql $RPM_BUILD_ROOT%{_libexecdir}/zabbix-agent2/postgresql
+cp zabbix-agent2-plugin-postgresql-%{version}/postgresql.conf $RPM_BUILD_ROOT%{_sysconfdir}/zabbix_agent2.d/plugins.d/
+
 cp -r ui $RPM_BUILD_ROOT%{_appdir}
 
-cp -p %{SOURCE1} $RPM_BUILD_ROOT%{_webapps}/%{_webapp}/apache.conf
-cp -p %{SOURCE1} $RPM_BUILD_ROOT%{_webapps}/%{_webapp}/httpd.conf
+cp -p %{SOURCE2} $RPM_BUILD_ROOT%{_webapps}/%{_webapp}/apache.conf
+cp -p %{SOURCE2} $RPM_BUILD_ROOT%{_webapps}/%{_webapp}/httpd.conf
 
-install        %{SOURCE2} $RPM_BUILD_ROOT/etc/rc.d/init.d/zabbix_agentd
-install        %{SOURCE3} $RPM_BUILD_ROOT/etc/rc.d/init.d/zabbix_server
-install        %{SOURCE4} $RPM_BUILD_ROOT/etc/rc.d/init.d/zabbix_proxy
-install        %{SOURCE5} $RPM_BUILD_ROOT/etc/rc.d/init.d/zabbix_agent2
-install %{SOURCE6} $RPM_BUILD_ROOT/etc/sysconfig/zabbix_agent2
+install        %{SOURCE3} $RPM_BUILD_ROOT/etc/rc.d/init.d/zabbix_agentd
+install        %{SOURCE4} $RPM_BUILD_ROOT/etc/rc.d/init.d/zabbix_server
+install        %{SOURCE5} $RPM_BUILD_ROOT/etc/rc.d/init.d/zabbix_proxy
+install        %{SOURCE6} $RPM_BUILD_ROOT/etc/rc.d/init.d/zabbix_agent2
+install %{SOURCE7} $RPM_BUILD_ROOT/etc/sysconfig/zabbix_agent2
 
 mv $RPM_BUILD_ROOT%{_appdir}/ui/conf $RPM_BUILD_ROOT%{_sysconfdir}/web
 ln -s %{_sysconfdir}/web $RPM_BUILD_ROOT%{_appdir}/ui/conf
@@ -555,6 +581,10 @@ fi
 %{_mandir}/man8/zabbix_agent2*
 %endif
 
+%files agent2-plugin-postgresql
+%attr(640,root,zabbix) %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/zabbix_agent2.d/plugins.d/postgresql.conf
+%attr(755,root,root) %{_libexecdir}/zabbix-agent2/postgresql
+
 %files web
 %defattr(644,root,root,755)
 %attr(750,root,http) %dir %{_webapps}/%{_webapp}