summarylogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--.SRCINFO23
-rw-r--r--PKGBUILD81
-rw-r--r--check_mk.install27
-rw-r--r--setup.sh.patch50
4 files changed, 140 insertions, 41 deletions
diff --git a/.SRCINFO b/.SRCINFO
index 285efc2810d0..924158cb84af 100644
--- a/.SRCINFO
+++ b/.SRCINFO
@@ -1,21 +1,30 @@
-# Generated by mksrcinfo v8
-# Sun Feb 21 21:33:41 UTC 2016
pkgbase = check_mk
pkgdesc = A comprehensive IT monitoring solution in the tradition of Nagios
- pkgver = 1.2.6p16
+ pkgver = 1.2.8p13
pkgrel = 1
url = http://mathias-kettner.com/check_mk.html
install = check_mk.install
arch = any
license = GPL2
depends = python2
- depends = nagios
+ depends = nagios>=4.0.0
depends = nagios-plugins
depends = xinetd
- depends = mod_python
+ depends = mod_python2
depends = apache
- source = https://mathias-kettner.de/support/1.2.6p16/check_mk-1.2.6p16.cre.tar.gz
- sha256sums = 102461b4ebba1ffa5620f9f2d21328a78183a537cf7bcb91e3e6c6db63bbadf7
+ depends = monitoring-plugins
+ optdepends = pnp4nagios: Graphing performance data
+ backup = etc/nagios/htpasswd.users
+ source = https://mathias-kettner.de/download/check_mk-1.2.8p13.tar.gz
+ source = check_mk_templates.cfg.patch
+ source = mkp.patch
+ source = check_mk.patch
+ source = setup.sh.patch
+ md5sums = df04190dea014f586f2723a6fb6b5419
+ md5sums = e10a352fff0563bddeb788c7f9aee759
+ md5sums = 5e8cb4a9ca2b7e17c1c902be43808653
+ md5sums = dff7c1d42947b4b54e2953dd31def78a
+ md5sums = 7c426024053ec772d21ce042776f9497
pkgname = check_mk
diff --git a/PKGBUILD b/PKGBUILD
index 5a500bcaa9c2..218cb3aba0e4 100644
--- a/PKGBUILD
+++ b/PKGBUILD
@@ -1,36 +1,47 @@
-# Maintainer: Tom Moore <t.moore01@gmail.com>
+# Maintainer: Georg Pichler <georg.pichler@gmail.com>
_rtfm=n # you want documentation? (y / n)
_other_agents=n # you want agents for other operating systems? (y / n)
+_agent=n # agent is in seperate package check_mk-agent
pkgname=check_mk
-pkgver=1.2.6p16
+pkgver=1.2.8p13
pkgrel=1
pkgdesc="A comprehensive IT monitoring solution in the tradition of Nagios"
license=('GPL2')
arch=('any')
url="http://mathias-kettner.com/check_mk.html"
-depends=('python2' 'nagios' 'nagios-plugins' 'xinetd' 'mod_python' 'apache')
+depends=( 'python2'
+ 'nagios>=4.0.0'
+ 'nagios-plugins'
+ 'xinetd'
+ 'mod_python2'
+ 'apache'
+ 'monitoring-plugins'
+ )
+optdepends=('pnp4nagios: Graphing performance data')
source=(
- "https://mathias-kettner.de/support/${pkgver}/${pkgname}-${pkgver}.cre.tar.gz"
- #'files_shebang.txt'
- #'check_mk_templates.cfg.patch'
- #'index.py.patch'
- #'mkp.patch'
- #'check_mk.patch'
-)
-sha256sums=(
- '102461b4ebba1ffa5620f9f2d21328a78183a537cf7bcb91e3e6c6db63bbadf7'
-# '4eb6e74e1e0bda172e6e11de5087ed29409f2cc38292e32de131c6c3fd687411'
-# 'f0bb81a195347ab0d46c8b34921021200f67f490fbe4be538e5d0c99b21e1400'
-# '7488ab4d5d5e0686f477a14456585015a9d2c9cdb3cdeea383507b70db8a060a'
-# 'f68f4593e15010004b3abf1c8fd92638efd34c92e0a93e7810b3a972ce0bfee7'
-# 'e577f3549b5f3a39e974aa9ab979c67722f8ef0a8bbb434cf6b1b5ca165fe473'
+ "https://mathias-kettner.de/download/${pkgname}-${pkgver}.tar.gz"
+ 'check_mk_templates.cfg.patch'
+ 'mkp.patch'
+ 'check_mk.patch'
+ 'setup.sh.patch'
)
+md5sums=('df04190dea014f586f2723a6fb6b5419'
+ 'e10a352fff0563bddeb788c7f9aee759'
+ '5e8cb4a9ca2b7e17c1c902be43808653'
+ 'dff7c1d42947b4b54e2953dd31def78a'
+ '7c426024053ec772d21ce042776f9497')
+
install="${pkgname}.install"
+backup=( 'etc/nagios/htpasswd.users' )
package() {
cd "${srcdir}/${pkgname}-${pkgver}"
+
+ # patch setup file
+ patch "./setup.sh" "${srcdir}/setup.sh.patch"
+
DESTDIR="${pkgdir}" \
wwwuser='http' \
nagios_binary='/usr/bin/nagios' \
@@ -38,28 +49,45 @@ package() {
nagpipe='/var/nagios/rw/nagios.cmd' \
check_result_path='/var/nagios/spool/checkresults' \
nagios_status_file='/var/nagios/status.dat' \
- check_icmp_path='/usr/share/nagios/libexec/check_icmp' \
+ check_icmp_path='/usr/lib/monitoring-plugins/check_icmp' \
apache_config_dir='/etc/httpd/conf/extra' \
livesock='/var/nagios/rw/live' \
+ nagios_version='4.2.2' \
./setup.sh
+
# Fix python shebangs:
cd "${pkgdir}"
- for f in `cat "${srcdir}/files_shebang.txt"`; do
- echo "#!/usr/bin/python2" > "${f}.new"
- cat "${f}" | tail -n +2 >> "${f}.new"
- cat "${f}.new" > "${f}"
- rm -f "${f}.new"
+ for f in `grep -rl '#!/usr/bin/python' .`; do
+ sed -i 's_#!/usr/bin/python_#!/usr/bin/env python2_g' "${f}"
done
# Fix other python2 stuff:
patch "./usr/share/check_mk/check_mk_templates.cfg" "${srcdir}/check_mk_templates.cfg.patch"
- patch "./usr/share/check_mk/web/htdocs/index.py" "${srcdir}/index.py.patch"
patch "./usr/bin/mkp" "${srcdir}/mkp.patch"
patch "./usr/bin/check_mk" "${srcdir}/check_mk.patch"
+
# Add symlinks for the agent:
mkdir -p "./usr/bin" "./etc/xinetd.d"
ln -s "/usr/share/check_mk/agents/check_mk_agent.linux" "./usr/bin/check_mk_agent"
ln -s "/usr/share/check_mk/agents/xinetd.conf" "./etc/xinetd.d/check_mk"
ln -s "/usr/share/check_mk/agents/waitmax" "./usr/bin/waitmax"
+
+ # Use proper webapps directory for apache config
+ mkdir -p "./etc/webapps/check_mk"
+ mv "./etc/httpd/conf/extra/zzz_check_mk.conf" "./etc/webapps/check_mk/apache.example.conf"
+
+ # Fixing directory permissions
+ chmod 0775 "./etc/nagios"
+ chmod 0775 "./etc/nagios/objects"
+ chmod 0750 "./etc/sudoers.d"
+
+ # Change directory owners
+ chown -R nagios:nagios "var/lib/check_mk"
+ chmod -R 0775 "var/lib/check_mk"
+ chown nagios:nagios "etc/check_mk/conf.d"
+ chmod 0775 "etc/check_mk/conf.d"
+ chown nagios:nagios "etc/check_mk/multisite.d"
+ chmod 0775 "etc/check_mk/multisite.d"
+
# Remove docs if the user wants it:
[[ "${_rtfm}" = "n" ]] && rm -rf "./usr/share/doc"
# Remove agents if the user wants it:
@@ -67,4 +95,9 @@ package() {
rm -rf "./usr/share/check_mk/agents/windows/"
rm -f "./usr/share/check_mk/agents/check_mk_agent."{freebsd,macosx,openvms,netbsd,aix,hpux,solaris,openbsd}
fi
+ # Remove agent if the user wants it:
+ if [[ "${_agent}" = "n" ]]; then
+ rm -rf "./etc/xinetd.d/"
+ rm -f "./usr/bin/check_mk_agent"
+ fi
}
diff --git a/check_mk.install b/check_mk.install
index ec7958743994..572eb1f536c9 100644
--- a/check_mk.install
+++ b/check_mk.install
@@ -1,16 +1,23 @@
post_install() {
- echo " ==> Check_MF is now installed."
+ echo " ==> Check_MK is now installed."
echo " ==> To use it, please do the following steps:"
- echo " 1. Edit /etc/check_mk/main.mk and add your hosts."
- echo " 2. Install the check_mk_agent and start xinetd on every host."
- echo " 3. Run cmk -I to autodetect services on the hosts."
+ echo " 1. Setup nagios (see wiki) and make sure it's working."
+ echo " 2. Don't forget to add the user \"http\" to the group \"nagios\":"
+ echo " usermod -G nagios -a http"
+ echo " 3. Install the check_mk_agent and start xinetd on every host."
echo " 4. Run check_mk -O to generate /etc/nagios/objects/check_mk_objects.cfg"
echo " 5. Add the following lines to your /etc/nagios/nagios.cfg:"
- echo " cfg_file=/etc/nagios/objects/check_mk_objects.cfg"
echo " cfg_file=/etc/nagios/objects/check_mk_templates.cfg"
- echo " 6. Add the following line to your /etc/httpd/conf/httpd.conf:"
- echo " Include conf/extra/zzz_check_mk.conf"
- echo " 7. Add the user your webserver is running as to the nagios group."
- echo " 8. Configure mod_python."
- echo " 9. Restart your webserver and nagios."
+ echo " cfg_file=/etc/nagios/objects/check_mk_objects.cfg"
+ echo " broker_module=/usr/lib/check_mk/livestatus.o /var/nagios/rw/live"
+ echo " 6. Copy or symlink /etc/webapps/check_mk/apache.example.conf"
+ echo " to /etc/httpd/conf/extra/check_mk.conf and include the following"
+ echo " following line to your /etc/httpd/conf/httpd.conf:"
+ echo " Include conf/extra/check_mk.conf"
+ echo " 7. Configure mod_python2:"
+ echo " Add the following line to /etc/httpd/conf/httpd.conf:"
+ echo " LoadModule python_module modules/mod_python.so"
+ echo " 8. Restart your webserver and nagios:"
+ echo " systemctl restart httpd"
+ echo " systemctl restart nagios"
}
diff --git a/setup.sh.patch b/setup.sh.patch
new file mode 100644
index 000000000000..33402b1eb107
--- /dev/null
+++ b/setup.sh.patch
@@ -0,0 +1,50 @@
+--- setup.sh.orig 2016-10-20 22:39:33.000000000 +0200
++++ setup.sh 2016-11-15 01:30:10.986666666 +0100
+@@ -738,33 +738,10 @@
+
+ create_sudo_configuration ()
+ {
+- # sudo only possible if running as root
+- if [ $UID != 0 ] ; then
+- return
+- fi
+-
++ mkdir -p $DESTDIR/etc/sudoers.d
+ sudolines="Defaults:$wwwuser !requiretty\n$wwwuser ALL = (root) NOPASSWD: $bindir/check_mk --automation *"
+-
+- if [ ! -e /etc/sudoers ] ; then
+- echo "You do not have sudo installed. Please install sudo "
+- echo "and add the following line to /etc/sudoers if you want"
+- echo "to use WATO - the Check_MK Web Administration Tool"
+- echo
+- echo -e "$sudolines"
+- echo
+- echo
+- return
+- fi
+-
+- if fgrep -q 'check_mk --automation' /etc/sudoers 2>/dev/null
+- then
+- # already present. Do not touch.
+- return
+- fi
+-
+- echo >> /etc/sudoers
+- echo "# Needed for WATO - the Check_MK Web Administration Tool" >> /etc/sudoers
+- echo -e "$sudolines" >> /etc/sudoers
++ echo "# Needed for WATO - the Check_MK Web Administration Tool" > $DESTDIR/etc/sudoers.d/check_mk
++ echo -e "$sudolines" >> $DESTDIR/etc/sudoers.d/check_mk
+ }
+
+ while true
+@@ -1049,8 +1026,9 @@
+ # WATO. Also create an empty and Apache-writable auth.serials
+ serials_file=$DESTDIR${htpasswd_file%/*}/auth.serials &&
+ touch "$serials_file" &&
++ touch "$DESTDIR${htpasswd_file}" &&
+ (chown $wwwuser "$serials_file" || true) &&
+- (chown $wwwuser "$htpasswd_file" || true) &&
++ (chown $wwwuser "$DESTDIR$htpasswd_file" || true) &&
+ create_sudo_configuration &&
+ if [ "$enable_mkeventd" = yes ]
+ then