forked from chaos/cerebro
-
Notifications
You must be signed in to change notification settings - Fork 0
/
cerebro.spec.in
228 lines (198 loc) · 6.49 KB
/
cerebro.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
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
Name: @PROJECT@
Version: @VERSION@
Release: @RELEASE@
Summary: Cerebro cluster monitoring tools and libraries
Group: System Environment/Base
License: GPL
Source: @PROJECT@-@[email protected]
BuildRoot: %{_tmppath}/@PROJECT@-@VERSION@
BuildRequires: systemd
Requires: systemd
Requires: /bin/sh
%description
Cerebro is a collection of cluster monitoring tools and libraries.
%{!?_with_genders: %{!?_without_genders: %define _without_genders --without-genders}}
%{!?_with_hostsfile: %{!?_without_hostsfile: %define _with_hostsfile --with-hostsfile}}
%{!?_with_boottime: %{!?_without_boottime: %define _with_boottime --with-boottime}}
%{!?_with_loadavg: %{!?_without_loadavg: %define _with_loadavg --with-loadavg}}
%{!?_with_memory: %{!?_without_memory: %define _with_memory --with-memory}}
%{!?_with_network: %{!?_without_network: %define _with_network --with-network}}
%{!?_with_slurm_state: %{!?_without_slurm_state: %define _without_slurm_state --without-slurm-state}}
%{!?_with_shutdown: %{!?_without_shutdown: %define _without_shutdown --without-shutdown}}
%{!?_with_updown: %{!?_without_updown: %define _with_updown --with-updown}}
%if %{?_with_debug:1}%{!?_with_debug:0}
%define _enable_debug --enable-debug
%endif
%package clusterlist-genders
Summary: clusterlist genders module
Group: System Environment/Base
Requires: cerebro
Requires: genders >= 1.2
%description clusterlist-genders
Genders module
%package clusterlist-hostsfile
Summary: clusterlist hostsfile module
Group: System Environment/Base
Requires: cerebro
%description clusterlist-hostsfile
Hostsfile module
%package metric-boottime
Summary: boottime module
Group: System Environment/Base
Requires: cerebro
%description metric-boottime
Metric module to monitor boottime.
%package metric-loadavg
Summary: loadavg module
Group: System Environment/Base
Requires: cerebro
%description metric-loadavg
Metric modules to monitor loadavgs.
%package metric-memory
Summary: memory module
Group: System Environment/Base
Requires: cerebro
%description metric-memory
Metric modules to monitor memory usage.
%package metric-network
Summary: network module
Group: System Environment/Base
Requires: cerebro
%description metric-network
Metric modules to monitor network usage.
%package metric-slurm-state
Summary: slurm_state module
Group: System Environment/Base
Requires: cerebro
%description metric-slurm-state
Metric module to monitor slurm_state.
%package metric-shutdown
Summary: shutdown module
Group: System Environment/Base
Requires: cerebro
%description metric-shutdown
Metric module to monitor graceful shutdowns.
%package event-updown
Summary: updown module
Group: System Environment/Base
Requires: cerebro
%description event-updown
Event module to monitor node up/down.
%prep
%setup -q -n @PROJECT@-@VERSION@
%build
%configure --program-prefix=%{?_program_prefix:%{_program_prefix}} \
%{?_with_genders} \
%{?_without_genders} \
%{?_with_hostsfile} \
%{?_without_hostsfile} \
%{?_with_boottime} \
%{?_without_boottime} \
%{?_with_loadavg} \
%{?_without_loadavg} \
%{?_with_memory} \
%{?_without_memory} \
%{?_with_network} \
%{?_without_network} \
%{?_with_slurm_state} \
%{?_without_slurm_state} \
%{?_with_shutdown} \
%{?_without_shutdown} \
%{?_with_updown} \
%{?_without_updown} \
%{?_with_cerebrod_speaker_only} \
%{?_without_cerebrod_speaker_only} \
%{?_with_cerebrod_no_threads} \
%{?_without_cerebrod_no_threads} \
%{?_with_cerebro_config_file} \
%{?_enable_static_modules} \
%{?_enable_debug} \
--with-systemdsystemunitdir=%{_unitdir}
make
%pretrans
# stop cerebro before modification, remember if it was running
if systemctl status cerebrod | grep running; then
touch %{_tmppath}/cerebrod_restart_sentinel_file
systemctl stop cerebrod
fi
%install
rm -rf $RPM_BUILD_ROOT
DESTDIR="$RPM_BUILD_ROOT" make install
%files
%defattr(-,root,root)
%doc README NEWS ChangeLog DISCLAIMER DISCLAIMER.UC COPYING
%attr(0600,root,root) %config(noreplace) %{_sysconfdir}/cerebro.conf
%{_includedir}/*
%dir %{_libdir}/cerebro
%{_libdir}/libcerebro*
%{_mandir}/*
%{_sbindir}/cerebrod
%{_sbindir}/cerebro-stat
%{_sbindir}/cerebro-admin
%{_unitdir}/cerebrod.service
%dir %attr(0755,root,root) %config %{_localstatedir}/run/cerebro
%if %{?_with_genders:1}%{!?_with_genders:0}
%files clusterlist-genders
%defattr(-,root,root)
%{_libdir}/cerebro/*cerebro_clusterlist_genders.*
%endif
%if %{?_with_hostsfile:1}%{!?_with_hostsfile:0}
%files clusterlist-hostsfile
%defattr(-,root,root)
%{_libdir}/cerebro/*cerebro_clusterlist_hostsfile.*
%endif
%if %{?_with_boottime:1}%{!?_with_boottime:0}
%files metric-boottime
%defattr(700,root,root)
%{_libdir}/cerebro/*cerebro_metric_boottime.*
%endif
%if %{?_with_loadavg:1}%{!?_with_loadavg:0}
%files metric-loadavg
%defattr(700,root,root)
%{_libdir}/cerebro/*cerebro_metric_loadavg1.*
%{_libdir}/cerebro/*cerebro_metric_loadavg5.*
%{_libdir}/cerebro/*cerebro_metric_loadavg15.*
%endif
%if %{?_with_memory:1}%{!?_with_memory:0}
%files metric-memory
%defattr(700,root,root)
%{_libdir}/cerebro/*cerebro_metric_memtotal.*
%{_libdir}/cerebro/*cerebro_metric_memused.*
%{_libdir}/cerebro/*cerebro_metric_memfree.*
%{_libdir}/cerebro/*cerebro_metric_swaptotal.*
%{_libdir}/cerebro/*cerebro_metric_swapused.*
%{_libdir}/cerebro/*cerebro_metric_swapfree.*
%endif
%if %{?_with_network:1}%{!?_with_network:0}
%files metric-network
%defattr(700,root,root)
%{_libdir}/cerebro/*cerebro_metric_bytesin.*
%{_libdir}/cerebro/*cerebro_metric_bytesout.*
%{_libdir}/cerebro/*cerebro_metric_packetsin.*
%{_libdir}/cerebro/*cerebro_metric_packetsout.*
%{_libdir}/cerebro/*cerebro_metric_rxerrs.*
%{_libdir}/cerebro/*cerebro_metric_txerrs.*
%endif
%if %{?_with_slurm_state:1}%{!?_with_slurm_state:0}
%files metric-slurm-state
%defattr(700,root,root)
%{_libdir}/cerebro/*cerebro_metric_slurm_state.*
%endif
%if %{?_with_shutdown:1}%{!?_with_shutdown:0}
%files metric-shutdown
%defattr(700,root,root)
%{_libdir}/cerebro/*cerebro_metric_shutdown.*
%endif
%if %{?_with_updown:1}%{!?_with_updown:0}
%files event-updown
%defattr(700,root,root)
%{_libdir}/cerebro/*cerebro_event_updown.*
%endif
%posttrans
# do we need to restart it?
if [ -f %{_tmppath}/cerebrod_restart_sentinel_file ]; then
systemctl daemon-reload
systemctl enable cerebrod
systemctl start cerebrod
rm %{_tmppath}/cerebrod_restart_sentinel_file
fi