Module: check_mk
Branch: master
Commit: 63eec1b698d15062c4011d3f27d4467e77bfe2e4
URL: http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=63eec1b698d150…
Author: Bernd Stroessenreuther <bs(a)mathias-kettner.de>
Date: Wed Jul 31 08:52:43 2013 +0200
fixed wording
---
checkman/plesk_backups | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/checkman/plesk_backups b/checkman/plesk_backups
index b7f4b8d..7025a42 100644
--- a/checkman/plesk_backups
+++ b/checkman/plesk_backups
@@ -19,8 +19,8 @@ item:
examples:
# set up a check for a plesk backup
- # warn if backup is elder than 1 day (86400 sec)
- # and crit if elder than 2 days
+ # warn if backup is older than 1 day (86400 sec)
+ # and crit if older than 2 days
# warn if Maximum size of all files on backup space is > 70 MB
# (73400320 Bytes) and crit if > 80 MB
# warn also if no backup is configured or no backup can be found
@@ -47,7 +47,7 @@ inventory:
is installed and working (it outputs the {<<<plesk_backups>>>} section).
[parameters]
-backup_age(int, int): if the age of the backup (in seconds) is elder than the first value, return {WARN} state, if elder than the second one, return {CRIT} state
+backup_age(int, int): if the age of the backup (in seconds) is older than the first value, return {WARN} state, if older than the second one, return {CRIT} state
total_size(int, int): if the total size of all backups on the backup space (in bytes) is larger than than the first value, return {WARN} state, if larger than the second one, return {CRIT} state
no_backup_configured_state(int): the numeric state that should be returned if no backup is configured ( 0 = {OK}, 1 = {WARN}, 2 = {CRIT} )
no_backup_found_state(int): the numeric state that should be returned if no backup can be found ( 0 = {OK}, 1 = {WARN}, 2 = {CRIT} )
Module: check_mk
Branch: master
Commit: 27cd90ef9920c8ae5980b0a2b1dd595d82180fa2
URL: http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=27cd90ef9920c8…
Author: Lars Michelsen <lm(a)mathias-kettner.de>
Date: Wed Jul 31 08:37:09 2013 +0200
Added host-only-filter ; Added ssh handler script to receive livedump output via stdin over ssh
---
doc/treasures/livedump/livedump | 39 +++++++++++++----------
doc/treasures/livedump/livedump-ssh-recv | 51 ++++++++++++++++++++++++++++++
2 files changed, 74 insertions(+), 16 deletions(-)
diff --git a/doc/treasures/livedump/livedump b/doc/treasures/livedump/livedump
index e483d0e..b784262 100755
--- a/doc/treasures/livedump/livedump
+++ b/doc/treasures/livedump/livedump
@@ -101,7 +101,8 @@ def livedump_config():
"GET hosts\n" \
"Columns: name alias address groups check_command " \
"max_check_attempts contacts\n" + \
- opt_host_headers
+ opt_host_headers + \
+ opt_host_only_headers
for row in g_connection.query_table_assoc(query):
prepare_row(row)
row["groupstring"] = ",".join(row["groups"])
@@ -151,7 +152,8 @@ def livedump_state():
query = \
"GET hosts\n" \
"Columns: name state plugin_output perf_data latency\n" \
- + opt_host_headers
+ + opt_host_headers \
+ + opt_host_only_headers
for row in g_connection.query_table_assoc(query):
encode_row(row)
@@ -219,20 +221,22 @@ def bail_out(x):
def usage():
sys.stderr.write("""Usage: %s [OPTIONS] [-C]
- -C, --config Dump configuration (instead of state)
+ -C, --config Dump configuration (instead of state)
+
+ -h, --help Show this cruft
+ -V, --version Show version and exit
+ -T, --dump-templates Also dump host/service templates
- -h, --help Show this cruft
- -V, --version Show version and exit
- -T, --dump-templates Also dump host/service templates
+ -s, --socket S connect to Livestatus-socket at S
+ -s tcp:10.11.0.55:6557
+ -s unix:/var/run/nagios/rw/live
+ -O, --host-only-header H add header H to host queries only (usually Filter: ...)
+ -H, --host-header H add header H to host queries (usually Filter: ...).
+ This header is also used in service queries.
+ -S, --service-header H add header H to service queries (usually Filter: ...)
- -s, --socket S connect to Livestatus-socket at S
- -s tcp:10.11.0.55:6557
- -s unix:/var/run/nagios/rw/live
- -H, --host-header H add header H to host LQL (usually Filter: ...)
- -S, --service-header H add header H to service LQL (usually Filter: ...)
-
- -v, --verbose output debug information an stderr
- --debug do not catch Python exceptions
+ -v, --verbose output debug information an stderr
+ --debug do not catch Python exceptions
""")
@@ -251,15 +255,16 @@ def print_version():
# | Main entry point, getopt, etc. |
# '----------------------------------------------------------------------'
-short_options = 'hVvc:H:S:TC'
+short_options = 'hVvc:H:S:O:TC'
long_options = [ "help", "version", "verbose", "debug", "socket=",
- "host-header=", "service-header=",
+ "host-header=", "host-only-header=", "service-header=",
"dump-templates", "config", "state" ]
opt_verbose = False
opt_debug = False
opt_socket = None
opt_host_headers = ""
+opt_host_only_headers = ""
opt_service_headers = ""
opt_dump_templates = False
@@ -286,6 +291,8 @@ for o,a in opts:
opt_debug = True
elif o in [ '-s', '--socket' ]:
opt_socket = a
+ elif o in [ '-O', '--host-only-header' ]:
+ opt_host_only_headers += a + "\n"
elif o in [ '-H', '--host-header' ]:
opt_host_headers += a + "\n"
elif o in [ '-S', '--service-header' ]:
diff --git a/doc/treasures/livedump/livedump-ssh-recv b/doc/treasures/livedump/livedump-ssh-recv
new file mode 100644
index 0000000..b8d69ae
--- /dev/null
+++ b/doc/treasures/livedump/livedump-ssh-recv
@@ -0,0 +1,51 @@
+#!/usr/bin/python
+# Can be called from remote system via SSH, for example as restricted command
+# of a specific SSH key. It reads stdin for
+# a) a header (specificing if its the configuration or status info)
+# b) the real data as generated by livedump
+#
+# When the first line contains the string "state", the following lines
+# are all treated as checkresult information. If the line contains the
+# string "config", the following lines are treated as nagios configuration
+# definitions. All chars after the config string in the subject are used
+# to identfy the sending system. This is an ident of the system to support
+# multiple sending systems.
+#
+# Configuration is written to etc/nagios/conf.d/remote-<ident>.cfg.
+# The status info is sent in nagios state result file format and
+# written to tmp/nagios/checkresults directory in a temporary file
+# which is then processed by nagios.
+
+import os
+import sys
+import tempfile
+
+omd_root = os.environ.get('OMD_ROOT')
+
+mode = None
+first = True
+content = ""
+
+for line in sys.stdin:
+ if first:
+ if line.startswith("status"):
+ mode = "status"
+ elif line.startswith("config"):
+ mode = "config"
+ ident = line[6:].strip().replace("/", "_").replace(".", "_")
+ first = False
+ else:
+ content += line
+
+if mode == "config":
+ file("%s/etc/nagios/conf.d/remote-%s.cfg" %
+ (omd_root, ident), "w").write(content)
+
+elif mode == "status":
+ fd, path = tempfile.mkstemp('', 'c', "%s/tmp/nagios/checkresults" % omd_root)
+ os.write(fd, content)
+ os.close(fd)
+ file(path + ".ok", "w")
+else:
+ sys.stderr.write("ERROR: Invalid mode\n")
+ sys.exit(1)