# TODO # Support Building with Oracle or PostgreSQL support Summary: Zabbix - The Ultimate Open Source Monitoring Solution Name: zabbix Version: 1.8.3 Release: 1 License: GPL v2+ Group: Networking/Admin Source0: http://dl.sourceforge.net/zabbix/%{name}-%{version}.tar.gz Patch0: zabbix-centos-log-and-pid-paths.patch URL: http://zabbix.sourceforge.net/ BuildRequires: mysql-devel BuildRequires: net-snmp-devel BuildRequires: openssl-devel >= 0.9.7d BuildRequires: gcc BuildRequires: curl-devel BuildRequires: iksemel-devel # Note: CentOS libssh packages are OLD, download NEWER libssh from... # http://packages.sw.be/libssh2/ BuildRequires: libssh2-devel >= 1.0.0 BuildRequires: OpenIPMI-devel Requires(postun): %{_sbindir}/groupdel Requires(postun): %{_sbindir}/userdel Requires(pre): /usr/sbin/groupadd Requires(pre): /usr/sbin/useradd Provides: group(zabbix) Provides: user(zabbix) BuildRoot: %{_tmppath}/%{name}-%{version}-root # Our pre-defined config variables # This is where our configuration files will go, generally /etc/zabbix %define _sysconfdir /etc/%{name} # This is where our "shared" files should go, generally in /usr/share/zabbix %define _appdir %{_datadir}/%{name} # This is where we will install the front-end PHP gui %define _webrootdir /var/www/html/%{name}-%{version} %description zabbix is software that monitors numerous parameters of a network and the servers on that network. It is a useful tool for monitoring the health and integrity of servers. zabbix uses a flexible notification mechanism that allows users to configure email based alerts for virtually any event. All monitored parameters are stored in a database. zabbix offers excellent reporting and data visualisation features based on the stored data. zabbix supports both polling and trapping. All zabbix reports and statistics, as well as configuration parameters, are accessed through a web-based front end. %package agent Summary: Standalone agent for zabbix Group: Networking/Admin Requires: %{name} = %{version} Requires: openssl-devel >= 0.9.7d %description agent This package provides the zabbix agent %package frontend-php Summary: PHP frontend for zabbix Group: Networking/Admin Requires: php >= 5.2.0 Requires: php-gd Requires: webserver Requires: php-xml %description frontend-php This package provides web based (PHP) frontend for zabbix. %package get Summary: Program retrieving data from the zabbix agentd daemon Group: Networking/Admin %description get This package provides a program retrieving data from zabbix agentd daemon. %package sender Summary: Zabbix sender Group: Networking/Admin %description sender This package provides the zabbix sender. %package server Summary: Zabbix server Group: Networking/Admin Requires: %{name} = %{version} %description server This package provides the zabbix server. %package proxy Summary: Program used as a proxy between zabbix servers and agents Group: Networking/Admin Requires: %{name} = %{version} %description proxy This package provides a program that acts as a proxy between zabbix servers and agents, to assist in passing through firewalls and NAT %prep %setup -q %patch0 # Here is our zabbix-proxy init script, for CentOS %{__cat} << 'EOF' > zabbix-proxy.initscript #!/bin/sh # # chkconfig: - 86 14 # description: ZABBIX proxy # processname: zabbix_proxy # config: /etc/zabbix/zabbix_proxy.conf # ### BEGIN INIT INFO # Provides: zabbix-proxy # Required-Start: $local_fs $network # Required-Stop: $local_fs $network # Should-Start: zabbix # Should-Stop: zabbix # Default-Start: # Default-Stop: 0 1 2 3 4 5 6 # Short-Description: Start and stop ZABBIX proxy # Description: ZABBIX proxy ### END INIT INFO # Source function library. . /etc/rc.d/init.d/functions exec=/usr/sbin/zabbix_proxy prog=${exec##*/} lockfile=/var/lock/subsys/zabbix-agent start() { echo -n $"Starting ZABBIX proxy: " daemon $exec rv=$? echo [ $rv -eq 0 ] && touch $lockfile return $rv } stop() { echo -n $"Shutting down ZABBIX proxy: " killproc $prog rv=$? echo [ $rv -eq 0 ] && rm -f $lockfile return $rv } restart() { stop start } case "$1" in start|stop|restart) $1 ;; force-reload) restart ;; status) status $prog ;; try-restart|condrestart) if status $prog >/dev/null ; then restart fi ;; reload) action $"Service ${0##*/} does not support the reload action: " /bin/false exit 3 ;; *) echo $"Usage: $0 {start|stop|status|restart|try-restart|force-reload}" exit 2 ;; esac EOF # Here is our zabbix-agent init script, for CentOS %{__cat} <<'EOF' > zabbix-agentd.initscript #!/bin/sh # # chkconfig: - 86 14 # description: ZABBIX agent daemon # processname: zabbix_agentd # config: /etc/zabbix/zabbix_agentd.conf # ### BEGIN INIT INFO # Provides: zabbix-agent # Required-Start: $local_fs $network # Required-Stop: $local_fs $network # Should-Start: zabbix zabbix-proxy # Should-Stop: zabbix zabbix-proxy # Default-Start: # Default-Stop: 0 1 2 3 4 5 6 # Short-Description: Start and stop ZABBIX agent # Description: ZABBIX agent ### END INIT INFO # Source function library. . /etc/rc.d/init.d/functions exec=/usr/sbin/zabbix_agentd prog=${exec##*/} lockfile=/var/lock/subsys/zabbix-agent start() { echo -n $"Starting ZABBIX agent: " daemon $exec rv=$? echo [ $rv -eq 0 ] && touch $lockfile return $rv } stop() { echo -n $"Shutting down ZABBIX agent: " killproc $prog rv=$? echo [ $rv -eq 0 ] && rm -f $lockfile return $rv } restart() { stop start } case "$1" in start|stop|restart) $1 ;; force-reload) restart ;; status) status $prog ;; try-restart|condrestart) if status $prog >/dev/null ; then restart fi ;; reload) action $"Service ${0##*/} does not support the reload action: " /bin/false exit 3 ;; *) echo $"Usage: $0 {start|stop|status|restart|try-restart|force-reload}" exit 2 ;; esac EOF # Here is our zabbix-server init script, for CentOS %{__cat} <<'EOF' > zabbix-server.initscript #!/bin/sh # # chkconfig: - 85 15 # description: ZABBIX server daemon # config: /etc/zabbix/zabbix_server.conf # ### BEGIN INIT INFO # Provides: zabbix # Required-Start: $local_fs $network # Required-Stop: $local_fs $network # Default-Start: # Default-Stop: 0 1 2 3 4 5 6 # Short-Description: Start and stop ZABBIX server # Description: ZABBIX server ### END INIT INFO # Source function library. . /etc/rc.d/init.d/functions exec=zabbix_server prog=${exec##*/} lockfile=/var/lock/subsys/zabbix start() { echo -n $"Starting ZABBIX server: " daemon $exec rv=$? echo [ $rv -eq 0 ] && touch $lockfile return $rv } stop() { echo -n $"Shutting down ZABBIX server: " killproc $prog rv=$? echo [ $rv -eq 0 ] && rm -f $lockfile return $rv } restart() { stop start } case "$1" in start|stop|restart) $1 ;; force-reload) restart ;; status) status $prog ;; try-restart|condrestart) if status $prog >/dev/null ; then restart fi ;; reload) action $"Service ${0##*/} does not support the reload action: " /bin/false exit 3 ;; *) echo $"Usage: $0 {start|stop|status|restart|try-restart|force-reload}" exit 2 ;; esac EOF %build %configure \ --with-openipmi \ --with-jabber \ --with-mysql \ --with-libcurl \ --enable-server \ --enable-proxy \ --enable-agent \ --with-net-snmp \ --with-jabber \ --with-ssh2 \ --prefix=%{_sysconfdir}/%{name} \ --exec-prefix=%{_prefix} \ --bindir=%{_bindir} \ --sbindir=%{_sbindir} \ --mandir=%{_mandir} \ --libdir=%{_libdir} \ --sysconfdir=%{_sysconfdir}/%{name} \ %{__make} %install rm -rf $RPM_BUILD_ROOT install -d $RPM_BUILD_ROOT{%{_sysconfdir},/etc/sysconfig/rc-inetd,%{_appdir},%{_webrootdir}} install -D -m0755 zabbix-proxy.initscript $RPM_BUILD_ROOT/etc/init.d/zabbix-proxy install -D -m0755 zabbix-agentd.initscript $RPM_BUILD_ROOT/etc/init.d/zabbix-agentd install -D -m0755 zabbix-server.initscript $RPM_BUILD_ROOT/etc/init.d/zabbix-server mkdir -p $RPM_BUILD_ROOT/var/log/zabbix %{__make} install \ DESTDIR=$RPM_BUILD_ROOT install misc/conf/zabbix_{a*,s*,p*} $RPM_BUILD_ROOT%{_sysconfdir} cp -r frontends/php/* $RPM_BUILD_ROOT%{_webrootdir} %clean rm -rf $RPM_BUILD_ROOT %pre user_check="`grep zabbix /etc/passwd | wc -l`" group_check="`grep zabbix /etc/group | wc -l`" if [[ $user_check -eq 0 ]]; then groupadd zabbix fi if [[ $group_check -eq 0 ]]; then useradd -d %{_appdir} -g zabbix -c "Zabbix User" -s /bin/false zabbix fi %post %postun userdel --force zabbix 2> /dev/null; true %files %defattr(644,root,root,755) %doc AUTHORS NEWS README ChangeLog %attr(750,zabbix,zabbix) %dir %{_sysconfdir} %files agent %defattr(644,root,root,755) %attr(750,zabbix,zabbix) %dir /var/log/zabbix %attr(640,zabbix,zabbix) %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/zabbix_agentd.conf %attr(640,zabbix,zabbix) %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/zabbix_agent.conf %attr(640,zabbix,zabbix) %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/zabbix_agentd.win.conf %attr(755,root,root) /etc/init.d/zabbix-agentd %attr(755,root,root) %{_sbindir}/zabbix_agentd %attr(755,root,root) %{_sbindir}/zabbix_agent %{_mandir}/man8/zabbix_agentd.8* %files frontend-php %defattr(644,root,root,755) %attr(775,apache,apache) %{_webrootdir} %files get %defattr(644,root,root,755) %attr(755,root,root) %{_bindir}/zabbix_get %{_mandir}/man1/zabbix_get.1* %files sender %defattr(644,root,root,755) %attr(755,root,root) %{_bindir}/zabbix_sender %{_mandir}/man1/zabbix_sender.1* %files server %defattr(644,root,root,755) %attr(750,zabbix,zabbix) %dir /var/log/zabbix %attr(644,root,root) %doc create upgrades %attr(755,root,root) /etc/init.d/zabbix-server %attr(640,zabbix,zabbix) %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/zabbix_server.conf %attr(755,root,root) %{_sbindir}/zabbix_server %{_mandir}/man8/zabbix_server.8* %files proxy %defattr(644,root,root,755) %attr(755,root,root) %{_sbindir}/zabbix_proxy %attr(755,root,root) /etc/init.d/zabbix-proxy %attr(640,zabbix,zabbix) %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/zabbix_proxy.conf %attr(640,zabbix,zabbix) %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/zabbix_proxy.conf.orig %{_mandir}/man8/zabbix_proxy.8* %changelog * Tue Aug 17 2010 Initial Commit * Andrew Farley Revision 1.0 2010/08/17 00:00:00 Andrew Farley - Complete RPM Spec file for Zabbix 1.8.3 for CentOS 5.5