Module: check_mk
Branch: master
Commit: 3368304ffdc6c010ec720364f0c7f90c839169ab
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=3368304ffdc6c0…
Author: Lars Michelsen <lm(a)mathias-kettner.de>
Date: Wed Jun 4 14:18:34 2014 +0200
Added first inline snmp statistics recording code
---
modules/check_mk.py | 3 ++-
modules/check_mk_base.py | 3 +++
web/plugins/wato/check_mk_configuration.py | 15 +++++++++++++++
3 files changed, 20 insertions(+), 1 deletion(-)
diff --git a/modules/check_mk.py b/modules/check_mk.py
index 9ee89ac..eb34e88 100755
--- a/modules/check_mk.py
+++ b/modules/check_mk.py
@@ -243,6 +243,7 @@ max_num_processes = 50
# SNMP communities and encoding
has_inline_snmp = False # is set to True by inline_snmp module, when
available
use_inline_snmp = True
+record_inline_snmp_stats = False
snmp_default_community = 'public'
snmp_communities = []
snmp_timing = []
@@ -3294,7 +3295,7 @@ no_inventory_possible = None
'piggyback_max_cachefile_age',
'simulation_mode', 'agent_simulator',
'aggregate_check_mk', 'debug_log',
'check_mk_perfdata_with_times',
'livestatus_unix_socket',
- 'has_inline_snmp', 'use_inline_snmp',
+ 'has_inline_snmp', 'use_inline_snmp',
'record_inline_snmp_stats',
]:
output.write("%s = %r\n" % (var, globals()[var]))
diff --git a/modules/check_mk_base.py b/modules/check_mk_base.py
index e57a3e7..511adf0 100644
--- a/modules/check_mk_base.py
+++ b/modules/check_mk_base.py
@@ -1015,6 +1015,9 @@ def do_check(hostname, ipaddress, only_check_types = None):
else:
output += "execution time %.1f sec|execution_time=%.3f\n" % (run_time,
run_time)
+ if record_inline_snmp_stats and has_inline_snmp and use_inline_snmp:
+ save_snmp_stats()
+
if opt_keepalive:
global total_check_output
total_check_output += output
diff --git a/web/plugins/wato/check_mk_configuration.py
b/web/plugins/wato/check_mk_configuration.py
index e5f02b9..6e034b0 100644
--- a/web/plugins/wato/check_mk_configuration.py
+++ b/web/plugins/wato/check_mk_configuration.py
@@ -1131,6 +1131,21 @@ register_configvar(group,
need_restart = True
)
+register_configvar(group,
+ "record_inline_snmp_stats",
+ Checkbox(
+ title = _("Record statistics of Inline SNMP"),
+ label = _("Enable recording of Inline SNMP statistics"),
+ help = _("When you have enabled Inline SNMP, you can use this flag to enable
recording of "
+ "some performance related values. The recorded values are stored in
a single file "
+ "at
<tt>var/check_mk/snmp.stats</tt>.<br><br>"
+ "<i>Please note:</i> Only enable this for a short
period, because it will "
+ "decrease the performance of your monitoring."),
+ default_value = False
+ ),
+ need_restart = True
+)
+
group = _("Service discovery")
register_configvar(group,