[checkmk-commits] Check_MK Git: check_mk: #1939 check_ftp: changed service description if the ftp port differs from 21

Andreas Boesl ab at mathias-kettner.de
Mon Feb 9 12:23:22 CET 2015


Module: check_mk
Branch: master
Commit: bbf2152a9e3d1e4dc9a67369de5163ae729a48d4
URL:    http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=bbf2152a9e3d1e4dc9a67369de5163ae729a48d4

Author: Andreas Boesl <ab at mathias-kettner.de>
Date:   Mon Feb  9 12:23:16 2015 +0100

#1939 check_ftp: changed service description if the ftp port differs from 21

If a host had two check_ftp services assigned they both shared the same
service description, which resulted in only one check. This has been changed.

If the ftp port differs from 21, the port is also shown in the service
description, e.g. <i>FTP Port 999</i>.

So, if you had any check_ftp services running on a port that differs from 21 they will
have an updated service description.

---

 .werks/1939      |   16 ++++++++++++++++
 ChangeLog        |    2 ++
 checks/check_ftp |   11 ++++++++++-
 3 files changed, 28 insertions(+), 1 deletion(-)

diff --git a/.werks/1939 b/.werks/1939
new file mode 100644
index 0000000..1a060e2
--- /dev/null
+++ b/.werks/1939
@@ -0,0 +1,16 @@
+Title: check_ftp: changed service description if the ftp port differs from 21
+Level: 1
+Component: checks
+Compatible: incomp
+Version: 1.2.7i1
+Date: 1423480555
+Class: feature
+
+If a host had two check_ftp services assigned they both shared the same
+service description, which resulted in only one check. This has been changed.
+
+If the ftp port differs from 21, the port is also shown in the service
+description, e.g. <i>FTP Port 999</i>.
+
+So, if you had any check_ftp services running on a port that differs from 21 they will
+have an updated service description.
diff --git a/ChangeLog b/ChangeLog
index 18f3114..87f8c6b 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -79,6 +79,8 @@
     * 1961 akcp_exp_humidity, akcp_exp_smoke, akcp_exp_temp, akcp_exp_water: New checks to monitor AKCP securityProbe and expansion boards...
     * 1991 emc_datadomain_temps: make configurable via WATO, add Perf-O-Meter...
             NOTE: Please refer to the migration notes!
+    * 1939 check_ftp: changed service description if the ftp port differs from 21...
+            NOTE: Please refer to the migration notes!
     * 1457 FIX: logins: new check renamed from "users" check...
             NOTE: Please refer to the migration notes!
     * 1762 FIX: lnx_thermal: Now ignoring trip points with level 0...
diff --git a/checks/check_ftp b/checks/check_ftp
index c9b177d..86d931c 100644
--- a/checks/check_ftp
+++ b/checks/check_ftp
@@ -65,10 +65,19 @@ def check_ftp_arguments(params):
 
     return args
 
+
+def check_ftp_get_item(params):
+    if type(params) == tuple:
+        return "FTP " + args[0]
+    else:
+        if "port" in params and params["port"] != 21:
+            return "FTP Port " + str(params["port"])
+        return "FTP"
+
 active_check_info['ftp'] = {
     "command_line"        : '$USER1$/check_ftp $ARG1$',
     "argument_function"   : check_ftp_arguments,
-    "service_description" : lambda args: type(args) == tuple and ("FTP %s" % args[0]) or "FTP",
+    "service_description" : check_ftp_get_item,
     "has_perfdata"        : True,
 }
 



More information about the checkmk-commits mailing list