zabbix-vl.spec 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410
  1. %define ver 2.2.9
  2. %define rel 1
  3. Summary: The Enterprise-class Monitoring Solution for Everyone
  4. Name: zabbix
  5. Version: %{ver}
  6. Release: %{rel}%{?_dist_release}
  7. License: GPLv2
  8. Group: Applications/Services
  9. URL: https://www.zabbix.com/
  10. Source0: %{name}-%{version}.tar.gz
  11. Source1: zabbix_server.init
  12. Source2: zabbix_proxy.init
  13. Source3: zabbix_agentd.init
  14. Source4: zabbix_server.logrotate
  15. Source5: zabbix_proxy.logrotate
  16. Source6: zabbix_agentd.logrotate
  17. Patch0: zabbix-2.0.4-vine_path.patch
  18. Patch1: zabbix-2.0.4-font.patch
  19. Patch2: zabbix-2.0.4-config.patch
  20. BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-buildroot
  21. BuildRequires: libpq-devel
  22. BuildRequires: libmysqlclient-devel
  23. BuildRequires: curl-devel
  24. BuildRequires: net-snmp-devel
  25. BuildRequires: OpenIPMI-devel
  26. BuildRequires: iksemel-devel
  27. BuildRequires: unixODBC-devel
  28. BuildRequires: libssh2-devel
  29. Requires(pre): glibc-common
  30. Requires(pre): shadow-utils
  31. Vendor: Project Vine
  32. Distribution: Vine Linux
  33. Packager: iwaim
  34. %description
  35. The Enterprise-class Monitoring Solution for Everyone.
  36. %package server-common
  37. Summary: common files for Zabbix Server
  38. Requires: %{name} == %{version}-%{release}
  39. Requires(post,preun): chkconfig
  40. Requires(preun,postun): initscripts
  41. %description server-common
  42. This package include common files for Zabbix Server.
  43. %package server-mysql
  44. Summary: Zabbix Server for MySQL/MariaDB
  45. Provides: %{name}-server
  46. Requires: %{name}-server-common == %{version}-%{release}
  47. %description server-mysql
  48. Zabbix Server for MySQL/MariaDB
  49. %package server-postgresql
  50. Summary: Zabbix Server for PostgreSQL
  51. Provides: %{name}-server
  52. Requires: %{name}-server-common == %{version}-%{release}
  53. %description server-postgresql
  54. Zabbix Server for PostgreSQL
  55. %package agent
  56. Summary: Zabbix Agent
  57. Requires: %{name} == %{version}-%{release}
  58. Requires(post,preun): chkconfig
  59. Requires(preun,postun): initscripts
  60. %description agent
  61. Zabbix Agent
  62. %package proxy-common
  63. Summary: common files for Zabbix Proxy
  64. Requires: %{name} == %{version}-%{release}
  65. Requires(post,preun): chkconfig
  66. Requires(preun,postun): initscripts
  67. %description proxy-common
  68. This package include common files for Zabbix Proxy
  69. %package proxy-mysql
  70. Summary: Zabbix Proxy for MySQL/MariaDB
  71. Provides: %{name}-proxy
  72. Requires: %{name}-proxy-common == %{version}-%{release}
  73. %description proxy-mysql
  74. Zabbix Proxy for MySQL/MariaDB
  75. %package proxy-postgresql
  76. Summary: Zabbix Proxy for PostgreSQL
  77. Provides: %{name}-proxy
  78. Requires: %{name}-proxy-common == %{version}-%{release}
  79. %description proxy-postgresql
  80. Zabbix Proxy for PostgreSQL
  81. %package frontend-php
  82. Summary: Zabbix web frontend with PHP
  83. Group: Applications/Internet
  84. Requires: php5
  85. Requires: TrueType-vlgothic
  86. %description frontend-php
  87. Zabbix web frontend with PHP.
  88. %package frontend-php-mysql
  89. Summary: Zabbix web frontend with PHP and MySQL/MariaDB
  90. Group: Applications/Internet
  91. Provides: %{name}-frontend-php == %{version}-%{release}
  92. Requires: php5-mysql
  93. %description frontend-php-mysql
  94. Zabbix web frontend with PHP and MySQL/MariaDB.
  95. %package frontend-php-postgresql
  96. Summary: Zabbix web frontend with PHP and PostgreSQL
  97. Group: Applications/Internet
  98. Provides: %{name}-frontend-php == %{version}-%{release}
  99. Requires: php5-pgsql
  100. %description frontend-php-postgresql
  101. Zabbix web frontend with PHP and PostgreSQL.
  102. %prep
  103. %setup -q -T -a 0 -c -n zabbix-%{version}
  104. mv zabbix-%{version} zabbix_mysql
  105. pushd zabbix_mysql
  106. %patch0 -p 1
  107. %patch1 -p 1
  108. %patch2 -p 1
  109. popd
  110. %setup -q -D -T -a 0 -n zabbix-%{version}
  111. mv zabbix-%{version} zabbix_pgsql
  112. pushd zabbix_pgsql
  113. %patch0 -p 1
  114. %patch1 -p 1
  115. %patch2 -p 1
  116. popd
  117. %build
  118. Build()
  119. {
  120. %configure \
  121. --enable-server \
  122. --enable-proxy \
  123. --enable-ipv6 \
  124. --sysconfdir=%{_sysconfdir}/zabbix \
  125. --with-libcurl \
  126. --with-openipmi \
  127. --with-net-snmp \
  128. --with-jabber \
  129. --with-unixodbc \
  130. --with-ssh2 \
  131. $@
  132. %__make
  133. }
  134. pushd zabbix_mysql
  135. Build --with-mysql \
  136. --enable-agent
  137. popd
  138. pushd zabbix_pgsql
  139. Build --with-postgresql
  140. popd
  141. %install
  142. %__rm -rf $RPM_BUILD_ROOT
  143. pushd zabbix_mysql
  144. make DESTDIR=$RPM_BUILD_ROOT install
  145. mv -f %{buildroot}%{_sbindir}/zabbix_server %{buildroot}%{_sbindir}/zabbix_server.mysql
  146. mv -f %{buildroot}%{_sbindir}/zabbix_proxy %{buildroot}%{_sbindir}/zabbix_proxy.mysql
  147. # make directories
  148. %__mkdir_p $RPM_BUILD_ROOT%{_localstatedir}/{log,run}/%{name}
  149. # DB
  150. %__mkdir_p $RPM_BUILD_ROOT%{_datadir}/zabbix
  151. %__cp -a database/postgresql $RPM_BUILD_ROOT%{_datadir}/zabbix/
  152. %__cp -a database/mysql $RPM_BUILD_ROOT%{_datadir}/zabbix/
  153. # init.d
  154. %__mkdir_p $RPM_BUILD_ROOT%{_initddir}
  155. %__cp %{SOURCE1} $RPM_BUILD_ROOT%{_initddir}/zabbix_server
  156. %__cp %{SOURCE2} $RPM_BUILD_ROOT%{_initddir}/zabbix_proxy
  157. %__cp %{SOURCE3} $RPM_BUILD_ROOT%{_initddir}/zabbix_agentd
  158. # logrotate
  159. %__mkdir_p $RPM_BUILD_ROOT%{_sysconfdir}/logrotate.d
  160. %__cp %{SOURCE4} $RPM_BUILD_ROOT%{_sysconfdir}/logrotate.d/zabbix_server
  161. %__cp %{SOURCE5} $RPM_BUILD_ROOT%{_sysconfdir}/logrotate.d/zabbix_proxy
  162. %__cp %{SOURCE6} $RPM_BUILD_ROOT%{_sysconfdir}/logrotate.d/zabbix_agentd
  163. # frontend-php
  164. %__mkdir_p $RPM_BUILD_ROOT%{_datadir}/zabbix-frontend
  165. %__cp -a frontends/php $RPM_BUILD_ROOT%{_datadir}/zabbix-frontend/
  166. %__rm -f $RPM_BUILD_ROOT%{_datadir}/zabbix-frontend/php/fonts/DejaVuSans.ttf
  167. ln -s /usr/share/fonts/TrueType-vlgothic/VL-Gothic-Regular.ttf \
  168. $RPM_BUILD_ROOT%{_datadir}/zabbix-frontend/php/fonts/
  169. # proxy
  170. mkdir -p %{buildroot}%{_datadir}/zabbix-proxy
  171. ln -sf ../zabbix/mysql %{buildroot}%{_datadir}/zabbix-proxy/
  172. ln -sf ../zabbix/postgresql %{buildroot}%{_datadir}/zabbix-proxy/
  173. popd
  174. pushd zabbix_pgsql
  175. install -m755 src/zabbix_server/zabbix_server %{buildroot}%{_sbindir}/zabbix_server.pgsql
  176. install -m755 src/zabbix_proxy/zabbix_proxy %{buildroot}%{_sbindir}/zabbix_proxy.pgsql
  177. popd
  178. %clean
  179. %__rm -rf $RPM_BUILD_ROOT
  180. %pre
  181. getent group zabbix >/dev/null || groupadd -r zabbix
  182. getent passwd zabbix >/dev/null || \
  183. useradd -r -g zabbix -d %{_sysconfdir}/zabbix -s /sbin/nologin \
  184. -c "Zabbix Monitoring Solution" zabbix
  185. exit 0
  186. %post server-mysql
  187. /sbin/update-alternatives --install /usr/sbin/zabbix_server \
  188. zabbix_server /usr/sbin/zabbix_server.mysql 10
  189. /sbin/chkconfig --add zabbix_server
  190. %post server-postgresql
  191. /sbin/update-alternatives --install /usr/sbin/zabbix_server \
  192. zabbix_server /usr/sbin/zabbix_server.pgsql 10
  193. /sbin/chkconfig --add zabbix_server
  194. %post proxy-mysql
  195. /sbin/update-alternatives --install /usr/sbin/zabbix_proxy \
  196. zabbix_proxy /usr/sbin/zabbix_proxy.mysql 10
  197. /sbin/chkconfig --add zabbix_proxy
  198. %post proxy-postgresql
  199. /sbin/update-alternatives --install /usr/sbin/zabbix_proxy \
  200. zabbix_proxy /usr/sbin/zabbix_proxy.pgsql 10
  201. /sbin/chkconfig --add zabbix_proxy
  202. %post agent
  203. /sbin/chkconfig --add zabbix_agentd
  204. %preun server-mysql
  205. if [ "$1" -eq 0 ]; then
  206. /sbin/service zabbix_server stop >/dev/null 2>&1
  207. /sbin/chkconfig --del zabbix_server
  208. /sbin/update-alternatives --remove zabbix_server \
  209. /usr/sbin/zabbix_server.mysql
  210. fi
  211. %preun server-postgresql
  212. if [ "$1" -eq 0 ]; then
  213. /sbin/service zabbix_server stop >/dev/null 2>&1
  214. /sbin/chkconfig --del zabbix_server
  215. /sbin/update-alternatives --remove zabbix_server \
  216. /usr/sbin/zabbix_server.pgsql
  217. fi
  218. %preun proxy-mysql
  219. if [ "$1" -eq 0 ]; then
  220. /sbin/service zabbix_proxy stop >/dev/null 2>&1
  221. /sbin/chkconfig --del zabbix_proxy
  222. /sbin/update-alternatives --remove zabbix_proxy \
  223. /usr/sbin/zabbix_proxy.mysql
  224. fi
  225. %preun proxy-postgresql
  226. if [ "$1" -eq 0 ]; then
  227. /sbin/service zabbix_proxy stop >/dev/null 2>&1
  228. /sbin/chkconfig --del zabbix_proxy
  229. /sbin/update-alternatives --remove zabbix_proxy \
  230. /usr/sbin/zabbix_proxy.pgsql
  231. fi
  232. %preun agent
  233. if [ "$1" -eq 0 ]; then
  234. /sbin/service zabbix_agentd stop >/dev/null 2>&1
  235. /sbin/chkconfig --del zabbix_agentd
  236. fi
  237. %postun server-mysql
  238. if [ "$1" -ge "1" ]; then
  239. /sbin/service zabbix_server condrestart >/dev/null 2>&1 || :
  240. fi
  241. %postun server-postgresql
  242. if [ "$1" -ge "1" ]; then
  243. /sbin/service zabbix_server condrestart >/dev/null 2>&1 || :
  244. fi
  245. %postun proxy-mysql
  246. if [ "$1" -ge "1" ]; then
  247. /sbin/service zabbix_proxy condrestart >/dev/null 2>&1 || :
  248. fi
  249. %postun proxy-postgresql
  250. if [ "$1" -ge "1" ]; then
  251. /sbin/service zabbix_proxy condrestart >/dev/null 2>&1 || :
  252. fi
  253. %postun agent
  254. if [ "$1" -ge "1" ]; then
  255. /sbin/service zabbix_agentd condrestart >/dev/null 2>&1 || :
  256. fi
  257. %files
  258. %defattr(-,root,root,-)
  259. %doc zabbix_mysql/AUTHORS zabbix_mysql/COPYING zabbix_mysql/ChangeLog zabbix_mysql/NEWS zabbix_mysql/README
  260. %attr(0755,zabbix,zabbix) %dir %{_localstatedir}/log/%{name}
  261. %attr(0755,zabbix,zabbix) %dir %{_localstatedir}/run/%{name}
  262. %dir %{_datadir}/zabbix
  263. %{_datadir}/zabbix/mysql
  264. %{_datadir}/zabbix/postgresql
  265. %files server-common
  266. %defattr(-,root,root,-)
  267. %dir %{_sysconfdir}/zabbix
  268. %config(noreplace) %{_sysconfdir}/zabbix/zabbix_server.conf
  269. %config(noreplace) %{_sysconfdir}/logrotate.d/zabbix_server
  270. %{_initddir}/zabbix_server*
  271. %{_mandir}/man8/zabbix_server.8*
  272. %files server-mysql
  273. %defattr(-,root,root,-)
  274. %{_sbindir}/zabbix_server.mysql
  275. %files server-postgresql
  276. %defattr(-,root,root,-)
  277. %{_sbindir}/zabbix_server.pgsql
  278. %files agent
  279. %defattr(-,root,root,-)
  280. %dir %{_sysconfdir}/zabbix
  281. %config(noreplace) %{_sysconfdir}/zabbix/zabbix_agent.conf
  282. %config(noreplace) %{_sysconfdir}/zabbix/zabbix_agentd.conf
  283. %config(noreplace) %{_sysconfdir}/logrotate.d/zabbix_agentd
  284. %{_bindir}/zabbix_get
  285. %{_bindir}/zabbix_sender
  286. %{_sbindir}/zabbix_agent
  287. %{_sbindir}/zabbix_agentd
  288. %{_initddir}/zabbix_agentd
  289. %{_mandir}/man1/zabbix_get.1*
  290. %{_mandir}/man1/zabbix_sender.1*
  291. %{_mandir}/man8/zabbix_agentd.8*
  292. %files proxy-common
  293. %defattr(-,root,root,-)
  294. %dir %{_sysconfdir}/zabbix
  295. %config(noreplace) %{_sysconfdir}/zabbix/zabbix_proxy.conf
  296. %config(noreplace) %{_sysconfdir}/logrotate.d/zabbix_proxy
  297. %{_initddir}/zabbix_proxy
  298. %{_mandir}/man8/zabbix_proxy.8*
  299. %{_datadir}/zabbix-proxy
  300. %files proxy-mysql
  301. %defattr(-,root,root,-)
  302. %{_sbindir}/zabbix_proxy.mysql
  303. %files proxy-postgresql
  304. %defattr(-,root,root,-)
  305. %{_sbindir}/zabbix_proxy.pgsql
  306. %files frontend-php
  307. %defattr(-,root,root,-)
  308. %doc zabbix_mysql/AUTHORS zabbix_mysql/COPYING zabbix_mysql/ChangeLog zabbix_mysql/NEWS zabbix_mysql/README
  309. %dir %{_datadir}/zabbix-frontend
  310. %{_datadir}/zabbix-frontend/php
  311. %files frontend-php-mysql
  312. %files frontend-php-postgresql
  313. %changelog
  314. * Sat Apr 11 2015 Tomohiro "Tomo-p" KATO <tomop@teamgedoh.net> 2.2.9-1
  315. - new upstream release.
  316. * Sun Jul 6 2014 Tomohiro "Tomo-p" KATO <tomop@teamgedoh.net> 2.2.4-1
  317. - new upstream release.
  318. - built with both of mysql and postgresql.
  319. * Mon Oct 07 2013 Daisuke SUZUKI <daisuke@linux.or.jp> 2.0.8-1
  320. - update to 2.0.8
  321. * Wed Feb 20 2013 Daisuke SUZUKI <daisuke@linux.or.jp> 2.0.5-2
  322. - use %%bcond_with mysql to build with mysql
  323. * Tue Feb 19 2013 IWAI, Masaharu <iwai@alib.jp> 2.0.5-1
  324. - update to 2.0.5
  325. - add using MySQL client library switch: default no
  326. - define use_postfix and use_mysql
  327. - add BuildRequires: MySQL-devel
  328. - add configure option: --with-mysql
  329. * Thu Feb 7 2013 IWAI, Masaharu <iwai@alib.jp> 2.0.4-1
  330. - initial build for Vine Linux