Compare commits

...

No commits in common. "pristine-tar" and "master" have entirely different histories.

73 changed files with 17071 additions and 4 deletions

8
AUTHORS Normal file
View File

@ -0,0 +1,8 @@
Check_MK was invented and implemented by Mathias Kettner
<mk@mathias-kettner.de>.
Currently Check_MK is being developed by the Mathias Kettner GmbH
with some contributions by the community (mainly checks).
Please have a look at http://mathias-kettner.de or
http://mathias-kettner.com, if you want to learn more about us.

341
COPYING Normal file
View File

@ -0,0 +1,341 @@
GNU GENERAL PUBLIC LICENSE
Version 2, June 1991
Copyright (C) 1989, 1991 Free Software Foundation, Inc.
59 Temple Place - Suite 330
Boston, MA 02111-1307, USA.
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
Preamble
The licenses for most software are designed to take away your
freedom to share and change it. By contrast, the GNU General Public
License is intended to guarantee your freedom to share and change free
software--to make sure the software is free for all its users. This
General Public License applies to most of the Free Software
Foundation's software and to any other program whose authors commit to
using it. (Some other Free Software Foundation software is covered by
the GNU Library General Public License instead.) You can apply it to
your programs, too.
When we speak of free software, we are referring to freedom, not
price. Our General Public Licenses are designed to make sure that you
have the freedom to distribute copies of free software (and charge for
this service if you wish), that you receive source code or can get it
if you want it, that you can change the software or use pieces of it
in new free programs; and that you know you can do these things.
To protect your rights, we need to make restrictions that forbid
anyone to deny you these rights or to ask you to surrender the rights.
These restrictions translate to certain responsibilities for you if you
distribute copies of the software, or if you modify it.
For example, if you distribute copies of such a program, whether
gratis or for a fee, you must give the recipients all the rights that
you have. You must make sure that they, too, receive or can get the
source code. And you must show them these terms so they know their
rights.
We protect your rights with two steps: (1) copyright the software, and
(2) offer you this license which gives you legal permission to copy,
distribute and/or modify the software.
Also, for each author's protection and ours, we want to make certain
that everyone understands that there is no warranty for this free
software. If the software is modified by someone else and passed on, we
want its recipients to know that what they have is not the original, so
that any problems introduced by others will not reflect on the original
authors' reputations.
Finally, any free program is threatened constantly by software
patents. We wish to avoid the danger that redistributors of a free
program will individually obtain patent licenses, in effect making the
program proprietary. To prevent this, we have made it clear that any
patent must be licensed for everyone's free use or not licensed at all.
The precise terms and conditions for copying, distribution and
modification follow.
GNU GENERAL PUBLIC LICENSE
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
0. This License applies to any program or other work which contains
a notice placed by the copyright holder saying it may be distributed
under the terms of this General Public License. The "Program", below,
refers to any such program or work, and a "work based on the Program"
means either the Program or any derivative work under copyright law:
that is to say, a work containing the Program or a portion of it,
either verbatim or with modifications and/or translated into another
language. (Hereinafter, translation is included without limitation in
the term "modification".) Each licensee is addressed as "you".
Activities other than copying, distribution and modification are not
covered by this License; they are outside its scope. The act of
running the Program is not restricted, and the output from the Program
is covered only if its contents constitute a work based on the
Program (independent of having been made by running the Program).
Whether that is true depends on what the Program does.
1. You may copy and distribute verbatim copies of the Program's
source code as you receive it, in any medium, provided that you
conspicuously and appropriately publish on each copy an appropriate
copyright notice and disclaimer of warranty; keep intact all the
notices that refer to this License and to the absence of any warranty;
and give any other recipients of the Program a copy of this License
along with the Program.
You may charge a fee for the physical act of transferring a copy, and
you may at your option offer warranty protection in exchange for a fee.
2. You may modify your copy or copies of the Program or any portion
of it, thus forming a work based on the Program, and copy and
distribute such modifications or work under the terms of Section 1
above, provided that you also meet all of these conditions:
a) You must cause the modified files to carry prominent notices
stating that you changed the files and the date of any change.
b) You must cause any work that you distribute or publish, that in
whole or in part contains or is derived from the Program or any
part thereof, to be licensed as a whole at no charge to all third
parties under the terms of this License.
c) If the modified program normally reads commands interactively
when run, you must cause it, when started running for such
interactive use in the most ordinary way, to print or display an
announcement including an appropriate copyright notice and a
notice that there is no warranty (or else, saying that you provide
a warranty) and that users may redistribute the program under
these conditions, and telling the user how to view a copy of this
License. (Exception: if the Program itself is interactive but
does not normally print such an announcement, your work based on
the Program is not required to print an announcement.)
These requirements apply to the modified work as a whole. If
identifiable sections of that work are not derived from the Program,
and can be reasonably considered independent and separate works in
themselves, then this License, and its terms, do not apply to those
sections when you distribute them as separate works. But when you
distribute the same sections as part of a whole which is a work based
on the Program, the distribution of the whole must be on the terms of
this License, whose permissions for other licensees extend to the
entire whole, and thus to each and every part regardless of who wrote it.
Thus, it is not the intent of this section to claim rights or contest
your rights to work written entirely by you; rather, the intent is to
exercise the right to control the distribution of derivative or
collective works based on the Program.
In addition, mere aggregation of another work not based on the Program
with the Program (or with a work based on the Program) on a volume of
a storage or distribution medium does not bring the other work under
the scope of this License.
3. You may copy and distribute the Program (or a work based on it,
under Section 2) in object code or executable form under the terms of
Sections 1 and 2 above provided that you also do one of the following:
a) Accompany it with the complete corresponding machine-readable
source code, which must be distributed under the terms of Sections
1 and 2 above on a medium customarily used for software interchange; or,
b) Accompany it with a written offer, valid for at least three
years, to give any third party, for a charge no more than your
cost of physically performing source distribution, a complete
machine-readable copy of the corresponding source code, to be
distributed under the terms of Sections 1 and 2 above on a medium
customarily used for software interchange; or,
c) Accompany it with the information you received as to the offer
to distribute corresponding source code. (This alternative is
allowed only for noncommercial distribution and only if you
received the program in object code or executable form with such
an offer, in accord with Subsection b above.)
The source code for a work means the preferred form of the work for
making modifications to it. For an executable work, complete source
code means all the source code for all modules it contains, plus any
associated interface definition files, plus the scripts used to
control compilation and installation of the executable. However, as a
special exception, the source code distributed need not include
anything that is normally distributed (in either source or binary
form) with the major components (compiler, kernel, and so on) of the
operating system on which the executable runs, unless that component
itself accompanies the executable.
If distribution of executable or object code is made by offering
access to copy from a designated place, then offering equivalent
access to copy the source code from the same place counts as
distribution of the source code, even though third parties are not
compelled to copy the source along with the object code.
4. You may not copy, modify, sublicense, or distribute the Program
except as expressly provided under this License. Any attempt
otherwise to copy, modify, sublicense or distribute the Program is
void, and will automatically terminate your rights under this License.
However, parties who have received copies, or rights, from you under
this License will not have their licenses terminated so long as such
parties remain in full compliance.
5. You are not required to accept this License, since you have not
signed it. However, nothing else grants you permission to modify or
distribute the Program or its derivative works. These actions are
prohibited by law if you do not accept this License. Therefore, by
modifying or distributing the Program (or any work based on the
Program), you indicate your acceptance of this License to do so, and
all its terms and conditions for copying, distributing or modifying
the Program or works based on it.
6. Each time you redistribute the Program (or any work based on the
Program), the recipient automatically receives a license from the
original licensor to copy, distribute or modify the Program subject to
these terms and conditions. You may not impose any further
restrictions on the recipients' exercise of the rights granted herein.
You are not responsible for enforcing compliance by third parties to
this License.
7. If, as a consequence of a court judgment or allegation of patent
infringement or for any other reason (not limited to patent issues),
conditions are imposed on you (whether by court order, agreement or
otherwise) that contradict the conditions of this License, they do not
excuse you from the conditions of this License. If you cannot
distribute so as to satisfy simultaneously your obligations under this
License and any other pertinent obligations, then as a consequence you
may not distribute the Program at all. For example, if a patent
license would not permit royalty-free redistribution of the Program by
all those who receive copies directly or indirectly through you, then
the only way you could satisfy both it and this License would be to
refrain entirely from distribution of the Program.
If any portion of this section is held invalid or unenforceable under
any particular circumstance, the balance of the section is intended to
apply and the section as a whole is intended to apply in other
circumstances.
It is not the purpose of this section to induce you to infringe any
patents or other property right claims or to contest validity of any
such claims; this section has the sole purpose of protecting the
integrity of the free software distribution system, which is
implemented by public license practices. Many people have made
generous contributions to the wide range of software distributed
through that system in reliance on consistent application of that
system; it is up to the author/donor to decide if he or she is willing
to distribute software through any other system and a licensee cannot
impose that choice.
This section is intended to make thoroughly clear what is believed to
be a consequence of the rest of this License.
8. If the distribution and/or use of the Program is restricted in
certain countries either by patents or by copyrighted interfaces, the
original copyright holder who places the Program under this License
may add an explicit geographical distribution limitation excluding
those countries, so that distribution is permitted only in or among
countries not thus excluded. In such case, this License incorporates
the limitation as if written in the body of this License.
9. The Free Software Foundation may publish revised and/or new versions
of the General Public License from time to time. Such new versions will
be similar in spirit to the present version, but may differ in detail to
address new problems or concerns.
Each version is given a distinguishing version number. If the Program
specifies a version number of this License which applies to it and "any
later version", you have the option of following the terms and conditions
either of that version or of any later version published by the Free
Software Foundation. If the Program does not specify a version number of
this License, you may choose any version ever published by the Free Software
Foundation.
10. If you wish to incorporate parts of the Program into other free
programs whose distribution conditions are different, write to the author
to ask for permission. For software which is copyrighted by the Free
Software Foundation, write to the Free Software Foundation; we sometimes
make exceptions for this. Our decision will be guided by the two goals
of preserving the free status of all derivatives of our free software and
of promoting the sharing and reuse of software generally.
NO WARRANTY
11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
REPAIR OR CORRECTION.
12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
POSSIBILITY OF SUCH DAMAGES.
END OF TERMS AND CONDITIONS
How to Apply These Terms to Your New Programs
If you develop a new program, and you want it to be of the greatest
possible use to the public, the best way to achieve this is to make it
free software which everyone can redistribute and change under these terms.
To do so, attach the following notices to the program. It is safest
to attach them to the start of each source file to most effectively
convey the exclusion of warranty; and each file should have at least
the "copyright" line and a pointer to where the full notice is found.
<one line to give the program's name and a brief idea of what it does.>
Copyright (C) 19yy <name of author>
This program 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; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; see the file COPYING. If not, write to
the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA.
Also add information on how to contact you by electronic and paper mail.
If the program is interactive, make it output a short notice like this
when it starts in an interactive mode:
Gnomovision version 69, Copyright (C) 19yy name of author
Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
This is free software, and you are welcome to redistribute it
under certain conditions; type `show c' for details.
The hypothetical commands `show w' and `show c' should show the appropriate
parts of the General Public License. Of course, the commands you use may
be called something other than `show w' and `show c'; they could even be
mouse-clicks or menu items--whatever suits your program.
You should also get your employer (if you work as a programmer) or your
school, if any, to sign a "copyright disclaimer" for the program, if
necessary. Here is a sample; alter the names:
Yoyodyne, Inc., hereby disclaims all copyright interest in the program
`Gnomovision' (which makes passes at compilers) written by James Hacker.
<signature of Ty Coon>, 1 April 1989
Ty Coon, President of Vice
This General Public License does not permit incorporating your program into
proprietary programs. If your program is a subroutine library, you may
consider it more useful to permit linking proprietary applications with the
library. If this is what you want to do, use the GNU Library General
Public License instead of this License.

9647
ChangeLog Normal file

File diff suppressed because it is too large Load Diff

1
VERSION Normal file
View File

@ -0,0 +1 @@
1.4.0p9

BIN
active_checks.tar.gz Normal file

Binary file not shown.

BIN
agents.tar.gz Normal file

Binary file not shown.

648
autodetect.py Executable file
View File

@ -0,0 +1,648 @@
#!/usr/bin/env python
# -*- encoding: utf-8; py-indent-offset: 4 -*-
# +------------------------------------------------------------------+
# | ____ _ _ __ __ _ __ |
# | / ___| |__ ___ ___| | __ | \/ | |/ / |
# | | | | '_ \ / _ \/ __| |/ / | |\/| | ' / |
# | | |___| | | | __/ (__| < | | | | . \ |
# | \____|_| |_|\___|\___|_|\_\___|_| |_|_|\_\ |
# | |
# | Copyright Mathias Kettner 2014 mk@mathias-kettner.de |
# +------------------------------------------------------------------+
#
# This file is part of Check_MK.
# 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-
# tails. 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.
import os, sys, stat
opt_debug = "-d" in sys.argv or "--debug" in sys.argv
# The following settings are tried to be autodetected
target_values = {
'apache_config_dir' : "Configuration directory of Apache",
'cgiurl' : "URL of Nagios CGI programs",
'check_icmp_path' : "Path to check_icmp Plugin",
'htdocsdir' : "Directory of Nagios' static web pages",
'htpasswd_file' : "File of Nagios' HTTP users and passwords",
'livestatus_in_nagioscfg' : "Wether nagios.cfg loads livestatus module",
'nagconfdir' : "Directory of Nagios objects (see cfg_dir)",
'nagiosaddconf' : "Snippet to add to nagios.cfg",
'nagios_auth_name' : "HTTP Basic AuthName for Nagios",
'nagios_binary' : "Absolute path to Nagios binary itself",
'nagios_version' : "Nagios version",
'nagios_config_file': "Absolute path to nagios.cfg",
'nagios_startscript': "Nagios startskript (usually in /etc/init.d)",
'nagios_status_file': "Absolute path to Nagios' status.dat",
'nagiosurl' : "Base-URL of Nagios web pages",
'nagiosuser' : "System user running the Nagios process",
'nagpipe' : "Absolute path to Nagios' command pipe (nagios.cmd)",
'check_result_path' : "Absolute path to Nagios' checkresults directory",
'pnp_url' : "URL of PNP4Nagios",
'pnpconffile' : "PNP4Nagios configuration file for its PHP pages",
'pnphtdocsdir' : "PNP4Nagios www document root directory",
'pnptemplates' : "directory of PHP templates for PNP4Nagios",
'rrddir' : "Base directory where RRDs are stored",
'wwwgroup' : "Common group of Nagios and Apache",
'wwwuser' : "System user apache runs with",
}
# Ich suche nach Prozessen mit folgenden Kriterien:
# - Der Text 'nagios' im Namen
# - eines der Worte muss '-d' oder '--daemon' sein.
# - Das letzte Wort ist der Name einer existierenden Datei
# Beispiel:
# /usr/sbin/nagios3 -d /etc/nagios3/nagios.cfg
class Sorry(Exception):
def __init__(self, reason):
self.reason = reason
super(Sorry, self).__init__(reason)
def find_pid_and_configfile():
procs = os.popen("ps ax -o pid,ppid,user,command").readlines()
pids = []
for line in procs:
if line.find('nagios.cfg') >= 0 or line.find('icinga.cfg') >= 0:
pids.append(line.split()[0])
for line in procs:
if line.find('nagios.cfg') >= 0 or line.find('icinga.cfg') >= 0:
try:
words = line.split()
if '-d' in words or '--daemon' in words:
pid = words[0]
ppid = words[1]
user = words[2]
configfile = words[-1]
if ppid in pids:
continue # this is not the main thread. It has
# another process as parent!
if os.path.exists(configfile):
return int(pid), user, configfile
except Exception, e:
if opt_debug:
raise
raise Sorry("Cannot find Nagios/Icinga process. Is it running?")
def find_apache_properties(nagiosuser, nagios_htdocs_dir):
wwwuser = None
# Search in running processes for Apache
for line in os.popen("ps ax -o pid,user,command").readlines():
parts = line.split()
if len(parts) >= 3 and \
(parts[2].endswith("/apache2") or \
parts[2].endswith("/httpd") or \
parts[2].endswith("/httpd2-prefork") or \
parts[2].endswith("/httpd2-worker")
) and \
parts[1] != 'root':
wwwuser = parts[1]
apache_pid = int(parts[0])
break
if not wwwuser:
raise Exception("Cannot find Apache process. Is it running?")
def scan_apacheconf(apache_conffile):
confdirs = []
if apache_conffile[0] != '/':
apache_conffile = httpd_root + "/" + apache_conffile
confdirs = []
for line in file(apache_conffile):
parts = line.strip().split()
if len(parts) == 2 and parts[0].lower() == "include":
if parts[1].endswith("/") or parts[1].endswith("/*.conf"):
confdir = "/".join(parts[1].split("/")[:-1])
if confdir[0] != "/":
confdir = httpd_root + "/" + confdir
if not os.path.exists(confdir):
continue
confdirs.append(confdir) # put at front of list
else:
try:
confdirs += scan_apacheconf(parts[1]) # recursive scan
except:
pass
return confdirs
# Find binary
try:
nagios_htpasswd_file = None
nagios_auth_name = None
apache_binary = process_executable(apache_pid)
apache_conffile = None
apache_confdir = None
httpd_root = ""
for line in os.popen("%s -V 2>&1" % apache_binary):
parts = line.split()
if parts[0] == "-D" and len(parts) > 1:
p = parts[1].split("=")
if len(p) == 2 and p[0] == "SERVER_CONFIG_FILE":
apache_conffile = p[1].replace('"', "")
elif len(p) == 2 and p[0] == "HTTPD_ROOT":
httpd_root = p[1].replace('"', "")
if apache_conffile:
confdirs = scan_apacheconf(apache_conffile)
if len(confdirs) > 0:
apache_confdir = confdirs[0]
for dir in confdirs:
if dir.endswith("/conf.d"):
apache_confdir = dir
# Search for Nagios configuration. We are interested
# in the authentication configuration. Most Nagios
# installations use HTTP basic auth with a htpasswd
# user file. We want to use that user file for the
# check_mk web pages.
def remove_quotes(text):
try:
if text[0] in '"\'':
text = text[1:]
if text[-1] in '"\'':
text = text[:-1]
except:
pass
return text
auth_files = []
auth_names = []
try:
for confdir in confdirs:
for fn in os.listdir(confdir):
file_good = False
conffile = file(confdir + "/" + fn)
try:
new_auth_names = []
new_auth_files = []
for line in conffile:
if nagios_htdocs_dir in line:
file_good = True
parts = line.split()
if len(parts) == 2 and parts[0].lower() == "authuserfile":
path = remove_quotes(parts[1])
if os.path.exists(path):
new_auth_files.append(path)
if len(parts) > 1 and parts[0].lower() == "authname":
parts = line.split(None, 1)
new_auth_names.append(remove_quotes(parts[1].strip()))
try:
if len(parts) > 1 and parts[0].lower().startswith("<directory") and "pnp4nagios" in line:
cleanedup = line.replace("<", "").replace(">", "").replace('"', "")
cleanedup = cleanedup[9:]
dir = cleanedup.strip()
if os.path.exists(dir) and os.path.exists(dir + "/application/config/config.php"):
result['pnphtdocsdir'] = dir
result['pnptemplates'] = dir + "/templates"
except Exception,e :
pass
if file_good:
auth_names += new_auth_names
auth_files += new_auth_files
except Exception, e:
pass
if len(auth_files) > 0:
nagios_htpasswd_file = auth_files[0]
if len(auth_names) > 0:
nagios_auth_name = auth_names[0]
except:
if opt_debug:
raise
pass
except:
if opt_debug:
raise
apache_confdir = None
nagios_htpasswd_file = None
www_groups = os.popen("id -nG " + wwwuser).read().split()
nagios_groups = os.popen("id -nG " + nagiosuser).read().split()
common_groups = [ g for g in www_groups if g in nagios_groups ]
if len(common_groups) > 1:
if 'nagios' in common_groups:
common_group = 'nagios'
elif 'icinga' in common_groups:
common_group = 'icinga'
else:
common_group = common_groups[0]
elif len(common_groups) == 1:
common_group = common_groups[0]
else:
common_group = None
return wwwuser, common_group, apache_confdir, nagios_htpasswd_file, nagios_auth_name
def process_environment(pid):
# Umgebung des Prozesses bestimmen. Ich brauch das nicht,
# aber der folgende Code ist einfach cool, oder?
try:
env = {}
for line in file("/proc/%d/environ" % pid).read().split("\0"):
if '=' in line:
var, value = entry.split('=', 1)
env[var] = value
return env
except:
raise Sorry("Cannot get environment of process %d. Aren't you root?" %
pid)
def process_executable(pid):
try:
return os.readlink("/proc/%d/exe" % pid).split(" ", 1)[0]
except:
raise Sorry("Cannot get executable of process %d. Aren't you root?" %
pid)
def open_files(pid):
try:
# Liste der offenen Dateien. Das ist schon nuetzlicher,
# denn hier sieht man z.B. die Commandpipe
procpath = "/proc/%d/fd" % pid
return [ os.readlink(procpath + "/" + entry) for entry in os.listdir(procpath) ]
except:
raise Sorry("Cannot get open files of process %d. Aren't you root?" %
pid)
def find_pipes(filenames):
pipes = []
for f in filenames:
try:
mode = os.stat(f)[stat.ST_MODE]
if stat.S_ISFIFO(mode):
pipes.append(f)
except:
pass
return pipes
def parse_nagios_config(configfile):
conf = []
for line in file(configfile):
line = line.strip()
if line == "" or line[0] == '#':
continue
try:
key, value = line.split('=', 1)
conf.append((key, value))
except:
pass # ignore invalid line (as Nagios seems to do)
return conf
def detect_pnp():
global result
# Jetzt will ich noch das Verzeichnis fuer die Schablonen
# von PNP finden. Ich erkenne es daran, dass es ein Verzeichnis
# ist, in dem 'templates' und 'templates.dist' liegen. Dieses
# Verzeichnis liegt hoffentlich innerhalb der Webseite von
# Nagios selbst. Dieser Pfad ist in cgi.cfg festgelegt. Das ganze
# klappt nur bei PNP 0.4
if 'pnptemplates' not in result:
try:
found = []
def func(arg, dirname, names):
if 'templates' in names and 'templates.dist' in names:
found.append(dirname + "/templates")
os.path.walk(cgiconf['physical_html_path'], func, None)
result['pnptemplates'] = found[0]
if 'pnphtdocsdir' not in result:
result['pnphtdocsdir'] = result['pnptemplates'].rsplit('/', 1)[0]
except:
pass
# Suche die Konfigurationsdatei von PNP4Nagios. Denn ich will
# den Eintrag finden, der auf die RRDs zeigt. Den braucht
# check_mk für das direkte Eintragen in die RRD-Datenbanken
try:
pnppath = os.path.dirname(result['pnptemplates'])
index_php = pnppath + "/index.php"
for line in file(index_php):
line = line.strip()
# $config = "/usr/local/nagios/etc/pnp/config";
if line.startswith('$config =') and line.endswith('";'):
pnpconffile = line.split('"')[1] + ".php"
result['pnpconffile'] = pnpconffile
result['pnpconfdir'] = pnpconffile.rsplit("/", 1)[0]
break
except:
pass
try:
# For PNP 0.6
if 'pnpconffile' not in result:
kohanaconf = result['pnphtdocsdir'] + "/application/config/config.php"
if os.path.exists(kohanaconf):
for line in file(kohanaconf):
line = line.strip()
if not line.startswith("#") and "pnp_etc_path" in line:
last = line.split('=')[-1].strip()
dir = last.replace("'", "").replace(";", "").replace('"', "")
if os.path.exists(dir):
result['pnpconfdir'] = dir
result['pnpconffile'] = dir + "/config.php"
except:
pass
try:
for line in file(result['pnpconffile']):
line = line.strip()
if line.startswith("$conf['rrdbase']") and line.endswith('";'):
rrddir = line.split('"')[1]
if rrddir.endswith('/'):
rrddir = rrddir[:-1]
result['rrddir'] = rrddir
elif (line.startswith("$conf['base_url']")
or line.startswith("$conf['pnp_base']")) \
and line.endswith(";"):
pnp_url = line.split('"')[1]
if not pnp_url.endswith("/"):
pnp_url += "/"
result["pnp_url"] = pnp_url
except:
pass
def detect_omd():
site = os.getenv("OMD_SITE")
root = os.getenv("OMD_ROOT")
if not site or not root:
return None
else:
return {
'apache_config_dir' : root + "/etc/apache/conf.d",
'cgiurl' : "/" + site + "/nagios/cgi-bin/",
'check_icmp_path' : root + "/lib/nagios/plugins/check_icmp",
'htdocsdir' : root + "/share/nagios/htdocs",
'htpasswd_file' : root + "/etc/htpasswd",
'livestatus_in_nagioscfg' : False,
'nagconfdir' : root + "/etc/nagios/conf.d",
'nagiosaddconf' : "",
'nagios_auth_name' : "OMD Monitoring Site " + site,
'nagios_binary' : root + "/bin/nagios",
'nagios_config_file' : root + "/tmp/nagios/nagios.cfg",
'nagios_startscript' : root + "/etc/init.d/nagios",
'nagios_status_file' : root + "/var/nagios/status.dat",
'nagiosurl' : "/" + site + "/nagios/",
'nagiosuser' : site,
'nagpipe' : root + "/tmp/run/nagios.cmd",
'check_result_path' : root + "/tmp/nagios/checkresults",
'pnp_url' : "/" + site + "/pnp4nagios/",
'pnpconffile' : root + "/etc/pnp4nagios/config.php",
'pnphtdocsdir' : root + "/share/pnp4nagios/htdocs",
'pnptemplates' : root + "/local/share/check_mk/pnp-templates",
'rrddir' : root + "/var/pnp4nagios/perfdata",
'wwwgroup' : site,
'wwwuser' : site,
}
# _
# _ __ ___ __ _(_)_ __
# | '_ ` _ \ / _` | | '_ \
# | | | | | | (_| | | | | |
# |_| |_| |_|\__,_|_|_| |_|
#
try:
result = detect_omd()
if not result:
result = {}
pid, nagiosuser, configfile = find_pid_and_configfile()
nagios_dir = os.path.dirname(configfile)
result['nagios_config_file'] = configfile
result['nagiosuser'] = nagiosuser
pipes = find_pipes(open_files(pid))
if len(pipes) > 0:
result['nagpipe'] = pipes[0]
# Path to executable
result['nagios_binary'] = process_executable(pid)
# Nagios version
result['nagios_version'] = ""
for line in os.popen(result["nagios_binary"]+ " --version 2>/dev/null"):
if line.startswith("Nagios Core") or line.startswith("Icinga Core"):
result['nagios_version'] = line.split()[2]
# Path to startscript
for path in [ '/etc/init.d/nagios', '/etc/init.d/nagios3', '/etc/init.d/icinga' ]:
if os.path.exists(path):
result['nagios_startscript'] = path
break
nagconf = parse_nagios_config(configfile)
nagconf_dict = dict(nagconf)
if "check_result_path" in nagconf_dict:
result['check_result_path'] = nagconf_dict['check_result_path']
try:
cgifile = os.path.dirname(configfile) + "/cgi.cfg"
cgiconf = dict(parse_nagios_config(cgifile))
result['htdocsdir'] = cgiconf['physical_html_path']
except:
cgiconf = {}
# Suche nach cfg_dir Direktiven. Wir suchen
# einen flauschigen Platz fuer unsere Konfigdateien
cfg_dirs = [ value for key, value in nagconf if key == 'cfg_dir' ]
if len(cfg_dirs) > 0:
# Wenn es mehrere gibt, bevorzuge ich das, das im gleichen
# Verzeichnis, wie die Nagios-Konfigdatei selbst liegt.
# Debian legt ein cfg_dir fuer die Plugins an....
if len(cfg_dirs) == 1:
result['nagconfdir'] = cfg_dirs[0]
else:
dir = os.path.dirname(configfile)
for d in cfg_dirs:
if os.path.dirname(d) == dir:
result['nagconfdir'] = d
break
else:
result['nagconfdir'] = cfg_dirs[0]
else:
# Mist. Kein cfg_dir in nagios.cfg. Das ist z.B. bei
# der immer noch verbreiteten Defaultkonfig der Fall.
# Wir legen einfach selbst eins fest und hängen das
# eigenmächtig hinten an die Config an
nagconfdir = nagios_dir + "/check_mk.d"
result['nagconfdir'] = nagconfdir
result['nagiosaddconf'] = "cfg_dir=" + nagconfdir
# Find path to status.dat, the Nagios status file. We
# need that for the check_mk web pages. Normally the
# path is configured in nagios.cfg. If no - we still
# have a chance by parsing the output of nagios3stats.
nagios_status_file = nagconf_dict.get("status_file")
if not nagios_status_file:
for stats_name in [ "stats", "tats" ]:
try:
stats_bin = result['nagios_binary'] + stats_name
for line in os.popen(stats_bin + " 2>/dev/null"):
if line.startswith("Status File:"):
parts = line.split()
nagios_status_file = parts[-1]
break
elif line.startswith("Error reading status file"):
parts = line.split()
nagios_status_file = parts[-1][1:-1]
break
except:
pass
if nagios_status_file:
result['nagios_status_file'] = nagios_status_file
# Ermittle $USER1$ Variablen, da sie in den Plugin-Pfaden
# auftauchen koennen.
uservars = {}
try:
for line in file(nagconf_dict['resource_file']):
line = line.strip()
if line.startswith('$') and '=' in line:
varname, value = line.split('=', 1)
uservars[varname.strip()] = value.strip()
except:
pass
# Suche nach einem Eintrag zum Laden des livestatus
# Moduls. Er darf auch auskommentiert sein. Dann lassen
# wir den Benutzer damit in Ruhe
found = False
for line in file(configfile):
if "broker_module=" in line and "/livestatus.o" in line:
found = True
break
result['livestatus_in_nagioscfg'] = found
# Jetzt wird's schwieriger: Ich suche nach check_icmp.
# Ich will keinen find machen, da das erstens ewig
# dauern kann und zweitens eventl. eine falsche Stelle
# findet, z.B. innerhalb eines ausgepackten und kompilierten
# Quellcodes der nagios-plugins. Daher suche ich in
# allen Objektdateien von Nagios nach command_line.
# Damit ermittle ich alle Verzeichnisse, in denen Plugins
# liegen. Dort suche ich dann nach check_icmp. Zur Sicherheit
# suche ich aber auch unter '/usr/lib/nagios' und '/usr/local/nagios/libexec'
# und '/usr/local/nagios/plugins'
found = []
for dir in cfg_dirs:
os.path.walk(dir, lambda x,dirname,names: found.append((dirname, names)), None)
plugin_paths = []
for dirname, names in found:
for name in names:
if name.endswith(".cfg"):
path = dirname + "/" + name
try:
for line in file(path):
if line.strip() == '':
continue
parts = line.strip().split()
if parts[0] == "command_line":
path = parts[1]
for var, value in uservars.items():
path = path.replace(var, value)
if path.startswith('/') and path not in plugin_paths:
plugin_paths.append(path)
except:
pass
for dir in plugin_paths + \
[ '/usr/lib/nagios/plugins',
'/usr/lib64/nagios/plugins',
'/usr/local/nagios/libexec',
'/usr/local/nagios/plugins' ]:
try:
mode = os.stat(dir)[stat.ST_MODE]
if not stat.S_ISDIR(mode):
dir = os.path.dirname(dir)
filenames = os.listdir(dir)
for filename in filenames:
if filename == 'check_icmp':
result['check_icmp_path'] = dir + '/' + filename
break
except:
pass
# Die Basis-Url fuer Nagios ist leider auch nicht immer
# gleich
try:
result['nagiosurl'] = cgiconf['url_html_path']
result['cgiurl'] = result['nagiosurl'] + "/cgi-bin"
except:
pass
# Suche eine Gruppe, die Nagios mit dem Apache gemeinsam
# hat. Diese brauchen wir z.B. für logwatch
try:
wwwuser, wwwgroup, apache_confdir, nagios_htpasswd_file, nagios_auth_name = \
find_apache_properties(nagiosuser, result['htdocsdir'])
if wwwuser:
result['wwwuser'] = wwwuser
if wwwgroup:
result['wwwgroup'] = wwwgroup
if apache_confdir:
result['apache_config_dir'] = apache_confdir
if nagios_htpasswd_file:
result['htpasswd_file'] = nagios_htpasswd_file
if nagios_auth_name:
result['nagios_auth_name'] = nagios_auth_name
except Exception, e:
sys.stderr.write("\033[1;41;35m Cannot determine Apache properties. \033[0m\n"
"Reason: %s\n" % e)
detect_pnp()
print "# Result of autodetection"
for var, value in result.items():
print
descr = target_values.get(var)
if descr:
print "# %s" % descr
else:
print "# (unknown value)"
print "%s='%s'" % (var, value)
for var, descr in target_values.items():
if var not in result:
print
print "# %s" % descr
print "# NOT DETECTED: %s" % var
except Sorry, e:
sys.stderr.write("\033[1;41;35m Sorry: %s \033[0m\n" % e.reason)
sys.exit(1)
except Exception, e:
if opt_debug:
raise
else:
sys.stderr.write("* Sorry, something unexpected happened: %s\n\n" % e)
import traceback
traceback.print_exc()
sys.exit(1)

BIN
base.tar.gz Normal file

Binary file not shown.

BIN
bin.tar.gz Normal file

Binary file not shown.

Binary file not shown.

View File

@ -1 +0,0 @@
decb37682f3a4d8a6e1c86d209040ccc099ebebf

Binary file not shown.

View File

@ -1 +0,0 @@
f042758850786cd730f1b32aea00b0f99ef68f3e

Binary file not shown.

View File

@ -1 +0,0 @@
a75cf68458e2d443f7c5cd5ef39b1b345c78b292

Binary file not shown.

View File

@ -1 +0,0 @@
c4ba8db292c103bdd1a5ba2c11d1c2f2df9f4bdb

BIN
checkman.tar.gz Normal file

Binary file not shown.

BIN
checks.tar.gz Normal file

Binary file not shown.

36
create-changelog.py Executable file
View File

@ -0,0 +1,36 @@
#!/usr/bin/env python
import sys
import os
import cmk.werks
def create_changelog(dest_file, precompiled_werk_files):
werks = load_werks(precompiled_werk_files)
with open(dest_file, "w") as f:
cmk.werks.write_as_text(werks, f)
# Append previous werk changes
if os.path.exists(dest_file + ".in"):
f.write("\n\n")
f.write(file(dest_file + ".in").read())
def load_werks(precompiled_werk_files):
werks = {}
for path in precompiled_werk_files:
werks.update(cmk.werks.load_precompiled_werks_file(path))
return werks
#
# MAIN
#
if len(sys.argv) < 3:
sys.stderr.write("ERROR: Call like this: create-changelog CHANGELOG WERK_DIR...\n")
sys.exit(1)
dest_file, precompiled_werk_files = sys.argv[1], sys.argv[2:]
create_changelog(dest_file, precompiled_werk_files)

30
debian/README.Debian vendored Normal file
View File

@ -0,0 +1,30 @@
check-mk-livestatus
===================
To load the event broker add the following lines to your Icinga
configuration:
broker_module=/usr/lib/check_mk/livestatus.o /var/lib/icinga/rw/live
See http://mathias-kettner.de/checkmk_livestatus.html for more configuration
options.
logwatch
========
To install logwatch copy logwatch.cfg from
/usr/share/doc/check-mk-agent/examples to /etc/check_mk/ on your client.
See http://mathias-kettner.de/checkmk_logfiles.html for more information.
On the server side you need multisite enabled to see the logs. If you also want
to acknowledge the alarms (recommended) put www-data into the nagios group
check-mk-config-icinga
======================
Check-MK's web frontend "Multisite" (package "check-mk-multisite") and the
server part of Check-MK ("check-mk-server") can only be used with Icinga.
Please install the "check-mk-config-icinga" package.

44
debian/README.source vendored Normal file
View File

@ -0,0 +1,44 @@
dpatch
------
We use dpatch for patch handling inside our nagios related packages.
Please see /usr/share/doc/dpatch/README.source.gz (if you have
installed dpatch) for documentation about dpatch.
upstream vs debian install paths
--------------------------------
This is a list of the differences between an upstream check_mk install
using setup.sh and what files and directories the debian packages
create.
Last reviewed 2015-08-21 by taggart@debian.org.
upstream -> debian
/etc/apache2/conf.d/zzz_check_mk.conf -> check-mk-config-* postinst creates
/etc/apache2/conf-available/check-mk-multisite.conf
(no logwatch.cfg) ->
/etc/check_mk/logwatch.cfg provided by check-mk-agent-logwatch
/usr/share/check_mk/agents/xinetd.conf -> /etc/xinetd.d/check_mk
/etc/nagios/auth.serials -> not needed
/usr/share/check_mk/modules/defaults -> provided by check-mk-config-*
/usr/share/check_mk/web/htdocs/defaults.py -> symlink to above, provided
by check-mk-config-*
/usr/share/check_mk/check_mk_templates.cfg -> not needed
/etc/nagios/objects/check_mk_templates.cfg -> symlink to above, not needed
/usr/share/check_mk/agents/ -> we just provide check_mk_agent/cmk/mk-job/mkp
/usr/share/check_mk/agents/plugins/ -> don't provide, see #796453
/usr/share/check_mk/inventory/ -> don't provide, see #796455
/usr/share/doc/check_mk/ -> split up by package name
/usr/share/doc/check_mk/checks/ -> /usr/share/check_mk/checks-man in -doc
/usr/share/check_mk/locale/ -> unneeded by default
/var/lib/check_mk/notify/ -> automatically created with the correct
ownership and permissions
/etc/check_mk/multisite.mk -> /usr/share/doc/check-mk-multisite/examples/

85
debian/apache.icinga vendored Normal file
View File

@ -0,0 +1,85 @@
# Created by setup of check_mk version 1.4.0p9
# This file will *not* be overwritten at the next setup
# of check_mk. You may edit it as needed. In order to get
# a new version, please delete it and re-run setup.sh.
# Note for RedHat 5.3 users (and probably other version:
# this file must be loaded *after* python.conf, otherwise
# <IfModule mod_python.c> does not trigger! For that
# reason, it is installed as zzz_.... Sorry for the
# inconveniance.
<IfModule mod_python.c>
Alias /check_mk /usr/share/check_mk/web/htdocs
<Directory /usr/share/check_mk/web/htdocs>
AddHandler mod_python .py
PythonHandler index
PythonDebug On
DirectoryIndex index.py
#Handle apache 2.2 and 2.4
<IfVersion >= 2.3>
Require local
</IfVersion>
<IfVersion < 2.3>
Order deny,allow
allow from all
</IfVersion>
# Need Nagios authentification. Please edit the
# following: Set AuthName and AuthUserFile to the
# same value that you use for your Nagios configuration!
Order deny,allow
allow from all
AuthName "Icinga Access"
AuthType Basic
AuthUserFile /etc/icinga/htpasswd.users
require valid-user
ErrorDocument 403 "<h1>Authentication Problem</h1>Either you've entered an invalid password or the authentication<br>configuration of your check_mk web pages is incorrect.<br><br>Please make sure that you've edited the file<br><tt>/etc/apache2/conf.d/check_mk</tt> and made it use the same<br>authentication settings as your Nagios web pages.<br>Restart Apache afterwards."
ErrorDocument 500 "<h1>Server or Configuration Problem</h1>A Server problem occurred. You'll find details in the error log of Apache. One possible reason is, that the file <tt>/etc/icinga/htpasswd.users</tt> is missing. You can create that file with <tt>htpasswd</tt> or <tt>htpasswd2</tt>. A better solution might be to use your existing htpasswd file from your Nagios installation. Please edit <tt>/etc/apache2/conf.d/check_mk</tt> and change the path there. Restart Apache afterwards."
</Directory>
## WARNING: automation is part of multisite, more information at
## http://mathias-kettner.com/checkmk_multisite_automation.html
## It uses a shared secret rather than HTTP Auth for authentication and
## and is potentially exposed to public networks so is disabled on Debian
## by default. If you need this feature, be sure you understand the
## security implications and take necessary precautions before turning it on.
## Automation is done without HTTP Auth
#<Location "/check_mk/automation.py">
# Order allow,deny
# Allow from all
# Satisfy any
#</Location>
## WARNING: like automation above, run_cron is part of multisite.
## It does not use HTTP Auth, but is only exposed to localhost. Having
## it enabled has less risk, but since it's part of multisite it is
## also disabled by default on Debian.
## Trigger cron jobs. This is done without authentication
#<Location "/check_mk/run_cron.py">
# Order deny,allow
# Deny from all
# Allow from 127.0.0.1
# Satisfy any
#</Location>
## WARNING: disabled like the others above
## Webservice for dynamic creation of PNP templates
#<Location "/check_mk/pnp_template.py">
# Order deny,allow
# Deny from all
# Allow from 127.0.0.1
# Satisfy any
#</Location>
</IfModule>
<IfModule !mod_python.c>
Alias /check_mk /usr/share/check_mk/web/htdocs
<Directory /usr/share/check_mk/web/htdocs>
Deny from all
ErrorDocument 403 "<h1>Check_mk: Incomplete Apache2 Installation</h1>You need mod_python in order to run the web interface of check_mk.<br> Please install mod_python and restart Apache."
</Directory>
</IfModule>

200
debian/changelog vendored Normal file
View File

@ -0,0 +1,200 @@
check-mk (1.4.0p9-1) experimental; urgency=high
* new upstream release
* fixes CVE-2017-9781 (Closes: #865497)
* move to the way upstream now does defaults
* add new librrd-dev, libboost-dev, libboost-system-dev, g++-6 build-deps
* new -common package for private python libs
-- Matt Taggart <taggart@debian.org> Thu, 22 Jun 2017 15:44:37 -0700
check-mk (1.2.8p16-1) unstable; urgency=medium
* new upstream release
* fix some lintian errors
* update policy version
* fix debian/watch
* update debhelper version
* clean up nagios support/references, thanks Bas Couwenberg! (Closes: #846848)
-- Matt Taggart <taggart@debian.org> Thu, 26 Jan 2017 23:20:02 -0800
check-mk (1.2.8p14-1) unstable; urgency=low
[ Bas Couwenberg ]
* Team upload.
* Update Vcs-* URLs to use HTTPS.
[ Matt Taggart ]
* Imported Upstream version 1.2.8p14
* upstream will now use coreutils timeout if available rather than waitmax
* xinetd.conf example moved, new xinetd_caching.conf
-- Matt Taggart <taggart@debian.org> Tue, 24 Jan 2017 12:20:53 -0800
check-mk (1.2.6p12-1) unstable; urgency=medium
[ Matt Taggart ]
* Imported Upstream version 1.2.6p12
* fix multisite.d dir in postinst (Closes: #798344).
-- Matt Taggart <taggart@debian.org> Thu, 24 Sep 2015 13:08:41 -0700
check-mk (1.2.6p7-1) unstable; urgency=low
[ Matt Taggart ]
* Imported Upstream version 1.2.6p7
* add myself to uploaders
* fix some lintian errors
* update version in defaults files (Closes: #792395).
* provide cmk and mkp utils.
* provide example multisite.mk config.
* ensure some needed directories are created.
* remove smartmontools depends until we properly fix the smart plugin.
* review difference between upstream and debian install paths and
document in README.source
[ Bernhard Schmidt ]
* start providing mk-job
* fix -agent-logwatch depends
* -agent-logwatch is arch all
-- Matt Taggart <taggart@debian.org> Fri, 21 Aug 2015 16:44:17 -0700
check-mk (1.2.6p5-1) unstable; urgency=medium
[ Matt Taggart ]
* Imported Upstream version 1.2.6p5
* migrate multisite conffile, fix logic to better detect different
cases (Closes: #732357)
* check-mk-server: clean up stuff in /var on purge (Closes: #788829).
* stop packaging all upsteam provided binaries (Closes: #790308).
-- Matt Taggart <taggart@debian.org> Fri, 03 Jul 2015 15:15:53 -0700
check-mk (1.2.6p4-1) unstable; urgency=medium
[ Thomas Bechtold ]
* New upstream release (Closes: #738987).
* debian/defaults.*: Use correct check-mk version.
* debian/control:
- Add myself to Uploaders field.
- Remove Sven Velt from Uploaders field (Closes: #739092).
[ Ilya Rassadin ]
* New upstream release (Closes: #778380).
* debian/defaults.*: Use correct check-mk version.
* debian/control: Add myself to Uploaders field.
* debian/check-mk-server.install: Add path for flexible notifications
* debian/check-mk-server.postinst: Add path for flexible notifications
[ Matt Taggart ]
* Confirmed that CVE-2014-2329, CVE-2014-2330, CVE-2014-2331,
CVE-2014-2332 are fixed in upstream as of 1.2.3i5 (Closes: #742689).
* New upstream release (Closes: #778380).
* upstream forgot to include waitmax.c in their "source" tarball,
provide it in the source package for now
* logwatch.cfg example changed location upstream, adjust
check_mk_agent_logwatch.{example,install}
* regenerate defaults.* starting with upstream versions generated by
setup.sh and then porting forward the debian specific changes.
* regenerate apache.* starting with upstream versions generated by
setup.sh and then porting forward the debian specific changes.
Disable multisite automation.py and run_cron.py services by default.
-- Matt Taggart <taggart@debian.org> Wed, 10 Jun 2015 11:10:32 -0700
check-mk (1.2.2p3-1) unstable; urgency=low
* New upstream release.
-- Thomas Bechtold <toabctl@debian.org> Thu, 05 Dec 2013 20:33:24 +0100
check-mk (1.2.2p2-1) unstable; urgency=low
[ Thomas Bechtold ]
* New upstream release (Closes: #678396).
* Update defaults in debian/defaults.nagios3 and debian/defaults.icinga.
* Update debian/patches/02_wato-sudoers.dpatch.
* debian/check-mk-server.install: Remove usr/share/check_mk/pnp-rraconf.
* debian/check-mk-config-nagios3.install: Adjust path for
check_mk_templates.cfg.
* debian/check-mk-config-icinga.install: Adjust path for
check_mk_templates.cfg.
* debian/check-mk-multisite.install: Remove no longer available
etc/sudoers.d/check_mk_wato.
* [411c207] check-mk-server: Add debconf note about RRD update.
* [fd007c2] Handle apache 2.2 and apache2.4
* [9038096] debconf msg only when upgrading from < 1.2.0
[ Alexander Wirt ]
* [1abe7cc] Bump standards version
-- Alexander Wirt <formorer@debian.org> Fri, 13 Sep 2013 08:00:52 +0200
check-mk (1.1.12p7-1) unstable; urgency=low
* [b088706] Add Recommends for snmp to server part
* [1708000] Imported Upstream version 1.1.12p7
* [256e383] Recommends ethtool and smartmontools in check-mk-agent
(Closes: #649677)
* [5a4c4cc] Move manpages to -server and don't compress docs (Closes: #649676)
* [2f52423] Create /etc/check_mk/conf.d in multisite package (Closes: #649316)
* [c536571] Bump version for default files
* [688edf4] Fix usage of dpkg-maintscript-helper.
Thanks to Colin Watson for the patch (Closes: #659548)
* [98ce919] Call dh_* with -a or -i (Closes: #649162)
* [1107727] Add missing dh_ calls to binary-indep
* [b2f781c] Add missing -nagios3 preinst
-- Alexander Wirt <formorer@debian.org> Thu, 05 Apr 2012 19:36:02 +0200
check-mk (1.1.12-1) unstable; urgency=low
[ Bernd Zeimetz ]
* [791a318] Install necessary sudo permissions for WATO.
* [cb1f3c7] Fix lintian W: check-mk source:
brace-expansion-in-debhelper-config-file
* [b5562b4] Install /var/lib/check_mk/wato as required by wato.
* [571007f] /var/lib/check_mk/autochecks/ should be owned by nagios, too.
* [d6e7572] /var/lib/check_mk/precompiled should be owned by nagios:nagios.
* [5456d5c] Move check_mk nagios/icinga config files into check_mk subfolder.
* [bd0ea1d] Add a check-mk-doc package and configure defaults accordingly.
[ Alexander Wirt ]
* [559e8b7] Migrate configuration files to /etc/icinga/objects/check_mk
* [d5bad65] Fix typo in control file
* [11edf6f] Migrate check-mk objects for nagios
* [a6b822f] Add missing debhelper tokens
* [fd14d37] Add missing set -e
* [28a25ee] config postinst should depend on adduser
* [6b67884] Fix permissions for wato dirs
* [ba084b0] Also include versions like 1.10p2
* [6f0a194] Imported Upstream version 1.1.10p3
* [869f2a0] Install logwatch.cfg to examples (Closes: #639255)
* [cdfef39] Make check-mk web dir sgid nagios
* [3b7f02e] Imported Upstream version 1.1.12
-- Alexander Wirt <formorer@debian.org> Fri, 11 Nov 2011 23:52:28 +0100
check-mk (1.1.10-2) unstable; urgency=low
[ Christoph Berg ]
* [1163b0d] Add Vcs-* fields
[ Alexander Wirt ]
* [84fc3f7] Fix installation path for objects and templates in
*nagios3* package.
Thanks to Richard James Salts for the patch (Closes: #634016)
* [7c1720c] Bump standards version (no changes)
* [66132ef] Add missing build targets to rules file
* [96b686b] Add README.source file
* [15fa444] Add README.Debian to all binary packages
-- Alexander Wirt <formorer@debian.org> Thu, 11 Aug 2011 07:56:01 +0200
check-mk (1.1.10-1) unstable; urgency=low
* Initial release
-- Alexander Wirt <formorer@debian.org> Mon, 30 May 2011 21:48:51 +0200

View File

@ -0,0 +1,2 @@
debian/tmp/usr/share/check_mk/agents/cfg_examples/logwatch.cfg

View File

@ -0,0 +1,3 @@
usr/share/check_mk/agents/plugins/mk_logwatch usr/lib/check_mk_agent/plugins
usr/share/check_mk/agents/cfg_examples/logwatch.cfg /etc/check_mk

6
debian/check-mk-agent.dirs vendored Normal file
View File

@ -0,0 +1,6 @@
usr/bin
etc/xinetd.d
usr/lib
usr/lib/check_mk_agent/plugins
usr/lib/check_mk_agent/local
usr/share/doc/check-mk-agent/examples

1
debian/check-mk-agent.examples vendored Normal file
View File

@ -0,0 +1 @@
debian/tmp/usr/share/check_mk/agents/cfg_examples/xinetd_caching.conf

1
debian/check-mk-agent.install vendored Normal file
View File

@ -0,0 +1 @@
usr/share/check_mk/agents/mk-job usr/bin

2
debian/check-mk-common.install vendored Normal file
View File

@ -0,0 +1,2 @@
usr/share/check_mk/cmk
usr/share/check_mk/cmk_base

3
debian/check-mk-config-icinga.install vendored Normal file
View File

@ -0,0 +1,3 @@
usr/share/check_mk/check_mk_templates.cfg etc/icinga/objects/check_mk
usr/share/check_mk/cmk/paths.py
etc/check_mk/multisite.mk

83
debian/check-mk-config-icinga.postinst vendored Normal file
View File

@ -0,0 +1,83 @@
#!/bin/bash
set -e
# a little helper for getting permissions right
setperm() {
local user="$1"
local group="$2"
local mode="$3"
local file="$4"
shift 4
# only do something when no setting exists
if ! dpkg-statoverride --list "$file" >/dev/null 2>&1; then
chown "$user":"$group" "$file"
chmod "$mode" "$file"
fi
}
dpkg-maintscript-helper mv_conffile \
/etc/icinga/objects/check_mk_templates.cfg \
/etc/icinga/objects/check_mk/check_mk_templates.cfg \
1.1.10-2 -- "$@"
# older releases (1.1.12p7-1 at least) delivered the multisite conffile to
# /etc/apache2/conf.d. If it exists we need to move it to conf-available
# once it's moved then the code below will setup the conf.d symlink.
# This code wasn't in place until 1.2.6p4-2, so we need to check everything
# before that.
dpkg-maintscript-helper mv_conffile \
/etc/apache2/conf.d/check_mk_multisite.cfg \
/etc/apache2/conf-available/check_mk_multisite.cfg \
1.2.6p4-2 -- "$@"
if [ -e '/etc/icinga/objects/check_mk_objects.cfg' ];
then
echo 'Migrate /etc/icinga/objects/check_mk_objects.cfg to /etc/icinga/objects/check_mk/check_mk_objects.cfg'
mv /etc/icinga/objects/check_mk_objects.cfg \
/etc/icinga/objects/check_mk/check_mk_objects.cfg
fi
case "$1" in
configure)
#make sure our nagios user exists
if ! getent passwd nagios > /dev/null ; then
echo 'Adding system-user for nagios' 1>&2
adduser --system --group --home /var/lib/nagios \
--disabled-login --force-badname nagios > /dev/null
fi
#fix permissions for some directorys
test -d /etc/icinga/objects/check_mk || mkdir -p /etc/icinga/objects/check_mk
setperm root nagios 0775 /etc/icinga/objects/check_mk
#handle the apache2.2 -> apache2.4 upgrade (see https://wiki.debian.org/Apache/PackagingFor24)
CONF="check-mk-multisite"
COMMON_STATE=$(dpkg-query -f '${Status}' -W 'apache2.2-common' 2>/dev/null | awk '{print $3}' || true)
if [ -e /usr/share/apache2/apache2-maintscript-helper ] ; then
. /usr/share/apache2/apache2-maintscript-helper
apache2_invoke enconf $CONF || exit $?
elif [ "$COMMON_STATE" = "installed" ] || [ "$COMMON_STATE" = "unpacked" ] ; then
if [ -d /etc/apache2/conf.d/ ]; then
if [ -L /etc/apache2/conf.d/$CONF.conf ]; then
# it's a symlink, all is well
true
elif [ -e /etc/apache2/conf.d/$CONF.conf ]; then
# it's not a symlink, but exists, error
echo "ERROR: /etc/apache2/conf.d/$CONF.conf is not a symlink, please investigate" 1>&2
else
# we need to create the symlink
ln -s ../conf-available/$CONF.conf /etc/apache2/conf.d/$CONF.conf
fi
fi
fi
;;
abort-upgrade|abort-remove|abort-deconfigure)
;;
*)
echo "postinst called with unknown argument \$1'" >&2
exit 1
;;
esac
#DEBHELPER#

33
debian/check-mk-config-icinga.postrm vendored Normal file
View File

@ -0,0 +1,33 @@
#!/bin/sh
set -e
dpkg-maintscript-helper mv_conffile \
/etc/icinga/objects/check_mk_templates.cfg \
/etc/icinga/objects/check_mk/check_mk_templates.cfg \
1.1.10-2 -- "$@"
# older releases (1.1.12p7-1 at least) delivered the multisite conffile to
# /etc/apache2/conf.d. If it exists we need to move it to conf-available
# once it's moved then the code below will setup the conf.d symlink.
# This code wasn't in place until 1.2.6p4-2, so we need to check everything
# before that.
dpkg-maintscript-helper mv_conffile \
/etc/apache2/conf.d/check_mk_multisite.cfg \
/etc/apache2/conf-available/check_mk_multisite.cfg \
1.2.6p4-2 -- "$@"
if [ "$1" = "remove" ] || [ "$1" = "purge" ] ; then
CONF="check-mk-multisite"
COMMON_STATE=$(dpkg-query -f '${Status}' -W 'apache2.2-common' 2>/dev/null | awk '{print $3}' || true)
if [ -e /usr/share/apache2/apache2-maintscript-helper ] ; then
. /usr/share/apache2/apache2-maintscript-helper
apache2_invoke disconf $CONF || exit $?
elif [ "$COMMON_STATE" = "installed" ] || [ "$COMMON_STATE" = "unpacked" ] ; then
[ -L /etc/apache2/conf.d/$CONF.conf ] && rm /etc/apache2/conf.d/$CONF.conf || true
fi
fi
#DEBHELPER#

11
debian/check-mk-config-icinga.preinst vendored Normal file
View File

@ -0,0 +1,11 @@
#!/bin/sh
set -e
dpkg-maintscript-helper mv_conffile \
/etc/icinga/objects/check_mk_templates.cfg \
/etc/icinga/objects/check_mk/check_mk_templates.cfg \
1.1.10-2 -- "$@"
#DEBHELPER#

1
debian/check-mk-doc.install vendored Normal file
View File

@ -0,0 +1 @@
usr/share/doc/check_mk/* usr/share/doc/check-mk-doc

2
debian/check-mk-livestatus.install vendored Normal file
View File

@ -0,0 +1,2 @@
usr/lib/check_mk/livestatus.o
usr/bin/unixcat

View File

@ -0,0 +1 @@
usr/lib/nagios/plugins/*

3
debian/check-mk-multisite.dirs vendored Normal file
View File

@ -0,0 +1,3 @@
etc/check_mk
var/lib/check_mk
etc/check_mk/multisite.d

1
debian/check-mk-multisite.examples vendored Normal file
View File

@ -0,0 +1 @@
debian/tmp/etc/check_mk/multisite.mk

3
debian/check-mk-multisite.install vendored Normal file
View File

@ -0,0 +1,3 @@
usr/share/check_mk/web
var/lib/check_mk/web
var/lib/check_mk/wato

36
debian/check-mk-multisite.postinst vendored Normal file
View File

@ -0,0 +1,36 @@
#!/bin/bash
set -e
. /usr/share/debconf/confmodule
setperm() {
local user="$1"
local group="$2"
local mode="$3"
local file="$4"
shift 4
# only do something when no setting exists
if ! dpkg-statoverride --list "$file" >/dev/null 2>&1; then
chown "$user":"$group" "$file"
chmod "$mode" "$file"
fi
}
case "$1" in
configure)
# explicitly set permissions on some files
setperm www-data nagios 4770 /var/lib/check_mk/web
setperm www-data nagios 4770 /var/lib/check_mk/wato
setperm www-data nagios 4770 /etc/check_mk/multisite.d
;;
abort-upgrade|abort-remove|abort-deconfigure)
;;
*)
echo "postinst called with unknown argument \$1'" >&2
exit 1
;;
esac
#DEBHELPER#

15
debian/check-mk-server.config vendored Normal file
View File

@ -0,0 +1,15 @@
#!/bin/sh
set -e
# config script is run with 2 parameters given (see man debconf-devel):
# 1. action being performed
# 2. version of the package that is currently installed
# Source debconf library.
. /usr/share/debconf/confmodule
# Message about rdd definiton changes
if [ "$#" -eq 2 ] && test -n "$2"; then
dpkg --compare-versions $2 lt 1.2.0 && db_input high check-mk-server/v1.2_upgrade_msg || true
fi
db_go || true

3
debian/check-mk-server.dirs vendored Normal file
View File

@ -0,0 +1,3 @@
etc/check_mk/conf.d
var/lib/check_mk
var/lib/check_mk/log

14
debian/check-mk-server.install vendored Normal file
View File

@ -0,0 +1,14 @@
etc/check_mk/main.mk
etc/check_mk/conf.d/README
var/lib/check_mk/autochecks
var/lib/check_mk/cache
var/lib/check_mk/counters
var/lib/check_mk/logwatch
var/lib/check_mk/packages
var/lib/check_mk/precompiled
usr/bin/check_mk
usr/share/check_mk/checks
usr/share/check_mk/checks-man
usr/share/check_mk/modules
usr/share/check_mk/pnp-templates
usr/share/check_mk/notifications

1
debian/check-mk-server.links vendored Normal file
View File

@ -0,0 +1 @@
usr/bin/check_mk usr/bin/cmk

53
debian/check-mk-server.postinst vendored Normal file
View File

@ -0,0 +1,53 @@
#!/bin/bash
set -e
# Source debconf library.
. /usr/share/debconf/confmodule
db_stop
# a little helper for getting permissions right
setperm() {
local user="$1"
local group="$2"
local mode="$3"
local file="$4"
shift 4
# only do something when no setting exists
if ! dpkg-statoverride --list "$file" >/dev/null 2>&1; then
chown "$user":"$group" "$file"
chmod "$mode" "$file"
fi
}
case "$1" in
configure)
#make sure our nagios user exists
if ! getent passwd nagios > /dev/null ; then
echo 'Adding system-user for nagios' 1>&2
adduser --system --group --home /var/lib/nagios \
--disabled-login --force-badname nagios > /dev/null
fi
#fix permissions for some directorys
test -d /var/lib/check_mk/cache || mkdir -p /var/lib/check_mk/cache
setperm nagios nagios 0750 /var/lib/check_mk/cache
test -d /var/lib/check_mk/autochecks || mkdir -p /var/lib/check_mk/autochecks
setperm nagios nagios 0750 /var/lib/check_mk/autochecks
test -d /var/lib/check_mk/precompiled || mkdir -p /var/lib/check_mk/precompiled
setperm nagios nagios 0750 /var/lib/check_mk/precompiled
test -d /var/lib/check_mk/counters/ || mkdir -p /var/lib/check_mk/counters/
setperm nagios nagios 0750 /var/lib/check_mk/counters/
test -d /var/lib/check_mk/logwatch/ || mkdir -p /var/lib/check_mk/logwatch/
setperm nagios www-data 0770 /var/lib/check_mk/logwatch/
test -d /var/lib/check_mk/notify/ || mkdir -p /var/lib/check_mk/notify/
setperm nagios www-data 0770 /var/lib/check_mk/notify/
;;
abort-upgrade|abort-remove|abort-deconfigure)
;;
*)
echo "postinst called with unknown argument \$1'" >&2
exit 1
;;
esac
#DEBHELPER#

10
debian/check-mk-server.postrm vendored Normal file
View File

@ -0,0 +1,10 @@
#!/bin/sh
set -e
# cleanup var dirs on
if [ "$1" = "purge" ] ; then
[ -e /var/lib/check_mk ] && rm -rf /var/lib/check_mk || true
fi
#DEBHELPER#

8
debian/check-mk-server.templates vendored Normal file
View File

@ -0,0 +1,8 @@
Template: check-mk-server/v1.2_upgrade_msg
Type: note
_Description: Convert or delete RRD graphs
The tcp_conn_stats check now also counts sockets in the state BOUND. From that follows that the check now issues one more performance data value.
Those who do not use PNP in the "MULTIPLE" mode need either to delete or convert their RRD graphs of those checks.
Otherwise they won't be updated anymore.
.
For further information, please read the migration notes provided upstream: http://mathias-kettner.de/checkmk_migration_notes.html .

1
debian/compat vendored Normal file
View File

@ -0,0 +1 @@
9

146
debian/control vendored Normal file
View File

@ -0,0 +1,146 @@
Source: check-mk
Section: admin
Priority: optional
Maintainer: Debian Nagios Maintainer Group <pkg-nagios-devel@lists.alioth.debian.org>
Uploaders: Alexander Wirt <formorer@debian.org>,
Jan Wagner <waja@cyconet.org>,
Thomas Bechtold <toabctl@debian.org>,
Ilya Rassadin <elcamlost@gmail.com>,
Matt Taggart <taggart@debian.org>
Build-Depends: debhelper (>= 9), dh-python, python, dpatch, librrd-dev, libboost-dev, libboost-system-dev, g++
Standards-Version: 3.9.8
Vcs-Git: https://anonscm.debian.org/git/pkg-nagios/pkg-check-mk.git
Vcs-Browser: https://anonscm.debian.org/cgit/pkg-nagios/pkg-check-mk.git
Package: check-mk-agent
Architecture: any
Depends: ${shlibs:Depends}, ${misc:Depends}
Suggests: xinetd, python
Recommends: ethtool
Description: general purpose monitoring plugin for retrieving data
Check_mk adopts a new a approach for collecting data from operating systems
and network components. It obsoletes NRPE, check_by_ssh, NSClient and
check_snmp. It has many benefits, the most important of which are:
.
* Significant reduction of CPU usage on the monitoring host.
* Automatic inventory of items to be checked on hosts.
.
This package contains the agent part of check-mk.
Package: check-mk-agent-logwatch
Architecture: all
Depends: ${shlibs:Depends}, ${misc:Depends}, check-mk-agent, python, check-mk-common
Description: general purpose monitoring plugin for retrieving data
Check_mk adopts a new a approach for collecting data from operating systems
and network components. It obsoletes NRPE, check_by_ssh, NSClient and
check_snmp. It has many benefits, the most important of which are:
.
* Significant reduction of CPU usage on the monitoring host.
* Automatic inventory of items to be checked on hosts.
.
This package contains the logwatch plugin for the agent.
Package: check-mk-server
Architecture: any
Depends: ${shlibs:Depends}, ${misc:Depends}, adduser, python, check-mk-config-icinga, debconf
Recommends: check-mk-doc, snmp
Description: general purpose monitoring plugin for retrieving data
Check_mk adopts a new a approach for collecting data from operating systems
and network components. It obsoletes NRPE, check_by_ssh, NSClient and
check_snmp. It has many benefits, the most important of which are:
.
* Significant reduction of CPU usage on the monitoring host.
* Automatic inventory of items to be checked on hosts.
.
This package contains the server part of check_mk
Package: check-mk-config-icinga
Conflicts: check-mk-config-nagios3
Architecture: any
Pre-Depends: dpkg (>= 1.15.7.2~), check-mk-common
Depends: ${shlibs:Depends}, ${misc:Depends}, adduser
Description: general purpose monitoring plugin for retrieving data
Check_mk adopts a new a approach for collecting data from operating systems
and network components. It obsoletes NRPE, check_by_ssh, NSClient and
check_snmp. It has many benefits, the most important of which are:
.
* Significant reduction of CPU usage on the Nagios host.
* Automatic inventory of items to be checked on hosts.
.
This package contains the icinga specific part of check_mk
Package: check-mk-livestatus
Architecture: any
Depends: ${shlibs:Depends}, ${misc:Depends}
Suggests: xinetd
Conflicts: ucspi-unix
Recommends: check-mk-doc
Description: general purpose monitoring plugin for retrieving data
Check_mk adopts a new a approach for collecting data from operating systems
and network components. It obsoletes NRPE, check_by_ssh, NSClient and
check_snmp. It has many benefits, the most important of which are:
.
* Significant reduction of CPU usage on the Nagios host.
* Automatic inventory of items to be checked on hosts.
.
This package contains livestatus
Package: check-mk-multisite
Architecture: any
Depends: ${shlibs:Depends}, ${misc:Depends}, libapache2-mod-python, check-mk-config-icinga
Recommends: sudo, check-mk-doc
Suggests: check-mk-livestatus
Description: general purpose monitoring plugin for retrieving data
Check_mk adopts a new a approach for collecting data from operating systems
and network components. It obsoletes NRPE, check_by_ssh, NSClient and
check_snmp. It has many benefits, the most important of which are:
.
* Significant reduction of CPU usage on the Nagios host.
* Automatic inventory of items to be checked on hosts.
.
This package contains the webfrontend of check_mk also known as
"MK-Multisite"
Package: check-mk-doc
Architecture: all
Section: doc
Depends: ${misc:Depends}
Suggests: check-mk-livestatus, check-mk-server, check-mk-multisite
Description: general purpose monitoring plugin for retrieving data (documentation)
Check_mk adopts a new a approach for collecting data from operating systems
and network components. It obsoletes NRPE, check_by_ssh, NSClient and
check_snmp. It has many benefits, the most important of which are:
.
* Significant reduction of CPU usage on the Nagios host.
* Automatic inventory of items to be checked on hosts.
.
This package contains the check_mk documentation.
Package: check-mk-common
Architecture: all
Section: python
Depends: ${misc:Depends}, ${python:Depends}
Description: general purpose monitoring plugin for retrieving data (common libraries)
Check_mk adopts a new a approach for collecting data from operating systems
and network components. It obsoletes NRPE, check_by_ssh, NSClient and
check_snmp. It has many benefits, the most important of which are:
.
* Significant reduction of CPU usage on the Nagios host.
* Automatic inventory of items to be checked on hosts.
.
This package contains the check_mk python libraries.
Package: check-mk-monitoring-plugins
Architecture: all
Section: net
Depends: ${misc:Depends}, check-mk-common
Description: general purpose monitoring plugin for retrieving data (monitoring plugins)
Check_mk adopts a new a approach for collecting data from operating systems
and network components. It obsoletes NRPE, check_by_ssh, NSClient and
check_snmp. It has many benefits, the most important of which are:
.
* Significant reduction of CPU usage on the Nagios host.
* Automatic inventory of items to be checked on hosts.
.
This package contains the check_mk provided monitoring plugins.

22
debian/copyright vendored Normal file
View File

@ -0,0 +1,22 @@
This package was debianized by Alexander Wirt <formorer@debian.org>
and Sven Velt <sven@velt.de>.
It was downloaded from http://mathias-kettner.de/check_mk_download.html
Current Debian Maintainers: The nagios packaging packaging team
http://alioth.debian.org/projects/pkg-nagios/
Mailing-List: pkg-nagios-devel@lists.alioth.debian.org
Upstream Author: Mathias Kettner <mk@mathias-kettner.de>
Copyright (c) 2009-2010 Mathias Kettner <mk@mathias-kettner.de>
License:
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License version 2 as
published by the Free Software Foundation.
On Debian systems, the complete text of the GNU General Public
License, version 2, can be found in /usr/share/common-licenses/GPL-2.

2
debian/patches/00list vendored Normal file
View File

@ -0,0 +1,2 @@
01_fix_livestatus
02_wato-sudoers

19
debian/patches/01_fix_livestatus.dpatch vendored Normal file
View File

@ -0,0 +1,19 @@
#! /bin/sh /usr/share/dpatch/dpatch-run
## 01_fix_livestatus.dpatch by Alexander Wirt <formorer@debian.org>
##
## All lines beginning with `## DP:' are a description of the patch.
## DP: No description.
@DPATCH@
diff -urNad '--exclude=CVS' '--exclude=.svn' '--exclude=.git' '--exclude=.arch' '--exclude=.hg' '--exclude=_darcs' '--exclude=.bzr' pkg-check_mk~/setup.sh pkg-check_mk/setup.sh
--- pkg-check_mk~/setup.sh 2011-05-28 13:21:38.000000000 +0200
+++ pkg-check_mk/setup.sh 2011-05-28 13:22:09.662237441 +0200
@@ -535,6 +535,8 @@
rm -rf $D
mkdir -p $D
tar xvzf $SRCDIR/livestatus.tar.gz -C $D
+ sed -i '/Boston/ a\
+#include <cstddef>' livestatus.src/src/TableStatus.cc livestatus.src/src/TableLog.cc
pushd $D
./configure --libdir=$libdir --bindir=$bindir &&
make clean &&

44
debian/patches/02_wato-sudoers.dpatch vendored Normal file
View File

@ -0,0 +1,44 @@
#! /bin/sh /usr/share/dpatch/dpatch-run
## wato-sudoers-location.dpatch by Bernd Zeimetz <bzed@debian.org>
##
## All lines beginning with `## DP:' are a description of the patch.
## DP: Install WATO sudoers line into /etc/sudoers.d/check_mk_WATO
@DPATCH@
diff -urNad '--exclude=CVS' '--exclude=.svn' '--exclude=.git' '--exclude=.arch' '--exclude=.hg' '--exclude=_darcs' '--exclude=.bzr' pkg-check-mk~/setup.sh pkg-check-mk/setup.sh
--- pkg-check-mk~/setup.sh 2013-08-07 11:44:12.000000000 +0200
+++ pkg-check-mk/setup.sh 2013-08-07 11:47:40.344748346 +0200
@@ -718,28 +718,11 @@
return
fi
- 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
+ sudolines="Defaults:$wwwuser !requiretty\n$wwwuser ALL = (nagios) NOPASSWD: $bindir/check_mk --automation *"
+ mkdir -p $DESTDIR/etc/sudoers.d
+ echo >> $DESTDIR/etc/sudoers.d/check_mk_wato
+ echo "# Needed for WATO - the Check_MK Web Administration Tool" >> $DESTDIR/etc/sudoers.d/check_mk_wato
+ echo -e "$sudolines" >> $DESTDIR/etc/sudoers.d/check_mk_wato
}
while true

217
debian/paths.py.icinga vendored Normal file
View File

@ -0,0 +1,217 @@
#!/usr/bin/python
# -*- encoding: utf-8; py-indent-offset: 4 -*-
# +------------------------------------------------------------------+
# | ____ _ _ __ __ _ __ |
# | / ___| |__ ___ ___| | __ | \/ | |/ / |
# | | | | '_ \ / _ \/ __| |/ / | |\/| | ' / |
# | | |___| | | | __/ (__| < | | | | . \ |
# | \____|_| |_|\___|\___|_|\_\___|_| |_|_|\_\ |
# | |
# | Copyright Mathias Kettner 2016 mk@mathias-kettner.de |
# +------------------------------------------------------------------+
#
# This file is part of Check_MK.
# 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-
# tails. 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.
"""This module serves the path structure of the Check_MK environment
to all components of Check_MK."""
import os
from .exceptions import MKGeneralException
# TODO: Clean this up one day by using the way recommended by gettext.
# (See https://docs.python.org/2/library/gettext.html). For this we
# need the path to the locale files here.
try:
_
except NameError:
_ = lambda x: x # Fake i18n when not available
#
# First declare the possible paths for the linters. Then set it within _set_paths()
#
# TODO: Add piggyback_dir and use it in code
omd_root = None
default_config_dir = None
main_config_file = None
final_config_file = None
local_config_file = None
check_mk_config_dir = None
modules_dir = None
var_dir = None
log_dir = None
autochecks_dir = None
precompiled_hostchecks_dir= None
snmpwalks_dir = None
counters_dir = None
tcp_cache_dir = None
tmp_dir = None
logwatch_dir = None
nagios_objects_file = None
nagios_command_pipe_path = None
check_result_path = None
nagios_status_file = None
nagios_conf_dir = None
nagios_config_file = None
nagios_startscript = None
nagios_binary = None
apache_config_dir = None
htpasswd_file = None
livestatus_unix_socket = None
pnp_rraconf_dir = None
livebackendsdir = None
share_dir = None
checks_dir = None
notifications_dir = None
inventory_dir = None
check_manpages_dir = None
agents_dir = None
mibs_dir = None
web_dir = None
pnp_templates_dir = None
doc_dir = None
locale_dir = None
bin_dir = None
lib_dir = None
mib_dir = None
# TODO: Add active_checks_dir and make it used in code
local_share_dir = None
local_checks_dir = None
local_notifications_dir = None
local_inventory_dir = None
local_check_manpages_dir = None
local_agents_dir = None
local_mibs_dir = None
local_web_dir = None
local_pnp_templates_dir = None
local_doc_dir = None
local_locale_dir = None
local_bin_dir = None
local_lib_dir = None
local_mib_dir = None
def _set_paths():
omd_root = _omd_root()
globals().update({
"omd_root" : omd_root,
"default_config_dir" : os.path.join(omd_root, "etc/check_mk"),
"main_config_file" : os.path.join(omd_root, "etc/check_mk/main.mk"),
"final_config_file" : os.path.join(omd_root, "etc/check_mk/final.mk"),
"local_config_file" : os.path.join(omd_root, "etc/check_mk/local.mk"),
"check_mk_config_dir" : os.path.join(omd_root, "etc/check_mk/conf.d"),
"modules_dir" : os.path.join(omd_root, "share/check_mk/modules"),
"var_dir" : os.path.join(omd_root, "var/check_mk"),
"log_dir" : os.path.join(omd_root, "var/log"),
"autochecks_dir" : os.path.join(omd_root, "var/check_mk/autochecks"),
"precompiled_hostchecks_dir" : os.path.join(omd_root, "var/check_mk/precompiled"),
"snmpwalks_dir" : os.path.join(omd_root, "var/check_mk/snmpwalks"),
"counters_dir" : os.path.join(omd_root, "tmp/check_mk/counters"),
"tcp_cache_dir" : os.path.join(omd_root, "tmp/check_mk/cache"),
"tmp_dir" : os.path.join(omd_root, "tmp/check_mk"),
"logwatch_dir" : os.path.join(omd_root, "var/check_mk/logwatch"),
"nagios_startscript" : os.path.join(omd_root, "etc/init.d/iginga"),
# Switched via symlinks on icinga/nagios change
"nagios_conf_dir" : os.path.join(omd_root, "etc/icinga/conf.d"),
"nagios_objects_file" : os.path.join(omd_root, "etc/icinga/conf.d/check_mk_objects.cfg"),
"check_result_path" : os.path.join(omd_root, "tmp/nagios/checkresults"),
"nagios_status_file" : os.path.join(omd_root, "tmp/nagios/status.dat"),
"apache_config_dir" : os.path.join(omd_root, "etc/apache"),
"htpasswd_file" : os.path.join(omd_root, "etc/htpasswd"),
"livestatus_unix_socket" : os.path.join(omd_root, "tmp/run/live"),
"pnp_rraconf_dir" : os.path.join(omd_root, "share/check_mk/pnp-rraconf"),
"livebackendsdir" : os.path.join(omd_root, "share/check_mk/livestatus"),
})
_set_core_specific_paths()
_set_overridable_paths()
_set_overridable_paths(local=True)
def _omd_root():
return os.environ.get("OMD_ROOT", "")
#try:
#except KeyError:
# raise MKGeneralException(_("OMD_ROOT environment variable not set. You can "
# "only execute this in an OMD site."))
def _set_core_specific_paths():
omd_root = _omd_root()
core = _get_core_name()
if core == "icinga":
globals().update({
"nagios_binary" : os.path.join(omd_root, "bin/icinga"),
"nagios_config_file" : os.path.join(omd_root, "tmp/icinga/icinga.cfg"),
"nagios_command_pipe_path" : os.path.join(omd_root, "tmp/run/icinga.cmd"),
})
else:
globals().update({
# debian override of default for icinga, to avoid needing an
# etc/omd/site.conf
"nagios_binary" : os.path.join(omd_root, "bin/icinga"),
"nagios_config_file" : os.path.join(omd_root, "tmp/icinga/nagios.cfg"),
"nagios_command_pipe_path" : os.path.join(omd_root, "tmp/run/icinga.cmd"),
})
# TODO: Find a better way to determine the currently configured core.
# For example generalize the etc/check_mk/conf.d/microcore.mk which is written by the CORE
# hook -> Change the name to core.mk and write it for all configured cores.
def _get_core_name():
try:
for l in open(os.path.join(omd_root, "etc/omd/site.conf")):
if l.startswith("CONFIG_CORE='"):
return l.split("'")[1]
except IOError, e:
# At least in test environment the file is not available. We only added this try/except for
# this case. This should better be solved in a cleaner way.
if e.errno == 2:
pass
else:
raise
def _set_overridable_paths(local=False):
rel_base = "local" if local else ""
var_prefix = "local_" if local else ""
globals().update({
var_prefix+"share_dir" : os.path.join(omd_root, rel_base, "share/check_mk"),
var_prefix+"checks_dir" : os.path.join(omd_root, rel_base, "share/check_mk/checks"),
var_prefix+"notifications_dir" : os.path.join(omd_root, rel_base, "share/check_mk/notifications"),
var_prefix+"inventory_dir" : os.path.join(omd_root, rel_base, "share/check_mk/inventory"),
var_prefix+"check_manpages_dir" : os.path.join(omd_root, rel_base, "share/check_mk/checkman"),
var_prefix+"agents_dir" : os.path.join(omd_root, rel_base, "share/check_mk/agents"),
var_prefix+"mibs_dir" : os.path.join(omd_root, rel_base, "share/check_mk/mibs"),
var_prefix+"web_dir" : os.path.join(omd_root, rel_base, "share/check_mk/web"),
var_prefix+"pnp_templates_dir" : os.path.join(omd_root, rel_base, "share/check_mk/pnp-templates"),
var_prefix+"doc_dir" : os.path.join(omd_root, rel_base, "share/doc/check_mk"),
var_prefix+"locale_dir" : os.path.join(omd_root, rel_base, "share/check_mk/locale"),
var_prefix+"bin_dir" : os.path.join(omd_root, rel_base, "bin"),
var_prefix+"lib_dir" : os.path.join(omd_root, rel_base, "lib"),
var_prefix+"mib_dir" : os.path.join(omd_root, rel_base, "share/snmp/mibs"),
})
_set_paths()

1
debian/po/POTFILES.in vendored Normal file
View File

@ -0,0 +1 @@
[type: gettext/rfc822deb] templates

184
debian/rules vendored Executable file
View File

@ -0,0 +1,184 @@
#!/usr/bin/make -f
# -*- makefile -*-
# Sample debian/rules that uses debhelper.
# This file was originally written by Joey Hess and Craig Small.
# As a special exception, when this file is copied by dh-make into a
# dh-make output file, you may use that output file without restriction.
# This special exception was added by Craig Small in version 0.37 of dh-make.
# Uncomment this to turn on verbose mode.
#export DH_VERBOSE=1
#python_share_dir = /usr/share/check_mk
#export PYBUILD_INSTALL_ARGS ?= \
# --install-lib=${package_share_dir}/ \
# --install-scripts=${package_share_dir}/
configure: configure-stamp
configure-stamp:
dh_testdir
# Add here commands to configure the package.
mkdir agents
tar -xzf agents.tar.gz -C agents
mkdir docs
tar -xzf doc.tar.gz -C docs
touch configure-stamp
build: build-arch build-indep
build-arch: build-stamp
build-indep: build-stamp
build-stamp: patch-stamp configure-stamp
dh_testdir
# Add here commands to compile the package.
#cd agents ; $(MAKE)
#docbook-to-man debian/check-mk.sgml > check-mk.1
touch $@
clean: clean-patched unpatch
clean-patched:
dh_testdir
dh_testroot
rm -f build-stamp configure-stamp
# Add here commands to clean up after the build process.
rm -rf agents docs config livestatus.src livestatus.log
dh_clean
install: build
dh_testdir
dh_testroot
dh_prep
dh_installdirs
dh_installdebconf
mkdir -p debian/tmp
DESTDIR=debian/tmp python_lib_dir=/usr/share/check_mk/ ./setup.sh --yes
## clean up binaries shipped by upstream
# upstream agent deb and rpm
rm -rf debian/tmp/usr/share/check_mk/agent/check-mk-agent*.deb
rm -rf debian/tmp/usr/share/check_mk/agent/check-mk-agent*.rpm
# java jar and classes (we don't rebuild these, help if you want them)
rm -rf debian/tmp/usr/share/doc/check_mk/treasures/jasperreports
# Windows binaries related (we don't rebuild these, help if you want them)
rm -rf debian/tmp/usr/share/check_mk/agents/windows
rm -rf debian/tmp/usr/share/doc/check_mk/windows
rm -rf debian/tmp/usr/share/doc/check_mk/checks/windows_*
rm -rf debian/tmp/usr/share/check_mk/checks/windows_*
rm -rf debian/tmp/usr/share/doc/check_mk/treasures/windows_msi
# remove deprecated stuff
rm -rf debian/tmp/usr/share/doc/check_mk/treasures/deprecated
# remove binary selinux policy file
rm -rf debian/tmp/usr/share/doc/check_mk/treasures/selinux/omd.pp
# remove webapps mkp package file and dir
rm -rf debian/tmp/usr/share/doc/check_mk/treasures/webapp
# remove sap agent with source tarball
rm -rf debian/tmp/usr/share/check_mk/agents/sap
# remove binary agent_modbus
rm debian/tmp/usr/share/doc/check_mk/treasures/modbus/agent_modbus
# remove waitmax binary, check_mk will use timeout if available
rm debian/tmp/usr/share/check_mk/agents/waitmax
rm debian/tmp/usr/share/check_mk/agents/z_os/waitmax
# copy the livestatus stuff that setup.sh generated in it's own dir
cp -a livestatus.src/debian/tmp/* debian/tmp/
## config files
# We need a "paths.py" file with edited paths for FHS and monitoring
# system changes
# remove the provided one
rm debian/tmp/usr/share/check_mk/cmk/paths.py
cp debian/paths.py.icinga debian/tmp/usr/share/check_mk/cmk/paths.py
# provide a safe apache config that references icinga
mkdir -p debian/check-mk-config-icinga/etc/apache2/conf-available/
cp debian/apache.icinga debian/check-mk-config-icinga/etc/apache2/conf-available/check-mk-multisite.conf
# Adjust path names
# sed -i 's#/nagios/cgi-bin/#/cgi-bin/icinga/#' debian/tmp/check-mk-config-icinga/etc/icinga/objects/check_mk_templates.cfg
# Prepare agent files
cp debian/tmp/usr/share/check_mk/agents/check_mk_agent.linux debian/check-mk-agent/usr/bin/check_mk_agent
chmod +x debian/check-mk-agent/usr/bin/check_mk_agent
# mkp wrapper script
mkdir -p debian/check-mk-server/usr/bin
cp debian/tmp/usr/bin/mkp debian/check-mk-server/usr/bin/
chmod +x debian/check-mk-server/usr/bin/mkp
# xinetd: provide config, but disabled by default
cp debian/tmp/usr/share/check_mk/agents/cfg_examples/xinetd.conf debian/check-mk-agent/etc/xinetd.d/check_mk
sed -i 's#disable\s*=\s*no#disable = yes#' debian/check-mk-agent/etc/xinetd.d/check_mk
# move checks manpages (to be installed in -server)
mv debian/tmp/usr/share/doc/check_mk/checks debian/tmp/usr/share/check_mk/checks-man
# remove installed ChangeLog to avoid duplicate
rm debian/tmp/usr/share/doc/check_mk/ChangeLog
# remove installed COPYING, redundant
rm debian/tmp/usr/share/doc/check_mk/COPYING
# Build architecture-independent files here.
binary-indep: build install
dh_testdir -i
dh_install -i
dh_installdocs -i debian/README.Debian
dh_installchangelogs -i ChangeLog
dh_installexamples -i
dh_install -i
dh_python2 /usr/share/check_mk
dh_installman -i
dh_link -i
dh_strip -i
dh_compress -i
dh_fixperms -i
dh_installdeb -i
dh_shlibdeps -i
dh_gencontrol -i
dh_md5sums -i
dh_builddeb -i
# We have nothing to do by default.
# Build architecture-dependent files here.
binary-arch: build install
dh_testdir -a
dh_testroot -a
dh_installchangelogs -a ChangeLog
dh_installdocs -a debian/README.Debian
dh_installexamples -a
dh_install -a
chmod +x debian/check-mk-server/usr/share/check_mk/checks/*
sed -i -e 's/nagiosadmin/icingaadmin/g' debian/check-mk-config-icinga/etc/check_mk/multisite.mk
# dh_installmenu
# dh_installdebconf
# dh_installlogrotate
# dh_installemacsen
# dh_installpam
# dh_installmime
# dh_installinit
# dh_installcron
# dh_installinfo
dh_installman -a
dh_link -a
dh_strip -a
dh_compress -a
dh_fixperms -a
# dh_perl
# dh_makeshlibs
dh_installdeb -a
dh_shlibdeps -a
dh_gencontrol -a
dh_md5sums -a
dh_builddeb -a
patch: patch-stamp
patch-stamp:
@echo "Doing $@"
dpatch --with-cpp apply-all
dpatch --with-cpp cat-all >patch-stamp
unpatch:
@echo "Doing $@"
dpatch --with-cpp deapply-all
rm -rf patch-stamp debian/patched
binary: binary-indep binary-arch
.PHONY: build clean binary-indep binary-arch binary install configure

1
debian/source/format vendored Normal file
View File

@ -0,0 +1 @@
1.0

2
debian/watch vendored Normal file
View File

@ -0,0 +1,2 @@
version=3
http://mathias-kettner.com/check_mk_download_source.html download/check_mk-(1\.2\.[p\d\.]*)\.tar\.gz

BIN
doc.tar.gz Normal file

Binary file not shown.

BIN
inventory.tar.gz Normal file

Binary file not shown.

BIN
lib.tar.gz Normal file

Binary file not shown.

BIN
livestatus.tar.gz Normal file

Binary file not shown.

BIN
modules.tar.gz Normal file

Binary file not shown.

BIN
notifications.tar.gz Normal file

Binary file not shown.

3989
package_info Normal file

File diff suppressed because it is too large Load Diff

BIN
pnp-templates.tar.gz Normal file

Binary file not shown.

25
precompile-werks.py Executable file
View File

@ -0,0 +1,25 @@
#!/usr/bin/env python
import os
import sys
import cmk.werks
werk_dir, dest_file = sys.argv[1:3]
if len(sys.argv) > 3:
edition_short = sys.argv[3]
else:
edition_short = None
werks = cmk.werks.load_raw_files(werk_dir)
if edition_short:
edition_werks = {}
for werk in werks.values():
if werk["edition"] == edition_short:
edition_werks[werk["id"]] = werk
werks = edition_werks
cmk.werks.write_precompiled_werks(dest_file, werks)

1042
setup.sh Executable file

File diff suppressed because it is too large Load Diff

BIN
share.tar.gz Normal file

Binary file not shown.

40
standalone.make Normal file
View File

@ -0,0 +1,40 @@
# +------------------------------------------------------------------+
# | ____ _ _ __ __ _ __ |
# | / ___| |__ ___ ___| | __ | \/ | |/ / |
# | | | | '_ \ / _ \/ __| |/ / | |\/| | ' / |
# | | |___| | | | __/ (__| < | | | | . \ |
# | \____|_| |_|\___|\___|_|\_\___|_| |_|_|\_\ |
# | |
# | Copyright Mathias Kettner 2014 mk@mathias-kettner.de |
# +------------------------------------------------------------------+
#
# This file is part of Check_MK.
# 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-
# tails. 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.
# TODO(sp) We should really use autotools here...
ifneq ($(shell which g++-6 2>/dev/null),)
CXX := g++-6 -std=c++14
else
CXX := g++-5 -std=c++14
endif
CXXFLAGS := -g -O3 -Wall -Wextra
LDFLAGS := -static-libstdc++
.PHONY: all clean
all: $(EXECUTABLES)
clean:
$(RM) $(EXECUTABLES)

BIN
web.tar.gz Normal file

Binary file not shown.

BIN
werks.tar.gz Normal file

Binary file not shown.