Module: check_mk
Branch: master
Commit: 0155f3b2ead4df7fc8bdcd9ef9ad207f68bc4ccb
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=0155f3b2ead4df…
Author: Lars Michelsen <lm(a)mathias-kettner.de>
Date: Wed Oct 5 16:08:49 2011 +0200
FIX: mbg_lantime_state: Fixed output UOM to really be miliseconds
---
ChangeLog | 1 +
checkman/mbg_lantime_state | 6 +++---
checks/mbg_lantime_state | 16 ++++++----------
3 files changed, 10 insertions(+), 13 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index 5eaa53a..cb5b7f2 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -9,6 +9,7 @@
* mrpe: make check cluster-aware and work as clustered_service
* cups_queues: Run agent part only on directly on CUPS servers,
not on clients
+ * FIX: mbg_lantime_state: Fixed output UOM to really be miliseconds
Multisite:
diff --git a/checkman/mbg_lantime_state b/checkman/mbg_lantime_state
index f5befac..266e06a 100644
--- a/checkman/mbg_lantime_state
+++ b/checkman/mbg_lantime_state
@@ -25,13 +25,13 @@ stratum_warn (int): stratums above this value will raise a {WARNING}
state.
stratum_warn (int): stratums above this value will raise a {CRITICAL} state.
The default is set to {0}. The threshold can be disabled by setting to {None}.
ref_offset_warn (int): refclock offsets above this value will raise a {WARNING} state.
- The default is set to {5}. The threshold can be disabled by setting to {None}.
+ The default is set to {500} microseconds. The threshold can be disabled by setting to
{None}.
ref_offset_crit (int): refclock offsets above this value will raise a {CRITICAL} state.
- The default is set to {10}. The threshold can be disabled by setting to {None}.
+ The default is set to {1000} microseconds. The threshold can be disabled by setting to
{None}.
[configuration]
mbg_lantime_state_default_levels (int, int, int, int): A tuple of four floats or
integers: The default
levels. These levels are used for inventorized checks. This variable
- is preset to {(0, 0, 5, 10)}
+ is preset to {(0, 0, 500, 1000)}
diff --git a/checks/mbg_lantime_state b/checks/mbg_lantime_state
index af5b042..6c0fd13 100644
--- a/checks/mbg_lantime_state
+++ b/checks/mbg_lantime_state
@@ -34,8 +34,8 @@ mbg_lantime_state_statemap = {
'5': 'normalOperationRefclock',
}
-# stratum, refclock_offset
-mbg_lantime_state_default_levels = (0, 0, 5, 10)
+# stratum, refclock_offset (in microseconds)
+mbg_lantime_state_default_levels = (0, 0, 500, 1000)
def inventory_mbg_lantime_state(info):
if len(info) > 0 and len(info[0]) == 5:
@@ -70,18 +70,14 @@ def check_mbg_lantime_state(item, params, info):
thr_txt = ''
- if refclock_offset < 0:
- pos_refclock_offset = refclock_offset * -1
- else:
- pos_refclock_offset = refclock_offset
-
- if params[2] is not None and int(pos_refclock_offset) > params[3]:
+ pos_refclock_offset = abs(savefloat(refclock_offset))
+ if params[2] is not None and pos_refclock_offset > params[3]:
state = max(state, 2)
thr_txt = ' (!!)'
- elif params[3] is not None and int(pos_refclock_offset) > params[2]:
+ elif params[3] is not None and pos_refclock_offset > params[2]:
state = max(state, 1)
thr_txt = ' (!)'
- state_txt.append('Refclock Offset: %sms%s' % (refclock_offset, thr_txt))
+ state_txt.append('Refclock Offset: %0.4fms%s' % (pos_refclock_offset /
1000, thr_txt))
perfdata = [('offset', refclock_offset, params[2], params[3])]