Merge branch 'master' of mathias-kettner.de:omd
[omd.git] / packages / check_mk / Makefile
blob715341c2809f305759b7ee41d25c6766baeca5c0
1 include ../../Makefile.omd
3 SHELL = /bin/bash
4 NAME = check_mk
5 VERSION = 1.2.6p12
6 DIR = $(NAME)-$(VERSION)
7 EDIR = mkeventd-$(VERSION)
9 .PHONY: skel
11 build:
12 tar xzf $(DIR).tar.gz
13 tar xzf $(EDIR).tar.gz
14 cd $(EDIR)/src ; make
15 cd $(EDIR)/lib ; make
17 install:
18 export bindir='$(OMD_ROOT)/bin' ; \
19 export sharedir='$(OMD_ROOT)/share/check_mk' ; \
20 export checksdir='$(OMD_ROOT)/share/check_mk/checks' ; \
21 export modulesdir='$(OMD_ROOT)/share/check_mk/modules' ; \
22 export web_dir='$(OMD_ROOT)/share/check_mk/web' ; \
23 export mibsdir='$(OMD_ROOT)/share/snmp/mibs' ; \
24 export docdir='$(OMD_ROOT)/share/doc/check_mk' ; \
25 export checkmandir='$(OMD_ROOT)/share/check_mk/checkman' ; \
26 export agentsdir='$(OMD_ROOT)/share/check_mk/agents' ; \
27 export agentslibdir='/usr/lib/check_mk_agent' ; \
28 export nagios_binary='$(OMD_ROOT)/bin/nagios' ; \
29 export check_icmp_path='$(OMD_ROOT)/lib/nagios/plugins/check_icmp' ; \
30 export pnptemplates='$(OMD_ROOT)/share/check_mk/pnp-templates' ; \
31 export livebackendsdir='$(OMD_ROOT)/share/check_mk/livestatus' ; \
32 export libdir='$(OMD_ROOT)/lib/check_mk' ; \
33 export confdir='$(OMD_ROOT)/skel/etc/check_mk' ; \
34 export pnpconfdir='$(OMD_ROOT)/skel/etc/pnp4nagios' ; \
35 export pnprraconf='$(OMD_ROOT)/share/check_mk/pnp-rraconf' ; \
36 export apache_config_dir='/REMOVE/skel/etc/apache' ; \
37 export agentsconfdir='/etc/check_mk' ; \
38 export vardir='/REMOVE/var/lib/check_mk' ; \
39 export nagios_config_file='/REMOVE/etc/nagios/nagios.cfg' ; \
40 export nagconfdir='/REMOVE/etc/nagios/conf.d' ; \
41 export htpasswd_file='/REMOVE/etc/nagios/htpasswd' ; \
42 export nagios_startscript='/REMOVE/etc/init.d/nagios' ; \
43 export nagpipe='/REMOVE/var/run/nagios/rw/nagios.cmd' ; \
44 export rrddir='/REMOVE/var/lib/nagios/rrd' ; \
45 export nagios_status_file='/REMOVE/var/spool/nagios/status.dat' ; \
46 export livesock='/REMOVE/var/run/nagios/rw/live' ; \
47 export checkmk_web_uri='/nag01/check_mk' ; \
48 export nagiosurl='/nag01/nagios' ; \
49 export cgiurl='/nag01/nagios/cgi-bin' ; \
50 export pnp_url='/nag01/pnp4nagios/' ; \
51 export enable_livestatus='no' ; \
52 export nagios_auth_name='Nagios Access' ; \
53 export nagiosuser='nagios' ; \
54 export wwwgroup='nagios' ; \
55 cd $(DIR) ; DESTDIR=$(DESTDIR) ./setup.sh --yes
57 # Delete files we do not want to package
58 rm -rf $(DESTDIR)/REMOVE
59 rm -f $(DESTDIR)$(OMD_ROOT)/skel/etc/check_mk/*-*.mk
61 # Install special version of check_mk dealing with site specific defaults
62 install -m 755 check_mk $(DESTDIR)$(OMD_ROOT)/bin
63 ln -sfn check_mk $(DESTDIR)$(OMD_ROOT)/bin/cmk
64 echo -e '#!/bin/sh\nexec check_mk -P "$$@"' > $(DESTDIR)$(OMD_ROOT)/bin/mkp
65 chmod 755 $(DESTDIR)$(OMD_ROOT)/bin/mkp
67 # defaults.py for Multisite which redirects to site specific defaults
68 install -m 644 defaults.py $(DESTDIR)$(OMD_ROOT)/share/check_mk/web/htdocs
70 # Event Console
71 mkdir -p $(DESTDIR)$(OMD_ROOT)/bin
72 install -m 755 $(EDIR)/bin/* $(DESTDIR)$(OMD_ROOT)/bin
73 install -m 755 $(EDIR)/src/mkevent $(DESTDIR)$(OMD_ROOT)/bin
74 install -m 755 $(EDIR)/src/mkeventd_open514 $(DESTDIR)$(OMD_ROOT)/bin
75 mkdir -p $(DESTDIR)$(OMD_ROOT)/lib/nagios/plugins
76 install -m 755 $(EDIR)/lib/check_mkevents $(DESTDIR)$(OMD_ROOT)/lib/nagios/plugins
77 mkdir -p $(DESTDIR)$(OMD_ROOT)/share/check_mk/checks
78 install -m 644 $(EDIR)/checks/* $(DESTDIR)$(OMD_ROOT)/share/check_mk/checks
79 mkdir -p $(DESTDIR)$(OMD_ROOT)/share/check_mk/web
80 cp -pr $(EDIR)/web/* $(DESTDIR)$(OMD_ROOT)/share/check_mk/web
82 # Install the diskspace cleanup plugin
83 mkdir -p $(DESTDIR)$(OMD_ROOT)/share/diskspace
84 install -m 644 diskspace $(DESTDIR)$(OMD_ROOT)/share/diskspace/check_mk
86 # Install active checks
87 tar xzf $(DIR)/doc.tar.gz -C $(DESTDIR)$(OMD_ROOT)/lib/nagios/plugins \
88 --strip-components 2 --wildcards --no-anchored treasures/active_checks/*
89 chmod 755 $(DESTDIR)$(OMD_ROOT)/lib/nagios/plugins/*
91 skel:
92 rm -f $(SKEL)/etc/check_mk/main.mk-*
93 rm -f $(SKEL)/etc/check_mk/multisite.mk-*
95 clean:
96 rm -rf check_mk-*.*.*[0-9]
97 rm -rf mkeventd-*.*.*[0-9]
99 # Get new upstream version (as in VERSION)
100 # Adapt configuration files for skeleton from upstream version
101 upstream:
102 if [ ! -e check_mk-$(VERSION).tar.gz ] ; then rm -f check_mk-*.tar.gz ; wget http://mathias-kettner.de/download/check_mk-$(VERSION).tar.gz ; fi
103 if [ ! -e mkeventd-$(VERSION).tar.gz ] ; then rm -f mkeventd-*.tar.gz ; wget http://mathias-kettner.de/download/mkeventd-$(VERSION).tar.gz ; fi
104 # check_mk_templates.cfg -> enter correct URLs and paths
105 if tar tvzf check_mk-$(VERSION).tar.gz | grep check_mk-$(VERSION)/share.tar.gz >/dev/null 2>&1; then \
106 tar xzf check_mk-$(VERSION).tar.gz --to-stdout check_mk-$(VERSION)/share.tar.gz | \
107 tar xzf - --to-stdout check_mk_templates.cfg | \
108 sed -e 's-@CHECK_ICMP@-$$USER4$$/lib/nagios/plugins/check_icmp-g' \
109 -e 's-@BINDIR@/--g' \
110 -e 's-@VARDIR@-$$USER4$$/var/check_mk-g' \
111 -e 's-@PNPURL@-/###SITE###/pnp4nagios/-g' \
112 -e 's-@CGIURL@-/###SITE###/nagios/cgi\-bin-g' > \
113 skel/etc/nagios/conf.d/check_mk_templates.cfg ; \
114 else \
115 tar xzf check_mk-$(VERSION).tar.gz --to-stdout check_mk-$(VERSION)/doc.tar.gz | \
116 tar xzf - --to-stdout check_mk_templates.cfg | \
117 sed -e 's-@CHECK_ICMP@-$$USER4$$/lib/nagios/plugins/check_icmp-g' \
118 -e 's-@BINDIR@/--g' \
119 -e 's-@VARDIR@-$$USER4$$/var/check_mk-g' \
120 -e 's-@PNPURL@-/###SITE###/pnp4nagios/-g' \
121 -e 's-@CGIURL@-/###SITE###/nagios/cgi\-bin-g' > \
122 skel/etc/nagios/conf.d/check_mk_templates.cfg ; \
125 # multisite.mk - replace nagiosadmin with omadmin
126 tar xzf check_mk-$(VERSION).tar.gz --to-stdout check_mk-$(VERSION)/conf.tar.gz | \
127 tar xzf - --to-stdout multisite.mk-$(VERSION) | \
128 sed -e 's/nagiosadmin/omdadmin/g' \
129 -e 's@^nagvis_base_url.*@nagvis_base_url = "/###SITE###/nagvis"@' \
130 > skel/etc/check_mk/multisite.mk
132 # Add correct version number
133 sed -i "s/^check_mk_version.*/check_mk_version = '$(VERSION)'/" skel/etc/check_mk/defaults
135 git add check_mk-$(VERSION).tar.gz
136 git add mkeventd-$(VERSION).tar.gz