Module: check_mk
Branch: master
Commit: 95fdd2f108865f70d1f4869c0648e037f74f8614
URL: http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=95fdd2f108865f…
Author: Lars Michelsen <lm(a)mathias-kettner.de>
Date: Mon Mar 7 16:45:19 2016 +0100
cleaned up some linter errors
- Add missing referenced but missing methods in base classes.
These methods are normally overridden by all subclasses,
but should be declared and raising NotImplentedError() to
clarify this.
- Declare and initialize attributes in constructor
Some attributes were set from external and used internally
but not declared within the class.
---
web/htdocs/watolib.py | 66 ++++++++++++++++++++++++++++++++++++-------------
1 file changed, 49 insertions(+), 17 deletions(-)
diff --git a/web/htdocs/watolib.py b/web/htdocs/watolib.py
index c8373ff..e437022 100644
--- a/web/htdocs/watolib.py
+++ b/web/htdocs/watolib.py
@@ -206,6 +206,7 @@ def log_pending(status, linkinfo, what, message, user_id = None):
# On each change to the Check_MK configuration mark the agents to be rebuild
if 'need_to_bake_agents' in globals():
+ # pylint: disable=undefined-variable
need_to_bake_agents()
# The latter one condition applies to slave sites
@@ -317,7 +318,7 @@ class WithPermissions(object):
def user_needs_permission(self, user_id, how):
- raise NotImplementedError("Subclasses has to implement this!")
+ raise NotImplementedError()
def need_permission(self, how):
@@ -369,7 +370,7 @@ class WithPermissionsAndAttributes(WithPermissions):
def effective_attributes(self):
- raise NotImplementedError("Subclasses has to implement this!")
+ raise NotImplementedError()
def effective_attribute(self, attrname, default_value=None):
@@ -397,7 +398,7 @@ class BaseFolder(WithPermissionsAndAttributes):
def hosts(self):
- raise NotImplementedError("Subclasses has to implement this!")
+ raise NotImplementedError()
def host_names(self):
@@ -432,10 +433,18 @@ class BaseFolder(WithPermissionsAndAttributes):
return self.parent() != None
+ def parent(self):
+ raise NotImplementedError()
+
+
def is_same_as(self, folder):
return self == folder or self.path() == folder.path()
+ def path(self):
+ raise NotImplementedError()
+
+
def is_current_folder(self):
return self.is_same_as(Folder.current())
@@ -472,7 +481,8 @@ class BaseFolder(WithPermissionsAndAttributes):
keepvars.append(("mode", "folder"))
def render_component(folder):
- return '<a href="%s">%s</a>' % (html.makeuri_contextless([("folder", folder.path())] + keepvars), folder.title())
+ return '<a href="%s">%s</a>' % (html.makeuri_contextless([ ("folder", folder.path())]
+ + keepvars), folder.title())
def breadcrump_element_start(end = '', z_index = 0):
html.write('<li style="z-index:%d;"><div class="left %s"></div>' % (z_index, end))
@@ -524,6 +534,18 @@ class BaseFolder(WithPermissionsAndAttributes):
html.write("</ul></div>\n")
+ def title(self):
+ raise NotImplementedError()
+
+
+ def has_subfolders(self):
+ raise NotImplementedError()
+
+
+ def subfolder_choices(self):
+ raise NotImplementedError()
+
+
#.
# .--Folder--------------------------------------------------------------.
# | _____ _ _ |
@@ -1744,6 +1766,10 @@ class SearchFolder(BaseFolder):
pass
+ def has_subfolder(self, name):
+ return False
+
+
def has_subfolders(self):
return False
@@ -2164,7 +2190,7 @@ class Host(WithPermissionsAndAttributes):
class Attribute:
# The constructor stores name and title. If those are
- # dynamic than leave them out and override name() and
+ # dynamic then leave them out and override name() and
# title()
def __init__(self, name=None, title=None, help=None, default_value=None):
self._name = name
@@ -2172,6 +2198,15 @@ class Attribute:
self._help = help
self._default_value = default_value
+ self._show_in_table = True
+ self._show_in_folder = True
+ self._show_in_host_search = False
+ self._show_in_form = True
+ self._show_inherited_value = True
+ self._depends_on_tags = []
+ self._depends_on_roles = []
+ self._editable = True
+
# Return the name (= identifier) of the attribute
def name(self):
return self._name
@@ -2223,45 +2258,41 @@ class Attribute:
def show_in_host_search(self):
return self._show_in_host_search
+
# Wether or not this attribute can be edited after creation
# of the object
def editable(self):
return self._editable
+
# Wether it is allowed that a host has no explicit
# value here (inherited or direct value). An mandatory
# has *no* default value.
def is_mandatory(self):
return False
+
# Return information about the user roles we depend on.
# The method is usually not overridden, but the variable
# _depends_on_roles is set by declare_host_attribute().
def depends_on_roles(self):
- try:
- return self._depends_on_roles
- except:
- return []
+ return self._depends_on_roles
+
# Return information about whether or not either the
# inherited value or the default value should be shown
# for an attribute.
# _depends_on_roles is set by declare_host_attribute().
def show_inherited_value(self):
- try:
- return self._show_inherited_value
- except:
- return True
+ return self._show_inherited_value
# Return information about the host tags we depend on.
# The method is usually not overridden, but the variable
# _depends_on_tags is set by declare_host_attribute().
def depends_on_tags(self):
- try:
- return self._depends_on_tags
- except:
- return []
+ return self._depends_on_tags
+
# Render HTML input fields displaying the value and
# make it editable. If filter == True, then the field
@@ -2270,6 +2301,7 @@ class Attribute:
def render_input(self, varprefix, value):
pass
+
# Create value from HTML variables.
def from_html_vars(self, varprefix):
return None
Module: check_mk
Branch: master
Commit: 9bfd85a2a8838b72db6e0527f08db7f31b2a2f20
URL: http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=9bfd85a2a8838b…
Author: Sebastian Herbord <sh(a)mathias-kettner.de>
Date: Mon Mar 7 17:14:39 2016 +0100
3088 rstcli, rstcli.pdisks: new checks to monitor Intel RST raids
---
.werks/3088 | 9 ++
ChangeLog | 1 +
agents/windows/plugins/rstcli.bat | 15 ++++
checkman/rstcli | 24 +++++
checkman/rstcli.pdisks | 24 +++++
checks/rstcli | 177 +++++++++++++++++++++++++++++++++++++
6 files changed, 250 insertions(+)
diff --git a/.werks/3088 b/.werks/3088
new file mode 100644
index 0000000..adc41c1
--- /dev/null
+++ b/.werks/3088
@@ -0,0 +1,9 @@
+Title: rstcli, rstcli.pdisks: new checks to monitor Intel RST raids
+Level: 1
+Component: checks
+Compatible: compat
+Version: 1.2.9i1
+Date: 1457367232
+Class: feature
+
+
diff --git a/ChangeLog b/ChangeLog
index 7bfb212..68956b1 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -20,6 +20,7 @@
* 3085 fortigate_signatures: new check to monitor av and ips signatures on fortigate firewalls...
* 3257 dell_idrac_virtdisks: new check which monitors the virtual disks of a Dell IDrac Device
* 3001 fileinfo: now able to configure the checks status if the file is missing
+ * 3088 rstcli, rstcli.pdisks: new checks to monitor Intel RST raids
* 3073 FIX: windows agent: relative paths to mrpe scripts are now treated as relative to the agent installation directory...
* 3061 FIX: mk_jolokia: Fixed debugging of the agent plugin
* 3074 FIX: windows agent: fixed incorrect values for 32-bit performance counters
diff --git a/agents/windows/plugins/rstcli.bat b/agents/windows/plugins/rstcli.bat
new file mode 100644
index 0000000..a2c041f
--- /dev/null
+++ b/agents/windows/plugins/rstcli.bat
@@ -0,0 +1,15 @@
+@ECHO off & setlocal EnableDelayedExpansion
+
+REM customize rstcli to your needs
+SET "rstcli=!ProgramFiles!\rstcli\rstcli64.exe"
+SET "rstcli_x86=!ProgramFiles!\rstcli\rstcli.exe"
+
+ECHO ^<^<^<rstcli:sep(58)^>^>^>
+IF EXIST !rstcli! (
+ !rstcli! --information --volume
+) ELSE IF EXIST !rstcli_x86! (
+ !rstcli_x86! --information --volume
+) ELSE (
+ ECHO rstcli not found
+)
+
diff --git a/checkman/rstcli b/checkman/rstcli
new file mode 100644
index 0000000..d91faaa
--- /dev/null
+++ b/checkman/rstcli
@@ -0,0 +1,24 @@
+title: Intel Rapid Storage Technologie: State of raid volumes
+agents: windows
+catalog: os/storage
+license: GPL
+distribution: check_mk
+description:
+ This check monitors the overall state of raid volumes set up
+ through Intel Rapid Storage Technologie.
+
+ Due to lack of documentation, this tool will only accept "Normal" as a healthy
+ state, all others are treated as critical. Please let us know about other states
+ you encounter.
+
+ For this check to work, the rstcli tool and the matching agent plugin have to
+ be installed.
+
+ The utility {rstcli} can be downloaded from
+ {https://downloadcenter.intel.com/download/24310/Intel-Rapid-Storage-Technology-Command-Line-Interface-RST-CLI}
+
+item:
+ The name of the raid volume.
+
+inventory:
+ One service is created for each volume.
diff --git a/checkman/rstcli.pdisks b/checkman/rstcli.pdisks
new file mode 100644
index 0000000..1961edc
--- /dev/null
+++ b/checkman/rstcli.pdisks
@@ -0,0 +1,24 @@
+title: Intel Rapid Storage Technologie: State of physical disks in raids
+agents: windows
+catalog: os/storage
+license: GPL
+distribution: check_mk
+description:
+ This check monitors the state of the physical disks of a raid set up
+ through Intel Rapid Storage Technologie.
+
+ Due to lack of documentation, this tool will only accept "Normal" as a healthy
+ state, all others are treated as critical. Please let us know about other states
+ you encounter.
+
+ For this check to work, the rstcli tool and the matching agent plugin have to
+ be installed.
+
+ The utility {rstcli} can be downloaded from
+ {https://downloadcenter.intel.com/download/24310/Intel-Rapid-Storage-Technology-Command-Line-Interface-RST-CLI}
+
+item:
+ A combination of the raid volume and the drive ID within that volume.
+
+inventory:
+ One service is created for each disk.
diff --git a/checks/rstcli b/checks/rstcli
new file mode 100644
index 0000000..4ea3736
--- /dev/null
+++ b/checks/rstcli
@@ -0,0 +1,177 @@
+#!/usr/bin/python
+# -*- encoding: utf-8; py-indent-offset: 4 -*-
+# +------------------------------------------------------------------+
+# | ____ _ _ __ __ _ __ |
+# | / ___| |__ ___ ___| | __ | \/ | |/ / |
+# | | | | '_ \ / _ \/ __| |/ / | |\/| | ' / |
+# | | |___| | | | __/ (__| < | | | | . \ |
+# | \____|_| |_|\___|\___|_|\_\___|_| |_|_|\_\ |
+# | |
+# | Copyright Mathias Kettner 2014 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-
+# tails. 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.
+
+
+# --VOLUME INFORMATION--
+#
+# Name: Vol1
+# Raid Level: 1
+# Size: 932 GB
+# StripeSize: 64 KB
+# Num Disks: 2
+# State: Normal
+# System: True
+# Initialized: True
+# Cache Policy: Off
+#
+#
+# --DISKS IN VOLUME: Vol1 --
+#
+# ID: 0-0-0-0
+# Type: Disk
+# Disk Type: SATA Disk
+# State: Normal
+# Size: 932 GB
+# Free Size: 0 GB
+# System Disk: False
+# Usage: Array member
+# Serial Number: AB-CDEF123456
+# Model: AB CD EF
+#
+# ID: 0-1-0-0
+# Type: Disk
+# Disk Type: SATA Disk
+# State: Normal
+# Size: 932 GB
+# Free Size: 0 GB
+# System Disk: False
+# Usage: Array member
+# Serial Number: AB-CDEF123457
+# Model: AB CD EF
+
+
+# split output into the --xxx-- sections
+def parse_rstcli_sections(info):
+ current_section = None
+ for line in info:
+ if line[0].startswith("--"):
+ if current_section is not None:
+ yield current_section
+ current_section = (":".join(line).strip("-").strip(), [])
+ else:
+ if current_section is None:
+ raise MKGeneralException("error: %s" % " ".join(line))
+ current_section[1].append(line)
+
+ yield current_section
+
+
+# interpret the volumes section
+def parse_rstcli_volumes(rows):
+ volumes = {}
+ current_volume = None
+
+ for row in rows:
+ if row[0] == "Name":
+ volumes[row[1].strip()] = current_volume = {}
+ else:
+ current_volume[row[0]] = row[1].strip()
+
+ return volumes
+
+
+# interpret the disks section
+def parse_rstcli_disks(rows):
+ disks = []
+ current_disk = None
+
+ for row in rows:
+ if row[0] == "ID":
+ current_disk = {}
+ disks.append(current_disk)
+
+ current_disk[row[0]] = row[1].strip()
+
+ return disks
+
+def parse_rstcli(info):
+ volumes = {}
+
+ for section in parse_rstcli_sections(info):
+ if section[0] == "VOLUME INFORMATION":
+ volumes = parse_rstcli_volumes(section[1])
+ elif section[0].startswith("DISKS IN VOLUME"):
+ volume = section[0].split(":")[1].strip()
+ volumes[volume]['Disks'] = parse_rstcli_disks(section[1])
+ else:
+ raise MKGeneralException("invalid section in rstcli output: %s" % section[0])
+
+ return volumes
+
+
+def inventory_rstcli(parsed):
+ return [(name, None) for name in parsed.keys()]
+
+
+# Help! There is no documentation, what are the possible values?
+rstcli_states = {
+ 'Normal': 0,
+}
+
+
+def check_rstcli(item, params, parsed):
+ if item in parsed:
+ volume = parsed[item]
+ return rstcli_states.get(volume['State']), "RAID %s, %d disks (%s), state %s" % \
+ (volume['Raid Level'], int(volume['Num Disks']),
+ volume['Size'], volume['State'])
+
+
+check_info["rstcli"] = {
+ 'check_function': check_rstcli,
+ 'inventory_function': inventory_rstcli,
+ 'parse_function': parse_rstcli,
+ 'service_description': 'RAID Volume %s',
+}
+
+
+def inventory_rstcli_pdisks(parsed):
+ for key, volume in parsed.iteritems():
+ for disk in volume['Disks']:
+ yield "%s/%s" % (key, disk['ID']), None
+
+
+def check_rstcli_pdisks(item, params, parsed):
+ reg = regex("(.*)/([0-9\-]*)")
+ match = reg.match(item)
+ if match:
+ return 3, "unsupported item name"
+
+ volume, disk_id = match.group(1), match.group(2)
+
+ disks = parsed.get(volume, {}).get('Disks', [])
+ for disk in disks:
+ if disk['ID'] == disk_id:
+ return rstcli_states.get(disk['State'], 2), \
+ "[%s] state %s" % (disk['Serial Number'], disk['State'])
+
+
+check_info["rstcli.pdisks"] = {
+ 'check_function': check_rstcli_pdisks,
+ 'inventory_function': inventory_rstcli_pdisks,
+ 'service_description': 'RAID Disk %s',
+}
+
Module: check_mk
Branch: master
Commit: 5eeb618a3de893595a8353b4f273fd5ef3b12968
URL: http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=5eeb618a3de893…
Author: Lars Michelsen <lm(a)mathias-kettner.de>
Date: Mon Mar 7 15:56:42 2016 +0100
3273 FIX Dashboard: The dashboard is now preserving edit/view state during page reloads
---
.werks/3273 | 10 ++++++++++
ChangeLog | 1 +
web/htdocs/js/checkmk.js | 2 +-
web/htdocs/js/dashboard.js | 18 +++++++++++++++++-
4 files changed, 29 insertions(+), 2 deletions(-)
diff --git a/.werks/3273 b/.werks/3273
new file mode 100644
index 0000000..b6704e5
--- /dev/null
+++ b/.werks/3273
@@ -0,0 +1,10 @@
+Title: Dashboard: The dashboard is now preserving edit/view state during page reloads
+Level: 1
+Component: multisite
+Class: fix
+Compatible: compat
+State: unknown
+Version: 1.2.9i1
+Date: 1457362576
+
+
diff --git a/ChangeLog b/ChangeLog
index 983fd69..7bfb212 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -72,6 +72,7 @@
* 3251 FIX: Fix sorting of entries in Views sidebar element
* 3230 FIX: Slightly improved popup menu positioning...
* 3264 FIX: Fix display of values in graphs that are < 1.0
+ * 3273 FIX: Dashboard: The dashboard is now preserving edit/view state during page reloads
WATO:
* 3244 WATO BI Module: swap order of aggregation function and child node selection...
diff --git a/web/htdocs/js/checkmk.js b/web/htdocs/js/checkmk.js
index 7e301ce..d4471ac 100644
--- a/web/htdocs/js/checkmk.js
+++ b/web/htdocs/js/checkmk.js
@@ -626,7 +626,7 @@ function makeuri(addvars, url) {
// Add new params
for (var key in addvars) {
- params.push(key + '=' + addvars[key]);
+ params.push(encodeURIComponent(key) + '=' + encodeURIComponent(addvars[key]));
}
return base + '?' + params.join('&')
diff --git a/web/htdocs/js/dashboard.js b/web/htdocs/js/dashboard.js
index 33f85a9..7cbb14f 100644
--- a/web/htdocs/js/dashboard.js
+++ b/web/htdocs/js/dashboard.js
@@ -437,8 +437,24 @@ function toggle_dashboard_edit() {
// Remove/Add edit=1 parameter from URL to make page reload handling correct
// Only a solution for browsers with history.replaceState support. Sadly
// we have no F5/reload fix for others...
+ //
+ // window.parent is either a reference to the current window (when opened as dedicated page)
+ // or the whole browser window if opened within a frame. The URL is either directly:
+ // http://[HOST]/[SITE]/check_mk/dashboard.py?name=main&edit=1
+ // or when opened within a frame it is:
+ // http://[HOST]/[SITE]/check_mk/index.py?start_url=%2F[SITE]%2Fcheck_mk%2Fdas…
+ // The new URL computation needs to deal with it.
if (window.parent.history.replaceState) {
- new_url = makeuri({'edit': g_editing ? '1' : '0'}, window.parent.location.href);
+ var url = window.parent.location.href;
+ if (url.indexOf("start_url") !== -1) {
+ var frame_url = decodeURIComponent(getUrlParam("start_url", url));
+ frame_url = makeuri({'edit': g_editing ? '1' : '0'}, frame_url);
+ new_url = makeuri({'start_url': frame_url}, url);
+ }
+ else {
+ new_url = makeuri({'edit': g_editing ? '1' : '0'}, url);
+ }
+
window.parent.history.replaceState({}, document.title, new_url);
}
Module: check_mk
Branch: master
Commit: 15060ef6da96294cabff22e7bf94d2234355c122
URL: http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=15060ef6da9629…
Author: Mathias Kettner <mk(a)mathias-kettner.de>
Date: Mon Mar 7 12:39:21 2016 +0100
3265 FIX mk_inventory.solaris: fix problem on Solaris 10, do prtdiag and prtpicl only in global zone
---
.werks/3265 | 10 ++++++++++
ChangeLog | 1 +
agents/plugins/mk_inventory.solaris | 36 ++++++++++++++++++++---------------
3 files changed, 32 insertions(+), 15 deletions(-)
diff --git a/.werks/3265 b/.werks/3265
new file mode 100644
index 0000000..91582d5
--- /dev/null
+++ b/.werks/3265
@@ -0,0 +1,10 @@
+Title: mk_inventory.solaris: fix problem on Solaris 10, do prtdiag and prtpicl only in global zone
+Level: 1
+Component: inv
+Class: fix
+Compatible: compat
+State: unknown
+Version: 1.2.9i1
+Date: 1457350724
+
+
diff --git a/ChangeLog b/ChangeLog
index 3df0ae7..d9afd1b 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -113,6 +113,7 @@
* 3192 snmp_extended_info: now inventorizes all physical components of devices which support the ENTITY-MIB
* 3219 FIX: lnx_distro: Now detecting Oracle VM Server correctly
* 3229 FIX: lnx_distro: SLES based systems have now an OS name inventorized\
+ * 3265 FIX: mk_inventory.solaris: fix problem on Solaris 10, do prtdiag and prtpicl only in global zone
1.2.8b1:
diff --git a/agents/plugins/mk_inventory.solaris b/agents/plugins/mk_inventory.solaris
index 5f461c5..1674674 100755
--- a/agents/plugins/mk_inventory.solaris
+++ b/agents/plugins/mk_inventory.solaris
@@ -28,7 +28,11 @@
INTERVAL=14400
FLAGFILE=$MK_VARDIR/mk_inventory.last.$REMOTE
-NOW=$(truss /usr/bin/date 2>&1 | grep ^time | awk -F"= " '{print $2}')
+if [ `uname -r` = "5.10" ]; then
+ NOW=$(truss /usr/bin/date 2>&1 | grep ^time | awk -F"= " '{print $2}')
+else
+ NOW=`date +%s`
+fi
UNTIL=$((NOW + INTERVAL + 600))
#check if flagfile exits
@@ -46,15 +50,23 @@ then
echo "<<<solaris_uname:sep(61):persist($UNTIL)>>>"
uname -X
- if type prtdiag > /dev/null; then
- echo "<<<solaris_prtdiag:sep(10):persist($UNTIL)>>>"
- if type sneep >/dev/null 2>&1; then
- SN=$(sneep -t serial)
- else
- SN=$(smbios -t SMB_TYPE_SYSTEM | grep 'Serial Number:' | awk '{print substr($0, index($0,$3))}')
+ if zoneadm list | grep -q global
+ then
+ if type prtdiag > /dev/null; then
+ echo "<<<solaris_prtdiag:sep(10):persist($UNTIL)>>>"
+ if type sneep >/dev/null 2>&1; then
+ SN=$(sneep -t serial)
+ else
+ SN=$(smbios -t SMB_TYPE_SYSTEM | grep 'Serial Number:' | awk '{print substr($0, index($0,$3))}')
+ fi
+ echo "SerialNumber: $SN"
+ prtdiag -v
+ fi
+
+ if type prtpicl > /dev/null; then
+ echo "<<<solaris_prtpicl:persist($UNTIL)>>>"
+ prtpicl -v
fi
- echo "SerialNumber: $SN"
- prtdiag -v
fi
if type psrinfo > /dev/null; then
@@ -62,12 +74,6 @@ then
psrinfo -p -v
fi
- if type prtpicl > /dev/null; then
- echo "<<<solaris_prtpicl:persist($UNTIL)>>>"
- prtpicl -v
- fi
-
-
if type pkginfo >/dev/null ; then
echo "<<<solaris_pkginfo:sep(58):persist($UNTIL)>>>"
pkginfo -l