%define _disable_ld_as_needed 1 %define _requires_exceptions pear Name: zabbix Version: 2.0.4 Release: %mkrel 2 Summary: Open-source monitoring solution for your IT infrastructure Group: Networking/Other License: GPLv2+ URL: http://www.zabbix.com Source0: http://freefr.dl.sourceforge.net/project/%{name}/ZABBIX%20Latest%20Stable/%{version}/%{name}-%{version}.tar.gz Source1: zabbix-web.conf Source2: zabbix-server.init Source3: zabbix-agent.init Source4: zabbix-logrotate.in %define database %{nil} %define zdb %{nil} %define with_postgresql %{?_with_postgresql: 1} %{?!_with_postgresql: 0} #define with_mysql %{?_with_mysql: 1} %{?!_with_mysql: 0} %define with_mysql %{?_without_mysql: 0} %{?!_without_mysql: 1} # Zabbix can only be built with mysql -or- postgresql # support. We build with mysql by default, but you can # pass --with postgresql to build with postgresql instead. %if %{with_postgresql} %define database postgresql %define zdb pgsql %endif %if %{with_mysql} %define database mysql %define zdb mysql %endif #if %{?database:1}%{!?database:0} %if %{with_mysql} || %{with_postgresql} BuildRequires: %{database}-devel %endif BuildRequires: net-snmp-devel BuildRequires: openldap-devel, gnutls-devel BuildRequires: libiksemel-devel BuildRequires: libtasn1-devel BuildRequires: curl-devel BuildRequires: libssh2-devel BuildRequires: openipmi-devel Requires: logrotate, fping Requires(pre): rpm-helper Requires(post): rpm-helper Requires(preun): rpm-helper %description Zabbix is the ultimate open source availability and performance monitoring solution. Zabbix offers advanced monitoring, alerting, and visualization features today which are missing in other monitoring systems, even some of the best commercial ones. %package agent Summary: Zabbix Agent Group: Networking/Other Requires: logrotate Requires(pre): rpm-helper Requires(post): rpm-helper Requires(preun): rpm-helper %description agent The zabbix client agent, to be installed on monitored systems. %package web Summary: Zabbix Web Frontend Group: Networking/Other Requires: apache-mod_php Requires: php-bcmath Requires: php-mbstring Requires: php-gd Requires: php-sockets Requires: php-xml, php-xmlreader, php-xmlwriter Requires: php-ctype Requires: php-session Requires: php-gettext Requires: php-%{zdb} %description web The php frontend to display the zabbix web interface. %prep %setup -q perl -pi -e 's/ -static//g' configure # fix up some lib64 issues %{__perl} -pi.orig -e 's|_LIBDIR=/usr/lib|_LIBDIR=%{_libdir}|g' \ configure # fix up pt_br %{__chmod} a-x frontends/php/include/locales/pt_br.inc.php ||: %{__sed} -i 's/\r//' frontends/php/include/locales/pt_br.inc.php ||: %build %configure \ --enable-server \ --enable-agent \ --with-net-snmp \ --with-openipmi \ --with-ldap \ --with-libcurl \ --with-ssh2 \ --with-jabber \ --enable-ipv6 \ --enable-static=no \ %if %{with_mysql} --with-mysql %endif %if %{with_postgresql} --with-%{zdb} %endif %if !%{with_mysql} && !%{with_postgresql} --with-sqlite3 %endif #--disable-static #--with-mysql \ #--with-mysql=%{_libdir}/mysql/mysql_config \ #--with-mysql=%{_bindir}/mysql_config # --disable-static is partially broken atm, # -static still gets into CFLAGS, so fix up in make # (and even then, .a files still show their face...) #find . -name Makefile -exec perl -pi -e 's/ -static//g' {} \; %make #make %{?_smp_mflags} CFLAGS="$RPM_OPT_FLAGS" %install # set up some required directories mkdir -p %{buildroot}%{_sysconfdir}/%{name} mkdir -p %{buildroot}%{_sysconfdir}/init.d mkdir -p %{buildroot}%{_sysconfdir}/logrotate.d mkdir -p %{buildroot}%{_sysconfdir}/httpd/conf.d mkdir -p %{buildroot}%{_datadir}/%{name}/schema mkdir -p %{buildroot}%{_datadir}/%{name}/web mkdir -p %{buildroot}%{_localstatedir}/log/%{name} mkdir -p %{buildroot}%{_localstatedir}/run/%{name} # php frontend cp -a frontends/php/* %{buildroot}%{_datadir}/%{name}/web mv %{buildroot}%{_datadir}/%{name}/web/include/db.inc.php \ %{buildroot}%{_sysconfdir}/%{name}/ ln -s ../../../..%{_sysconfdir}/%{name}/db.inc.php \ %{buildroot}%{_datadir}/%{name}/web/include/db.inc.php # kill off .htaccess files, options set in SOURCE1 rm -f %{buildroot}%{_datadir}/%{name}/web/include/.htaccess rm -f %{buildroot}%{_datadir}/%{name}/web/include/classes/.htaccess # drop config files in place install -m 0644 conf/%{name}_agent.conf %{buildroot}%{_sysconfdir}/%{name} cat conf/%{name}_agentd.conf | sed \ -e 's|PidFile=.*|PidFile=%{_localstatedir}/run/%{name}/%{name}_agentd.pid|g' \ -e 's|LogFile=.*|LogFile=%{_localstatedir}/log/%{name}/%{name}_agentd.log|g' \ > %{buildroot}%{_sysconfdir}/%{name}/%{name}_agentd.conf cat conf/zabbix_server.conf | sed \ -e 's|PidFile=.*|PidFile=%{_localstatedir}/run/%{name}/%{name}.pid|g' \ -e 's|LogFile=.*|LogFile=%{_localstatedir}/log/%{name}/%{name}_server.log|g' \ -e 's|AlertScriptsPath=/home/%{name}/bin/|AlertScriptsPath=%{_localstatedir}/lib/%{name}/|g' \ -e 's|DBUser=root|DBUser=%{name}|g' \ -e 's|DBSocket=/tmp/mysql.sock|DBSocket=%{_localstatedir}/lib/%{zdb}/%{zdb}.sock|g' \ -e 's|FpingLocation=/usr/sbin/fping|FpingLocation=/bin/fping|g' \ > %{buildroot}%{_sysconfdir}/%{name}/%{name}_server.conf install -m 0644 %{SOURCE1} %{buildroot}%{_sysconfdir}/httpd/conf.d/%{name}.conf # log rotation cat %{SOURCE4} | sed -e 's|COMPONENT|server|g' > \ %{buildroot}%{_sysconfdir}/logrotate.d/%{name} cat %{SOURCE4} | sed -e 's|COMPONENT|agentd|g' > \ %{buildroot}%{_sysconfdir}/logrotate.d/%{name}-agent # init scripts install -m 0755 %{SOURCE2} %{buildroot}%{_sysconfdir}/init.d/%{name} install -m 0755 %{SOURCE3} %{buildroot}%{_sysconfdir}/init.d/%{name}-agent # database schemata cp -a database %{buildroot}/%{_datadir}/%{name}/schema cp -a upgrades %{buildroot}/%{_datadir}/%{name}/schema rm -f %{buildroot}/%{_datadir}/%{name}/schema/*/Makefile* %makeinstall_std rm -f %{buildroot}%{_sysconfdir}/%{name}*.conf rm -rf %{buildroot}%{_libdir}/libzbx*.a %pre # Add the "zabbix" user /usr/sbin/useradd -c "Zabbix Monitoring System" \ -s /sbin/nologin -r -d %{_localstatedir}/lib/%{name} %{name} 2> /dev/null || : %pre agent # Add the "zabbix" user /usr/sbin/useradd -c "Zabbix Monitoring System" \ -s /sbin/nologin -r -d %{_localstatedir}/lib/%{name} %{name} 2> /dev/null || : %post /sbin/chkconfig --add %{name} %post agent /sbin/chkconfig --add %{name}-agent %preun if [ "$1" = 0 ] then /sbin/service %{name} stop >/dev/null 2>&1 || : /sbin/chkconfig --del %{name} fi %preun agent if [ "$1" = 0 ] then /sbin/service %{name}-agent stop >/dev/null 2>&1 || : /sbin/chkconfig --del %{name}-agent fi %clean %files %doc AUTHORS ChangeLog COPYING INSTALL NEWS README %{_datadir}/%{name}/schema %dir %{_sysconfdir}/%{name} %{_sbindir}/%{name}_server %{_sysconfdir}/init.d/%{name} %{_mandir}/man8/%{name}_server.8* %config(noreplace) %{_sysconfdir}/logrotate.d/zabbix %config(noreplace) %{_sysconfdir}/%{name}/%{name}_server.conf %attr(0755,%{name},%{name}) %dir %{_localstatedir}/log/%{name} %attr(0755,%{name},%{name}) %dir %{_localstatedir}/run/%{name} %files agent %doc AUTHORS ChangeLog COPYING INSTALL NEWS README %dir %{_sysconfdir}/%{name} %{_bindir}/%{name}_sender %{_bindir}/%{name}_get %{_sbindir}/%{name}_agent %{_sbindir}/%{name}_agentd %{_mandir}/man1/%{name}_sender.1* %{_mandir}/man1/%{name}_get.1* %{_mandir}/man8/%{name}_agentd.8* %{_sysconfdir}/init.d/%{name}-agent %config(noreplace) %{_sysconfdir}/logrotate.d/%{name}-agent %config(noreplace) %{_sysconfdir}/%{name}/%{name}_agent.conf %config(noreplace) %{_sysconfdir}/%{name}/%{name}_agentd.conf %attr(0755,%{name},%{name}) %dir %{_localstatedir}/log/%{name} %attr(0755,%{name},%{name}) %dir %{_localstatedir}/run/%{name} %files web %doc README %dir %{_sysconfdir}/%{name} %config(noreplace) %{_sysconfdir}/%{name}/db.inc.php %config(noreplace) %{_sysconfdir}/httpd/conf.d/%{name}.conf %{_datadir}/%{name}/web