Module: check_mk
Branch: master
Commit: fbad61f4b76710718d0c3a28330f0c0eb011c9e5
URL: http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=fbad61f4b76710…
Author: Bernd Stroessenreuther <bs(a)mathias-kettner.de>
Date: Mon Sep 30 18:32:34 2013 +0200
Updated bug entries #1052
---
.bugs/1052 | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)
diff --git a/.bugs/1052 b/.bugs/1052
index e89f6e8..f42ceb3 100644
--- a/.bugs/1052
+++ b/.bugs/1052
@@ -1,9 +1,9 @@
Title: CUPS print queue monitoring: Default Printer is not checked / inventorized
Component: checks
-State: open
+Class: bug
+State: done
Date: 2013-09-16 08:52:34
Targetversion: 1.2.3i2
-Class: bug
after a change in the linux agent, all printers are monitored / inventorized
except the default printer, having a
@@ -14,3 +14,6 @@ execution time optimization can be done within the change:
lpstat -a
command should not be executed twice, but only once
(whereas the lpstat -p and lpstat -o commands can be done once per printer)
+
+2013-09-30 18:32:21: changed state open -> done
+fixed with commit 7575f6df5402533d19a8c31e8000a4673905b419
Module: check_mk
Branch: master
Commit: 7b469142248e95111b762f41665b74d8df28b910
URL: http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=7b469142248e95…
Author: Mathias Kettner <mk(a)mathias-kettner.de>
Date: Mon Sep 30 16:06:13 2013 +0200
Began WATOization of check_sql
---
checks/check_sql | 57 ++++++++++++++++++++++++
doc/treasures/active_checks/check_sql | 22 +++++-----
web/plugins/wato/active_checks.py | 77 ++++++++++++++++++++-------------
3 files changed, 115 insertions(+), 41 deletions(-)
diff --git a/checks/check_sql b/checks/check_sql
new file mode 100644
index 0000000..d391c78
--- /dev/null
+++ b/checks/check_sql
@@ -0,0 +1,57 @@
+#!/usr/bin/python
+# -*- encoding: utf-8; py-indent-offset: 4 -*-
+# +------------------------------------------------------------------+
+# | ____ _ _ __ __ _ __ |
+# | / ___| |__ ___ ___| | __ | \/ | |/ / |
+# | | | | '_ \ / _ \/ __| |/ / | |\/| | ' / |
+# | | |___| | | | __/ (__| < | | | | . \ |
+# | \____|_| |_|\___|\___|_|\_\___|_| |_|_|\_\ |
+# | |
+# | Copyright Mathias Kettner 2013 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.
+
+def check_sql_arguments(params):
+ args = " -H '$HOSTNAME$'"
+ args += " --dbms %s" % quote_shell_string(params["dbms"])
+ args += " --name %s" % quote_shell_string(params["name"])
+
+ if "levels" in params:
+ upper = params["levels"]
+ else:
+ upper = "", ""
+
+ if "levels_low" in params:
+ lower = params["levels_low"]
+ else:
+ lower = "", ""
+
+ if "levels" in params or "levels_low" in params:
+ args += " -w %s:%s" % (lower[0], upper[0])
+ args += " -c %s:%s" % (lower[1], upper[1])
+
+ args += " %s" % quote_shell_string(params["sql"])
+
+ return args
+
+
+active_check_info['sql'] = {
+ "command_line" : '$USER1$/check_sql $ARG1$',
+ "argument_function" : check_sql_arguments,
+ "service_description" : lambda args: args["description"],
+ "has_perfdata" : True,
+}
+
diff --git a/doc/treasures/active_checks/check_sql b/doc/treasures/active_checks/check_sql
index 47a7212..4b9954e 100755
--- a/doc/treasures/active_checks/check_sql
+++ b/doc/treasures/active_checks/check_sql
@@ -30,8 +30,8 @@ import sys, getopt
def usage():
sys.stderr.write("""Check_MK SQL Test
-USAGE: check-sql [OPTIONS] SQL-Statement
- check-sql -h
+USAGE: check_sql [OPTIONS] SQL-Statement
+ check_sql -h
ARGUMENTS:
SQL-Statement Valid SQL-Statement for the selected database
@@ -40,17 +40,17 @@ ARGUMENTS:
OPTIONS:
-h, --help Show this help message and exit
- -u USER, --user USER Username for database access
- -p PASS, --password PASS Password for database access
- -d DBMS, --dbms DBMS Name of the database management system.
+ -u USER, --user USER Username for database access
+ -p PASS, --password PASS Password for database access
+ -d DBMS, --dbms DBMS Name of the database management system.
Default is 'postgres', other valid values are
'mysql' and 'oracle'
- -H HOST , --hostname HOST Hostname or IP-Address where the database lives. Default is '127.0.0.1'
- -n NAME, --name NAME Name of the database on the DBMS
- -w RANGE, --warning RANGE lower and upper level for the warning state
- -c RANGE, --critical RANGE lower and upper level for the critical state
+ -H HOST, --hostname HOST Hostname or IP-Address where the database lives. Default is '127.0.0.1'
+ -n NAME, --name NAME Name of the database on the DBMS
+ -w RANGE, --warning RANGE lower and upper level for the warning state, separated by a colon
+ -c RANGE, --critical RANGE lower and upper level for the critical state, separated by a colon
--debug Debug mode: let Python exceptions come through
- -v, --verbose Verbose mode: print sql statement and levels
+ -v, --verbose Verbose mode: print SQL statement and levels
""")
@@ -116,7 +116,7 @@ try:
if args:
opt_sql = ' '.join(map(str,args))
else:
- print "UNKNOWN - no sql statement given"
+ print "UNKNOWN - no SQL statement given"
sys.exit(3)
except Exception, e:
diff --git a/web/plugins/wato/active_checks.py b/web/plugins/wato/active_checks.py
index 1ca1dae..1ee64a0 100644
--- a/web/plugins/wato/active_checks.py
+++ b/web/plugins/wato/active_checks.py
@@ -89,41 +89,58 @@ register_rule(group,
register_rule(group,
"active_checks:sql",
- Tuple(
- title = _("Check SQL DB"),
- help = _("This check connects to the specified database, sends a custom sql-statement "
+ Dictionary(
+ title = _("Check SQL Database"),
+ help = _("This check connects to the specified database, sends a custom SQL-statement "
"and checks that the result has a defined format containing three columns, a "
"number, a text, and performance data. Upper or lower levels may be defined "
"here. If they are not defined the number is taken as the state of the check."
"This check uses the active check <tt>check_sql</tt>."),
+ optional_keys = [ "levels", "levels_low", "perfdata" ],
elements = [
- TextAscii(title = _("Hostname"), allow_empty = False,
- help = _('The hostname or address you want to query')),
- TextAscii(title = _("DBMS"), allow_empty = False,
- help = _('The database management system you want to query')),
- TextAscii(title = _("DB-Name"), allow_empty = False,
- help = _('The name of the database on the DBMS')),
- TextAscii(title = _("SQL-Statement"), allow_empty = False,
- help = _('The SQL-Statement which is sent to the DBMS')),
- Dictionary(
- title = _("Optional parameters"),
- elements = [
- ( "upperlevels",
- Tuple(
- title = _("Upper levels for first output item"),
- elements = [
- Float( title = _("Warning if above")),
- Float( title = _("Critical if above"))
- ])
- ),
- ( "lowerlevels",
- Tuple(
- title = _("Lower levels for first output item"),
- elements = [
- Float( title = _("Warning if below")),
- Float( title = _("Critical if below"))
- ])),
- ]),
+ ( "description",
+ TextUnicode(title = _("Service Description"),
+ help = _("The name of this active service to be displayed."),
+ allow_empty = False,
+ )),
+ ( "dbms",
+ DropdownChoice(
+ title = _("Type of Database"),
+ choices = [
+ ( "mysql", _("MySQL") ),
+ ( "postgres", _("PostgreSQL") ),
+ ( "oracle", _("Oracle") ),
+ ],
+ default_value = "mysql",
+ ),
+ ),
+ ( "name",
+ TextAscii(title = _("Database Name"), allow_empty = False,
+ help = _('The name of the database on the DBMS'))
+ ),
+ ( "sql",
+ TextAscii(title = _("SQL-Statement"), allow_empty = False,
+ help = _('The SQL-Statement which is sent to the DBMS'))
+ ),
+ ( "levels",
+ Tuple(
+ title = _("Upper levels for first output item"),
+ elements = [
+ Float( title = _("Warning if above")),
+ Float( title = _("Critical if above"))
+ ])
+ ),
+ ( "levels_low",
+ Tuple(
+ title = _("Lower levels for first output item"),
+ elements = [
+ Float( title = _("Warning if below")),
+ Float( title = _("Critical if below"))
+ ])
+ ),
+ ( "perfdata",
+ FixedValue(True, totext=_("Store output value into RRD database"), title = _("Performance Data"), ),
+ )
]
),
match = 'all')
Module: check_mk
Branch: master
Commit: 57b7e5e5ae32b6b9a5037cda5b1f53419358c5ff
URL: http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=57b7e5e5ae32b6…
Author: Bernd Stroessenreuther <bs(a)mathias-kettner.de>
Date: Mon Sep 30 15:57:16 2013 +0200
optimizing layout and grouping of check manpages
---
checkman/apc_symmetra_test | 5 +++--
checkman/etherbox.humidity | 1 +
checkman/etherbox.smoke | 1 +
checkman/etherbox.switch | 1 +
checkman/etherbox.temp | 1 +
checkman/ups_test | 11 ++++++-----
checkman/win_printers | 4 ++--
7 files changed, 15 insertions(+), 9 deletions(-)
diff --git a/checkman/apc_symmetra_test b/checkman/apc_symmetra_test
index 9bfef24..bac876b 100644
--- a/checkman/apc_symmetra_test
+++ b/checkman/apc_symmetra_test
@@ -20,8 +20,9 @@ inventory:
[parameters]
parameters(tuple): parameters is a tuple of two values
- warn (int): The warning level in days
- crit (int): The critical level in days
+ {warn}: (int) The warning level in days
+
+ {crit}: (int) The critical level in days
[configuration]
ups_test_default (tuple): This variable is preset to { (0,0) }
diff --git a/checkman/etherbox.humidity b/checkman/etherbox.humidity
index 5a719a0..a394a7e 100644
--- a/checkman/etherbox.humidity
+++ b/checkman/etherbox.humidity
@@ -8,6 +8,7 @@ description:
item:
The port number of the sensor followed by the sensor type
+
Example: "2.3" A humidity sensor(type 3) on port 2
perfdata:
diff --git a/checkman/etherbox.smoke b/checkman/etherbox.smoke
index c9fe94d..9b8036b 100644
--- a/checkman/etherbox.smoke
+++ b/checkman/etherbox.smoke
@@ -8,6 +8,7 @@ description:
item:
The port number of the sensor followed by the sensor type
+
Example: "2.6" A smoke sensor(type 6) on port 2
perfdata:
diff --git a/checkman/etherbox.switch b/checkman/etherbox.switch
index 97cb0fd..00d228f 100644
--- a/checkman/etherbox.switch
+++ b/checkman/etherbox.switch
@@ -11,6 +11,7 @@ description:
item:
The port number of the sensor followed by the sensor type
+
Example: "2.4" A switch contact sensor(type 4) on port 2
perfdata:
diff --git a/checkman/etherbox.temp b/checkman/etherbox.temp
index 2a0f09a..8504078 100644
--- a/checkman/etherbox.temp
+++ b/checkman/etherbox.temp
@@ -8,6 +8,7 @@ description:
item:
The port number of the sensor followed by the sensor type
+
Example: "2.1" A temperature sensor(type 1) on port 2
perfdata:
diff --git a/checkman/ups_test b/checkman/ups_test
index 0bc4d22..9d1ef53 100644
--- a/checkman/ups_test
+++ b/checkman/ups_test
@@ -5,9 +5,9 @@ license: GPL
distribution: check_mk
description:
This check monitors parameters related to the self test of UPS devices: The result of the
- last self test and the last date of the self test run. The check becomes critical if the test
- result is {"doneError"} or {"aborted"}, and warning if the result is {"doneWarning"} or
- {"noTestsInitiated"}. It also has a warning or critical state if the date of the last self
+ last self test and the last date of the self test run. The check becomes {CRIT} if the test
+ result is {"doneError"} or {"aborted"}, and {WARN} if the result is {"doneWarning"} or
+ {"noTestsInitiated"}. It also has a {WARN} or {CRIT} state if the date of the last self
test is more than the warning or critical level ago.
examples:
@@ -21,8 +21,9 @@ inventory:
[parameters]
parameters(tuple): parameters is a tuple of two values
- warn (int): The warning level in days
- crit (int): The critical level in days
+ {warn}: (int) The warning level in days
+
+ {crit}: (int) The critical level in days
[configuration]
ups_test_default (tuple): This variable is preset to { (0,0) }
diff --git a/checkman/win_printers b/checkman/win_printers
index 983542b..2df6d88 100644
--- a/checkman/win_printers
+++ b/checkman/win_printers
@@ -1,12 +1,12 @@
title: Windows Printers: Queue and printer states
agents: windows
-catalog: os/misc
+catalog: os/services
license: GPL
distribution: check_mk
description:
This check needs the agent pluing win_printers.ps1 from our plugin directory.
After copying to the agent plugin directory, Check_MK will find all connected printers.
- Then its possible to set warning and critical levels for the number of jobs in the queue.
+ Then its possible to set {WARN} and {CRIT} levels for the number of jobs in the queue.
Error and operational states from the print will be automaticly detected and displayed.
item:
Module: check_mk
Branch: master
Commit: aa1337e130b9057165ae2caf1cbbaf6deebefcd7
URL: http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=aa1337e130b905…
Author: Götz Golla <gg(a)mathias-kettner.de>
Date: Mon Sep 30 15:32:54 2013 +0200
wato integration of check_sql
---
web/plugins/wato/active_checks.py | 45 +++++++++++++++++++++++++++++++++++--
1 file changed, 43 insertions(+), 2 deletions(-)
diff --git a/web/plugins/wato/active_checks.py b/web/plugins/wato/active_checks.py
index a8473f8..1ca1dae 100644
--- a/web/plugins/wato/active_checks.py
+++ b/web/plugins/wato/active_checks.py
@@ -33,7 +33,7 @@ register_rule(group,
"active_checks:dns",
Tuple(
title = _("Check DNS service"),
- help = _("Check the resultion of a hostname into an IP address by a DNS server. "
+ help = _("Check the resolution of a hostname into an IP address by a DNS server. "
"This check uses <tt>check_dns</tt> from the standard Nagios plugins."),
elements = [
TextAscii(title = _("Hostname"), allow_empty = False,
@@ -88,10 +88,51 @@ register_rule(group,
match = 'all')
register_rule(group,
+ "active_checks:sql",
+ Tuple(
+ title = _("Check SQL DB"),
+ help = _("This check connects to the specified database, sends a custom sql-statement "
+ "and checks that the result has a defined format containing three columns, a "
+ "number, a text, and performance data. Upper or lower levels may be defined "
+ "here. If they are not defined the number is taken as the state of the check."
+ "This check uses the active check <tt>check_sql</tt>."),
+ elements = [
+ TextAscii(title = _("Hostname"), allow_empty = False,
+ help = _('The hostname or address you want to query')),
+ TextAscii(title = _("DBMS"), allow_empty = False,
+ help = _('The database management system you want to query')),
+ TextAscii(title = _("DB-Name"), allow_empty = False,
+ help = _('The name of the database on the DBMS')),
+ TextAscii(title = _("SQL-Statement"), allow_empty = False,
+ help = _('The SQL-Statement which is sent to the DBMS')),
+ Dictionary(
+ title = _("Optional parameters"),
+ elements = [
+ ( "upperlevels",
+ Tuple(
+ title = _("Upper levels for first output item"),
+ elements = [
+ Float( title = _("Warning if above")),
+ Float( title = _("Critical if above"))
+ ])
+ ),
+ ( "lowerlevels",
+ Tuple(
+ title = _("Lower levels for first output item"),
+ elements = [
+ Float( title = _("Warning if below")),
+ Float( title = _("Critical if below"))
+ ])),
+ ]),
+ ]
+ ),
+ match = 'all')
+
+register_rule(group,
"active_checks:tcp",
Tuple(
title = _("Check connecting to a TCP port"),
- help = _("This check test the connection to a TCP port. It uses "
+ help = _("This check tests the connection to a TCP port. It uses "
"<tt>check_tcp</tt> from the standard Nagios plugins."),
elements = [
Integer(title = _("TCP Port"), minvalue=1, maxvalue=65535),