Module: check_mk
Branch: master
Commit: afc64683852ce94b0e9113fe92d8262d0caf63f8
URL: http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=afc64683852ce9…
Author: Bernd Stroessenreuther <bs(a)mathias-kettner.de>
Date: Mon Jan 13 14:04:09 2014 +0100
hitachi_hnas_cifs: new check for the number of users using a CIFS share
---
.werks/324 | 8 +++++
ChangeLog | 1 +
checkman/hitachi_hnas_cifs | 18 ++++++++++
checks/hitachi_hnas_cifs | 49 ++++++++++++++++++++++++++
pnp-templates/check_mk-hitachi_hnas_cifs.php | 34 ++++++++++++++++++
web/plugins/perfometer/check_mk.py | 9 +++++
6 files changed, 119 insertions(+)
diff --git a/.werks/324 b/.werks/324
new file mode 100644
index 0000000..8605f75
--- /dev/null
+++ b/.werks/324
@@ -0,0 +1,8 @@
+Title: hitachi_hnas_cifs: new check for the number of users using a CIFS share
+Level: 2
+Component: checks
+Version: 1.2.5i1
+Date: 1389618206
+Class: feature
+
+
diff --git a/ChangeLog b/ChangeLog
index be23603..ac175ae 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -38,6 +38,7 @@
NOTE: Please refer to the migration notes!
* 0078 job: check now monitors the time since last start of the job, limits can be configured in WATO
* 0079 f5_bigip_conns: new check to monitor number of current connections
+ * 0324 hitachi_hnas_cifs: new check for the number of users using a CIFS share
* 0103 FIX: services: Fixed bug with service inventory defined in main.mk...
* 0299 FIX: borcade_mlx_fan: Prettified output, handling "other" state now
* 0300 FIX: cisco_fru_power: Trying not to inventorize not plugged in FRUs...
diff --git a/checkman/hitachi_hnas_cifs b/checkman/hitachi_hnas_cifs
new file mode 100644
index 0000000..467f866
--- /dev/null
+++ b/checkman/hitachi_hnas_cifs
@@ -0,0 +1,18 @@
+title: Hitachi HNAS: Number of Users using CIFS shares
+agents: snmp
+catalog: hw/storagehw/hitachi
+license: GPL
+distribution: check_mk
+description:
+ Reports the number of users currently using a CIFS share on an Hitachi HNAS
+ storage system. The check always returns {OK}.
+
+item:
+ The ID of the EVS plus the name of the CIFS share, separated by a space.
+ E. g. 6 home
+
+perfdata:
+ One value: The number of current users.
+
+inventory:
+ Finds one item per CIFS share.
diff --git a/checks/hitachi_hnas_cifs b/checks/hitachi_hnas_cifs
new file mode 100644
index 0000000..d4cfbed
--- /dev/null
+++ b/checks/hitachi_hnas_cifs
@@ -0,0 +1,49 @@
+#!/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 inventory_hitachi_hnas_cifs(info):
+ # import pprint; pprint.pprint(info)
+ inventory = []
+ for evs_id, share_name, users in info:
+ inventory.append( (evs_id + " " + share_name, None) )
+ return inventory
+
+def check_hitachi_hnas_cifs(item, _no_params, info):
+ for evs_id, share_name, users in info:
+ if evs_id + " " + share_name == item:
+ perfdata = [ ('users', users, '', '', 0) ]
+ return 0, "%s users" % users, perfdata
+ return 3, "Share not found"
+
+check_info["hitachi_hnas_cifs"] = {
+ "check_function" : check_hitachi_hnas_cifs,
+ "inventory_function" : inventory_hitachi_hnas_cifs,
+ "service_description" : "CIFS Share EVS %s",
+ "has_perfdata" : True,
+ "snmp_info" : (".1.3.6.1.4.1.11096.6.1.1.3.2.1.3.1", [1, 2, 5]),
+ # cifsShareEvsId, cifsShareName, cifsShareUsers
+ "snmp_scan_function" : lambda oid: oid(".1.3.6.1.2.1.1.2.0").startswith(".1.3.6.1.4.1.11096.6"),
+}
diff --git a/pnp-templates/check_mk-hitachi_hnas_cifs.php b/pnp-templates/check_mk-hitachi_hnas_cifs.php
new file mode 100644
index 0000000..e9078c5
--- /dev/null
+++ b/pnp-templates/check_mk-hitachi_hnas_cifs.php
@@ -0,0 +1,34 @@
+<?php
+# +------------------------------------------------------------------+
+# | ____ _ _ __ __ _ __ |
+# | / ___| |__ ___ ___| | __ | \/ | |/ / |
+# | | | | '_ \ / _ \/ __| |/ / | |\/| | ' / |
+# | | |___| | | | __/ (__| < | | | | . \ |
+# | \____|_| |_|\___|\___|_|\_\___|_| |_|_|\_\ |
+# | |
+# | 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.
+
+$opt[1] = "--vertical-label \"Number of Users\" --title \"$hostname / $servicedesc\" ";
+
+$def[1] = "DEF:var1=$RRDFILE[1]:$DS[1]:MAX ";
+$def[1] .= "AREA:var1#2080ff:\"Users Current\:\" ";
+$def[1] .= "GPRINT:var1:LAST:\"%2.0lf\" ";
+$def[1] .= "LINE1:var1#000080:\"\" ";
+$def[1] .= "GPRINT:var1:MAX:\"(Max\: %2.0lf,\" ";
+$def[1] .= "GPRINT:var1:AVERAGE:\"Avg\: %2.0lf)\" ";
+?>
diff --git a/web/plugins/perfometer/check_mk.py b/web/plugins/perfometer/check_mk.py
index a638528..06a5895 100644
--- a/web/plugins/perfometer/check_mk.py
+++ b/web/plugins/perfometer/check_mk.py
@@ -297,6 +297,15 @@ def perfometer_temperature_multi(row, check_command, perf_data):
perfometers["check_mk-brocade_mlx_temp"] = perfometer_temperature_multi
+def perfometer_users(row, check_command, perf_data):
+ state = row["service_state"]
+ color = "#39f"
+ value = float(perf_data[0][1])
+ crit = savefloat(perf_data[0][4])
+ return u"%d users" % int(value), perfometer_logarithmic(value, 50, 2, color)
+
+perfometers["check_mk-hitachi_hnas_cifs"] = perfometer_users
+
def perfometer_blower(row, check_command, perf_data):
rpm = saveint(perf_data[0][1])
perc = rpm / 10000.0 * 100.0
Module: check_mk
Branch: master
Commit: 1123f9ba3330c98fcd4728853d66b360b3a28a86
URL: http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=1123f9ba3330c9…
Author: Götz Golla <gg(a)mathias-kettner.de>
Date: Mon Jan 13 13:07:01 2014 +0100
f5_bigip_conns: new check to monitor number of current connections
---
.werks/79 | 7 +++
ChangeLog | 1 +
checkman/f5_bigip_conns | 34 ++++++++++++++
checks/f5_bigip_conns | 83 ++++++++++++++++++++++++++++++++++
web/plugins/wato/check_parameters.py | 29 ++++++++++++
5 files changed, 154 insertions(+)
diff --git a/.werks/79 b/.werks/79
new file mode 100644
index 0000000..ad5ea3f
--- /dev/null
+++ b/.werks/79
@@ -0,0 +1,7 @@
+Title: f5_bigip_conns: new check to monitor number of current connections
+Level: 1
+Component: checks
+Version: 1.2.5i1
+Date: 1389614781
+Class: feature
+
diff --git a/ChangeLog b/ChangeLog
index a411a03..4e1b87d 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -37,6 +37,7 @@
* 0077 cmciii.psm_current, cmciii_psm_plugs, cmciii_io, cmciii.access, cmciii.temp, cmciii.can_current, cmciii.sensor, cmciii.state: new sub checks included in one new check cmcmiii superseding and improving several previous checks of the Rittal CMCIII device...
NOTE: Please refer to the migration notes!
* 0078 job: check now monitors the time since last start of the job, limits can be configured in WATO
+ * 0079 f5_bigip_conns: new check to monitor number of current connections
* 0103 FIX: services: Fixed bug with service inventory defined in main.mk...
* 0299 FIX: borcade_mlx_fan: Prettified output, handling "other" state now
* 0300 FIX: cisco_fru_power: Trying not to inventorize not plugged in FRUs...
diff --git a/checkman/f5_bigip_conns b/checkman/f5_bigip_conns
new file mode 100644
index 0000000..6629dd8
--- /dev/null
+++ b/checkman/f5_bigip_conns
@@ -0,0 +1,34 @@
+title: F5 Big-IP: number of current connections
+agents: snmp
+catalog: hw/network/f5
+license: GPL
+distribution: check_mk
+description:
+ The check queries the MIB tables of F5 BIG-IP loadbalancers (local traffic managers)
+ for the number of current connections and the number of current ssl connections.
+
+ It supports devices running the 9.0 and above releases of the F5 OS. It's tested against 9.3
+ devices.
+
+ Warning and critical limits can be given for both types of data.
+
+ The check is supported by WATO.
+
+inventory:
+ The check has two items per host, the number of connections, and the number of ssl connections
+
+perfdata:
+ The value: the number of current connections
+
+[parameters]
+parameters(dict): parameters is a dictionary with two keys
+
+ {"conns"}: the number of connections from {sysStatClientCurConns }
+
+ {"sslconns"}: the number of ssl connections from {sysClientsslStatCurConns }
+
+[configuration]
+f5_bigip_conns_default_levels(dict): This variable is preset to {{ "conns": ( 25000, 30000 ) }, "sslconns": ( 25000, 30000 )}
+
+
+
diff --git a/checks/f5_bigip_conns b/checks/f5_bigip_conns
new file mode 100644
index 0000000..09e6eb1
--- /dev/null
+++ b/checks/f5_bigip_conns
@@ -0,0 +1,83 @@
+#!/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.
+
+
+# {iso(1) identified-organization(3) dod(6) internet(1) private(4) enterprise(1) 3375 bigipTrafficMgmt(2) bigipSystem(1) sysGlobals(1) sysGlobalStats(2) sysGlobalStat(1) sysStatClientCurConns(8)}
+
+# {iso(1) identified-organization(3) dod(6) internet(1) private(4) enterprise(1) 3375 bigipTrafficMgmt(2) bigipSystem(1) sysGlobals(1) sysGlobalStats(2) sysGlobalClientSslStat(9) sysClientsslStatCurConns(2)}
+
+
+# f5_bigip_conns_default_levels = ( 25000, 30000 )
+factory_settings["f5_bigip_conns_default_levels"] = {
+ "conns": ( 25000, 30000 ),
+ "sslconns": ( 25000, 30000 ),
+}
+
+
+def inventory_f5_bigip_conns(info):
+ inventory = []
+ if info[0][0]:
+ inventory.append( ( "Open Connections", {} ) )
+ if info[0][1]:
+ inventory.append( ( "Open SSL Connections", {} ) )
+
+ return inventory
+
+def check_f5_bigip_conns(item, params, info):
+ if item == "Open Connections":
+ warn, crit = params.get("conns")
+ conns = int(info[0][0])
+ elif item == "Open SSL Connections":
+ warn, crit = params.get("sslconns")
+ conns = int(info[0][1])
+ else:
+ return 3, "no such item"
+
+ infotext = "Number %d (limits %d/%d)" % (conns, warn, crit)
+ perfdata = [ ("conns", conns, warn, crit ) ]
+ if conns > crit:
+ state = 2
+ elif conns > warn:
+ state = 1
+ else:
+ state = 0
+
+ return (state, infotext, perfdata)
+
+check_info["f5_bigip_conns"] = {
+ 'check_function' : check_f5_bigip_conns,
+ 'inventory_function' : inventory_f5_bigip_conns,
+ 'service_description' : 'Open Connections',
+ 'has_perfdata' : True,
+ 'default_levels_variable' : "f5_bigip_conns_default_levels",
+ 'snmp_info' : ( '.1.3.6.1.4.1.3375.2.1.1.2', [
+ '1.8', # sysStatServerCurConns
+ '9.2', # sysClientsslStatCurConns
+ ] ),
+ 'snmp_scan_function' : lambda oid: '.1.3.6.1.4.1.3375.2' in \
+ oid(".1.3.6.1.2.1.1.2.0") and "big-ip" in \
+ oid(".1.3.6.1.4.1.3375.2.1.4.1.0").lower(),
+}
diff --git a/web/plugins/wato/check_parameters.py b/web/plugins/wato/check_parameters.py
index 72898f8..06307eb 100644
--- a/web/plugins/wato/check_parameters.py
+++ b/web/plugins/wato/check_parameters.py
@@ -2661,6 +2661,35 @@ register_check_parameters(
register_check_parameters(
subgroup_applications,
+ "f5_connections",
+ _("F5 Loadbalancer Connections"),
+ Dictionary(
+ elements = [
+ ( "conns",
+ Tuple(
+ title = _("Max. number of connections"),
+ elements = [
+ Integer(title = _("Warning if above"), default_value = 25000 ),
+ Integer(title = _("Critical if above"), default_value = 30000 ) ,
+ ]
+ )
+ ),
+ ( "ssl_conns",
+ Tuple(
+ title = _("Max. number of ssl connections"),
+ elements = [
+ Integer(title = _("Warning if above"), default_value = 25000 ),
+ Integer(title = _("Critical if above"), default_value = 30000 ),
+ ]
+ )
+ ),
+ ]),
+ None,
+ "dict"
+)
+
+register_check_parameters(
+ subgroup_applications,
"dbsize",
_("Size of MySQL/PostgresQL databases"),
Optional(
Module: check_mk
Branch: master
Commit: 5790b3270399a33c115604312be0d2f242fc00da
URL: http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=5790b3270399a3…
Author: Lars Michelsen <lm(a)mathias-kettner.de>
Date: Mon Jan 13 12:01:41 2014 +0100
It is now possible to define custom time ranges in PNP graph search
A display option for choosing the time range to be shown in the searched graphs
has been added to the Graph Search view. This option can be used to specify custom
time ranges, either relative or absolute date/time specifications.
Additionally you can also use the former existing PNP view option to choose the
level of detail (RRAs / views).
---
.werks/430 | 13 ++++
ChangeLog | 1 +
web/htdocs/js/checkmk.js | 23 +++++--
web/htdocs/valuespec.py | 135 ++++++++++++++++++++++++++++++++++++-
web/plugins/views/availability.py | 100 +++------------------------
web/plugins/views/painters.py | 27 ++++++--
6 files changed, 196 insertions(+), 103 deletions(-)
Diff: http://git.mathias-kettner.de/git/?p=check_mk.git;a=commitdiff;h=5790b32703…
Module: check_mk
Branch: master
Commit: 13f53de10fad98589740a9a7ceef7c2244dc4c47
URL: http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=13f53de10fad98…
Author: Mathias Kettner <mk(a)mathias-kettner.de>
Date: Mon Jan 13 10:16:07 2014 +0100
Fix typo in werk title
---
.werks/116 | 2 +-
ChangeLog | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/.werks/116 b/.werks/116
index 11c2f1e..fb58040 100644
--- a/.werks/116
+++ b/.werks/116
@@ -1,4 +1,4 @@
-Title: cisco_vpn_tunnel: Fixed typo who leads to an exception
+Title: cisco_vpn_tunnel: Fixed typo that lead to an exception
Level: 1
Component: checks
Class: fix
diff --git a/ChangeLog b/ChangeLog
index a95acf1..24fe86b 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -93,7 +93,7 @@
* 0403 FIX: mem.used: Prefer statgrab on FreeBSD for supporting more than 4GB...
* 0404 FIX: cups_queues: fix exception in case of alternative time format...
* 0444 FIX: timemachine: do not inventorize check when timemachine is not used
- * 0116 FIX: cisco_vpn_tunnel: Fixed typo who leads to an exception
+ * 0116 FIX: cisco_vpn_tunnel: Fixed typo that lead to an exception
Multisite:
* 0371 Added log class filter to hostsvcevents view
Module: check_mk
Branch: master
Commit: 9256d8286d12041815459342d9b658e50f30bb9e
URL: http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=9256d8286d1204…
Author: Götz Golla <gg(a)mathias-kettner.de>
Date: Fri Jan 10 17:28:01 2014 +0100
job: check now monitors the time since last start of the job, limits can be configured in WATO
---
.werks/78 | 8 ++++++++
ChangeLog | 1 +
checkman/job | 35 ++++++++++++++++++++++------------
checks/job | 27 +++++++++++++++++++-------
web/plugins/wato/check_parameters.py | 22 +++++++++++++++++++++
5 files changed, 74 insertions(+), 19 deletions(-)
diff --git a/.werks/78 b/.werks/78
new file mode 100644
index 0000000..a66346a
--- /dev/null
+++ b/.werks/78
@@ -0,0 +1,8 @@
+Title: job: check now monitors the time since last start of the job, limits can be configured in WATO
+Level: 1
+Component: checks
+Version: 1.2.5i1
+Date: 1389371210
+Class: feature
+
+
diff --git a/ChangeLog b/ChangeLog
index 9a5addd..a411a03 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -36,6 +36,7 @@
* 0254 agent_vsphere: Make handling of spaces in hostnames of ESX configurable...
* 0077 cmciii.psm_current, cmciii_psm_plugs, cmciii_io, cmciii.access, cmciii.temp, cmciii.can_current, cmciii.sensor, cmciii.state: new sub checks included in one new check cmcmiii superseding and improving several previous checks of the Rittal CMCIII device...
NOTE: Please refer to the migration notes!
+ * 0078 job: check now monitors the time since last start of the job, limits can be configured in WATO
* 0103 FIX: services: Fixed bug with service inventory defined in main.mk...
* 0299 FIX: borcade_mlx_fan: Prettified output, handling "other" state now
* 0300 FIX: cisco_fru_power: Trying not to inventorize not plugged in FRUs...
diff --git a/checkman/job b/checkman/job
index 128b82c..1d46c5c 100644
--- a/checkman/job
+++ b/checkman/job
@@ -5,25 +5,27 @@ license: GPL
distribution: check_mk
description:
This check monitors state and performance information of any linux program
- call like for example regular running cronjobs.
+ call, for example regular running cronjobs.
The check uses information provided by the wrapper program {mk-job}. This
program is shipped with the linux agent and installed to {/usr/bin}.
- {mk-job} is a wrapper which is called instead of the normal program. For
- example if you have a command line {nightly-backup >/dev/null} which gets
- executed by cronjob every night, you can change the command line to
+ {mk-job} is a wrapper which is called instead of the program. For
+ example, if you have a command line {nightly-backup >/dev/null} which gets
+ executed by a cronjob every night, you can change the command line to
{mk-job backup nightly-backup >/dev/null} to let mk-job collect information
- about the job during runtime while the string {backup} is the ident of the
- job to be executed. This ident must be an unique identifier for this job
- on each host. When the job finished, mk-job writes the collected data to
- {/var/lib/check_mk_agent/job/<job-id>}. The agent outputs
- all available data to the Check_MK server.
+ about the job during runtime. In this expression, the string {backup} is
+ the identifier of the job to be executed. It must be a unique identifier
+ for this job on each host. When the job is finished, {mk-job} writes the
+ collected data to {/var/lib/check_mk_agent/job/<identifier>}. The agent sends
+ all these data to the Check_MK server.
- At the moment this check has no parameters. It reports a {CRITICAL}
- state when the exit code of the job is not 0.
+ The check is {CRITICAL} if the exit code of the job is not {0}, or if
+ warning or critical limits for the job age have been reached.
+
+ Limits can be configured with WATO.
item:
- The ident of the job defined by the first argument to {mk-job}.
+ The identifier of the job defined by the first argument to {mk-job}.
inventory:
One check per job will be created.
@@ -36,3 +38,12 @@ perfdata:
{writes}: Number of file system outputs by the process.
{max_res_bytes}: Maximum resident set size of the process during its lifetime.
{avg_mem_bytes}: Average total (data+stack+text) memory use of the process.
+
+[parameters]
+parameters(dict): parameters is a dictionary with one key
+
+ {"age"}: contains a tuple for the warning and critical limits for the time
+ since last start of the job. Units are seconds.
+
+[configuration]
+job_default_levels(dict): This variable is preset to {{ "age": ( 0, 0 ) }}, which means that the limits are disabled
diff --git a/checks/job b/checks/job
index bf58809..046a4fd 100644
--- a/checks/job
+++ b/checks/job
@@ -48,12 +48,16 @@
#max_res_kbytes 1984
#avg_mem_kbytes 0
+factory_settings["job_default_levels"] = {
+ "age": ( 0, 0 ) # disabled as default
+}
+
def inventory_job(info):
inventory = []
for line in info:
if line[0] == '==>':
item = ' '.join(line[1:-1])
- inventory.append( (item, None) )
+ inventory.append( (item, {} ) )
return inventory
def job_parse_real_time(s):
@@ -91,7 +95,8 @@ def job_parse(item, info):
return data
-def check_job(item, _no_params, info):
+def check_job(item, params, info):
+ warn, crit = params.get('age')
job = job_parse(item, info)
if not job:
return 3, 'Got no information for this job'
@@ -124,6 +129,13 @@ def check_job(item, _no_params, info):
display_value = get_age_human_readable(value)
elif key == 'start_time':
display_value = time.strftime("%Y-%m-%d %H:%M:%S", time.localtime(value) )
+ job_age = time.time() - value
+ if crit > 0 and job_age >= crit:
+ state = max(state, 2)
+ display_value += "(!!) (more than %s ago)" % get_age_human_readable(crit)
+ elif warn > 0 and job_age >= warn:
+ state = max(state, 1)
+ display_value += "(!!) (more than %s ago)" % get_age_human_readable(warn)
else:
display_value = value
@@ -133,9 +145,10 @@ def check_job(item, _no_params, info):
return state, ', '.join(output), perfdata
check_info["job"] = {
- 'check_function': check_job,
- 'inventory_function': inventory_job,
- 'service_description': 'Job %s',
- 'group': 'job',
- 'has_perfdata': True,
+ 'check_function' : check_job,
+ 'inventory_function' : inventory_job,
+ 'service_description' : 'Job %s',
+ 'default_levels_variable' : 'job_default_levels',
+ 'group' : 'job',
+ 'has_perfdata' : True,
}
diff --git a/web/plugins/wato/check_parameters.py b/web/plugins/wato/check_parameters.py
index e43c7ba..72898f8 100644
--- a/web/plugins/wato/check_parameters.py
+++ b/web/plugins/wato/check_parameters.py
@@ -2483,6 +2483,28 @@ register_check_parameters(
register_check_parameters(
subgroup_applications,
+ "job",
+ _("Age of jobs controlled by mk-job"),
+ Dictionary(
+ elements = [
+ ("age",
+ Tuple(
+ title = _("Maximum time since last start of job execution"),
+ elements = [
+ Age(title = _("Warning if above"), default_value = 0),
+ Age(title = _("Critical if above"), default_value = 0)
+ ]
+ )
+ )]
+ ),
+ TextAscii(
+ title = _("Job name"),
+ ),
+ None
+)
+
+register_check_parameters(
+ subgroup_applications,
"mssql_counters_locks",
_("MSSQL Locks"),
Dictionary(