Module: check_mk
Branch: master
Commit: 1f9fb2a4a1c5e385da656891319c80f1a8ffc405
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=1f9fb2a4a1c5e3…
Author: Götz Golla <gg(a)mathias-kettner.de>
Date: Mon Nov 11 16:52:36 2013 +0100
livedump: new option to mark the mode at the beginning of the dump and documentation
fixes
livedump now has an option to mark the mode of the dump (config or status) in the first
line of the dump to be read by the livedump receiver livedump-ssh-recv
---
.werks/67 | 9 +++++++++
ChangeLog | 1 +
doc/treasures/livedump/README | 4 ++--
doc/treasures/livedump/livedump | 15 +++++++++++++--
doc/treasures/livedump/livedump-ssh-recv | 2 +-
5 files changed, 26 insertions(+), 5 deletions(-)
diff --git a/.werks/67 b/.werks/67
new file mode 100644
index 0000000..a8bd992
--- /dev/null
+++ b/.werks/67
@@ -0,0 +1,9 @@
+Title: livedump: new option to mark the mode at the beginning of the dump and
documentation fixes
+Level: 1
+Component: livestatus
+Version: 1.2.3i7
+Date: 1384184962
+Class: feature
+
+livedump now has an option to mark the mode of the dump (config or status) in the first
+line of the dump to be read by the livedump receiver livedump-ssh-recv
diff --git a/ChangeLog b/ChangeLog
index 74ee996..73fbc7c 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -40,6 +40,7 @@
* 0026 FIX: snmpd_mkevent.py: fixed crash on startup
Livestatus:
+ * 0067 livedump: new option to mark the mode at the beginning of the dump and
documentation fixes...
* 0023 FIX: table statehist: code cleanup / minor performance improvements
diff --git a/doc/treasures/livedump/README b/doc/treasures/livedump/README
index 797adb2..3f478ab 100644
--- a/doc/treasures/livedump/README
+++ b/doc/treasures/livedump/README
@@ -30,10 +30,10 @@ NSCA users will now this. This is easily done by:
./livedump -TC > some_file.cfg
and then copying that file to your objects or conf.d directory on
-your target nagios. Note: The option -C will add some templates
+your target nagios. Note: The option -T will add some templates
to the configuration that are used by the created host and service
definitions. If you import data from more than on source those
-template will be duplicate. Use -T in that case in order to avoid
+template will be duplicate. Use -C only in that case in order to avoid
duplication.
Now restart your target system and new hosts and services will appear
diff --git a/doc/treasures/livedump/livedump b/doc/treasures/livedump/livedump
index b784262..ad391cc 100755
--- a/doc/treasures/livedump/livedump
+++ b/doc/treasures/livedump/livedump
@@ -33,9 +33,11 @@ def dump_templates():
sys.stdout.write("""
define host {
name livedump-host
+ use check_mk_default
register 0
active_checks_enabled 0
passive_checks_enabled 1
+
}
define service {
@@ -226,6 +228,8 @@ def usage():
-h, --help Show this cruft
-V, --version Show version and exit
-T, --dump-templates Also dump host/service templates
+ -M, --mark-mode Puts the mode (state/configuration dump) in the first
+ line for use with livedump-ssh-recv and similar scripts
-s, --socket S connect to Livestatus-socket at S
-s tcp:10.11.0.55:6557
@@ -255,14 +259,15 @@ def print_version():
# | Main entry point, getopt, etc. |
# '----------------------------------------------------------------------'
-short_options = 'hVvc:H:S:O:TC'
+short_options = 'hVvc:H:S:O:TCM'
long_options = [ "help", "version", "verbose",
"debug", "socket=",
"host-header=", "host-only-header=",
"service-header=",
- "dump-templates", "config", "state" ]
+ "dump-templates", "config", "state",
"mark-mode" ]
opt_verbose = False
opt_debug = False
opt_socket = None
+opt_mark_mode = False
opt_host_headers = ""
opt_host_only_headers = ""
opt_service_headers = ""
@@ -299,6 +304,8 @@ for o,a in opts:
opt_service_headers += a + "\n"
elif o in [ '-T', '--dump-templates' ]:
opt_dump_templates = True
+ elif o in [ '-M', '--mark-mode' ]:
+ opt_mark_mode = True
# Main modes
@@ -306,8 +313,12 @@ try:
connect()
for o, a in opts:
if o in [ '-C', '--config' ]:
+ if opt_mark_mode:
+ print "config"
livedump_config()
sys.exit(0)
+ if opt_mark_mode:
+ print "status"
livedump_state()
except Exception, e:
diff --git a/doc/treasures/livedump/livedump-ssh-recv
b/doc/treasures/livedump/livedump-ssh-recv
old mode 100644
new mode 100755
index b8d69ae..7d76172
--- a/doc/treasures/livedump/livedump-ssh-recv
+++ b/doc/treasures/livedump/livedump-ssh-recv
@@ -4,7 +4,7 @@
# 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
+# When the first line contains the string "status", 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