Skip to content

Commit

Permalink
Merge pull request #1 from liske/master
Browse files Browse the repository at this point in the history
Merge changes for 0.2.
  • Loading branch information
liske authored Nov 19, 2016
2 parents f40d0f2 + 70e5a0b commit b805332
Show file tree
Hide file tree
Showing 4 changed files with 46 additions and 7 deletions.
7 changes: 7 additions & 0 deletions ChangeLog
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
cmk_cisco-dom (0.2) unstable; urgency=low

* Fix missing string convertion required for check-mk 1.2.8.
* Add simple perfometer implementation.

-- Thomas Liske <liske@ibh.de> Sat, 19 Nov 2016 12:09:49 +0100

cmk_cisco-dom (0.1) unstable; urgency=low

* Initial release.
Expand Down
8 changes: 4 additions & 4 deletions checks/cisco_dom
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
# Thomas Liske <liske@ibh.de>
#
# Copyright Holder:
# 2015 (C) IBH IT-Service GmbH [http://www.ibh.de/]
# 2015 - 2016 (C) IBH IT-Service GmbH [http://www.ibh.de/]
#
# License:
# This program is free software; you can redistribute it and/or modify
Expand Down Expand Up @@ -75,7 +75,7 @@ def get_thresh_trigger(precision, thresholds):
for soid, ssever, srel, svalue, striggered in thresholds:
if striggered == '1' and (severity == None or severity < int(ssever)):
severity = int(ssever)
threshold = (cisdom_snmp_rels[srel] + "%." + precision + "f dBm") % (int(svalue) * 10**(-1 * int(precision)))
threshold = (cisdom_snmp_rels[srel] + "%." + str(precision) + "f dBm") % (int(svalue) * 10**(-1 * int(precision)))
# critical
if severity in [20, 30]:
return [2, threshold]
Expand Down Expand Up @@ -104,7 +104,7 @@ def check_cisdom(item, params, info):
if sidx == params[0]:
sthresh = filter_thresh_cisdom(sidx, info[2])
spower = int(svalue) * 10**(-1 * int(sprecis))
sdescr = ("Power Level %." + sprecis + "f dBm (Δ %." + sprecis + "f dB)") % (spower, (spower - params[1]))
sdescr = ("Power Level %." + str(sprecis) + "f dBm (Δ %." + str(sprecis) + "f dB)") % (spower, (spower - params[1]))
perf = [
['power level', ("%." + sprecis + "f") % spower, get_thresh_fmt(['10'], sprecis, sthresh), get_thresh_fmt(['20', '30'], sprecis, sthresh), '', ''],
['deviation', ("%." + sprecis + "f") % (spower - params[1]), '-%.1f:%.1f' % (cisdom_dev_warn, cisdom_dev_warn), '-%.1f:%.1f' % (cisdom_dev_crit, cisdom_dev_crit), '', ''],
Expand All @@ -129,7 +129,7 @@ def check_cisdom(item, params, info):
dsever = 1
return (max([tsever, dsever]), sdescr, perf)

return (3, "index '%s' not found in SNMP table" % sidx)
return (3, "index '%s' not found in SNMP table" % params[0])


# check registry
Expand Down
6 changes: 3 additions & 3 deletions packages/cisco_dom
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,6 @@
'web': []},
'name': 'cisco_dom',
'title': 'Cisco Digital Optical Monitoring (SNMP)',
'version': '0.1',
'version.min_required': '1.2.4p5',
'version.packaged': '1.2.4p5'}
'version': '0.2',
'version.min_required': '1.2.6',
'version.packaged': '1.2.6'}
32 changes: 32 additions & 0 deletions perfometer/cisco_dom.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
#!/usr/bin/python
# -*- encoding: utf-8; py-indent-offset: 4 -*-

# cmk_cisco-dom - check-mk plugin for SNMP-based Cisco Digital-Optical-Monitoring monitoring
#
# Authors:
# Thomas Liske <liske@ibh.de>
#
# Copyright Holder:
# 2015 - 2016 (C) IBH IT-Service GmbH [http://www.ibh.de/]
#
# License:
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this package; if not, write to the Free Software
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
#

def perfometer_cisco_dom(row, check_command, perf_data):
color = { 0: "#a4f", 1: "#ff2", 2: "#f22", 3: "#fa2" }[row["service_state"]]
return "%.1f dBm" % perf_data[0][1], perfometer_logarithmic(perf_data[0][1] + 20, 20, 2, color)

perfometers["check_mk-cisco_dom"] = perfometer_cisco_dom

0 comments on commit b805332

Please sign in to comment.