]>
Commit | Line | Data |
---|---|---|
3f15af45 | 1 | # TODO |
cba9cb99 | 2 | # - missing %%post %%service restart |
3f15af45 ER |
3 | # |
4 | # Conditional build: | |
405853f4 | 5 | %bcond_with tests # do not perform "make test" |
30fc16b9 | 6 | |
3f15af45 | 7 | Summary: Python daemon that collects system metrics and publishes them to Graphite (and others) |
30fc16b9 | 8 | Summary(pl.UTF-8): Demon napisany w Pythonie, zbierający statystyki i publikujący je do Graphite (i innych) |
30fc16b9 MK |
9 | Name: diamond |
10 | Version: 4.0.195 | |
cba9cb99 | 11 | Release: 2 |
30fc16b9 MK |
12 | License: MIT |
13 | Group: Libraries/Python | |
30fc16b9 MK |
14 | Source0: https://pypi.python.org/packages/source/d/diamond/%{name}-%{version}.tar.gz |
15 | # Source0-md5: b49da676079eafab3e784cccedc6bfa1 | |
30fc16b9 MK |
16 | Source1: %{name}.conf |
17 | Source3: %{name}.init | |
18 | Source10: PostgresqlCollector.conf | |
30fc16b9 | 19 | URL: https://github.com/python-diamond/Diamond |
3f15af45 | 20 | BuildRequires: python-modules |
30fc16b9 | 21 | BuildRequires: rpm-pythonprov |
30fc16b9 | 22 | BuildRequires: rpmbuild(macros) >= 1.710 |
ac40a9df ER |
23 | Requires(postun): /usr/sbin/groupdel |
24 | Requires(postun): /usr/sbin/userdel | |
25 | Requires(pre): /bin/id | |
26 | Requires(pre): /usr/bin/getgid | |
27 | Requires(pre): /usr/sbin/groupadd | |
28 | Requires(pre): /usr/sbin/useradd | |
30fc16b9 MK |
29 | Requires: python-configobj >= 5.0.6 |
30 | Requires: python-modules | |
31 | Suggests: python-setproctitle | |
32 | Provides: group(diamond) | |
33 | Provides: user(diamond) | |
30fc16b9 MK |
34 | BuildArch: noarch |
35 | BuildRoot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n) | |
36 | ||
37 | %description | |
3f15af45 ER |
38 | Diamond is a python daemon that collects system metrics and publishes |
39 | them to Graphite (and others). It is capable of collecting cpu, | |
40 | memory, network, i/o, load and disk metrics. Additionally, it features | |
41 | an API for implementing custom collectors for gathering metrics from | |
42 | almost any source. | |
30fc16b9 | 43 | |
3c5ad78a | 44 | %package -n %{name}-collector-postgresql |
30fc16b9 MK |
45 | Summary: Data collector for PostgreSQL database |
46 | Summary(pl.UTF-8): Zbieracz statystyk dla bazdy danych Postgresql | |
47 | Group: Libraries/Python | |
3f15af45 | 48 | Requires: %{name} = %{version}-%{release} |
30fc16b9 MK |
49 | Requires: python-psycopg2 |
50 | ||
3c5ad78a | 51 | %description -n %{name}-collector-postgresql |
30fc16b9 MK |
52 | Data collector for PostgreSQL database |
53 | ||
3c5ad78a | 54 | %description -n %{name}-collector-postgresql -l pl.UTF-8 |
30fc16b9 MK |
55 | Zbieracz statystyk dla bazdy danych Postgresql |
56 | ||
57 | %prep | |
3c5ad78a | 58 | %setup -q |
30fc16b9 | 59 | |
30fc16b9 | 60 | %build |
30fc16b9 | 61 | %py_build %{?with_tests:test} |
30fc16b9 MK |
62 | |
63 | %install | |
64 | rm -rf $RPM_BUILD_ROOT | |
3c5ad78a ER |
65 | install -d $RPM_BUILD_ROOT%{_sysconfdir}/%{name}/{collectors,handlers} \ |
66 | $RPM_BUILD_ROOT{/etc/rc.d/init.d,%{_localstatedir}/log/%{name}} | |
30fc16b9 | 67 | |
30fc16b9 MK |
68 | %py_install |
69 | %py_postclean | |
3f15af45 | 70 | |
3c5ad78a | 71 | cp -p %{SOURCE1} $RPM_BUILD_ROOT/%{_sysconfdir}/%{name}/diamond.conf |
30fc16b9 | 72 | install -p %{SOURCE3} $RPM_BUILD_ROOT/etc/rc.d/init.d/diamond |
3c5ad78a | 73 | cp -p %{SOURCE10} $RPM_BUILD_ROOT%{_sysconfdir}/%{name}/collectors |
30fc16b9 | 74 | |
30fc16b9 MK |
75 | %clean |
76 | rm -rf $RPM_BUILD_ROOT | |
77 | ||
78 | %pre | |
79 | %groupadd -g 327 diamond | |
80 | %useradd -u 327 -d /var/log/diamond -g diamond -c "Diamond daemon user" diamond | |
81 | ||
8fceffdd MK |
82 | %post |
83 | /sbin/chkconfig --add diamond | |
8fceffdd MK |
84 | |
85 | %preun | |
86 | if [ "$1" = "0" ]; then | |
87 | %service diamond stop | |
88 | /sbin/chkconfig --del diamond | |
89 | fi | |
8fceffdd | 90 | |
30fc16b9 MK |
91 | %postun |
92 | if [ "$1" = "0" ]; then | |
93 | %userremove diamond | |
94 | %groupremove diamond | |
95 | fi | |
8fceffdd | 96 | |
30fc16b9 MK |
97 | %files |
98 | %defattr(644,root,root,755) | |
99 | %doc README.md LICENSE | |
3c5ad78a ER |
100 | %dir %attr(750,root,diamond) %{_sysconfdir}/%{name} |
101 | %dir %attr(750,root,diamond) %{_sysconfdir}/%{name}/collectors | |
102 | %dir %attr(750,root,diamond) %{_sysconfdir}/%{name}/handlers | |
103 | %attr(640,root,diamond) %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/%{name}/diamond.conf | |
30fc16b9 MK |
104 | %attr(755,root,root) %{_bindir}/diamond |
105 | %attr(755,root,root) %{_bindir}/diamond-setup | |
3c5ad78a | 106 | %{py_sitescriptdir}/%{name} |
3f15af45 | 107 | %{_datadir}/diamond |
30fc16b9 MK |
108 | %attr(750,diamond,diamond) /var/log/diamond |
109 | %attr(754,root,root) /etc/rc.d/init.d/diamond | |
3c5ad78a | 110 | %{py_sitescriptdir}/%{name}-%{version}-py*.egg-info |
30fc16b9 | 111 | |
3c5ad78a | 112 | %files -n %{name}-collector-postgresql |
30fc16b9 | 113 | %defattr(644,root,root,755) |
3c5ad78a | 114 | %{_sysconfdir}/%{name}/collectors/PostgresqlCollector.conf |