Module: check_mk
Branch: master
Commit: 8af39c0824755eb8c77f325e31a98d427dd43fd4
URL: http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=8af39c0824755e…
Author: Andreas Boesl <ab(a)mathias-kettner.de>
Date: Tue Nov 24 12:51:25 2015 +0100
#2801 snmp text encoding: now able to decode cp437 encoded snmp strings
Furthermore the explicit decoding with the <i>decode_snmp_string</i> function in
the checks <i>if</i>, <i>hr_fs</i> and <i>printer_supply</i> has been removed.
Decoding of strings is now done before the data hits the check.
---
.werks/2801 | 12 ++++++++++++
ChangeLog | 1 +
checks/hr_fs | 2 +-
checks/if | 2 --
checks/printer_supply | 2 +-
modules/snmp.py | 16 +++++-----------
web/plugins/wato/check_mk_configuration.py | 1 +
7 files changed, 21 insertions(+), 15 deletions(-)
diff --git a/.werks/2801 b/.werks/2801
new file mode 100644
index 0000000..63a119c
--- /dev/null
+++ b/.werks/2801
@@ -0,0 +1,12 @@
+Title: snmp text encoding: now able to decode cp437 encoded snmp strings
+Level: 1
+Component: checks
+Compatible: compat
+Version: 1.2.7i4
+Date: 1448365635
+Class: feature
+
+Furthermore the explicit decoding with the <i>decode_snmp_string</i> function in
+the checks <i>if</i>, <i>hr_fs</i> and <i>printer_supply</i> has been removed.
+
+Decoding of strings is now done before the data hits the check.
diff --git a/ChangeLog b/ChangeLog
index 9dace45..f6fd98a 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -40,6 +40,7 @@
* 1304 mk_mysql: Agent plugin can now detect multiple instances running unter the same user...
* 2797 netscaler_vserver: now also shows tftp servers and health state of loadbalacing entities
* 2863 wagner_titanus_topsens: added support for more devices...
+ * 2801 snmp text encoding: now able to decode cp437 encoded snmp strings...
* 2660 FIX: fixed windows agent using the wrong working directory...
* 2664 FIX: ps: Speedup in situation with many matching processes...
* 2661 FIX: windows agent: fixed incomplete process list...
diff --git a/checks/hr_fs b/checks/hr_fs
index 2e9bb33..6489d84 100644
--- a/checks/hr_fs
+++ b/checks/hr_fs
@@ -27,7 +27,7 @@
# Juniper devices put information about the device into the
# field where we expect the mount point. Ugly. Remove that crap.
def fix_hr_fs_mountpoint(mp):
- mp = snmp_decode_string(mp).replace("\\", "/")
+ mp = mp.replace("\\", "/")
if "mounted on:" in mp:
return mp.rsplit(":",1)[-1].strip()
elif "Label:" in mp:
diff --git a/checks/if b/checks/if
index 5514c62..a3849ae 100644
--- a/checks/if
+++ b/checks/if
@@ -35,8 +35,6 @@ def if_convert_to_if64(info):
for line in info:
if saveint(line[0]) > 0: #Fix for switches with empty indexes
newinfo.append(line[0:8] + ['0'] + line[8:12] + ['0'] + line[12:16] + line[1:2] + line[16:17])
- # Fix encoding of interface description
- newinfo[-1][1] = snmp_decode_string(newinfo[-1][1])
return newinfo
check_includes['if'] = [ "if.include" ]
diff --git a/checks/printer_supply b/checks/printer_supply
index 6c4ed20..e3788ae 100644
--- a/checks/printer_supply
+++ b/checks/printer_supply
@@ -68,7 +68,7 @@ def printer_supply_fix_infos(info):
colors = []
new_info = []
for index, line in enumerate(info):
- line_0 = snmp_decode_string(line[0]) # give chance for latin1->utf8 decoding
+ line_0 = line[0] # give chance for latin1->utf8 decoding
# For toners or drum units add the color (if available)
if line_0.startswith('Toner Cartridge') \
diff --git a/modules/snmp.py b/modules/snmp.py
index 81660a9..f14b91f 100644
--- a/modules/snmp.py
+++ b/modules/snmp.py
@@ -276,7 +276,7 @@ def compute_fetch_oid(oid, suboid, column):
def sanitize_snmp_encoding(columns):
for index, column in enumerate(columns):
- columns[index] = map(decode_incoming_string, column)
+ columns[index] = map(snmp_decode_string, column)
return columns
@@ -529,22 +529,16 @@ def get_stored_snmpwalk(hostname, oid):
else:
return rowinfo
-# Helper function to be used in checks. It applies a user-specified
-# character encoding in order to tranlate e.g. latin1 to utf8
def snmp_decode_string(text):
encoding = get_snmp_character_encoding(g_hostname)
if encoding:
- return text.decode(encoding).encode("utf-8")
+ return text.decode(encoding)
else:
- # Try to determine the current string encoding. In case a UTF-8
- # decoding fails, we decode latin1 and encode it as UTF-8 again.
- # When UTF-8 decoding works, we assume the string is already
- # encoded in UTF-8 as we expect it to be.
+ # Try to determine the current string encoding. In case a UTF-8 decoding fails, we decode latin1.
try:
- text.decode('utf-8')
- return text
+ return text.decode('utf-8')
except:
- return text.decode('latin1').encode('utf-8')
+ return text.decode('latin1')
# .--Classic SNMP--------------------------------------------------------.
# | ____ _ _ ____ _ _ __ __ ____ |
diff --git a/web/plugins/wato/check_mk_configuration.py b/web/plugins/wato/check_mk_configuration.py
index 71efa24..e2cdd83 100644
--- a/web/plugins/wato/check_mk_configuration.py
+++ b/web/plugins/wato/check_mk_configuration.py
@@ -1979,6 +1979,7 @@ register_rule(group,
choices = [
("utf-8", _("UTF-8") ),
("latin1" ,_("latin1")),
+ ("cp437" ,_("cp437")),
]
)),
Module: check_mk
Branch: master
Commit: 39db43cf8adb97d0629f8b769e1190c063624f04
URL: http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=39db43cf8adb97…
Author: Andreas Boesl <ab(a)mathias-kettner.de>
Date: Tue Nov 24 11:56:33 2015 +0100
#2800 FIX mk_mysql: fixed some issues with incorrect assembled command line
This plugin tries to detect the correct command line out of the command line for the mysqld.exe.
There were some instances where this mechanism failed.
---
.werks/2800 | 11 +++++++++++
ChangeLog | 1 +
agents/windows/plugins/mk_mysql.vbs | 12 +++++++++++-
3 files changed, 23 insertions(+), 1 deletion(-)
diff --git a/.werks/2800 b/.werks/2800
new file mode 100644
index 0000000..d13f6ff
--- /dev/null
+++ b/.werks/2800
@@ -0,0 +1,11 @@
+Title: mk_mysql: fixed some issues with incorrect assembled command line
+Level: 1
+Component: checks
+Compatible: compat
+Version: 1.2.7i4
+Date: 1448362357
+Class: fix
+
+This plugin tries to detect the correct command line out of the command line for the mysqld.exe.
+There were some instances where this mechanism failed.
+
diff --git a/ChangeLog b/ChangeLog
index e331831..9dace45 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -98,6 +98,7 @@
* 2798 FIX: netapp_api_cpu: fixed incorrect scaling of CPU data in NetApp Clustermode...
* 2799 FIX: check_mail_loop: "Use TLS over SMTP" option did not work
* 2777 FIX: check_mk_agent.linux: avoid execution of .deb temporary files as plugins
+ * 2800 FIX: mk_mysql: fixed some issues with incorrect assembled command line...
Multisite:
* 2684 Added icons for downloading agent data / walks of hosts...
diff --git a/agents/windows/plugins/mk_mysql.vbs b/agents/windows/plugins/mk_mysql.vbs
index 8c26dab..7999b41 100644
--- a/agents/windows/plugins/mk_mysql.vbs
+++ b/agents/windows/plugins/mk_mysql.vbs
@@ -94,6 +94,15 @@ For Each instance In instances.Keys
pos = InStrRev(output, vbCrLf, Len(output)-1)
conn_args = Mid(output, pos+2, Len(output)-pos-4)
+ Dim RegEx : Set RegEx = New RegExp
+ RegEx.Pattern = "(--port=.*?) "
+
+ If RegEx.Test(conn_args) Then
+ conn_args = RegEx.Execute(conn_args)(0).SubMatches(0)
+ Else
+ conn_args = ""
+ End If
+
' Now we try to construct a mysql.exe client command which is able to connect to this database
' based on the command uses by the database service.
' In our development setup, where MySQL 5.6 has been used, the server command is:
@@ -101,7 +110,8 @@ For Each instance In instances.Keys
' To get the client command we simply need to replace mysqld.exe with mysql.exe, remove the
' my.ini and instance name from the end of the command and add our config as --defaults-extra-file.
cmd = instances.Item(instance)
- cmd = Replace(cmd, "mysqld.exe", "mysql.exe")
+ cmd = Replace(cmd, "mysqld""", "mysql""")
+ cmd = Replace(cmd, "mysql""", "mysql.exe""")
cmd = Left(cmd, InStr(cmd, "mysql.exe""")+9)
If cfg_file <> "" Then
cmd = cmd & " --defaults-extra-file=""" & cfg_file & """"
Module: check_mk
Branch: master
Commit: 3aec63e83fcad3b5e7401c2057521774f16f5efd
URL: http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=3aec63e83fcad3…
Author: Sebastian Herbord <sh(a)mathias-kettner.de>
Date: Tue Nov 24 09:26:52 2015 +0100
#2863 wagner_titanus_topsens: added support for more devices
The supported devices are both topsens-es, but different variants. The main difference seems to be
that one has a LSN (Local Security Network) interface and one doesn't.
---
.werks/2863 | 10 ++++
ChangeLog | 1 +
checks/wagner_titanus_topsense | 116 +++++++++++++++++++++++++++-------------
3 files changed, 90 insertions(+), 37 deletions(-)
Diff: http://git.mathias-kettner.de/git/?p=check_mk.git;a=commitdiff;h=3aec63e83f…
Module: check_mk
Branch: master
Commit: 86cf5a8227fe1b230dcff5fed07dff4dfadea1b8
URL: http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=86cf5a8227fe1b…
Author: Mathias Kettner <mk(a)mathias-kettner.de>
Date: Mon Nov 23 21:16:45 2015 +0100
#2777 FIX check_mk_agent.linux: avoid execution of .deb temporary files as plugins
---
.werks/2777 | 9 +++++++++
ChangeLog | 1 +
agents/check_mk_agent.linux | 13 +++++++++----
3 files changed, 19 insertions(+), 4 deletions(-)
diff --git a/.werks/2777 b/.werks/2777
new file mode 100644
index 0000000..06aa6a2
--- /dev/null
+++ b/.werks/2777
@@ -0,0 +1,9 @@
+Title: check_mk_agent.linux: avoid execution of .deb temporary files as plugins
+Level: 1
+Component: checks
+Compatible: compat
+Version: 1.2.7i4
+Date: 1448309782
+Class: fix
+
+
diff --git a/ChangeLog b/ChangeLog
index 44c8f85..64a0988 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -96,6 +96,7 @@
* 2844 FIX: heartbeat_crm: Fixed problem processing the state of clone set resources
* 2798 FIX: netapp_api_cpu: fixed incorrect scaling of CPU data in NetApp Clustermode...
* 2799 FIX: check_mail_loop: "Use TLS over SMTP" option did not work
+ * 2777 FIX: check_mk_agent.linux: avoid execution of .deb temporary files as plugins
Multisite:
* 2684 Added icons for downloading agent data / walks of hosts...
diff --git a/agents/check_mk_agent.linux b/agents/check_mk_agent.linux
index d32045d..949bc51 100755
--- a/agents/check_mk_agent.linux
+++ b/agents/check_mk_agent.linux
@@ -723,17 +723,22 @@ then
done
fi
+function is_valid_plugin () {
+ [[ -f "$1" && -x "$1" && ! "$1" =~ \.dpkg-(new|old|temp)$ ]] && true || false
+}
+
+
# Local checks
echo '<<<local>>>'
if cd $LOCALDIR ; then
for skript in $(ls) ; do
- if [ -f "$skript" -a -x "$skript" ] ; then
+ if is_valid_plugin "$skript" ; then
./$skript
fi
done
# Call some plugins only every X'th second
for skript in [1-9]*/* ; do
- if [ -x "$skript" ] ; then
+ if is_valid_plugin "$skript" ; then
run_cached local_${skript//\//\\} ${skript%/*} "$skript"
fi
done
@@ -742,13 +747,13 @@ fi
# Plugins
if cd $PLUGINSDIR ; then
for skript in $(ls) ; do
- if [ -f "$skript" -a -x "$skript" ] ; then
+ if is_valid_plugin "$skript" ; then
./$skript
fi
done
# Call some plugins only every Xth second
for skript in [1-9]*/* ; do
- if [ -x "$skript" ] ; then
+ if is_valid_plugin "$skript" ; then
run_cached plugins_${skript//\//\\} ${skript%/*} "$skript"
fi
done