1 |
%define _disable_ld_as_needed 1 |
2 |
%define _requires_exceptions pear |
3 |
|
4 |
Name: zabbix |
5 |
Version: 1.8.11 |
6 |
Release: %mkrel 1 |
7 |
Summary: Open-source monitoring solution for your IT infrastructure |
8 |
Group: Networking/Other |
9 |
License: GPLv2+ |
10 |
URL: http://www.zabbix.com |
11 |
Source0: http://downloads.sourceforge.net/%{name}/%{name}-%{version}.tar.gz |
12 |
Source1: zabbix-web.conf |
13 |
Source2: zabbix-server.init |
14 |
Source3: zabbix-agent.init |
15 |
Source4: zabbix-logrotate.in |
16 |
|
17 |
%define database %{nil} |
18 |
%define zdb %{nil} |
19 |
%define with_postgresql %{?_with_postgresql: 1} %{?!_with_postgresql: 0} |
20 |
#define with_mysql %{?_with_mysql: 1} %{?!_with_mysql: 0} |
21 |
%define with_mysql %{?_without_mysql: 0} %{?!_without_mysql: 1} |
22 |
|
23 |
# Zabbix can only be built with mysql -or- postgresql |
24 |
# support. We build with mysql by default, but you can |
25 |
# pass --with postgresql to build with postgresql instead. |
26 |
%if %{with_postgresql} |
27 |
%define database postgresql |
28 |
%define zdb pgsql |
29 |
%endif |
30 |
%if %{with_mysql} |
31 |
%define database mysql |
32 |
%define zdb mysql |
33 |
%endif |
34 |
|
35 |
#if %{?database:1}%{!?database:0} |
36 |
%if %{with_mysql} || %{with_postgresql} |
37 |
BuildRequires: %{database}-devel |
38 |
%endif |
39 |
BuildRequires: net-snmp-devel |
40 |
BuildRequires: openldap-devel, gnutls-devel |
41 |
BuildRequires: libiksemel-devel |
42 |
BuildRequires: libtasn1-devel |
43 |
BuildRequires: curl-devel |
44 |
Requires: logrotate, fping |
45 |
Requires(pre): rpm-helper |
46 |
Requires(post): rpm-helper |
47 |
Requires(preun): rpm-helper |
48 |
|
49 |
%description |
50 |
ZABBIX is software that monitors numerous parameters of a |
51 |
network and the health and integrity of servers. ZABBIX |
52 |
uses a flexible notification mechanism that allows users |
53 |
to configure e-mail based alerts for virtually any event. |
54 |
This allows a fast reaction to server problems. ZABBIX |
55 |
offers excellent reporting and data visualisation features |
56 |
based on the stored data. This makes ZABBIX ideal for |
57 |
capacity planning. |
58 |
|
59 |
ZABBIX supports both polling and trapping. All ZABBIX |
60 |
reports and statistics, as well as configuration |
61 |
parameters are accessed through a web-based front end. A |
62 |
web-based front end ensures that the status of your network |
63 |
and the health of your servers can be assessed from any |
64 |
location. Properly configured, ZABBIX can play an important |
65 |
role in monitoring IT infrastructure. This is equally true |
66 |
for small organisations with a few servers and for large |
67 |
companies with a multitude of servers. |
68 |
|
69 |
|
70 |
%package agent |
71 |
Summary: Zabbix Agent |
72 |
Group: Networking/Other |
73 |
Requires: logrotate |
74 |
Requires(pre): rpm-helper |
75 |
Requires(post): rpm-helper |
76 |
Requires(preun): rpm-helper |
77 |
|
78 |
%description agent |
79 |
The zabbix client agent, to be installed on monitored systems. |
80 |
|
81 |
%package web |
82 |
Summary: Zabbix Web Frontend |
83 |
Group: Networking/Other |
84 |
Requires: php-%{zdb}, php-gd, apache-mod_php, php-bcmath php-sockets |
85 |
|
86 |
%description web |
87 |
The php frontend to display the zabbix web interface. |
88 |
|
89 |
%prep |
90 |
%setup -q |
91 |
perl -pi -e 's/ -static//g' configure |
92 |
|
93 |
# fix up some lib64 issues |
94 |
%{__perl} -pi.orig -e 's|_LIBDIR=/usr/lib|_LIBDIR=%{_libdir}|g' \ |
95 |
configure |
96 |
|
97 |
# fix up pt_br |
98 |
%{__chmod} a-x frontends/php/include/locales/pt_br.inc.php ||: |
99 |
%{__sed} -i 's/\r//' frontends/php/include/locales/pt_br.inc.php ||: |
100 |
|
101 |
%build |
102 |
%configure \ |
103 |
--enable-server \ |
104 |
--enable-agent \ |
105 |
--with-net-snmp \ |
106 |
--with-ldap \ |
107 |
--with-jabber \ |
108 |
--enable-static=no \ |
109 |
%if %{with_mysql} |
110 |
--with-mysql |
111 |
%endif |
112 |
%if %{with_postgresql} |
113 |
--with-%{zdb} |
114 |
%endif |
115 |
%if !%{with_mysql} && !%{with_postgresql} |
116 |
--with-sqlite3 |
117 |
%endif |
118 |
#--disable-static |
119 |
#--with-mysql \ |
120 |
#--with-mysql=%{_libdir}/mysql/mysql_config \ |
121 |
#--with-mysql=%{_bindir}/mysql_config |
122 |
|
123 |
# --disable-static is partially broken atm, |
124 |
# -static still gets into CFLAGS, so fix up in make |
125 |
# (and even then, .a files still show their face...) |
126 |
#find . -name Makefile -exec perl -pi -e 's/ -static//g' {} \; |
127 |
%make |
128 |
#make %{?_smp_mflags} CFLAGS="$RPM_OPT_FLAGS" |
129 |
|
130 |
%install |
131 |
# set up some required directories |
132 |
mkdir -p %{buildroot}%{_sysconfdir}/%{name} |
133 |
mkdir -p %{buildroot}%{_sysconfdir}/init.d |
134 |
mkdir -p %{buildroot}%{_sysconfdir}/logrotate.d |
135 |
mkdir -p %{buildroot}%{_sysconfdir}/httpd/conf.d |
136 |
mkdir -p %{buildroot}%{_datadir} |
137 |
mkdir -p %{buildroot}%{_localstatedir}/log/%{name} |
138 |
mkdir -p %{buildroot}%{_localstatedir}/run/%{name} |
139 |
# php frontend |
140 |
cp -a frontends/php %{buildroot}%{_datadir}/%{name} |
141 |
mv %{buildroot}%{_datadir}/%{name}/include/db.inc.php \ |
142 |
%{buildroot}%{_sysconfdir}/%{name}/ |
143 |
ln -s ../../../..%{_sysconfdir}/%{name}/db.inc.php \ |
144 |
%{buildroot}%{_datadir}/%{name}/include/db.inc.php |
145 |
# kill off .htaccess files, options set in SOURCE1 |
146 |
rm -f %{buildroot}%{_datadir}/%{name}/include/.htaccess |
147 |
rm -f %{buildroot}%{_datadir}/%{name}/include/classes/.htaccess |
148 |
# drop config files in place |
149 |
install -m 0644 misc/conf/%{name}_agent.conf %{buildroot}%{_sysconfdir}/%{name} |
150 |
cat misc/conf/%{name}_agentd.conf | sed \ |
151 |
-e 's|PidFile=.*|PidFile=%{_localstatedir}/run/%{name}/%{name}_agentd.pid|g' \ |
152 |
-e 's|LogFile=.*|LogFile=%{_localstatedir}/log/%{name}/%{name}_agentd.log|g' \ |
153 |
> %{buildroot}%{_sysconfdir}/%{name}/%{name}_agentd.conf |
154 |
cat misc/conf/zabbix_server.conf | sed \ |
155 |
-e 's|PidFile=.*|PidFile=%{_localstatedir}/run/%{name}/%{name}.pid|g' \ |
156 |
-e 's|LogFile=.*|LogFile=%{_localstatedir}/log/%{name}/%{name}_server.log|g' \ |
157 |
-e 's|AlertScriptsPath=/home/%{name}/bin/|AlertScriptsPath=%{_localstatedir}/lib/%{name}/|g' \ |
158 |
-e 's|DBUser=root|DBUser=%{name}|g' \ |
159 |
-e 's|DBSocket=/tmp/mysql.sock|DBSocket=%{_localstatedir}/lib/%{zdb}/%{zdb}.sock|g' \ |
160 |
-e 's|FpingLocation=/usr/sbin/fping|FpingLocation=/bin/fping|g' \ |
161 |
> %{buildroot}%{_sysconfdir}/%{name}/%{name}_server.conf |
162 |
install -m 0644 %{SOURCE1} %{buildroot}%{_sysconfdir}/httpd/conf.d/%{name}.conf |
163 |
# log rotation |
164 |
cat %{SOURCE4} | sed -e 's|COMPONENT|server|g' > \ |
165 |
%{buildroot}%{_sysconfdir}/logrotate.d/%{name} |
166 |
cat %{SOURCE4} | sed -e 's|COMPONENT|agentd|g' > \ |
167 |
%{buildroot}%{_sysconfdir}/logrotate.d/%{name}-agent |
168 |
# init scripts |
169 |
install -m 0755 %{SOURCE2} %{buildroot}%{_sysconfdir}/init.d/%{name} |
170 |
install -m 0755 %{SOURCE3} %{buildroot}%{_sysconfdir}/init.d/%{name}-agent |
171 |
|
172 |
%makeinstall_std |
173 |
rm -rf %{buildroot}%{_libdir}/libzbx*.a |
174 |
|
175 |
%pre |
176 |
# Add the "zabbix" user |
177 |
/usr/sbin/useradd -c "Zabbix Monitoring System" \ |
178 |
-s /sbin/nologin -r -d %{_localstatedir}/lib/%{name} %{name} 2> /dev/null || : |
179 |
|
180 |
%pre agent |
181 |
# Add the "zabbix" user |
182 |
/usr/sbin/useradd -c "Zabbix Monitoring System" \ |
183 |
-s /sbin/nologin -r -d %{_localstatedir}/lib/%{name} %{name} 2> /dev/null || : |
184 |
|
185 |
%post |
186 |
/sbin/chkconfig --add %{name} |
187 |
|
188 |
%post agent |
189 |
/sbin/chkconfig --add %{name}-agent |
190 |
|
191 |
%preun |
192 |
if [ "$1" = 0 ] |
193 |
then |
194 |
/sbin/service %{name} stop >/dev/null 2>&1 || : |
195 |
/sbin/chkconfig --del %{name} |
196 |
fi |
197 |
|
198 |
%preun agent |
199 |
if [ "$1" = 0 ] |
200 |
then |
201 |
/sbin/service %{name}-agent stop >/dev/null 2>&1 || : |
202 |
/sbin/chkconfig --del %{name}-agent |
203 |
fi |
204 |
|
205 |
%files |
206 |
%doc AUTHORS ChangeLog COPYING CREDITS NEWS README |
207 |
%doc create |
208 |
%dir %{_sysconfdir}/%{name} |
209 |
%{_sbindir}/%{name}_server |
210 |
%{_sysconfdir}/init.d/%{name} |
211 |
%{_mandir}/man8/%{name}_server.8* |
212 |
%config(noreplace) %{_sysconfdir}/logrotate.d/zabbix |
213 |
%config(noreplace) %{_sysconfdir}/%{name}/%{name}_server.conf |
214 |
%attr(0755,%{name},%{name}) %dir %{_localstatedir}/log/%{name} |
215 |
%attr(0755,%{name},%{name}) %dir %{_localstatedir}/run/%{name} |
216 |
|
217 |
%files agent |
218 |
%doc AUTHORS ChangeLog COPYING CREDITS NEWS README |
219 |
%dir %{_sysconfdir}/%{name} |
220 |
%{_bindir}/%{name}_sender |
221 |
%{_bindir}/%{name}_get |
222 |
%{_sbindir}/%{name}_agent |
223 |
%{_sbindir}/%{name}_agentd |
224 |
%{_mandir}/man1/%{name}_sender.1* |
225 |
%{_mandir}/man1/%{name}_get.1* |
226 |
%{_mandir}/man8/%{name}_agentd.8* |
227 |
%{_sysconfdir}/init.d/%{name}-agent |
228 |
%config(noreplace) %{_sysconfdir}/logrotate.d/%{name}-agent |
229 |
%config(noreplace) %{_sysconfdir}/%{name}/%{name}_agent.conf |
230 |
%config(noreplace) %{_sysconfdir}/%{name}/%{name}_agentd.conf |
231 |
%attr(0755,%{name},%{name}) %dir %{_localstatedir}/log/%{name} |
232 |
%attr(0755,%{name},%{name}) %dir %{_localstatedir}/run/%{name} |
233 |
|
234 |
%files web |
235 |
%doc README |
236 |
%dir %{_sysconfdir}/%{name} |
237 |
%config(noreplace) %{_sysconfdir}/%{name}/db.inc.php |
238 |
%config(noreplace) %{_sysconfdir}/httpd/conf.d/%{name}.conf |
239 |
%{_datadir}/%{name} |