Module: check_mk
Branch: master
Commit: 22c3efd13de80c88fabc4b876cf021e630a41d88
URL: http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=22c3efd13de80c…
Author: Andreas Boesl <ab(a)mathias-kettner.de>
Date: Mon Oct 3 21:01:54 2016 +0200
3817 logwatch patterns: now able to set a rule which converts on incoming state to another
The WATO rule now allows you to configure a complete state conversion.
For example, you can set that all reported <i>C</i> lines are converted to <i>W</i>.
---
.werks/3817 | 11 ++++
ChangeLog | 1 +
checks/logwatch | 82 +++++++++++++++--------
web/plugins/wato/check_parameters.py | 122 +++++++++++++++++++++++++----------
4 files changed, 154 insertions(+), 62 deletions(-)
Diff: http://git.mathias-kettner.de/git/?p=check_mk.git;a=commitdiff;h=22c3efd13d…
Module: check_mk
Branch: master
Commit: 9c48e6ceb1224350104c7f1fb7d8968140b72f92
URL: http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=9c48e6ceb12243…
Author: Marcel Arentz <ma(a)mathias-kettner.de>
Date: Tue Oct 4 10:09:47 2016 +0200
3841 cups_queues: thresholds are now configurable in WATO
Thresholds are now configurable through WATO. Additionally the
printer states are also confugrable.
Defaults are the following:
job_count: (5,10)
job_age: (360,720)
is idle: OK
now printing: OK
disbaled since: CRIT
---
.werks/3841 | 16 ++++++++++++
ChangeLog | 1 +
checkman/cups_queues | 21 +++++++---------
checks/cups_queues | 32 +++++++++++++-----------
web/plugins/wato/check_parameters.py | 47 ++++++++++++++++++++++++++++++++++++
5 files changed, 91 insertions(+), 26 deletions(-)
diff --git a/.werks/3841 b/.werks/3841
new file mode 100644
index 0000000..270b7e0
--- /dev/null
+++ b/.werks/3841
@@ -0,0 +1,16 @@
+Title: cups_queues: thresholds are now configurable in WATO
+Level: 1
+Component: checks
+Compatible: compat
+Version: 1.4.0i2
+Date: 1475568172
+Class: feature
+
+Thresholds are now configurable through WATO. Additionally the
+printer states are also confugrable.
+Defaults are the following:
+job_count: (5,10)
+job_age: (360,720)
+is idle: OK
+now printing: OK
+disbaled since: CRIT
diff --git a/ChangeLog b/ChangeLog
index 27277fa..b37861d 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -3,6 +3,7 @@
* 3648 FIX: Fixed log file parsing of host states...
Checks & Agents:
+ * 3841 cups_queues: thresholds are now configurable in WATO...
* 3894 FIX: mkeventd_status: Fixed bug in case Event Console is not running
* 3907 FIX: oracle_tablespaces: simplyfied free space calculation depending on version...
diff --git a/checkman/cups_queues b/checkman/cups_queues
index a736ba5..1f92e2d 100644
--- a/checkman/cups_queues
+++ b/checkman/cups_queues
@@ -14,27 +14,24 @@ description:
The resulting state also depends on the number of jobs in the queue and
the age of the oldest job in the queue.
+ Be aware that custom parameters for jobs in
+ queue will be preferred. Even if e.g. "disabled since" would result in {CRIT}
+ but the length of queue is {OK} and vice versa.
+
item:
The name of the printer in CUPS as printed by {lpstat -p}.
-examples:
- # Set number of minimum jobs to 5 to result in a warning state and 10 to result in a critical state
- # Set the maximum age of a job to 5 minutes to result in a warning state and 10 minutes to result in
- # a critical state. The age is given in seconds.
- cups_queues_default_levels = (5, 10, 360, 720)
-
perfdata:
- It contains the current number of jobs in the queue in the {jobs} value.
+ It contains the current number of jobs in the queue.
inventory:
Checks are created for all available printers in {lpstat -p} output.
[parameters]
-warning_count (int): Number of jobs to result in a warning state
-critical_count (int): Number of jobs to result in a critical state
-warning_age (int): Age of oldest job to result in a warning state
-critical_age (int): Age of oldest job to result in a critical state
+ job_count (int, int): WARN/CRIT if number of jobs are above
+ job_age (int, int): WARN/CRIT if oldest job is above in seconds
+ is_idle (int): Internal state for pritner state "is idle"
[configuration]
-cups_queues_default_levels (int, int, int, int): The global default levels for
+ cups_queues_default_levels (int, int, int, int): The global default levels for
all checks of this type. This is {(5, 10, 360, 720)}.
diff --git a/checks/cups_queues b/checks/cups_queues
index 2dccf4e..e719180 100644
--- a/checks/cups_queues
+++ b/checks/cups_queues
@@ -45,14 +45,19 @@
# zam19-113565 Sebastian Hirschdobler 3561472 Fri Jul 31 12:58:01 2015
# Default thresholds
-# ("<Warning max entries>", "<Critical num entries>", "<Warning entry age in seconds>", "<Critical entry age>")
-cups_queues_default_levels = (5, 10, 360, 720)
+factory_settings['cups_queues_default_levels'] = {
+ 'job_count' : (5,10), #warn/crit for queue entries
+ 'job_age' : (360,720), #warn/crit for entry age in seconds
+ 'is_idle' : 0, #state for "is idle"
+ 'now_printing' : 0, #state for "now printing"
+ 'disabled_since' : 2, #state for "disbaled since"
+}
def inventory_cups_queues(info):
- return [ ('%s' % line[1], '', "cups_queues_default_levels") for line in info if line[0] == 'printer' ]
-
+ return [ ('%s' % line[1], '', {}) for line in info if line[0] == 'printer' ]
def check_cups_queues(item, params, info):
- warnNum, critNum, warnAge, critAge = params
+ warnNum, critNum = params["job_count"]
+ warnAge, critAge = params["job_age"]
state = 3
output = "Queue not found"
numJobs = 0
@@ -68,11 +73,8 @@ def check_cups_queues(item, params, info):
if len(info) > num+1 and not info[num+1][0] in [ 'printer', '---' ]:
statusoutput += " (%s)" % " ".join(info[num+1])
- if status == "disabled since":
- state = 2
- output = "%s" % statusoutput
- elif status in [ "is idle.", "now printing" ]:
- state = 0
+ if status in [ "is idle.", "now printing", "disabled since"]:
+ state = params[status.replace(" ", "_").replace(".", "")]
output = "%s" % statusoutput
else:
state = 3
@@ -110,8 +112,10 @@ def check_cups_queues(item, params, info):
check_info["cups_queues"] = {
- 'check_function': check_cups_queues,
- 'inventory_function': inventory_cups_queues,
- 'service_description': 'CUPS Queue %s',
- 'has_perfdata': True,
+ 'inventory_function' : inventory_cups_queues,
+ 'check_function' : check_cups_queues,
+ 'service_description' : 'CUPS Queue %s',
+ 'has_perfdata' : True,
+ 'default_levels_variable' : 'cups_queues_default_levels',
+ 'group' : 'cups_queues'
}
diff --git a/web/plugins/wato/check_parameters.py b/web/plugins/wato/check_parameters.py
index 65469a7..373bcdf 100644
--- a/web/plugins/wato/check_parameters.py
+++ b/web/plugins/wato/check_parameters.py
@@ -3715,6 +3715,53 @@ register_check_parameters(
"first"
)
+register_check_parameters(
+ subgroup_printing,
+ "cups_queues",
+ _("CUPS Queue"),
+ Dictionary(
+ elements = [
+ ( "job_count", Tuple(
+ title = _("Levels of current jobs"),
+ default_value = (5, 10),
+ elements = [
+ Integer(title = _("Warning at")),
+ Integer(title = _("Critical at"))
+ ]
+ ),
+ ),
+ ( "job_age", Tuple(
+ title = _("Levels for age of jobs"),
+ help = _("A value in seconds"),
+ default_value = (360, 720),
+ elements = [
+ Integer(title = _("Warning at")),
+ Integer(title = _("Critical at"))
+ ]
+ ),
+ ),
+ ( "is_idle", MonitoringState(
+ title = _("State for 'is idle'"),
+ default_value = 0,
+ )
+ ),
+ ( "now_printing", MonitoringState(
+ title = _("State for 'now printing'"),
+ default_value = 0,
+ )
+ ),
+ ( "disabled_since", MonitoringState(
+ title = _("State for 'disabled since'"),
+ default_value = 2,
+ )
+ ),
+ ],
+ ),
+ TextAscii(
+ title = _("CUPS Queue") ),
+ "dict",
+)
+
#.
# .--Unsorted--(Don't create new stuff here!)----------------------------.
# | _ _ _ _ |
Module: check_mk
Branch: master
Commit: 79478c8f0658e9fc8c5b301524c80ccaeb4b778d
URL: http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=79478c8f0658e9…
Author: Mathias Kettner <mk(a)mathias-kettner.de>
Date: Mon Oct 3 21:23:53 2016 +0200
Moved livedump from treasures directly into bin/
Conflicts:
bin/.f12
---
bin/.f12 | 2 +-
{doc/treasures/livedump => bin}/livedump | 23 ++++++++++++++---------
doc/treasures/livedump/README | 12 +++---------
3 files changed, 18 insertions(+), 19 deletions(-)
diff --git a/bin/.f12 b/bin/.f12
index f9f022e..208a079 100644
--- a/bin/.f12
+++ b/bin/.f12
@@ -4,7 +4,7 @@ SITE=${SITE:-$(omd sites --bare | head -n 1)}
OMD_ROOT=/omd/sites/${SITE}
make
-sudo install -m 755 mkeventd mkeventd_open514 mkevent mkbackup $OMD_ROOT/bin/
+sudo install -m 755 livedump mkeventd mkeventd_open514 mkevent mkbackup $OMD_ROOT/bin/
sudo chown root.omd $OMD_ROOT/bin/mkeventd_open514
sudo chmod 4750 $OMD_ROOT/bin/mkeventd_open514
echo "Installed to $OMD_ROOT/bin"
diff --git a/doc/treasures/livedump/livedump b/bin/livedump
similarity index 99%
rename from doc/treasures/livedump/livedump
rename to bin/livedump
index b5cfc61..bfcd5f1 100755
--- a/doc/treasures/livedump/livedump
+++ b/bin/livedump
@@ -257,25 +257,27 @@ def bail_out(x):
sys.exit(1)
def usage():
- sys.stderr.write("""
-Usage: %s [OPTION]...
+ sys.stderr.write("""Usage: %s [OPTION]...
+
+ -s, --socket S Connect to Livestatus-socket at S
+ -s tcp:10.11.0.55:6557
+ -s unix:/var/run/nagios/rw/live
-C, --config Dump configuration (instead of state)
- -h, --help Show this help
- -V, --version Show version and exit
-T, --dump-templates Also dump host/service templates
+
-M, --mark-mode Puts the mode (state/configuration dump) in the first
line for use with livedump-ssh-recv and similar scripts
+
-p, --prefix P Add a prefix P to hostnames. Use this option to dump live
data from multiple sites with duplicated hostnames
- -s, --socket S Connect to Livestatus-socket at S
- -s tcp:10.11.0.55:6557
- -s unix:/var/run/nagios/rw/live
-O, --host-only-header H Add header H to host queries only (usually Filter: ...)
+
-H, --host-header H Add header H to host queries (usually Filter: ...)
This header is also used in service queries
+
-S, --service-header H Add header H to service queries (usually Filter: ...)
-i, --interval I Assume this check interval for hosts/services. This is
@@ -284,11 +286,14 @@ Usage: %s [OPTION]...
option is only used when dumping the config together
with templates (-C -T)
- -v, --verbose Output debug information on stderr
-G, --include-groups Use contact groups instead of contacts on dumping config
+
--include-host-icon Add host icon_image to config
- --debug Do not catch Python exceptions
+ -V, --version Show version and exit
+ -h, --help Show this help
+ -v, --verbose Output debug information on stderr
+ --debug Do not catch Python exceptions
""" % os.path.split(sys.argv[0])[1])
def print_version():
diff --git a/doc/treasures/livedump/README b/doc/treasures/livedump/README
index eac5c43..574402a 100644
--- a/doc/treasures/livedump/README
+++ b/doc/treasures/livedump/README
@@ -15,19 +15,13 @@ Advantages:
Disadvantages:
- Introduces some latency
-How to setup livedump
----------------------
-Copy the file livedump to a convenient place. Make sure that
-../livestatus/api/python/livestatus.py is either in the same
-directory as livedump or somewhere in the Python path.
-
Using livedump
--------------
The first step is to extract the configuration from the source system using. This step
is needed whenever your configuration of hosts or services changes.
NSCA users will now this. This is easily done by:
-./livedump -TC > some_file.cfg
+livedump -TC > some_file.cfg
and then copying that file to your objects or conf.d directory on
your target nagios. Note: The option -T will add some templates
@@ -41,7 +35,7 @@ and be in pending state.
Now create a cronjob that does the following every 1 or 5 minutes:
-1. ./livedump > ca1b2c3
+1. livedump > ca1b2c3
2. copy that file to the target system into the checkresults directory
(in OMD this is ~/tmp/nagios/checkresults)
3. After a correct copy touch the file ca1b2c3.ok in that
@@ -59,7 +53,7 @@ and service livestatus headers. The following example will only dump
hosts and services of the host group "foo". Please make sure that
all hosts that are needed by the dumped services are also dumped:
-./livedump -H "Filter: host_groups > foo"
+livedump -H "Filter: host_groups > foo"
Note: The -H headers will also be added to the service queries.
Make sure that all columns are prefixed with host_ in these.
Module: check_mk
Branch: master
Commit: 2e1f74e2a3154e1b02bb0379e005220310bd4d26
URL: http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=2e1f74e2a3154e…
Author: Mathias Kettner <mk(a)mathias-kettner.de>
Date: Mon Oct 3 21:26:11 2016 +0200
3740 Moved livedump utility from treasures directly into bin directory
You can now use <tt>livedump</tt> without specifying a path.
---
.werks/3740 | 10 ++++++++++
ChangeLog | 3 +++
2 files changed, 13 insertions(+)
diff --git a/.werks/3740 b/.werks/3740
new file mode 100644
index 0000000..5596175
--- /dev/null
+++ b/.werks/3740
@@ -0,0 +1,10 @@
+Title: Moved livedump utility from treasures directly into bin directory
+Level: 1
+Component: livestatus
+Class: feature
+Compatible: compat
+State: unknown
+Version: 1.4.0i2
+Date: 1475522726
+
+You can now use <tt>livedump</tt> without specifying a path.
diff --git a/ChangeLog b/ChangeLog
index 7f25a5c..27277fa 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -10,6 +10,9 @@
* 3915 User access times: New icon when never logged in; New column "last seen"
* 3914 FIX: Roles: Aliases are now unique during cloning
+ Livestatus:
+ * 3740 Moved livedump utility from treasures directly into bin directory...
+
HW/SW-Inventory:
* 3906 oracle: now version, database creation and startup time, log and open mode, logins, flashback are inventorised