Module: check_mk
Branch: master
Commit: c6895aeabe81b5e4e21b8c8dd2552e1944ff1aa4
URL: http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=c6895aeabe81b5…
Author: Andreas Boesl <ab(a)mathias-kettner.de>
Date: Wed Aug 26 14:08:45 2015 +0200
#2423 interface checks: now able to configure absolute levels for error packets
You can now configure absolute levels for the error package rate.
Note: These new levels are configured as a tuple of integers.
The previous version of this check did not distinguish between percentual levels
configured as pair of int or float.
If you configured the old error rates as int tuples (which was an error in the first place),
you have to update these rules accordingly.
---
.werks/2423 | 15 +++++++++++++++
ChangeLog | 1 +
checks/if.include | 21 ++++++++++++++-------
web/plugins/wato/check_parameters.py | 28 +++++++++++++++++++++-------
4 files changed, 51 insertions(+), 14 deletions(-)
diff --git a/.werks/2423 b/.werks/2423
new file mode 100644
index 0000000..0c52f7e
--- /dev/null
+++ b/.werks/2423
@@ -0,0 +1,15 @@
+Title: interface checks: now able to configure absolute levels for error packets
+Level: 1
+Component: checks
+Compatible: compat
+Version: 1.2.7i3
+Date: 1440590161
+Class: feature
+
+You can now configure absolute levels for the error package rate.
+
+Note: These new levels are configured as a tuple of integers.
+The previous version of this check did not distinguish between percentual levels
+configured as pair of int or float.
+If you configured the old error rates as int tuples (which was an error in the first place),
+you have to update these rules accordingly.
diff --git a/ChangeLog b/ChangeLog
index aa38f76..4aa320f 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -63,6 +63,7 @@
* 2511 siemens_plc: Special agent can now be configured to fetch other memory areas than DB...
* 2421 winperf_phydisk: now able to monitor the average read/write duration for each disk...
* 2422 winperf_mem: new check to monitor memory pages per second...
+ * 2423 interface checks: now able to configure absolute levels for error packets...
* 2315 FIX: windows agent: BOM replacement, fixed incorrect byte offset...
* 2316 FIX: windows agent: fix garbled output of cached agent plugins...
* 2358 FIX: check_mk_agent.solaris: more correct computation of zfs used space...
diff --git a/checks/if.include b/checks/if.include
index e100031..ae416f9 100644
--- a/checks/if.include
+++ b/checks/if.include
@@ -753,16 +753,23 @@ def check_if_common_single(item, params, info, force_counter_wrap = False,
pacrate = urate + nurate + errorrate
if pacrate > 0.0: # any packets transmitted?
errperc = 100.0 * errorrate / pacrate
-
if errperc > 0:
infotext += ", %s-errors: %.2f%%" % (what, errperc)
+ if type(err_crit) == float: # percentual levels
+ if errperc >= err_crit:
+ state = 2
+ infotext += "(!!) >= %s%%" % str(err_crit)
+ elif errperc >= err_warn:
+ state = max(state, 1)
+ infotext += "(!) >= %s%%" % str(err_warn)
+ elif type(err_crit) == int: # absolute levels
+ if errorrate >= err_crit:
+ state = 2
+ infotext += ", %s-error packets: %d (!!) >= %s" % (what, errorrate, err_crit)
+ elif errorrate >= err_warn:
+ state = max(state, 1)
+ infotext += ", %s-errors packets: %d (!!) >= %s" % (what, errorrate, err_warn)
- if err_crit != None and errperc >= err_crit:
- state = 2
- infotext += "(!!) >= " + str(err_crit)
- elif err_warn != None and errperc >= err_warn:
- state = max(state, 1)
- infotext += "(!) >= " + str(err_warn)
# check rate of non-unicast packets
if nucast_crit or nucast_warn:
diff --git a/web/plugins/wato/check_parameters.py b/web/plugins/wato/check_parameters.py
index a4342e9..c9f6210 100644
--- a/web/plugins/wato/check_parameters.py
+++ b/web/plugins/wato/check_parameters.py
@@ -3107,17 +3107,31 @@ register_check_parameters(
# keys where each was configured with an Alternative valuespec
Transform(Dictionary(
elements = [
- ( "errors",
- Tuple(
+ ( "errors",
+ Alternative(
title = _("Levels for error rates"),
help = _("These levels make the check go warning or critical whenever the "
- "<b>percentual error rate</b> of the monitored interface reaches "
- "the given bounds. The error rate is computed by dividing number of "
+ "<b>percentual error rate</b> or the <b>absolute error rate</b> of the monitored interface reaches "
+ "the given bounds. The percentual error rate is computed by dividing number of "
"errors by the total number of packets (successful plus errors)."),
elements = [
- Percentage(title = _("Warning at"), label = _("errors"), default_value = 0.01, display_format = '%.3f' ),
- Percentage(title = _("Critical at"), label = _("errors"), default_value = 0.1, display_format = '%.3f' )
- ])),
+ Tuple(
+ title = _("Percentual levels for error rates"),
+ elements = [
+ Percentage(title = _("Warning at"), unit = _("percent errors"), default_value = 0.01, display_format = '%.3f' ),
+ Percentage(title = _("Critical at"), unit = _("percent errors"), default_value = 0.1, display_format = '%.3f' )
+ ]
+ ),
+ Tuple(
+ title = _("Absolute levels for error rates"),
+ elements = [
+ Integer(title = _("Warning at"), unit= _("errors") ),
+ Integer(title = _("Critical at"), unit = _("errors") )
+ ]
+ )
+ ]
+ )
+ ),
( "speed",
OptionalDropdownChoice(
title = _("Operating speed"),
Module: check_mk
Branch: master
Commit: 746ceacce80a773bd1c2cd39974e21cfe7b8790e
URL: http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=746ceacce80a77…
Author: Andreas Boesl <ab(a)mathias-kettner.de>
Date: Wed Aug 26 12:45:13 2015 +0200
#2422 winperf_mem: new check to monitor memory pages per second
To use this check you need to activate the output of Memory information in
{check_mk.ini}. You can do this by adding {counters = 4:mem} to the section {[winperf]}.
or through the agent bakery rule "Windows Performance-Counter objects".
---
.werks/2422 | 12 +++++
ChangeLog | 1 +
checkman/winperf_mem | 19 +++++++
checks/winperf_mem | 97 ++++++++++++++++++++++++++++++++++
web/plugins/metrics/check_mk.py | 14 +++++
web/plugins/wato/check_parameters.py | 21 ++++++++
6 files changed, 164 insertions(+)
diff --git a/.werks/2422 b/.werks/2422
new file mode 100644
index 0000000..ac6189a
--- /dev/null
+++ b/.werks/2422
@@ -0,0 +1,12 @@
+Title: winperf_mem: new check to monitor memory pages per second
+Level: 1
+Component: checks
+Compatible: compat
+Version: 1.2.7i3
+Date: 1440585785
+Class: feature
+
+To use this check you need to activate the output of Memory information in
+{check_mk.ini}. You can do this by adding {counters = 4:mem} to the section {[winperf]}.
+or through the agent bakery rule "Windows Performance-Counter objects".
+
diff --git a/ChangeLog b/ChangeLog
index 1eaa80a..aa38f76 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -62,6 +62,7 @@
* 2521 new check juniper_trpz_aps_sessions: shows the radio data and sessions per online access point...
* 2511 siemens_plc: Special agent can now be configured to fetch other memory areas than DB...
* 2421 winperf_phydisk: now able to monitor the average read/write duration for each disk...
+ * 2422 winperf_mem: new check to monitor memory pages per second...
* 2315 FIX: windows agent: BOM replacement, fixed incorrect byte offset...
* 2316 FIX: windows agent: fix garbled output of cached agent plugins...
* 2358 FIX: check_mk_agent.solaris: more correct computation of zfs used space...
diff --git a/checkman/winperf_mem b/checkman/winperf_mem
new file mode 100644
index 0000000..f695aca
--- /dev/null
+++ b/checkman/winperf_mem
@@ -0,0 +1,19 @@
+title: Windows memory statistics
+agents: windows
+catalog: os/networking
+license: GPL
+distribution: check_mk
+description:
+ This check monitors the number of memory pages per second.
+ To use this check you need to activate the output of Memory information in
+ {check_mk.ini}. You can do this by adding {counters = 4:mem} to the section {[winperf]}.
+ This {check_mk.ini} configuration can also be done via WATO in the agent bakery rules.
+ You can configure levels for the number of pages per second.
+
+perfdata:
+ The number of pages per second
+
+inventory:
+ If the windows agents has the section {<<<winperf_mem>>>}, then one check
+ will be created
+
diff --git a/checks/winperf_mem b/checks/winperf_mem
new file mode 100644
index 0000000..680f424
--- /dev/null
+++ b/checks/winperf_mem
@@ -0,0 +1,97 @@
+#!/usr/bin/python
+# -*- encoding: utf-8; py-indent-offset: 4 -*-
+# +------------------------------------------------------------------+
+# | ____ _ _ __ __ _ __ |
+# | / ___| |__ ___ ___| | __ | \/ | |/ / |
+# | | | | '_ \ / _ \/ __| |/ / | |\/| | ' / |
+# | | |___| | | | __/ (__| < | | | | . \ |
+# | \____|_| |_|\___|\___|_|\_\___|_| |_|_|\_\ |
+# | |
+# | Copyright Mathias Kettner 2014 mk(a)mathias-kettner.de |
+# +------------------------------------------------------------------+
+#
+# This file is part of Check_MK.
+# The official homepage is at http://mathias-kettner.de/check_mk.
+#
+# check_mk 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 in version 2. check_mk is distributed
+# in the hope that it will be useful, but WITHOUT ANY WARRANTY; with-
+# out even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE. See the GNU General Public License for more de-
+# ails. You should have received a copy of the GNU General Public
+# License along with GNU Make; see the file COPYING. If not, write
+# to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
+# Boston, MA 02110-1301 USA.
+
+# Example output from agent:
+# <<<winperf_mem>>>
+# 1440580801.44 4 3579545
+# 24 5203433 counter
+# 20 643575808 large_rawcount
+# 22 291414016 large_rawcount
+# 26 6212497408 large_rawcount
+# 28 17614 counter
+# 30 1012830 counter
+# 32 3988745 counter
+# 34 456907 counter
+# 36 2011463 counter -----> Pages Counter
+# 818 2007095 counter
+# 38 141612 counter
+# 44 4368 counter
+# 52 35241984 large_rawcount
+# 54 6586368 large_rawcount
+# 46 273 counter
+# 56 41033 rawcount
+# 60 33522 rawcount
+# 674 3545 rawcount
+# 814 114274304 large_rawcount
+# 816 155688960 large_rawcount
+# 62 35016704 large_rawcount
+# 64 1003520 large_rawcount
+# 66 131072 large_rawcount
+# 68 2777088 large_rawcount
+# 70 1777664 large_rawcount
+# 72 77348864 large_rawcount
+# 1402 71146 raw_fraction
+# 1402 1516723 raw_base
+# 1376 628492 large_rawcount
+# 1378 613 large_rawcount
+
+
+def inventory_winperf_mem(info):
+ if len(info) > 1:
+ return [ (None, {}) ]
+
+def check_winperf_mem(_unused, params, info):
+ init_line = info[0]
+ this_time = float(init_line[0])
+
+ lines = iter(info)
+ try:
+ while True:
+ line = lines.next()
+ if line[0] == "36":
+ page_counter = int(line[1])
+ break
+ except StopIteration:
+ pass
+
+ pages_per_sec = get_rate(None, this_time, page_counter)
+ state = 0
+ if "pages_per_second" in params:
+ warn, crit = params["pages_per_second"]
+ if pages_per_sec >= crit:
+ state = 2
+ elif pages_per_sec >= warn:
+ state = 1
+
+ yield state, "Pages/s: %d" % pages_per_sec, [("mem_pages_rate", pages_per_sec)]
+
+check_info["winperf_mem"] = {
+ 'check_function': check_winperf_mem,
+ 'inventory_function': inventory_winperf_mem,
+ 'service_description': 'Memory Pages',
+ 'group': 'mem_pages',
+ 'has_perfdata': True
+}
diff --git a/web/plugins/metrics/check_mk.py b/web/plugins/metrics/check_mk.py
index 1a01079..4931c0f 100644
--- a/web/plugins/metrics/check_mk.py
+++ b/web/plugins/metrics/check_mk.py
@@ -446,6 +446,12 @@ metric_info["caches"] = {
"color" : "51/a",
}
+metric_info["mem_pages_rate"] = {
+ "title" : _("Memory Pages"),
+ "unit" : "1/s",
+ "color": "34/a",
+}
+
metric_info["mem_lnx_cached"] = {
"title" : _("File contents"),
"color": "#91cceb",
@@ -4151,6 +4157,13 @@ perfometer_info.append({
"exponent" : 2,
})
+perfometer_info.append({
+ "type" : "logarithmic",
+ "metric" : "mem_pages_rate",
+ "half_value" : 5000,
+ "exponent" : 2,
+})
+
#.
# .--Graphs--------------------------------------------------------------.
# | ____ _ |
@@ -4328,6 +4341,7 @@ graph_info.append({
],
})
+
graph_info.append({
"title" : _("Cache hit ratio"),
"metrics" : [
diff --git a/web/plugins/wato/check_parameters.py b/web/plugins/wato/check_parameters.py
index 580202c..a4342e9 100644
--- a/web/plugins/wato/check_parameters.py
+++ b/web/plugins/wato/check_parameters.py
@@ -3357,6 +3357,27 @@ register_check_parameters(
register_check_parameters(
subgroup_os,
+ "mem_pages",
+ _("Memory Pages Statistics"),
+ Dictionary(
+ elements = [
+ ("pages_per_second",
+ Tuple(
+ title = _("Pages per second"),
+ elements = [
+ Integer(title = _("Warning at"), unit = _("pages/s") ),
+ Integer(title = _("Critical at"), unit = _("pages/s") ),
+ ]
+ ),
+ )
+ ]
+ ),
+ None,
+ "dict"
+)
+
+register_check_parameters(
+ subgroup_os,
"statgrab_mem",
_("Statgrab Memory Usage"),
Alternative(
Module: check_mk
Branch: master
Commit: 5686cf7da2a3f5117fa8a963c4a2e07c3ce15028
URL: http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=5686cf7da2a3f5…
Author: Lars Michelsen <lm(a)mathias-kettner.de>
Date: Tue Aug 25 14:44:51 2015 +0200
#2512 Custom Icons/Actions: URLs target frames can now be configured
In previous versions the URLs were always opened within the current frameset
instead of the current content frame page. Now you can configure the URLs to
be opened in new frames/tabs or instead of the frameset.
---
.werks/2512 | 11 +++++++++
ChangeLog | 1 +
web/htdocs/views.py | 26 ++++++++++++++++----
web/plugins/views/painters.py | 15 ++++++++----
web/plugins/wato/check_mk_configuration.py | 36 ++++++++++++++++++++--------
5 files changed, 71 insertions(+), 18 deletions(-)
diff --git a/.werks/2512 b/.werks/2512
new file mode 100644
index 0000000..1ea10f9
--- /dev/null
+++ b/.werks/2512
@@ -0,0 +1,11 @@
+Title: Custom Icons/Actions: URLs target frames can now be configured
+Level: 1
+Component: multisite
+Compatible: compat
+Version: 1.2.7i3
+Date: 1440506631
+Class: feature
+
+In previous versions the URLs were always opened within the current frameset
+instead of the current content frame page. Now you can configure the URLs to
+be opened in new frames/tabs or instead of the frameset.
diff --git a/ChangeLog b/ChangeLog
index c08a728..4b8d591 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -149,6 +149,7 @@
* 2484 Virtual Host Tree now allows adding levels of WATO folders...
* 2501 Implemented new crash report handling...
* 2491 Allow clickable URLs in comments and downtime texts...
+ * 2512 Custom Icons/Actions: URLs target frames can now be configured...
* 2314 FIX: Availability: fixed exception when grouping by host or service group
* 2361 FIX: Fix exception for missing key 'title' in certain cases of older customized views
* 2379 FIX: Plugin-Output: Fixed handling of URLs within output of check_http...
diff --git a/web/htdocs/views.py b/web/htdocs/views.py
index 7ed9456..92f988f 100644
--- a/web/htdocs/views.py
+++ b/web/htdocs/views.py
@@ -2542,22 +2542,40 @@ def ajax_popup_action_menu():
for icon in icons:
html.write('<li>\n')
if len(icon) == 4:
- icon_name, title, url = icon[1:]
- if url:
+ icon_name, title, url_spec = icon[1:]
+ if url_spec:
+ url, target_frame = sanitize_action_url(url_spec)
+
url = replace_action_url_macros(url, what, row)
+
onclick = ''
if url.startswith('onclick:'):
onclick = ' onclick="%s"' % url[8:]
url = 'javascript:void(0)'
- html.write('<a href="%s"%s>' % (url, onclick))
+
+ target = ""
+ if target_frame != "_self":
+ target = " target=\"%s\"" % target_frame
+
+ html.write('<a href="%s"%s%s>' % (url, target, onclick))
+
html.icon('', icon_name)
+
if title:
html.write(title)
else:
html.write(_("No title"))
- if url:
+
+ if url_spec:
html.write('</a>')
else:
html.write(icon[1])
html.write('</li>\n')
html.write('</ul>\n')
+
+
+def sanitize_action_url(url_spec):
+ if type(url_spec) == tuple:
+ return url_spec
+ else:
+ return (url_spec, "_self")
diff --git a/web/plugins/views/painters.py b/web/plugins/views/painters.py
index fc9f0b9..fd085cf 100644
--- a/web/plugins/views/painters.py
+++ b/web/plugins/views/painters.py
@@ -288,16 +288,23 @@ def paint_icons(what, row):
output = ''
for icon in toplevel_icons:
if len(icon) == 4:
- icon_name, title, url = icon[1:]
- if url:
+ icon_name, title, url_spec = icon[1:]
+ if url_spec:
+ url, target_frame = sanitize_action_url(url_spec)
url = replace_action_url_macros(url, what, row)
+
onclick = ''
if url.startswith('onclick:'):
onclick = ' onclick="%s"' % url[8:]
url = 'javascript:void(0)'
- output += '<a href="%s"%s>' % (url, onclick)
+
+ target = ""
+ if target_frame != "_self":
+ target = " target=\"%s\"" % target_frame
+
+ output += '<a href="%s"%s%s>' % (url, target, onclick)
output += html.render_icon(icon_name, title)
- if url:
+ if url_spec:
output += '</a>'
else:
output += icon[1]
diff --git a/web/plugins/wato/check_mk_configuration.py b/web/plugins/wato/check_mk_configuration.py
index 2660b37..7df6b18 100644
--- a/web/plugins/wato/check_mk_configuration.py
+++ b/web/plugins/wato/check_mk_configuration.py
@@ -494,16 +494,32 @@ register_configvar(group,
allow_empty = False
)),
('title', TextUnicode(title = _('Title'))),
- ('url', TextAscii(
- title = _('Action URL'),
- help = _('This URL is opened when clicking on the action / icon. You '
- 'can use some macros within the URL which are dynamically '
- 'replaced for each object. These are:<br>'
- '<ul><li>$HOSTNAME$: Contains the name of the host</li>'
- '<li>$SERVICEDESC$: Contains the service description '
- '(in case this is a service)</li>'
- '<li>$HOSTADDRESS$: Contains the network address of the host</li></ul>'),
- size = 80,
+ ('url', Transform(
+ Tuple(
+ title = _('Action'),
+ elements = [
+ TextAscii(
+ title = _('URL'),
+ help = _('This URL is opened when clicking on the action / icon. You '
+ 'can use some macros within the URL which are dynamically '
+ 'replaced for each object. These are:<br>'
+ '<ul><li>$HOSTNAME$: Contains the name of the host</li>'
+ '<li>$SERVICEDESC$: Contains the service description '
+ '(in case this is a service)</li>'
+ '<li>$HOSTADDRESS$: Contains the network address of the host</li></ul>'),
+ size = 80,
+ ),
+ DropdownChoice(
+ title = _("Open in"),
+ choices = [
+ ("_blank", _("Load in a new window / tab")),
+ ("_self", _("Load in current content area (keep sidebar)")),
+ ("_top", _("Load as new page (hide sidebar)")),
+ ],
+ ),
+ ],
+ ),
+ forth = lambda x: type(x) != tuple and (x, "_self") or x,
)),
('toplevel', FixedValue(True,
title = _('Show in column'),
Module: check_mk
Branch: master
Commit: 0dfbdce39066c545cd7dcdc715a55c68bca0dd39
URL: http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=0dfbdce39066c5…
Author: Lars Michelsen <lm(a)mathias-kettner.de>
Date: Tue Aug 25 14:12:58 2015 +0200
#2511 siemens_plc: Special agent can now be configured to fetch other memory areas than DB
The Siemens PLC special agent was only able to fetch data from the "Datenbaustein" memory areas.
Now it can also fetch data from Input, Output, Merker, Timer and Counter memory areas.
---
.werks/2511 | 10 ++++++
ChangeLog | 1 +
agents/special/agent_siemens_plc | 55 +++++++++++++++++++++++--------
web/plugins/wato/datasource_programs.py | 24 ++++++++++++--
4 files changed, 74 insertions(+), 16 deletions(-)
diff --git a/.werks/2511 b/.werks/2511
new file mode 100644
index 0000000..7863e32
--- /dev/null
+++ b/.werks/2511
@@ -0,0 +1,10 @@
+Title: siemens_plc: Special agent can now be configured to fetch other memory areas than DB
+Level: 1
+Component: checks
+Compatible: compat
+Version: 1.2.7i3
+Date: 1440504698
+Class: feature
+
+The Siemens PLC special agent was only able to fetch data from the "Datenbaustein" memory areas.
+Now it can also fetch data from Input, Output, Merker, Timer and Counter memory areas.
diff --git a/ChangeLog b/ChangeLog
index f47e153..8b67b4c 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -60,6 +60,7 @@
* 1283 hyperv_checkpoints,hyperv_vmstatus: Checkpoints and Integration Services Check for HyperV VMs...
* 2520 New check genua_vpn: monitors the VPN state of a genuscreen VPN appliance...
* 2521 new check juniper_trpz_aps_sessions: shows the radio data and sessions per online access point...
+ * 2511 siemens_plc: Special agent can now be configured to fetch other memory areas than DB...
* 2315 FIX: windows agent: BOM replacement, fixed incorrect byte offset...
* 2316 FIX: windows agent: fix garbled output of cached agent plugins...
* 2358 FIX: check_mk_agent.solaris: more correct computation of zfs used space...
diff --git a/agents/special/agent_siemens_plc b/agents/special/agent_siemens_plc
index 8f0d0ad..14b672c 100755
--- a/agents/special/agent_siemens_plc
+++ b/agents/special/agent_siemens_plc
@@ -27,6 +27,7 @@
import getopt, sys, socket, traceback, re, pprint
import snap7
from snap7.util import *
+from snap7.snap7types import S7AreaPE, S7AreaPA, S7AreaMK, S7AreaDB, S7AreaCT, S7AreaTM
def usage():
sys.stderr.write("""Check_MK Siemens PLC Agent
@@ -51,7 +52,9 @@ VALUES:
A value is specified by the following single data fields, which are
concatenated by a ",":
- DB_NUMBER Numeric identified of the DB
+ AREA[:DB_NUMBER] Identifier of the memory area to fetch (db, input,
+ output, merker, timer or counter), plus the optional
+ numeric identifier of the DB separeated by a ":".
ADDRESS Memory address to read
DATATYPE The datatype of the value to read
VALUETYPE The logical type of the value
@@ -112,14 +115,23 @@ for arg in args:
sys.stderr.write("ERROR: Invalid value specified: %s\n" % spec)
usage()
sys.exit(1)
+
+ if ':' in p[0]:
+ area_name, db_number = p[0].split(':')
+ area = (area_name, int(db_number))
+ else:
+ area = ("db", int(p[0]))
+
byte, bit = map(int, p[1].split('.'))
+
if ':' in p[2]:
typename, size = p[2].split(':')
datatype = typename, int(size)
else:
datatype = p[2]
- # db_number, address, datatype, valuetype, ident
- values.append((int(p[0]), (byte, bit), datatype, p[3], p[4]))
+
+ # area, address, datatype, valuetype, ident
+ values.append((area, (byte, bit), datatype, p[3], p[4]))
devices.append({
'host_name' : parts[0],
@@ -132,6 +144,7 @@ for arg in args:
socket.setdefaulttimeout(opt_timeout)
+
def get_dint(_bytearray, byte_index):
"""
Get int value from bytearray.
@@ -144,6 +157,18 @@ def get_dint(_bytearray, byte_index):
byte0 = _bytearray[byte_index]
return byte3 + (byte2 << 8) + (byte1 << 16) + (byte0 << 32)
+
+def area_name_to_area_id(name):
+ return {
+ 'db' : S7AreaDB,
+ 'input' : S7AreaPE,
+ 'output' : S7AreaPA,
+ 'merker' : S7AreaMK,
+ 'timer' : S7AreaTM,
+ 'counter' : S7AreaCT,
+ }[name]
+
+
datatypes = {
# type-name size(bytes) parse-function
# A size of None means the size is provided by configuration
@@ -167,36 +192,40 @@ for device in devices:
addresses = {}
start_address = None
end_address = None
- for db_number, (byte, bit), datatype, valuetype, ident in device['values']:
+ for area, (byte, bit), datatype, valuetype, ident in device['values']:
if type(datatype) == tuple:
size = datatype[1]
else:
size = datatypes[datatype][0]
- addresses.setdefault(db_number, [None, None])
- start_address, end_address = addresses[db_number]
+ addresses.setdefault(area, [None, None])
+ start_address, end_address = addresses[area]
if start_address == None or byte < start_address:
- addresses[db_number][0] = byte
+ addresses[area][0] = byte
end = byte + size
if end_address == None or end > end_address:
- addresses[db_number][1] = end
+ addresses[area][1] = end
# Now fetch the data from each db number
data = {}
- for db_number, (start, end) in addresses.items():
- data[db_number] = client.db_read(db_number, start, size=end-start)
+ for (area_name, db_number), (start, end) in addresses.items():
+ area_id = area_name_to_area_id(area_name)
+ data[(area_name, db_number)] = client.read_area(area_id, db_number, start, size=end-start)
# Now loop all values to be fetched and extract the data
# from the bytes fetched above
- for db_number, (byte, bit), datatype, valuetype, ident in device['values']:
+ for (area_name, db_number), (byte, bit), datatype, valuetype, ident in device['values']:
if type(datatype) == tuple:
typename, size = datatype
parse_func = datatypes[typename][1]
else:
size, parse_func = datatypes[datatype]
- data_offset = addresses[db_number][0]
- data = client.db_read(db_number, byte-data_offset, size)
+
+ data_offset = addresses[(area_name, db_number)][0]
+ area_id = area_name_to_area_id(area_name)
+
+ data = client.read_area(area_id, db_number, byte-data_offset, size)
value = parse_func(data, 0, bit)
sys.stdout.write("%s %s %s %s\n" % (device['host_name'], valuetype, ident, value))
except:
diff --git a/web/plugins/wato/datasource_programs.py b/web/plugins/wato/datasource_programs.py
index 3df0584..956c0f4 100644
--- a/web/plugins/wato/datasource_programs.py
+++ b/web/plugins/wato/datasource_programs.py
@@ -504,9 +504,27 @@ def validate_siemens_plc_values(value, varprefix):
valuetypes[valuetype].append(ident)
_siemens_plc_value = [
- Integer(
- title = "<nobr>%s</nobr>" % _("DB Number"),
- minvalue = 1,
+ Transform(
+ CascadingDropdown(
+ title = _("Area"),
+ choices = [
+ ("db", _("Datenbaustein"),
+ Integer(
+ title = "<nobr>%s</nobr>" % _("DB Number"),
+ minvalue = 1,
+ )
+ ),
+ ("input", _("Input")),
+ ("output", _("Output")),
+ ("merker", _("Merker")),
+ ("timer", _("Timer")),
+ ("counter", _("Counter")),
+ ],
+ orientation = "horizontal",
+ sorted = True,
+ ),
+ # Transform old Integer() value spec to new cascading dropdown value
+ forth = lambda x: type(x) == int and ("db", x) or x,
),
Float(
title = _("Address"),
Module: check_mk
Branch: master
Commit: 0e8d07d2bb9058f3795ccb2976be5097daee218f
URL: http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=0e8d07d2bb9058…
Author: Bastian Kuhn <bk(a)mathias-kettner.de>
Date: Tue Aug 25 11:44:52 2015 +0200
#1284 FIX symantec_av_progstate: Now Supports the current version of Symantec AV
---
.werks/1284 | 10 ++++++++++
ChangeLog | 1 +
checks/symantec_av_progstate | 2 --
3 files changed, 11 insertions(+), 2 deletions(-)
diff --git a/.werks/1284 b/.werks/1284
new file mode 100644
index 0000000..1f272e7
--- /dev/null
+++ b/.werks/1284
@@ -0,0 +1,10 @@
+Title: symantec_av_progstate: Now Supports the current version of Symantec AV
+Level: 1
+Component: checks
+Class: fix
+Compatible: compat
+State: unknown
+Version: 1.2.7i3
+Date: 1440495858
+
+
diff --git a/ChangeLog b/ChangeLog
index f47e153..c1fc112 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -132,6 +132,7 @@
* 2507 FIX: mysql_slave: fixed exception caused by wrong parsing of agent data
* 1280 FIX: check_mail_loop: It was not possible to use POP3 as protocol to fetch mails
* 1282 FIX: win_printers: Not longer discover offline printers
+ * 1284 FIX: symantec_av_progstate: Now Supports the current version of Symantec AV
Multisite:
* 2385 SEC: Fixed possible reflected XSS on all GUI pages where users can produce unhandled exceptions...
diff --git a/checks/symantec_av_progstate b/checks/symantec_av_progstate
index 417da90..1ece2a1 100644
--- a/checks/symantec_av_progstate
+++ b/checks/symantec_av_progstate
@@ -25,8 +25,6 @@
# Boston, MA 02110-1301 USA.
# Example output from agent:
-# Put here the example output from your TCP-Based agent. If the
-# check is SNMP-Based, then remove this section
def inventory_symantec_av_progstate(info):
return [ ( None, None ) ]