forked from OpenTSDB/opentsdb
-
Notifications
You must be signed in to change notification settings - Fork 1
/
opentsdb.spec.in
115 lines (98 loc) · 4.03 KB
/
opentsdb.spec.in
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
# Put the RPM in the current directory.
%define _rpmdir .
# Find the tarball produced by `make dist' in the current directory.
%define _sourcedir %(echo $PWD)
Name: @PACKAGE@
Version: %(echo @VERSION@ | sed 's/-/_/g')
Release: 1
Summary: A scalable, distributed Time Series Database
Packager: @PACKAGE_BUGREPORT@
BuildArch: noarch
Group: Service/Monitoring
License: LGPLv2.1+
URL: http://opentsdb.net
Source: @PACKAGE@-@[email protected]
Requires: gnuplot
# Disable the stupid stuff rpm distros include in the build process by
# default:
# Disable any prep shell actions. replace them with simply 'true'
%define __spec_prep_pre true
%define __spec_prep_post true
# Disable any build shell actions. replace them with simply 'true'
%define __spec_build_pre cd %{_builddir}
%define __spec_build_post true
# Disable any install shell actions. replace them with simply 'true'
%define __spec_install_pre cd %{_builddir}
%define __spec_install_post true
# Disable any clean shell actions. replace them with simply 'true'
%define __spec_clean_pre cd %{_builddir}
%define __spec_clean_post true
%description
OpenTSDB is a distributed, scalable Time Series Database (TSDB) written on top
of HBase. OpenTSDB was written to address a common need: store, index and
serve metrics collected from computer systems (network gear, operating
systems, applications) at a large scale, and make this data easily accessible
and graphable.
Thanks to HBase's scalability, OpenTSDB allows you to collect many thousands
of metrics from thousands of hosts and applications, at a high rate (every few
seconds). OpenTSDB will never delete or downsample data and can easily store
billions of data points.
%prep
%setup -q -n @PACKAGE@-@VERSION@
%build
%configure
make
%install
rm -rf %{buildroot}
make install DESTDIR=%{buildroot}
mkdir -p %{buildroot}%{_localstatedir}/cache/opentsdb
mkdir -p %{buildroot}%{_localstatedir}/log/opentsdb
mkdir -p %{buildroot}%{_localstatedir}/tmp/opentsdb
mkdir -p %{buildroot}%{_datarootdir}/opentsdb/plugins
# TODO: Use alternatives to manage the init script and configuration.
%clean
rm -rf %{buildroot}
%files
%defattr(644,root,root,755)
%attr(0755,root,root) %{_bindir}/*
%attr(0755,root,root) %{_datarootdir}/opentsdb/bin/*.sh
%attr(0755,root,root) %{_datarootdir}/opentsdb/plugins
%attr(0755,root,root) %{_datarootdir}/opentsdb/tools/*
%attr(0755,root,root) %{_datarootdir}/opentsdb/etc/init.d/opentsdb
%attr(0644,root,root) %{_datarootdir}/opentsdb/etc/systemd/system/[email protected]
%config %{_datarootdir}/opentsdb/etc/opentsdb/opentsdb.conf
%config %{_datarootdir}/opentsdb/etc/opentsdb/logback.xml
%doc
%{_datarootdir}/opentsdb
%{_bindir}/tsdb
%dir %attr(0755,opentsdb,opentsdb) %{_tmppath}/opentsdb
%dir %attr(0755,opentsdb,opentsdb) %{_localstatedir}/cache/opentsdb
%dir %attr(0755,opentsdb,opentsdb) %{_localstatedir}/log/opentsdb
%dir %attr(0755,opentsdb,opentsdb) %{_localstatedir}/tmp/opentsdb
%changelog
%pre
getent group opentsdb 2>/dev/null >/dev/null || /usr/sbin/groupadd -r opentsdb
getent passwd opentsbd 2>&1 > /dev/null || /usr/sbin/useradd -c "OpenTSDB" -s /sbin/nologin -g opentsdb -r -d %{_datarootdir}/opentsdb opentsdb 2> /dev/null || :
%post
if [ $1 -eq 1 ]; then
# we're installing the first version of this package
ln -s %{_datarootdir}/opentsdb/etc/opentsdb /etc/opentsdb
if [ -d /run/systemd/system ]; then
ln -s %{_datarootdir}/opentsdb/etc/systemd/system/opentsdb.service /lib/systemd/system
ln -s %{_datarootdir}/opentsdb/etc/systemd/system/[email protected] /lib/systemd/system
systemctl daemon-reload
else
ln -s %{_datarootdir}/opentsdb/etc/init.d/opentsdb /etc/init.d/opentsdb
fi
fi
exit 0
%postun
if [ $1 -eq 0 ]; then
# we're removing last version of this package
[ -L /etc/opentsdb ] && rm -f /etc/opentsdb
[ -L /etc/init.d/opentsdb ] && rm -f /etc/init.d/opentsdb
[ -L /lib/systemd/system/opentsdb.service ] && rm -f /lib/systemd/system/opentsdb.service
[ -L /lib/systemd/system/[email protected] ] && rm -f /lib/systemd/system/[email protected]
[ -d /run/systemd/system ] && systemctl daemon-reload
fi
exit 0