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