Module: check_mk
Branch: master
Commit: 63136ad96807febd8a4f0f9e4e2154fb382fb0ee
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=63136ad96807fe…
Author: Mathias Kettner <mk(a)mathias-kettner.de>
Date: Wed Mar 13 14:24:01 2013 +0100
New filter for IP address of a host
---
ChangeLog | 3 ++-
web/plugins/views/builtin.py | 2 ++
web/plugins/views/filters.py | 34 ++++++++++++++++++++++++++++++++++
3 files changed, 38 insertions(+), 1 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index 4f9c7aa..3aafa27 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -17,9 +17,10 @@
possible for addons like mkeventd - reset to default values works now
correctly even for multisite related settings
* perfometer: Bit values now using base of 1000
- * ADD: check_disk_smb pnp-template
+ * Added PNP tempate for check_disk_smb
* Dashboards can now be configured to be reloaded on resizing
(automatically adds width/height url parameters)
+ * New filter for IP address of a host
Event Console:
* New rule feature: automatically delete event after actions
diff --git a/web/plugins/views/builtin.py b/web/plugins/views/builtin.py
index a6fec08..6843ee2 100644
--- a/web/plugins/views/builtin.py
+++ b/web/plugins/views/builtin.py
@@ -990,6 +990,7 @@ multisite_builtin_views.update({
'opthostgroup',
'opthost_contactgroup',
'host_check_command',
+ 'host_address',
],
'sorters': [],
'title': _('Host search'),
@@ -1050,6 +1051,7 @@ multisite_builtin_views.update({
'service_scheduled_downtime_depth',
'service_acknowledged',
'hostregex',
+ 'host_address',
'service_active_checks_enabled',
'summary_host',
'serviceregex',
diff --git a/web/plugins/views/filters.py b/web/plugins/views/filters.py
index 3f6e0de..0e734a2 100644
--- a/web/plugins/views/filters.py
+++ b/web/plugins/views/filters.py
@@ -76,6 +76,40 @@ declare_filter(202, FilterText("output", _("Status
detail"), "service", "servic
+class FilterIPAddress(Filter):
+ def __init__(self):
+ Filter.__init__(self, "host_address", _("Host IP Address"),
"host", ["host_address", "host_address_prefix"],
["host_address"])
+
+ def display(self):
+ html.text_input("host_address")
+ html.write("<br><br>")
+ html.begin_radio_group()
+ html.radiobutton("host_address_prefix", "yes", True,
_("Prefix match"))
+ html.radiobutton("host_address_prefix", "no", False,
_("Exact match"))
+ html.end_radio_group()
+
+ def double_height(self):
+ return True
+
+ def filter(self, infoname):
+ address = html.var("host_address")
+ if address:
+ if html.var("host_address_prefix") == "yes":
+ return "Filter: host_address ~ ^%s\n" % address
+ else:
+ return "Filter: host_address = %s\n" % address
+ else:
+ return ""
+
+ def variable_settings(self, row):
+ return [ ("host_address", row["host_address"]) ]
+
+ def heading_info(self, infoname):
+ return html.var("host_address")
+
+declare_filter(102, FilterIPAddress())
+
+
# Helper that retrieves the list of host/service/contactgroups via Livestatus
def all_groups(what):
groups = dict(html.live.query("GET %sgroups\nColumns: name alias\n" %
what))