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)
Module: check_mk
Branch: master
Commit: 0dd6de0930b8d6f7b77c9384f181962c206ca526
URL: http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=0dd6de0930b8d6…
Author: Bernd Stroessenreuther <bs(a)mathias-kettner.de>
Date: Tue Jul 30 13:41:48 2013 +0200
unified capitalization of the name Cisco
---
checkman/aironet_clients | 4 ++--
checkman/aironet_errors | 4 ++--
checkman/cisco_cpu | 4 ++--
checkman/cisco_mem | 2 +-
checkman/cisco_power | 4 ++--
5 files changed, 9 insertions(+), 9 deletions(-)
diff --git a/checkman/aironet_clients b/checkman/aironet_clients
index 279f561..e57763c 100644
--- a/checkman/aironet_clients
+++ b/checkman/aironet_clients
@@ -1,11 +1,11 @@
-title: CISCO Aironet access points: Client status
+title: Cisco Aironet access points: Client status
agents: snmp
catalog: hw/network/cisco
license: GPL
distribution: check_mk
description:
This check monitors three aspects of the client status
- of an CISCO Aironet access point: the number of clients
+ of an Cisco Aironet access point: the number of clients
logged in, their average signal strength and their average
signal quality. You may provide levels for strength and quality.
If zero clients are logged in, this check is always OK.
diff --git a/checkman/aironet_errors b/checkman/aironet_errors
index e4153d2..704fb35 100644
--- a/checkman/aironet_errors
+++ b/checkman/aironet_errors
@@ -1,11 +1,11 @@
-title: CISCO Aironet access points: CRC errors
+title: Cisco Aironet access points: CRC errors
agents: snmp
catalog: hw/network/cisco
license: GPL
distribution: check_mk
description:
This check monitors the rate of CRC errors on MAC level
- on each of the radios of an CISCO Aironet access point.
+ on each of the radios of an Cisco Aironet access point.
item:
The number of the radio - usually {1} or {2} (integer).
diff --git a/checkman/cisco_cpu b/checkman/cisco_cpu
index 4bae11b..412ed09 100644
--- a/checkman/cisco_cpu
+++ b/checkman/cisco_cpu
@@ -4,13 +4,13 @@ catalog: hw/network/cisco
license: GPL
distribution: check_mk
description:
- Check CPU utilization of the last 5 minutes in percent on CISCO devices.
+ Check CPU utilization of the last 5 minutes in percent on Cisco devices.
perfdata:
Just one value: The CPU utilization of the last 5 minutes in percent.
inventory:
- One service per CISCO device is created.
+ One service per Cisco device is created.
[parameters]
warning (int): The percentage of CPU utilization that triggers a warning level.
diff --git a/checkman/cisco_mem b/checkman/cisco_mem
index b372091..fe67e5b 100644
--- a/checkman/cisco_mem
+++ b/checkman/cisco_mem
@@ -4,7 +4,7 @@ catalog: hw/network/cisco
license: GPL
distribution: check_mk
description:
- This check monitors the memory usage of CISCO devices. The check distinguises between
+ This check monitors the memory usage of Cisco devices. The check distinguises between
CPU and I/O pool.
inventory:
diff --git a/checkman/cisco_power b/checkman/cisco_power
index bd130db..87c59ba 100644
--- a/checkman/cisco_power
+++ b/checkman/cisco_power
@@ -1,11 +1,11 @@
-title: CISCO switches: Redundant Power Supplies
+title: Cisco switches: Redundant Power Supplies
agents: snmp
catalog: hw/network/cisco
license: GPL
distribution: check_mk
description:
This check monitors the health of redundant power supplies in
- CISCO switches. If one of the two power supplies fails, the
+ Cisco switches. If one of the two power supplies fails, the
check returns {CRIT}.
item: