Refactoring: Changed all check parameters starting with an 'o' to the new rulespec...
[check_mk.git] / agents / check-mk-agent.spec
blob2f33493d25b34830cefe721573e6e54c7b8eb700
1 # +------------------------------------------------------------------+
2 # | ____ _ _ __ __ _ __ |
3 # | / ___| |__ ___ ___| | __ | \/ | |/ / |
4 # | | | | '_ \ / _ \/ __| |/ / | |\/| | ' / |
5 # | | |___| | | | __/ (__| < | | | | . \ |
6 # | \____|_| |_|\___|\___|_|\_\___|_| |_|_|\_\ |
7 # | |
8 # | Copyright Mathias Kettner 2014 mk@mathias-kettner.de |
9 # +------------------------------------------------------------------+
11 # This file is part of Check_MK.
12 # The official homepage is at http://mathias-kettner.de/check_mk.
14 # check_mk is free software; you can redistribute it and/or modify it
15 # under the terms of the GNU General Public License as published by
16 # the Free Software Foundation in version 2. check_mk is distributed
17 # in the hope that it will be useful, but WITHOUT ANY WARRANTY; with-
18 # out even the implied warranty of MERCHANTABILITY or FITNESS FOR A
19 # PARTICULAR PURPOSE. See the GNU General Public License for more de-
20 # tails. You should have received a copy of the GNU General Public
21 # License along with GNU Make; see the file COPYING. If not, write
22 # to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
23 # Boston, MA 02110-1301 USA.
25 Summary: Check_MK Agent for Linux
26 Name: check-mk-agent
27 Version: (automatically inserted)
28 Release: 1
29 License: GPL
30 Group: System/Monitoring
31 URL: http://mathias-kettner.de/check_mk.html
32 Vendor: Mathias Kettner GmbH
33 Source: check-mk-agent-%{_version}.tar.gz
34 BuildRoot: %{_topdir}/buildroot
35 AutoReq: off
36 AutoProv: off
37 BuildArch: noarch
38 Obsoletes: check_mk-agent check_mk_agent
39 Provides: check_mk-agent check_mk_agent
41 %description
42 The Check_MK Agent uses xinetd to provide information about the system
43 on TCP port 6556. This can be used to monitor the host via Check_MK.
45 %define _binaries_in_noarch_packages_terminate_build 0
47 %prep
48 %setup -n check-mk-agent-%{_version}
50 %install
52 R=$RPM_BUILD_ROOT
53 rm -rf $R
55 # install agent
56 # xinitd
57 mkdir -p $R/etc/xinetd.d
58 install -m 644 cfg_examples/xinetd.conf $R/etc/xinetd.d/check_mk
59 # Systemd
60 mkdir -p $R/etc/systemd/system
61 install -m 644 cfg_examples/systemd/check_mk\@.service $R/etc/systemd/system
62 install -m 644 cfg_examples/systemd/check_mk.socket $R/etc/systemd/system
63 mkdir -p $R/etc/check_mk
64 mkdir -p $R/usr/bin
65 install -m 755 check_mk_agent.linux $R/usr/bin/check_mk_agent
66 install -m 755 check_mk_caching_agent.linux $R/usr/bin/check_mk_caching_agent
67 install -m 755 waitmax $R/usr/bin
68 install -m 755 mk-job $R/usr/bin
69 mkdir -p $R/usr/lib/check_mk_agent/plugins
70 mkdir -p $R/usr/lib/check_mk_agent/local
71 mkdir -p $R/var/lib/check_mk_agent
72 mkdir -p $R/var/lib/check_mk_agent/job
73 mkdir -p $R/var/lib/check_mk_agent/spool
75 %clean
76 rm -rf $RPM_BUILD_ROOT
78 %files
79 %config(noreplace) /etc/xinetd.d/check_mk
80 %config(noreplace) /etc/systemd/system/check_mk@.service
81 %config(noreplace) /etc/systemd/system/check_mk.socket
82 /etc/check_mk
83 /usr/bin/*
84 /usr/lib/check_mk_agent
85 /var/lib/check_mk_agent
87 %define reload_xinetd if which xinetd >/dev/null 2>&1 ; then if pgrep -x xinetd >/dev/null ; then echo "Reloading xinetd..." ; service xinetd reload ; else echo "Starting xinetd..." ; service xinetd start ; fi ; fi
89 %define activate_xinetd if which xinetd >/dev/null 2>&1 && which chkconfig >/dev/null 2>&1 ; then echo "Activating startscript of xinetd" ; chkconfig xinetd on ; fi
91 %define cleanup_rpmnew if [ -f /etc/xinetd.d/check_mk.rpmnew ] ; then rm /etc/xinetd.d/check_mk.rpmnew ; fi
93 %define systemd_enable if which systemctl >/dev/null 2>&1 && ! which xinetd >/dev/null 2>&1 ; then echo "Enable Check_MK_Agent in systemd..." ; systemctl enable check_mk.socket ; systemctl restart sockets.target ; fi
95 %pre
96 if ! which xinetd >/dev/null 2>&1 && ! which systemctl >/dev/null 2>&1 ; then
97 echo
98 echo "---------------------------------------------"
99 echo "WARNING"
100 echo
101 echo "This package needs xinetd to be installed. "
102 echo "Currently you do not have installed xinetd. "
103 echo "Please install and start xinetd or install "
104 echo "and setup another inetd manually."
105 echo ""
106 echo "It's also possible to monitor via SSH without "
107 echo "an inetd."
108 echo "---------------------------------------------"
109 echo
112 %post
113 %cleanup_rpmnew
114 %activate_xinetd
115 %reload_xinetd
116 %systemd_enable
118 %postun
119 %reload_xinetd