1 %define mod_path
/opt
/monitor
/op5
/merlin
2 %define nagios_cfg
/opt
/monitor
/etc
/nagios.cfg
4 %define install_args
--batch
--dest
-dir
=%mod_path \\\
5 --bindir
=%_bindir --libexecdir
=%_libdir/merlin
--nagios
-cfg
=%nagios_cfg
9 %define mysql_rpm mysql
12 %define mysql_rpm mysql
-server
15 %{?dgroup:%define daemon_group %{dgroup}}
17 Summary: The merlin daemon is a multiplexing event
-transport program
19 Version: %{op5version}
20 Release: %{op5release}%{?dist}
23 URL: http
://www.op5.se
24 Source0: %name-%version.tar.gz
25 BuildRoot: %{_tmppath}/%{name}-%{version}
28 Requires: merlin
-apps
>= %version
29 Requires: monitor
-config
31 BuildRequires
: mysql
-devel
32 BuildRequires
: op5
-nagios
-devel
>= 3.99.99.7
33 Obsoletes
: monitor
-reports
-module
34 BuildRequires
: check
-devel
37 BuildRequires
: libdbi
-devel
38 BuildRequires
: pkg
-config
40 Requires: libdbi
-drivers
-dbd
-mysql
41 Requires(post
): mysql
-client
43 BuildRequires
: libdbi
-devel
44 BuildRequires
: pkgconfig
46 Requires: libdbi
-dbd
-mysql
51 The merlin daemon is a multiplexing event
-transport program designed to
52 link multiple Nagios instances together. It can also inject status
53 data into a variety of databases
, using libdbi.
56 %package -n monitor
-merlin
57 Summary: A Nagios module designed to communicate with the Merlin daemon
59 Requires: op5
-nagios
>= 3.99.99.7, merlin
= %version-%release
60 Requires: monitor
-config
61 Requires: op5
-monitor
-supported
-database
63 %description -n monitor
-merlin
64 monitor
-merlin is an event broker module running inside Nagios. Its
65 only purpose
in life is to send events from the Nagios core to the
66 merlin daemon
, which
then takes appropriate action.
70 Summary: Applications used to
set up and aid a merlin
/ninja installation
73 Requires: op5
-monitor
-supported
-database
76 Requires: python
-mysql
80 Requires: python26
-mysqldb
82 Requires: MySQL
-python
86 Obsoletes
: monitor
-distributed
89 This package contains standalone applications required by Ninja and
90 Merlin
in order to
make them both fully support everything that a
91 fully fledged op5 Monitor
install is supposed to handle.
92 'mon' works as a single entry point wrapper and general purpose helper
93 tool
for those applications and a wide variety of other different
94 tasks
, such as showing monitor's configuration files
, calculating
95 sha1 checksums and the latest changed such file
, as well as
96 preparing object configuration
for pollers
, helping with ssh key
97 management and allround tasks regarding administering a distributed
98 network monitoring setup.
101 Summary: Test files
for merlin
103 Requires: monitor
-livestatus
105 Requires: merlin merlin
-apps monitor
-merlin
108 Some additional
test files
for merlin
114 sed
-i 's
/^DEF_VER
=.
*/DEF_VER
=%{version}-%{release}/' gen
-version.sh
116 # If we're building for CentOS 5 we have some sed'ing to do
117 %if ( ! 0%{?suse_version} ) && ( 0%{?rhel} <= 5 )
118 # use python26 for 'mon'
119 sed
-i '
1s
#/bin/python.*#/bin/python26#' apps/mon.py
123 make ENABLE_LIBDBI
=1 NAGIOS_PREFIX
=/opt
/monitor
124 make ENABLE_LIBDBI
=1 NAGIOS_PREFIX
=/opt
/monitor
test
129 sh
install-merlin.sh
%install_args --root
=%buildroot --install=files
,apps
,init
131 chmod
777 %buildroot/%mod_path/logs
132 mkdir -p
%buildroot/%mod_path/binlogs
133 mkdir -p
%buildroot%_sysconfdir/logrotate.d
134 cp merlin.logrotate
%buildroot%_sysconfdir/logrotate.d
/merlin
135 ln
-s ..
/..
/..
/..
/usr
/bin
/merlind
%buildroot/%mod_path/merlind
136 ln
-s ..
/..
/..
/..
/%_libdir/merlin
/import
%buildroot/%mod_path/import
137 ln
-s ..
/..
/..
/..
/%_libdir/merlin
/ocimp
%buildroot/%mod_path/ocimp
138 ln
-s ..
/..
/..
/..
/%_libdir/merlin
/showlog
%buildroot/%mod_path/showlog
139 ln
-s ..
/..
/..
/..
/%_libdir/merlin
/merlin.so
%buildroot/%mod_path/merlin.so
141 # install plugins and create their symlinks
142 mkdir -p
%buildroot/opt
143 cp
-r apps
/plugins
%buildroot/opt
144 chmod
755 %buildroot/opt
/plugins
/*
145 for path
in %buildroot/opt
/plugins
/*; do
148 ln
-s $full_f
%buildroot/opt
/plugins
/$f
152 mkdir -p
%buildroot%_sysconfdir/cron.d
153 cp apps
/*.cron
%buildroot%_sysconfdir/cron.d
/
155 mkdir -p
%buildroot/opt
/monitor
/op5
/nacoma
/hooks
/save
/
156 sed
-i 's
#@@LIBEXECDIR@@#%_libdir/merlin#' op5build/nacoma_hook.py
157 install -m
0755 op5build
/nacoma_hook.py
%buildroot/opt
/monitor
/op5
/nacoma
/hooks
/save
/merlin_hook.py
159 mkdir -p
%buildroot%_sysconfdir/op5kad
/conf.d
160 cp kad.conf
%buildroot%_sysconfdir/op5kad
/conf.d
/merlin.kad
162 mkdir -p
%buildroot%_sysconfdir/nrpe.d
163 cp nrpe
-merlin.cfg
%buildroot%_sysconfdir/nrpe.d
167 # we must stop the merlin deamon so it doesn't interfere with any
168 # database upgrades, logfile imports and whatnot
169 /etc
/init.d
/merlind stop
>/dev
/null ||
:
171 # Verify that mysql-server is installed and running before executing sql scripts
172 service
%mysqld status
2&>1 >/dev
/null
173 if [ $?
-gt
0 ]; then
174 echo "Attempting to start
%mysqld..."
175 service
%mysqld start
176 if [ $?
-gt
0 ]; then
177 echo "Abort
: Failed to start
%mysqld."
182 $
(mysql
-Be "quit"
2>/dev
/null
) && MYSQL_AVAILABLE
=1
183 if [ -n "$MYSQL_AVAILABLE"
]; then
184 %mod_path/install-merlin.sh
%install_args --batch
--install=db
186 echo "Can't login to
%mysqld, probably because you have a root password
set, bailing out..."
190 /sbin
/chkconfig
--add merlind ||
:
192 # If mysql-server is running _or_ this is an upgrade
194 if [ $
1 -eq
2 ]; then
195 echo "Importing status events from logfiles to database"
196 mon log import
--incremental ||
:
197 echo "Importing notifications from logfiles to database"
198 mon log import
--only
-notifications
--incremental ||
:
201 # restart all daemons
202 for daemon
in merlind op5kad nrpe
; do
203 test -f
/etc
/init.d
/$daemon
&& /etc
/init.d
/$daemon restart ||
:
207 %pre -n monitor
-merlin
208 # If we're upgrading the module while Nagios makes a call
209 # into it, we'll end up with a core-dump due to some weirdness
210 # in dlopen(). If we're installing anew, we need to update the
211 # config and then restart. Either way, it's safe to stop it
212 # unconditionally here
213 sh
/etc
/init.d
/monitor stop ||
:
214 sh
/etc
/init.d
/monitor slay ||
:
216 %preun -n monitor
-merlin
217 if [ $
1 -eq
0 ]; then
218 # removing the merlin module entirely
219 sh
/etc
/init.d
/monitor stop ||
:
220 sh
/etc
/init.d
/monitor slay ||
:
221 sed
-i
/merlin.so
/d
%prefix/etc
/nagios.cfg
222 sh
/etc
/init.d
/monitor start ||
:
223 sh
/etc
/init.d
/merlind stop ||
:
226 %post -n monitor
-merlin
227 sed
-i 's
#import_program = /opt/monitor/op5/merlin/import.php#import_program = /opt/monitor/op5/merlin/ocimp#g' %mod_path/merlin.conf
228 %mod_path/install-merlin.sh
%install_args --install=config ||
:
229 sh
/etc
/init.d
/monitor start ||
:
233 %defattr(-,root
,root
)
234 %config(noreplace
) %mod_path/merlin.conf
235 %mod_path/sample.merlin.conf
238 %mod_path/install-merlin.sh
239 %_sysconfdir/logrotate.d
/merlin
240 %_sysconfdir/op5kad
/conf.d
/merlin.kad
241 %_sysconfdir/nrpe.d
/nrpe
-merlin.cfg
249 %files -n monitor
-merlin
250 %defattr(-,root
,root
)
252 %_libdir/merlin
/merlin.so
256 %defattr(-,root
,root
)
264 %_sysconfdir/cron.d
/*
266 /opt
/monitor
/op5
/nacoma
/hooks
/save
/merlin_hook.py
*
268 %attr(700, -, -) %_libdir/merlin
/mon
/syscheck.db_mysql_check.sh
269 %attr(700, -, -) %_libdir/merlin
/mon
/syscheck.fs_ext_state.sh
270 %attr(700, -, -) %_libdir/merlin
/mon
/syscheck.proc_smsd.sh
272 %exclude %_libdir/merlin
/mon
/test.py
*
273 %exclude %_libdir/merlin
/mon
/run
-ci
-test.sh
274 %exclude %_libdir/merlin
/merlin.so
277 %_libdir/merlin
/mon
/test.py
*
278 %_libdir/merlin
/mon
/run
-ci
-test.sh
284 * Tue Mar
17 2009 Andreas Ericsson
<ae@op5.se
>
285 - Initial specfile creation.