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 |
|
|
Release: %mkrel 1 |
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 |
|
|
|
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 |
mitya |
336482 |
BuildRequires: libssh2-devel |
45 |
|
|
BuildRequires: openipmi-devel |
46 |
mitya |
233026 |
Requires: logrotate, fping |
47 |
|
|
Requires(pre): rpm-helper |
48 |
|
|
Requires(post): rpm-helper |
49 |
|
|
Requires(preun): rpm-helper |
50 |
|
|
|
51 |
|
|
%description |
52 |
mitya |
336482 |
Zabbix is the ultimate open source availability and performance monitoring |
53 |
|
|
solution. Zabbix offers advanced monitoring, alerting, and visualization features |
54 |
|
|
today which are missing in other monitoring systems, even some of the best |
55 |
|
|
commercial ones. |
56 |
mitya |
233026 |
|
57 |
|
|
%package agent |
58 |
|
|
Summary: Zabbix Agent |
59 |
|
|
Group: Networking/Other |
60 |
|
|
Requires: logrotate |
61 |
|
|
Requires(pre): rpm-helper |
62 |
|
|
Requires(post): rpm-helper |
63 |
|
|
Requires(preun): rpm-helper |
64 |
|
|
|
65 |
|
|
%description agent |
66 |
|
|
The zabbix client agent, to be installed on monitored systems. |
67 |
|
|
|
68 |
|
|
%package web |
69 |
|
|
Summary: Zabbix Web Frontend |
70 |
|
|
Group: Networking/Other |
71 |
mitya |
336482 |
Requires: apache-mod_php |
72 |
|
|
Requires: php-bcmath |
73 |
|
|
Requires: php-mbstring |
74 |
|
|
Requires: php-gd |
75 |
|
|
Requires: php-sockets |
76 |
|
|
Requires: php-xml, php-xmlreader, php-xmlwriter |
77 |
|
|
Requires: php-ctype |
78 |
|
|
Requires: php-session |
79 |
|
|
Requires: php-gettext |
80 |
|
|
Requires: php-%{zdb} |
81 |
mitya |
233026 |
|
82 |
|
|
%description web |
83 |
|
|
The php frontend to display the zabbix web interface. |
84 |
|
|
|
85 |
|
|
%prep |
86 |
|
|
%setup -q |
87 |
|
|
perl -pi -e 's/ -static//g' configure |
88 |
|
|
|
89 |
|
|
# fix up some lib64 issues |
90 |
|
|
%{__perl} -pi.orig -e 's|_LIBDIR=/usr/lib|_LIBDIR=%{_libdir}|g' \ |
91 |
|
|
configure |
92 |
|
|
|
93 |
|
|
# fix up pt_br |
94 |
|
|
%{__chmod} a-x frontends/php/include/locales/pt_br.inc.php ||: |
95 |
|
|
%{__sed} -i 's/\r//' frontends/php/include/locales/pt_br.inc.php ||: |
96 |
|
|
|
97 |
|
|
%build |
98 |
|
|
%configure \ |
99 |
|
|
--enable-server \ |
100 |
|
|
--enable-agent \ |
101 |
|
|
--with-net-snmp \ |
102 |
mitya |
336482 |
--with-openipmi \ |
103 |
mitya |
233026 |
--with-ldap \ |
104 |
mitya |
336482 |
--with-libcurl \ |
105 |
|
|
--with-ssh2 \ |
106 |
mitya |
233026 |
--with-jabber \ |
107 |
mitya |
336482 |
--enable-ipv6 \ |
108 |
mitya |
233026 |
--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 |
mitya |
336482 |
|
132 |
mitya |
233026 |
# set up some required directories |
133 |
|
|
mkdir -p %{buildroot}%{_sysconfdir}/%{name} |
134 |
|
|
mkdir -p %{buildroot}%{_sysconfdir}/init.d |
135 |
|
|
mkdir -p %{buildroot}%{_sysconfdir}/logrotate.d |
136 |
|
|
mkdir -p %{buildroot}%{_sysconfdir}/httpd/conf.d |
137 |
mitya |
336482 |
mkdir -p %{buildroot}%{_datadir}/%{name}/schema |
138 |
|
|
mkdir -p %{buildroot}%{_datadir}/%{name}/web |
139 |
mitya |
233026 |
mkdir -p %{buildroot}%{_localstatedir}/log/%{name} |
140 |
|
|
mkdir -p %{buildroot}%{_localstatedir}/run/%{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 |
mitya |
233026 |
-e 's|PidFile=.*|PidFile=%{_localstatedir}/run/%{name}/%{name}_agentd.pid|g' \ |
157 |
|
|
-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 |
mitya |
233026 |
-e 's|PidFile=.*|PidFile=%{_localstatedir}/run/%{name}/%{name}.pid|g' \ |
161 |
|
|
-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 |
mitya |
336482 |
# database schemata |
180 |
|
|
cp -a database %{buildroot}/%{_datadir}/%{name}/schema |
181 |
|
|
cp -a upgrades %{buildroot}/%{_datadir}/%{name}/schema |
182 |
|
|
rm -f %{buildroot}/%{_datadir}/%{name}/schema/*/Makefile* |
183 |
|
|
|
184 |
mitya |
233026 |
%makeinstall_std |
185 |
mitya |
336482 |
rm -f %{buildroot}%{_sysconfdir}/%{name}*.conf |
186 |
mitya |
233026 |
rm -rf %{buildroot}%{_libdir}/libzbx*.a |
187 |
|
|
|
188 |
|
|
%pre |
189 |
|
|
# Add the "zabbix" user |
190 |
|
|
/usr/sbin/useradd -c "Zabbix Monitoring System" \ |
191 |
|
|
-s /sbin/nologin -r -d %{_localstatedir}/lib/%{name} %{name} 2> /dev/null || : |
192 |
|
|
|
193 |
|
|
%pre agent |
194 |
|
|
# Add the "zabbix" user |
195 |
|
|
/usr/sbin/useradd -c "Zabbix Monitoring System" \ |
196 |
|
|
-s /sbin/nologin -r -d %{_localstatedir}/lib/%{name} %{name} 2> /dev/null || : |
197 |
|
|
|
198 |
|
|
%post |
199 |
|
|
/sbin/chkconfig --add %{name} |
200 |
|
|
|
201 |
|
|
%post agent |
202 |
|
|
/sbin/chkconfig --add %{name}-agent |
203 |
|
|
|
204 |
|
|
%preun |
205 |
|
|
if [ "$1" = 0 ] |
206 |
|
|
then |
207 |
|
|
/sbin/service %{name} stop >/dev/null 2>&1 || : |
208 |
|
|
/sbin/chkconfig --del %{name} |
209 |
|
|
fi |
210 |
|
|
|
211 |
|
|
%preun agent |
212 |
|
|
if [ "$1" = 0 ] |
213 |
|
|
then |
214 |
|
|
/sbin/service %{name}-agent stop >/dev/null 2>&1 || : |
215 |
|
|
/sbin/chkconfig --del %{name}-agent |
216 |
|
|
fi |
217 |
|
|
|
218 |
mitya |
336482 |
%clean |
219 |
|
|
|
220 |
mitya |
233026 |
%files |
221 |
mitya |
336482 |
%doc AUTHORS ChangeLog COPYING INSTALL NEWS README |
222 |
|
|
%{_datadir}/%{name}/schema |
223 |
mitya |
233026 |
%dir %{_sysconfdir}/%{name} |
224 |
|
|
%{_sbindir}/%{name}_server |
225 |
|
|
%{_sysconfdir}/init.d/%{name} |
226 |
|
|
%{_mandir}/man8/%{name}_server.8* |
227 |
|
|
%config(noreplace) %{_sysconfdir}/logrotate.d/zabbix |
228 |
|
|
%config(noreplace) %{_sysconfdir}/%{name}/%{name}_server.conf |
229 |
|
|
%attr(0755,%{name},%{name}) %dir %{_localstatedir}/log/%{name} |
230 |
|
|
%attr(0755,%{name},%{name}) %dir %{_localstatedir}/run/%{name} |
231 |
|
|
|
232 |
|
|
%files agent |
233 |
mitya |
336482 |
%doc AUTHORS ChangeLog COPYING INSTALL NEWS README |
234 |
mitya |
233026 |
%dir %{_sysconfdir}/%{name} |
235 |
|
|
%{_bindir}/%{name}_sender |
236 |
|
|
%{_bindir}/%{name}_get |
237 |
|
|
%{_sbindir}/%{name}_agent |
238 |
|
|
%{_sbindir}/%{name}_agentd |
239 |
|
|
%{_mandir}/man1/%{name}_sender.1* |
240 |
|
|
%{_mandir}/man1/%{name}_get.1* |
241 |
|
|
%{_mandir}/man8/%{name}_agentd.8* |
242 |
|
|
%{_sysconfdir}/init.d/%{name}-agent |
243 |
|
|
%config(noreplace) %{_sysconfdir}/logrotate.d/%{name}-agent |
244 |
|
|
%config(noreplace) %{_sysconfdir}/%{name}/%{name}_agent.conf |
245 |
|
|
%config(noreplace) %{_sysconfdir}/%{name}/%{name}_agentd.conf |
246 |
|
|
%attr(0755,%{name},%{name}) %dir %{_localstatedir}/log/%{name} |
247 |
|
|
%attr(0755,%{name},%{name}) %dir %{_localstatedir}/run/%{name} |
248 |
|
|
|
249 |
|
|
%files web |
250 |
|
|
%doc README |
251 |
|
|
%dir %{_sysconfdir}/%{name} |
252 |
|
|
%config(noreplace) %{_sysconfdir}/%{name}/db.inc.php |
253 |
|
|
%config(noreplace) %{_sysconfdir}/httpd/conf.d/%{name}.conf |
254 |
mitya |
336482 |
%{_datadir}/%{name}/web |