Skip to content

Commit

Permalink
Moved Check_MK into brand-new GIT repository
Browse files Browse the repository at this point in the history
The first new version available via GIT will
be 1.1.0beta17
  • Loading branch information
MathiasKettner committed Nov 16, 2009
0 parents commit 77fde41
Show file tree
Hide file tree
Showing 350 changed files with 41,300 additions and 0 deletions.
7 changes: 7 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
*~
check_mk-*.spec
check_mk-*.tar.gz
mk-livestatus-*.tar.gz
rpm.buildroot/
rpm.topdir/
*.rpm
5 changes: 5 additions & 0 deletions AUTHORS
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
check_mk was invented and implemented by Mathias Kettner
<mk@mathias-kettner.de>.

Please have a look at http://mathias-kettner.de or
http://mathias-kettner.com, if you want to learn more about me.
341 changes: 341 additions & 0 deletions COPYING

Large diffs are not rendered by default.

497 changes: 497 additions & 0 deletions ChangeLog

Large diffs are not rendered by default.

173 changes: 173 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,173 @@
# +------------------------------------------------------------------+
# | _ _ _ |
# | __| |_ ___ __| |__ _ __ | |__ |
# | / _| ' \/ -_) _| / / | ' \| / / |
# | \__|_||_\___\__|_\_\_|_|_|_|_\_\ |
# | |___| |
# | _ _ __ _ _ _ ____ |
# | / | / | / \| |__ ___| |_ __ _/ |__ | |
# | | |_| || () | '_ \/ -_) _/ _` | | / / |
# | |_(_)_(_)__/|_.__/\___|\__\__,_|_|/_/ |
# | check_mk 1.1.0beta17 |
# | |
# | Copyright Mathias Kettner 2009 mk@mathias-kettner.de |
# +------------------------------------------------------------------+
#
# This file is part of check_mk 1.1.0beta17.
# The official homepage is at http://mathias-kettner.de/check_mk.
#
# check_mk is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License as published by
# the Free Software Foundation in version 2. check_mk is distributed
# in the hope that it will be useful, but WITHOUT ANY WARRANTY; with-
# out even the implied warranty of MERCHANTABILITY or FITNESS FOR A
# PARTICULAR PURPOSE. See the GNU General Public License for more de-
# ails. You should have received a copy of the GNU General Public
# License along with GNU Make; see the file COPYING. If not, write
# to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
# Boston, MA 02110-1301 USA.

SHELL = /bin/bash
VERSION = 1.1.0beta17
NAME = check_mk
RPM_TOPDIR = rpm.topdir
RPM_BUILDROOT = rpm.buildroot
WWWROOT = /srv/www/htdocs
PREFIX = /usr
BINDIR = $(PREFIX)/bin
CONFDIR = /etc/$(NAME)
LIBDIR = $(PREFIX)/lib/$(NAME)
DISTNAME = $(NAME)-$(VERSION)
TAROPTS = --owner=root --group=root --exclude=.svn --exclude=*~
DOWNLOADURL = http://mathias-kettner.de/download/$(DISTNAME).tar.gz
CHECKMANDIR = /home/mk/svn/mkde/htdocs/checkmk

.PHONY: help install clean

all: dist

help:
@echo "make --> dist, rpm and deb"
@echo "make dist --> create TGZ package"
@echo "make deb --> create DEB package"
@echo "make rpm --> create RPM package"
@echo "make DESTDIR=/tmp/hirn install --> install directly"
@echo "make version --> switch to new version"
@echo "make headers --> create/update fileheades"

dist: mk-livestatus
@echo "--------------------------------------------------------------------------"
@echo "Making $(DISTNAME)"
rm -rf $(DISTNAME)
mkdir -p $(DISTNAME)
tar czf $(DISTNAME)/checks.tar.gz $(TAROPTS) -C checks $$(cd checks ; ls)
tar czf $(DISTNAME)/checkman.tar.gz $(TAROPTS) -C checkman $$(cd checkman ; ls)
tar czf $(DISTNAME)/htdocs.tar.gz $(TAROPTS) -C htdocs $$(cd htdocs ; ls *.php *.css *.png *.gif)
tar czf $(DISTNAME)/web.tar.gz $(TAROPTS) -C web $$(cd web ; ls *.py *.css *.jpg *.png)
tar czf $(DISTNAME)/livestatus.tar.gz $(TAROPTS) -C livestatus $$(cd livestatus ; ls *.{h,c,cc} Makefile nagios/*.h )
tar czf $(DISTNAME)/pnp-templates.tar.gz $(TAROPTS) -C pnp-templates $$(cd pnp-templates ; ls *.php)
tar cf $(DISTNAME)/doc.tar $(TAROPTS) -C doc --exclude .svn --exclude "*~" \
check_mk_templates.cfg check_mk.1 \
check_mk.css screenshot1.png Abstract README helpers \
check_mk{,.trans}.200.png quickstart_debian.txt windows \
df_magic_number.py livestatus
tar rf $(DISTNAME)/doc.tar $(TAROPTS) COPYING AUTHORS ChangeLog
gzip $(DISTNAME)/doc.tar
tar czf $(DISTNAME)/modules.tar.gz $(TAROPTS) -C modules $$(cd modules ; ls *.py)

cp main.mk main.mk-$(VERSION)
tar czf $(DISTNAME)/conf.tar.gz $(TAROPTS) main.mk-$(VERSION)
rm -f main.mk-$(VERSION)
tar cf $(DISTNAME)/agents.tar $(TAROPTS) -C agents --exclude "*~" $$(cd agents ; ls | grep -v windows )
tar rf $(DISTNAME)/agents.tar $(TAROPTS) -C agents windows/{check_mk_agent.exe,check_mk_agent.cc,Makefile}
gzip $(DISTNAME)/agents.tar
install -m 755 scripts/*.{sh,py} $(DISTNAME)
install -m 644 COPYING AUTHORS ChangeLog doc/INSTALL $(DISTNAME)
echo "$(VERSION)" > $(DISTNAME)/VERSION
tar czf $(DISTNAME).tar.gz $(DISTNAME)
rm -rf $(DISTNAME)
@echo "=============================================================================="
@figlet " finished."
@echo "=============================================================================="
./listtar $(DISTNAME).tar.gz

mk-livestatus:
rm -rf mk-livestatus-$(VERSION)
mkdir -p mk-livestatus-$(VERSION)
cp livestatus/*{.c,.cc,.h,Makefile} mk-livestatus-$(VERSION)
mkdir -p mk-livestatus-$(VERSION)/nagios
cp livestatus/nagios/*.h mk-livestatus-$(VERSION)/nagios/
tar czf mk-livestatus-$(VERSION).tar.gz mk-livestatus-$(VERSION)
rm -rf mk-livestatus-$(VERSION)


version:
@newversion=$$(dialog --stdout --inputbox "New Version:" 0 0 "$(VERSION)") ; \
if [ -n "$$newversion" ] ; then \
sed -ri 's/^(VERSION[[:space:]]*= *).*/\1'"$$newversion/" Makefile ; \
./headrify ; \
fi ; \
for agent in agents/* ; do \
sed -i 's/echo Version: [0-9.a-z]*/'"echo Version: $$newversion/g" $$agent; \
done ; \
sed -i 's/#define CHECK_MK_VERSION .*/#define CHECK_MK_VERSION "'$$newversion'"/' agents/windows/check_mk_agent.cc ; \
sed -i 's/^VERSION=.*/VERSION='"$$newversion"'/' scripts/setup.sh ; \
echo 'check-mk_$$newversion-1_all.deb net optional' > debian/files ; \
sed -i 's/^MKVERSION=.*/MKVERSION=\$${3:-'"$$newversion}"'/' scripts/install_nagios_on_lenny.sh

headers:
./headrify

rpm $(DISTNAME)-1.noarch.rpm:
rm -rf $(RPM_TOPDIR)
mkdir -p $(RPM_TOPDIR)/RPMS
mkdir -p $(RPM_TOPDIR)/SRPMS
mkdir -p $(RPM_TOPDIR)/SOURCES
mkdir -p $(RPM_TOPDIR)/BUILD
mkdir -p $(RPM_TOPDIR)/SPECS
$(MAKE) dist
cp $(DISTNAME).tar.gz $(RPM_TOPDIR)/SOURCES
sed "s/^Version:.*/Version: $(VERSION)/" $(NAME).spec > $(NAME)-$(VERSION).spec
rpmbuild -ba --target=noarch --buildroot "$$(pwd)/$(RPM_BUILDROOT)" --define "_topdir $$(pwd)/$(RPM_TOPDIR)" $(NAME)-$(VERSION).spec
rm -f $(DISTNAME).spec
mv -v $(RPM_TOPDIR)/RPMS/*/* .
mv -v $(RPM_TOPDIR)/SRPMS/* .
rm -rf $(RPM_TOPDIR)


deb: deb-agent

deb-base:
rm -rf deb.bauen
mkdir -p deb.bauen
tar xzf $(DISTNAME).tar.gz -C deb.bauen
mv deb.bauen/check_mk-$(VERSION) deb.bauen/check-mk-$(VERSION)
cp -prv debian deb.bauen/check-mk-$(VERSION)/
cd deb.bauen/check-mk-$(VERSION) ; dpkg-buildpackage -uc -us -rfakeroot
mv -v deb.bauen/*.deb .
rm -rf deb.bauen

deb-agent: $(NAME)-agent-$(VERSION)-1.noarch.rpm $(NAME)-agent-logwatch-$(VERSION)-1.noarch.rpm
@echo "Sorry. Debian packages currently via alien"
@for pac in $^ ; do \
fakeroot alien --scripts -d $$pac ; \
done


clean:
rm -rf dist.tmp rpm.topdir *.rpm *.deb mk-livestatus-*.tar.gz $(NAME)-*.tar.gz *~ counters autochecks precompiled cache
$(MAKE) -C livestatus clean
find -name "*~" | xargs rm -f


check:
@set -e ; for checkfile in *.HS ; do \
echo -n "Checking config output of $${checkfile%.HS}..." ; \
diff -u <(./check_mk -c $${checkfile%.HS} -HS | grep -v 'created by check_mk') \
<(grep -v 'created by check_mk' < $$checkfile) && echo OK || { \
echo "ERROR. Update reference with:" ; \
echo "./check_mk -c $${checkfile%.HS} -HS > $$checkfile" ; \
exit 1 ; } ; \
done

-include Makefile.private
25 changes: 25 additions & 0 deletions Makefile.private
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# These are targets only needed by the maintainers of
# the official distribution of Check_MK

upload:
scp $(DISTNAME).tar.gz mathias-kettner.de:/var/www/80/mathias-kettner.de/download/
diff <(curl -s $(DOWNLOADURL)) $(DISTNAME).tar.gz
@echo "Alles OK. URL ist: $(DOWNLOADURL)"

mkde:
echo 'TI:Table of check types (incomplete)' > $(CHECKMANDIR)/checks
echo "DT:$$(date +%F)" >> $(CHECKMANDIR)/checks
echo "H1:Table of checks with documentation" >> $(CHECKMANDIR)/checks
echo "The following table shows all checks in the current check_mk distribution " >> $(CHECKMANDIR)/checks
echo "that provide online documentation. You can see the same documentation " >> $(CHECKMANDIR)/checks
echo "by calling check_mk with the option <b>-M</b> and the name of the check, for example:" >> $(CHECKMANDIR)/checks
echo "C+:" >> $(CHECKMANDIR)/checks
echo "RP:check_mk -M ps" >> $(CHECKMANDIR)/checks
echo "C-:" >> $(CHECKMANDIR)/checks
echo "H2:Table of documented checks" >> $(CHECKMANDIR)/checks
echo "<table><tr><th>Name</th><th>Title</th></tr>">> $(CHECKMANDIR)/checks
for check in $$(cd checkman ; ls | fgrep -v '~') ; \
do ./check_mk --nowiki -M $$check > $(CHECKMANDIR)/check_$$check 2>> $(CHECKMANDIR)/checks ; \
done
echo "</table>" >> $(CHECKMANDIR)/checks
make -C $(CHECKMANDIR)/../.. install
45 changes: 45 additions & 0 deletions agents/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
# +------------------------------------------------------------------+
# | _ _ _ |
# | __| |_ ___ __| |__ _ __ | |__ |
# | / _| ' \/ -_) _| / / | ' \| / / |
# | \__|_||_\___\__|_\_\_|_|_|_|_\_\ |
# | |___| |
# | _ _ __ _ _ _ ____ |
# | / | / | / \| |__ ___| |_ __ _/ |__ | |
# | | |_| || () | '_ \/ -_) _/ _` | | / / |
# | |_(_)_(_)__/|_.__/\___|\__\__,_|_|/_/ |
# | check_mk 1.1.0beta17 |
# | |
# | Copyright Mathias Kettner 2009 mk@mathias-kettner.de |
# +------------------------------------------------------------------+
#
# This file is part of check_mk 1.1.0beta17.
# The official homepage is at http://mathias-kettner.de/check_mk.
#
# check_mk is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License as published by
# the Free Software Foundation in version 2. check_mk is distributed
# in the hope that it will be useful, but WITHOUT ANY WARRANTY; with-
# out even the implied warranty of MERCHANTABILITY or FITNESS FOR A
# PARTICULAR PURPOSE. See the GNU General Public License for more de-
# ails. You should have received a copy of the GNU General Public
# License along with GNU Make; see the file COPYING. If not, write
# to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
# Boston, MA 02110-1301 USA.

waitmax: waitmax.c
@if type diet >/dev/null ; then \
echo "Compiling with diet (please ignore diet-warnings)..." ; \
diet gcc -s -o waitmax waitmax.c ; \
else \
echo "WARNING: your binary is not portable. Please compile " ; \
echo "with dietlibc on 32-Bit to get portable statically " ; \
echo "linked binary." ; \
echo ; \
echo "Compiling with normal gcc..." ; \
gcc -s -o waitmax waitmax.c ; \
fi
@echo "Fine. Typing 'make install' as root now will install into /usr/bin"

clean:
rm -rf *~ waitmax
111 changes: 111 additions & 0 deletions agents/check_mk_agent.aix
Original file line number Diff line number Diff line change
@@ -0,0 +1,111 @@
#!/bin/sh
# +------------------------------------------------------------------+
# | _ _ _ |
# | __| |_ ___ __| |__ _ __ | |__ |
# | / _| ' \/ -_) _| / / | ' \| / / |
# | \__|_||_\___\__|_\_\_|_|_|_|_\_\ |
# | |___| |
# | _ _ __ _ _ _ ____ |
# | / | / | / \| |__ ___| |_ __ _/ |__ | |
# | | |_| || () | '_ \/ -_) _/ _` | | / / |
# | |_(_)_(_)__/|_.__/\___|\__\__,_|_|/_/ |
# | check_mk 1.1.0beta17 |
# | |
# | Copyright Mathias Kettner 2009 mk@mathias-kettner.de |
# +------------------------------------------------------------------+
#
# This file is part of check_mk 1.1.0beta17.
# The official homepage is at http://mathias-kettner.de/check_mk.
#
# check_mk is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License as published by
# the Free Software Foundation in version 2. check_mk is distributed
# in the hope that it will be useful, but WITHOUT ANY WARRANTY; with-
# out even the implied warranty of MERCHANTABILITY or FITNESS FOR A
# PARTICULAR PURPOSE. See the GNU General Public License for more de-
# ails. You should have received a copy of the GNU General Public
# License along with GNU Make; see the file COPYING. If not, write
# to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
# Boston, MA 02110-1301 USA.

export MK_LIBDIR="/to/be/changed"
export MK_CONFDIR="/to/be/changed"

# All executables in PLUGINSDIR will simply be executed and their
# ouput appended to the output of the agent. Plugins define their own
# sections and must output headers with '<<<' and '>>>'
PLUGINSDIR=$MK_LIBDIR/plugins

# All executables in LOCALDIR will by executabled and their
# output inserted into the section <<<local>>>. They must
# *not* output a section header. A local extension may output
# zero, one or several lines. Each line must be in the form
# EXITCODE CHECK_NAME PERFDATA CHECK_OUTPUT
# EXITCODE is 0, 1, 2 or 3
# CHECK_NAME will be used as Nagios's service_descriptions and
# must be unique for this host
# PERFDATA is optional performance data in the standard Nagios
# format for variable=value;warn;crit;min;max. You can send
# only one variable currently. If you do not want to send
# performance data output a single dash instead
# CHECK_OUTPUT will be used by Nagios as the check's output
# EXITCODE, CHECK_NAME and PERFDATA must not contain spaces
# or tabs. CHECK_OUTPUT may contain spaces and tabs
LOCALDIR=$MK_LIBDIR/local


echo '<<<check_mk>>>'
echo Version: 1.1.0beta17

echo '<<<df>>>'
df -kP | sed 's/ / - /' | grep -v ^/proc

echo '<<<ps>>>'
ps -ef -F args | sed 1d

if type lparstat >/dev/null 2>&1
then
echo '<<<lparstat_aix>>>'
lparstat | tail -n1
fi

echo '<<<vmstat_aix>>>'
vmstat | tail -n1

echo '<<<mpstat_aix>>>'
mpstat -a | tail -n1


if cd $PLUGINSDIR 2>/dev/null
then
for skript in $(ls)
do
if [ -x "$skript" ] ; then
./$skript
fi
done
fi


echo '<<<local>>>'
if cd $LOCALDIR 2>/dev/null
then
for skript in $(ls)
do
if [ -x "$skript" ] ; then
./$skript
fi
done
fi

# MK's Remote Plugin Executor
if [ -e "$MK_CONFDIR/mrpe.cfg" ]
then
echo '<<<mrpe>>>'
grep -Ev '^[[:space:]]*($|#)' "$MK_CONFDIR/mrpe.cfg" | \
while read descr cmdline
do
OUTPUT=$($cmdline)
echo "$? $descr $OUTPUT"
done
fi
Loading

0 comments on commit 77fde41

Please sign in to comment.