1 |
mitya |
233026 |
%define _disable_ld_as_needed 1 |
2 |
|
|
%define _requires_exceptions pear |
3 |
|
|
|
4 |
|
|
Name: zabbix |
5 |
mitya |
336482 |
Version: 2.0.4 |
6 |
luigiwalser |
391742 |
Release: %mkrel 4 |
7 |
mitya |
233026 |
Summary: Open-source monitoring solution for your IT infrastructure |
8 |
|
|
Group: Networking/Other |
9 |
|
|
License: GPLv2+ |
10 |
|
|
URL: http://www.zabbix.com |
11 |
mitya |
336482 |
Source0: http://freefr.dl.sourceforge.net/project/%{name}/ZABBIX%20Latest%20Stable/%{version}/%{name}-%{version}.tar.gz |
12 |
mitya |
233026 |
Source1: zabbix-web.conf |
13 |
|
|
Source2: zabbix-server.init |
14 |
|
|
Source3: zabbix-agent.init |
15 |
|
|
Source4: zabbix-logrotate.in |
16 |
colin |
389409 |
Source5: %{name}-tmpfiles.conf |
17 |
luigiwalser |
391742 |
Patch0: zabbix-2.0.4-CVE-2012-6086.diff |
18 |
mitya |
233026 |
|
19 |
|
|
%define database %{nil} |
20 |
|
|
%define zdb %{nil} |
21 |
|
|
%define with_postgresql %{?_with_postgresql: 1} %{?!_with_postgresql: 0} |
22 |
|
|
#define with_mysql %{?_with_mysql: 1} %{?!_with_mysql: 0} |
23 |
|
|
%define with_mysql %{?_without_mysql: 0} %{?!_without_mysql: 1} |
24 |
|
|
|
25 |
|
|
# Zabbix can only be built with mysql -or- postgresql |
26 |
|
|
# support. We build with mysql by default, but you can |
27 |
|
|
# pass --with postgresql to build with postgresql instead. |
28 |
|
|
%if %{with_postgresql} |
29 |
|
|
%define database postgresql |
30 |
|
|
%define zdb pgsql |
31 |
|
|
%endif |
32 |
|
|
%if %{with_mysql} |
33 |
|
|
%define database mysql |
34 |
|
|
%define zdb mysql |
35 |
|
|
%endif |
36 |
|
|
|
37 |
|
|
#if %{?database:1}%{!?database:0} |
38 |
|
|
%if %{with_mysql} || %{with_postgresql} |
39 |
|
|
BuildRequires: %{database}-devel |
40 |
|
|
%endif |
41 |
|
|
BuildRequires: net-snmp-devel |
42 |
|
|
BuildRequires: openldap-devel, gnutls-devel |
43 |
|
|
BuildRequires: libiksemel-devel |
44 |
|
|
BuildRequires: libtasn1-devel |
45 |
|
|
BuildRequires: curl-devel |
46 |
mitya |
336482 |
BuildRequires: libssh2-devel |
47 |
|
|
BuildRequires: openipmi-devel |
48 |
mitya |
233026 |
Requires: logrotate, fping |
49 |
|
|
Requires(pre): rpm-helper |
50 |
|
|
Requires(post): rpm-helper |
51 |
|
|
Requires(preun): rpm-helper |
52 |
|
|
|
53 |
|
|
%description |
54 |
mitya |
336482 |
Zabbix is the ultimate open source availability and performance monitoring |
55 |
|
|
solution. Zabbix offers advanced monitoring, alerting, and visualization features |
56 |
|
|
today which are missing in other monitoring systems, even some of the best |
57 |
|
|
commercial ones. |
58 |
mitya |
233026 |
|
59 |
|
|
%package agent |
60 |
|
|
Summary: Zabbix Agent |
61 |
|
|
Group: Networking/Other |
62 |
|
|
Requires: logrotate |
63 |
|
|
Requires(pre): rpm-helper |
64 |
|
|
Requires(post): rpm-helper |
65 |
|
|
Requires(preun): rpm-helper |
66 |
|
|
|
67 |
|
|
%description agent |
68 |
|
|
The zabbix client agent, to be installed on monitored systems. |
69 |
|
|
|
70 |
|
|
%package web |
71 |
|
|
Summary: Zabbix Web Frontend |
72 |
|
|
Group: Networking/Other |
73 |
mitya |
336482 |
Requires: apache-mod_php |
74 |
|
|
Requires: php-bcmath |
75 |
|
|
Requires: php-mbstring |
76 |
|
|
Requires: php-gd |
77 |
|
|
Requires: php-sockets |
78 |
|
|
Requires: php-xml, php-xmlreader, php-xmlwriter |
79 |
|
|
Requires: php-ctype |
80 |
|
|
Requires: php-session |
81 |
|
|
Requires: php-gettext |
82 |
|
|
Requires: php-%{zdb} |
83 |
mitya |
233026 |
|
84 |
|
|
%description web |
85 |
|
|
The php frontend to display the zabbix web interface. |
86 |
|
|
|
87 |
|
|
%prep |
88 |
|
|
%setup -q |
89 |
luigiwalser |
391742 |
%patch0 -p1 |
90 |
mitya |
233026 |
perl -pi -e 's/ -static//g' configure |
91 |
|
|
|
92 |
|
|
# fix up some lib64 issues |
93 |
|
|
%{__perl} -pi.orig -e 's|_LIBDIR=/usr/lib|_LIBDIR=%{_libdir}|g' \ |
94 |
|
|
configure |
95 |
|
|
|
96 |
|
|
# fix up pt_br |
97 |
|
|
%{__chmod} a-x frontends/php/include/locales/pt_br.inc.php ||: |
98 |
|
|
%{__sed} -i 's/\r//' frontends/php/include/locales/pt_br.inc.php ||: |
99 |
|
|
|
100 |
|
|
%build |
101 |
|
|
%configure \ |
102 |
|
|
--enable-server \ |
103 |
|
|
--enable-agent \ |
104 |
|
|
--with-net-snmp \ |
105 |
mitya |
336482 |
--with-openipmi \ |
106 |
mitya |
233026 |
--with-ldap \ |
107 |
mitya |
336482 |
--with-libcurl \ |
108 |
|
|
--with-ssh2 \ |
109 |
mitya |
233026 |
--with-jabber \ |
110 |
mitya |
336482 |
--enable-ipv6 \ |
111 |
mitya |
233026 |
--enable-static=no \ |
112 |
|
|
%if %{with_mysql} |
113 |
|
|
--with-mysql |
114 |
|
|
%endif |
115 |
|
|
%if %{with_postgresql} |
116 |
|
|
--with-%{zdb} |
117 |
|
|
%endif |
118 |
|
|
%if !%{with_mysql} && !%{with_postgresql} |
119 |
|
|
--with-sqlite3 |
120 |
|
|
%endif |
121 |
|
|
#--disable-static |
122 |
|
|
#--with-mysql \ |
123 |
|
|
#--with-mysql=%{_libdir}/mysql/mysql_config \ |
124 |
|
|
#--with-mysql=%{_bindir}/mysql_config |
125 |
|
|
|
126 |
|
|
# --disable-static is partially broken atm, |
127 |
|
|
# -static still gets into CFLAGS, so fix up in make |
128 |
|
|
# (and even then, .a files still show their face...) |
129 |
|
|
#find . -name Makefile -exec perl -pi -e 's/ -static//g' {} \; |
130 |
|
|
%make |
131 |
|
|
#make %{?_smp_mflags} CFLAGS="$RPM_OPT_FLAGS" |
132 |
|
|
|
133 |
|
|
%install |
134 |
mitya |
336482 |
|
135 |
mitya |
233026 |
# set up some required directories |
136 |
|
|
mkdir -p %{buildroot}%{_sysconfdir}/%{name} |
137 |
|
|
mkdir -p %{buildroot}%{_sysconfdir}/init.d |
138 |
|
|
mkdir -p %{buildroot}%{_sysconfdir}/logrotate.d |
139 |
|
|
mkdir -p %{buildroot}%{_sysconfdir}/httpd/conf.d |
140 |
mitya |
336482 |
mkdir -p %{buildroot}%{_datadir}/%{name}/schema |
141 |
|
|
mkdir -p %{buildroot}%{_datadir}/%{name}/web |
142 |
mitya |
233026 |
mkdir -p %{buildroot}%{_localstatedir}/log/%{name} |
143 |
mitya |
336482 |
|
144 |
mitya |
233026 |
# php frontend |
145 |
mitya |
336482 |
cp -a frontends/php/* %{buildroot}%{_datadir}/%{name}/web |
146 |
|
|
mv %{buildroot}%{_datadir}/%{name}/web/include/db.inc.php \ |
147 |
mitya |
233026 |
%{buildroot}%{_sysconfdir}/%{name}/ |
148 |
|
|
ln -s ../../../..%{_sysconfdir}/%{name}/db.inc.php \ |
149 |
mitya |
336482 |
%{buildroot}%{_datadir}/%{name}/web/include/db.inc.php |
150 |
|
|
|
151 |
mitya |
233026 |
# kill off .htaccess files, options set in SOURCE1 |
152 |
mitya |
336482 |
rm -f %{buildroot}%{_datadir}/%{name}/web/include/.htaccess |
153 |
|
|
rm -f %{buildroot}%{_datadir}/%{name}/web/include/classes/.htaccess |
154 |
|
|
|
155 |
mitya |
233026 |
# drop config files in place |
156 |
mitya |
336482 |
install -m 0644 conf/%{name}_agent.conf %{buildroot}%{_sysconfdir}/%{name} |
157 |
|
|
cat conf/%{name}_agentd.conf | sed \ |
158 |
colin |
389409 |
-e 's|PidFile=.*|PidFile=/run/%{name}/%{name}_agentd.pid|g' \ |
159 |
mitya |
233026 |
-e 's|LogFile=.*|LogFile=%{_localstatedir}/log/%{name}/%{name}_agentd.log|g' \ |
160 |
|
|
> %{buildroot}%{_sysconfdir}/%{name}/%{name}_agentd.conf |
161 |
mitya |
336482 |
cat conf/zabbix_server.conf | sed \ |
162 |
colin |
389409 |
-e 's|PidFile=.*|PidFile=/run/%{name}/%{name}.pid|g' \ |
163 |
mitya |
233026 |
-e 's|LogFile=.*|LogFile=%{_localstatedir}/log/%{name}/%{name}_server.log|g' \ |
164 |
|
|
-e 's|AlertScriptsPath=/home/%{name}/bin/|AlertScriptsPath=%{_localstatedir}/lib/%{name}/|g' \ |
165 |
|
|
-e 's|DBUser=root|DBUser=%{name}|g' \ |
166 |
|
|
-e 's|DBSocket=/tmp/mysql.sock|DBSocket=%{_localstatedir}/lib/%{zdb}/%{zdb}.sock|g' \ |
167 |
|
|
-e 's|FpingLocation=/usr/sbin/fping|FpingLocation=/bin/fping|g' \ |
168 |
|
|
> %{buildroot}%{_sysconfdir}/%{name}/%{name}_server.conf |
169 |
|
|
install -m 0644 %{SOURCE1} %{buildroot}%{_sysconfdir}/httpd/conf.d/%{name}.conf |
170 |
mitya |
336482 |
|
171 |
mitya |
233026 |
# log rotation |
172 |
|
|
cat %{SOURCE4} | sed -e 's|COMPONENT|server|g' > \ |
173 |
|
|
%{buildroot}%{_sysconfdir}/logrotate.d/%{name} |
174 |
|
|
cat %{SOURCE4} | sed -e 's|COMPONENT|agentd|g' > \ |
175 |
|
|
%{buildroot}%{_sysconfdir}/logrotate.d/%{name}-agent |
176 |
mitya |
336482 |
|
177 |
mitya |
233026 |
# init scripts |
178 |
|
|
install -m 0755 %{SOURCE2} %{buildroot}%{_sysconfdir}/init.d/%{name} |
179 |
|
|
install -m 0755 %{SOURCE3} %{buildroot}%{_sysconfdir}/init.d/%{name}-agent |
180 |
|
|
|
181 |
colin |
389409 |
# tmpfiles |
182 |
|
|
install -D -p -m 0644 %{SOURCE5} %{buildroot}%{_tmpfilesdir}/%{name}.conf |
183 |
|
|
install -D -p -m 0644 %{SOURCE5} %{buildroot}%{_tmpfilesdir}/%{name}-agent.conf |
184 |
|
|
|
185 |
mitya |
336482 |
# database schemata |
186 |
|
|
cp -a database %{buildroot}/%{_datadir}/%{name}/schema |
187 |
|
|
cp -a upgrades %{buildroot}/%{_datadir}/%{name}/schema |
188 |
|
|
rm -f %{buildroot}/%{_datadir}/%{name}/schema/*/Makefile* |
189 |
|
|
|
190 |
mitya |
233026 |
%makeinstall_std |
191 |
mitya |
336482 |
rm -f %{buildroot}%{_sysconfdir}/%{name}*.conf |
192 |
mitya |
233026 |
rm -rf %{buildroot}%{_libdir}/libzbx*.a |
193 |
|
|
|
194 |
|
|
%pre |
195 |
colin |
389408 |
%_pre_useradd %{name} %{_localstatedir}/lib/%{name} /sbin/nologin |
196 |
mitya |
233026 |
|
197 |
|
|
%pre agent |
198 |
colin |
389408 |
%_pre_useradd %{name} %{_localstatedir}/lib/%{name} /sbin/nologin |
199 |
mitya |
233026 |
|
200 |
|
|
%post |
201 |
colin |
389409 |
%_tmpfilescreate %{name} |
202 |
colin |
389408 |
%_post_service %{name} |
203 |
mitya |
233026 |
|
204 |
|
|
%post agent |
205 |
colin |
389409 |
%_tmpfilescreate %{name}-agent |
206 |
colin |
389408 |
%_post_service %{name}-agent |
207 |
mitya |
233026 |
|
208 |
|
|
%preun |
209 |
colin |
389408 |
%_preun_service %{name} |
210 |
mitya |
233026 |
|
211 |
|
|
%preun agent |
212 |
colin |
389408 |
%_preun_service %{name}-agent |
213 |
mitya |
233026 |
|
214 |
mitya |
336482 |
%clean |
215 |
|
|
|
216 |
mitya |
233026 |
%files |
217 |
mitya |
336482 |
%doc AUTHORS ChangeLog COPYING INSTALL NEWS README |
218 |
|
|
%{_datadir}/%{name}/schema |
219 |
mitya |
233026 |
%dir %{_sysconfdir}/%{name} |
220 |
|
|
%{_sbindir}/%{name}_server |
221 |
|
|
%{_sysconfdir}/init.d/%{name} |
222 |
|
|
%{_mandir}/man8/%{name}_server.8* |
223 |
colin |
389409 |
%{_tmpfilesdir}/%{name}.conf |
224 |
mitya |
233026 |
%config(noreplace) %{_sysconfdir}/logrotate.d/zabbix |
225 |
|
|
%config(noreplace) %{_sysconfdir}/%{name}/%{name}_server.conf |
226 |
|
|
%attr(0755,%{name},%{name}) %dir %{_localstatedir}/log/%{name} |
227 |
|
|
|
228 |
|
|
%files agent |
229 |
mitya |
336482 |
%doc AUTHORS ChangeLog COPYING INSTALL NEWS README |
230 |
mitya |
233026 |
%dir %{_sysconfdir}/%{name} |
231 |
|
|
%{_bindir}/%{name}_sender |
232 |
|
|
%{_bindir}/%{name}_get |
233 |
|
|
%{_sbindir}/%{name}_agent |
234 |
|
|
%{_sbindir}/%{name}_agentd |
235 |
|
|
%{_mandir}/man1/%{name}_sender.1* |
236 |
|
|
%{_mandir}/man1/%{name}_get.1* |
237 |
|
|
%{_mandir}/man8/%{name}_agentd.8* |
238 |
|
|
%{_sysconfdir}/init.d/%{name}-agent |
239 |
colin |
389409 |
%{_tmpfilesdir}/%{name}-agent.conf |
240 |
mitya |
233026 |
%config(noreplace) %{_sysconfdir}/logrotate.d/%{name}-agent |
241 |
|
|
%config(noreplace) %{_sysconfdir}/%{name}/%{name}_agent.conf |
242 |
|
|
%config(noreplace) %{_sysconfdir}/%{name}/%{name}_agentd.conf |
243 |
|
|
%attr(0755,%{name},%{name}) %dir %{_localstatedir}/log/%{name} |
244 |
|
|
|
245 |
|
|
%files web |
246 |
|
|
%doc README |
247 |
|
|
%dir %{_sysconfdir}/%{name} |
248 |
|
|
%config(noreplace) %{_sysconfdir}/%{name}/db.inc.php |
249 |
|
|
%config(noreplace) %{_sysconfdir}/httpd/conf.d/%{name}.conf |
250 |
mitya |
336482 |
%{_datadir}/%{name}/web |