Module: check_mk
Branch: master
Commit: 2a352c7298c6609c03604d0ca4fef01ead3cf157
URL: http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=2a352c7298c660…
Author: Mathias Kettner <mk(a)mathias-kettner.de>
Date: Tue Dec 17 12:26:42 2013 +0100
FIX smart.stats: Remove duplicate disks
In same cases a disk has two physical paths and thus is seen
two times by the <tt>smart</tt> plugin for Linux. This plugin
has now been fixed and no longer outputs duplicate entries.
---
.werks/347 | 12 ++++++++++++
ChangeLog | 1 +
agents/plugins/smart | 7 +++++++
3 files changed, 20 insertions(+)
diff --git a/.werks/347 b/.werks/347
new file mode 100644
index 0000000..72ef9c1
--- /dev/null
+++ b/.werks/347
@@ -0,0 +1,12 @@
+Title: smart.stats: Remove duplicate disks
+Level: 1
+Component: checks
+Class: fix
+State: unknown
+Version: 1.2.5i1
+Date: 1387279511
+Targetversion: future
+
+In same cases a disk has two physical paths and thus is seen
+two times by the <tt>smart</tt> plugin for Linux. This plugin
+has now been fixed and no longer outputs duplicate entries.
diff --git a/ChangeLog b/ChangeLog
index 06fc932..a2b23fb 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -50,6 +50,7 @@
* 0245 FIX: Inline SNMP now longer throws an exception when using SNMPv3 credentials...
* 0380 FIX: jolokia_metrics.mem: PNP-Template now handles non existant max values...
* 0381 FIX: win_printers: Fixed creation of duplicate services...
+ * 0347 FIX: smart.stats: Remove duplicate disks...
Multisite:
* 0371 Added log class filter to hostsvcevents view
diff --git a/agents/plugins/smart b/agents/plugins/smart
index a1727f4..a995367 100755
--- a/agents/plugins/smart
+++ b/agents/plugins/smart
@@ -23,6 +23,7 @@ if which smartctl > /dev/null 2>&1 ; then
fi
echo '<<<smart>>>'
+ SEEN=
for D in /dev/disk/by-id/{scsi,ata}-*; do
[ "$D" != "${D%scsi-\*}" ] && continue
[ "$D" != "${D%ata-\*}" ] && continue
@@ -45,6 +46,12 @@ if which smartctl > /dev/null 2>&1 ; then
continue
fi
+ # Avoid duplicate entries for same device
+ if [ "${SEEN//.$N./}" != "$SEEN" ] ; then
+ continue
+ fi
+ SEEN="$SEEN.$N."
+
# strip device name for final output
DNAME=${D#/dev/disk/by-id/scsi-}
DNAME=${DNAME#/dev/disk/by-id/ata-}
Module: check_mk
Branch: master
Commit: 1beeafa48f089f9c033d9a6487390c05422ed121
URL: http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=1beeafa48f089f…
Author: Lars Michelsen <lm(a)mathias-kettner.de>
Date: Tue Dec 17 11:57:44 2013 +0100
FIX jolokia_metrics.mem: PNP-Template now handles non existant max values
With some application servers the maximum values for memory are not provided
by the agent. The checks did already handle this, but the PNP graph could
not be displayed in this case.
---
.werks/380 | 12 ++++++++++++
ChangeLog | 1 +
pnp-templates/check_mk-jolokia_metrics.mem.php | 12 ++++++++----
3 files changed, 21 insertions(+), 4 deletions(-)
diff --git a/.werks/380 b/.werks/380
new file mode 100644
index 0000000..3a487f0
--- /dev/null
+++ b/.werks/380
@@ -0,0 +1,12 @@
+Title: jolokia_metrics.mem: PNP-Template now handles non existant max values
+Level: 1
+Component: checks
+Class: fix
+State: unknown
+Version: 1.2.5i1
+Date: 1387277786
+Targetversion: future
+
+With some application servers the maximum values for memory are not provided
+by the agent. The checks did already handle this, but the PNP graph could
+not be displayed in this case.
diff --git a/ChangeLog b/ChangeLog
index b167301..1e3b68a 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -48,6 +48,7 @@
* 0345 FIX: Linux agent: fix detaching of background plugins...
* 0378 FIX: agent_vsphere.pysphere: Trying to deal with permissions only on some guests/hosts
* 0245 FIX: Inline SNMP now longer throws an exception when using SNMPv3 credentials...
+ * 0380 FIX: jolokia_metrics.mem: PNP-Template now handles non existant max values...
Multisite:
* 0371 Added log class filter to hostsvcevents view
diff --git a/pnp-templates/check_mk-jolokia_metrics.mem.php b/pnp-templates/check_mk-jolokia_metrics.mem.php
index 9454309..2f79096 100644
--- a/pnp-templates/check_mk-jolokia_metrics.mem.php
+++ b/pnp-templates/check_mk-jolokia_metrics.mem.php
@@ -31,16 +31,20 @@ $def[1] = ""
. "CDEF:min_nonheap=0,nonheap,- "
. "CDEF:total=heap,nonheap,+ "
- . "AREA:heap#00c0ff:\"Heap\" "
- . "LINE1:$MAX[1]#003077:\"Heap MAX\" ";
+ . "AREA:heap#00c0ff:\"Heap\" ";
+if ($MAX[1]) {
+ $def[1] .= "LINE1:$MAX[1]#003077:\"Heap MAX\" ";
+}
if ($CRIT[1]) {
$def[1] .= "LINE1:$WARN[1]#a0ad00:\"Heap WARN\" "
. "LINE1:$CRIT[1]#ad0000:\"Heap CRIT\" ";
}
-$def[1] .= "AREA:min_nonheap#3430bf:\"Nonheap\" "
- . "LINE1:-$MAX[2]#003233:\"Nonheap MAX \" ";
+$def[1] .= "AREA:min_nonheap#3430bf:\"Nonheap\" ";
+if ($MAX[2]) {
+ $def[1] .= "LINE1:-$MAX[2]#003233:\"Nonheap MAX \" ";
+}
if ($CRIT[2]) {
$def[1] .= "LINE1:-$WARN[2]#adfd30:\"Nonheap WARN\" "
. "LINE1:-$CRIT[2]#ff0080:\"Nonheap CRIT\" ";
Module: check_mk
Branch: master
Commit: 8fe01b8cb4b15d4718d1fde513126e782ca13fd1
URL: http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=8fe01b8cb4b15d…
Author: Mathias Kettner <mk(a)mathias-kettner.de>
Date: Tue Dec 17 11:30:25 2013 +0100
FIX Fix folder visibility in WATO for unpriviledged users
In WATO if you are an unpriviledged user you might have write access to some
lower subfolders but not to the upper folders. This is perfectly common,
because that way the monitoring administrator can delegate tasks for certain
classes of hosts to his collegues.
Previously, however, you couldn't navigate to the lower folders without
faking the URL. This has been fixed now. If you are located in a folder
without having permissions to it you won't see any hosts of that folder,
but still you see the subfolders and also can enter these.
Also this fix removes that buttons for actions on a folder if you do
not have write permissions to it.
---
.werks/346 | 21 +++++++++++++++++++++
ChangeLog | 1 +
web/htdocs/wato.css | 8 ++++++++
web/htdocs/wato.py | 46 +++++++++++++++++++++++++++++-----------------
4 files changed, 59 insertions(+), 17 deletions(-)
diff --git a/.werks/346 b/.werks/346
new file mode 100644
index 0000000..36cd5de
--- /dev/null
+++ b/.werks/346
@@ -0,0 +1,21 @@
+Title: Fix folder visibility in WATO for unpriviledged users
+Level: 2
+Component: wato
+Class: fix
+State: unknown
+Version: 1.2.5i1
+Date: 1387276017
+Targetversion: future
+
+In WATO if you are an unpriviledged user you might have write access to some
+lower subfolders but not to the upper folders. This is perfectly common,
+because that way the monitoring administrator can delegate tasks for certain
+classes of hosts to his collegues.
+
+Previously, however, you couldn't navigate to the lower folders without
+faking the URL. This has been fixed now. If you are located in a folder
+without having permissions to it you won't see any hosts of that folder,
+but still you see the subfolders and also can enter these.
+
+Also this fix removes that buttons for actions on a folder if you do
+not have write permissions to it.
diff --git a/ChangeLog b/ChangeLog
index e5792cf..9f59b6d 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -79,6 +79,7 @@
* 0361 FIX: The page linked by "new rule" can now be bookmarked again
* 0341 FIX: Avoid rare exception in WATO when deleting a host...
* 0376 FIX: LDAP: Default configuration of attributes is reflected within WATO now
+ * 0346 FIX: Fix folder visibility in WATO for unpriviledged users...
Notifications:
* 0362 sms: now searching PATH for sendsms and smssend commands...
diff --git a/web/htdocs/wato.css b/web/htdocs/wato.css
index fb0550d..39eb26d 100644
--- a/web/htdocs/wato.css
+++ b/web/htdocs/wato.css
@@ -362,6 +362,7 @@ table.validationerror img {
position: absolute;
top: 28px;
right: 19px;
+ z-index: 500;
}
.wato div.floatfolder div.infos img {
@@ -422,6 +423,13 @@ table.validationerror img {
top: -2px;
}
+.wato img.authicon {
+ width: 28px;
+ height: 28px;
+ margin-right: 10px;
+ vertical-align: middle;
+}
+
.wato div.move_dialog {
padding:10px;
background-color: #45829D;
diff --git a/web/htdocs/wato.py b/web/htdocs/wato.py
index 029eac2..4518ff6 100644
--- a/web/htdocs/wato.py
+++ b/web/htdocs/wato.py
@@ -827,6 +827,10 @@ def get_folder_aliaspath(folder, show_main = True):
# '----------------------------------------------------------------------'
def mode_folder(phase):
+ auth_message = check_folder_permissions(g_folder, "read", False)
+ auth_read = auth_message == True
+ auth_write = check_folder_permissions(g_folder, "write", False) == True
+
global g_folder
if phase == "title":
return g_folder["title"]
@@ -835,16 +839,17 @@ def mode_folder(phase):
global_buttons()
if config.may("wato.rulesets") or config.may("wato.seeall"):
html.context_button(_("Rulesets"), make_link([("mode", "ruleeditor")]), "rulesets")
- html.context_button(_("Folder Properties"), make_link_to([("mode", "editfolder")], g_folder), "edit")
- if not g_folder.get(".lock_subfolders") and config.may("wato.manage_folders"):
+ if auth_read:
+ html.context_button(_("Folder Properties"), make_link_to([("mode", "editfolder")], g_folder), "edit")
+ if not g_folder.get(".lock_subfolders") and config.may("wato.manage_folders") and auth_write:
html.context_button(_("New folder"), make_link([("mode", "newfolder")]), "newfolder")
- if not g_folder.get(".lock_hosts") and config.may("wato.manage_hosts"):
+ if not g_folder.get(".lock_hosts") and config.may("wato.manage_hosts") and auth_write:
html.context_button(_("New host"), make_link([("mode", "newhost")]), "new")
html.context_button(_("New cluster"), make_link([("mode", "newcluster")]), "new_cluster")
if config.may("wato.services"):
html.context_button(_("Bulk Inventory"), make_link([("mode", "bulkinventory"), ("all", "1")]),
"inventory")
- if not g_folder.get(".lock_hosts") and config.may("wato.parentscan"):
+ if not g_folder.get(".lock_hosts") and config.may("wato.parentscan") and auth_write:
html.context_button(_("Parent scan"), make_link([("mode", "parentscan"), ("all", "1")]),
"parentscan")
search_button()
@@ -955,6 +960,9 @@ def mode_folder(phase):
else:
render_folder_path()
+ if not auth_read:
+ html.message('<img class=authicon src="images/icon_autherr.png"> %s' % auth_message)
+
lock_messages = []
if g_folder.get(".lock_hosts"):
if g_folder[".lock_hosts"] == True:
@@ -982,7 +990,7 @@ def mode_folder(phase):
if True == check_folder_permissions(g_folder, "read", False):
have_something = show_hosts(g_folder) or have_something
- if not have_something:
+ if not have_something and auth_write:
menu_items = []
if not g_folder.get(".lock_hosts"):
menu_items.extend([
@@ -1098,7 +1106,7 @@ def check_folder_permissions(folder, how, exception=True, user = None, users = N
if c in cgs:
return True
- reason = _("Sorry, you have no permissions to access the folder <b>%s</b>. ") % folder["title"]
+ reason = _("Sorry, you have no permissions to the folder <b>%s</b>. ") % folder["title"]
if not cgs:
reason += _("The folder has no contact groups assigned to.")
else:
@@ -1107,6 +1115,7 @@ def check_folder_permissions(folder, how, exception=True, user = None, users = N
reason += _("Your contact groups are <b>%s</b>.") % ", ".join(user_cgs)
else:
reason += _("But you are not a member of any contact group.")
+ reason += _("You may enter the folder as you might have permission on a subfolders, though.")
if exception:
raise MKAuthException(reason)
@@ -1152,18 +1161,24 @@ def show_subfolders(folder):
html.write('<div class="floatfolder%s" id="folder_%s"' % (
auth_read and " unlocked" or " locked", entry['.name']))
- if auth_write:
- html.write(' onclick="wato_open_folder(event, \'%s\');"' % enter_url)
+ html.write(' onclick="wato_open_folder(event, \'%s\');"' % enter_url)
html.write('>')
# Only make folder openable when permitted to edit
- if auth_read:
- html.write(
- '<div class=hoverarea onmouseover="wato_toggle_folder(event, this, true);" '
- 'onmouseout="wato_toggle_folder(event, this, false)">'
- )
+ if not auth_read:
+ html.write('<img class="icon autherr" src="images/icon_autherr.png" title="%s">' % \
+ (html.strip_tags(auth_message)))
+
+ if True: # auth_read:
+ if not auth_read:
+ html.write('<div class=hoverarea>')
+
+ else:
+ html.write(
+ '<div class=hoverarea onmouseover="wato_toggle_folder(event, this, true);" '
+ 'onmouseout="wato_toggle_folder(event, this, false)">'
+ )
- if auth_read:
html.icon_button(
edit_url,
_("Edit the properties of this folder"),
@@ -1200,9 +1215,6 @@ def show_subfolders(folder):
)
html.write('</div>')
- else:
- html.write('<img class="icon autherr" src="images/icon_autherr.png" title="%s">' % \
- (html.strip_tags(auth_message)))
html.write('<div class=infos>')
# Show contact groups of the folder
effective = effective_attributes(None, entry)
Module: check_mk
Branch: master
Commit: 5a034c7dc8d95a69c456aeb69d7581b2ad90c26d
URL: http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=5a034c7dc8d95a…
Author: Lars Michelsen <lm(a)mathias-kettner.de>
Date: Tue Dec 17 10:48:42 2013 +0100
agent_vsphere.pysphere: More compatibility in case of not enough permissions
---
agents/special/agent_vsphere.pysphere | 15 +++++++++------
1 file changed, 9 insertions(+), 6 deletions(-)
diff --git a/agents/special/agent_vsphere.pysphere b/agents/special/agent_vsphere.pysphere
index 2e26e18..68284f8 100755
--- a/agents/special/agent_vsphere.pysphere
+++ b/agents/special/agent_vsphere.pysphere
@@ -640,12 +640,15 @@ def output_datastores():
# print inspect.getmembers(MORTypes)
print "<<<esx_vsphere_datastores:sep(%d)>>>" % ord('\t')
- for mor in host._retrieve_properties_traversal(property_names=property_names, obj_type=MORTypes.Datastore):
- for entry in mor.PropSet:
- if entry.Name == "name":
- print '[%s]' % entry.Val
- else:
- print '%s\t%s' % (entry.Name.split(".")[1], entry.Val)
+ rows = host._retrieve_properties_traversal(property_names=property_names, obj_type=MORTypes.Datastore)
+ # if the user has no permission to host / datastores, rows is None, skip it then
+ if rows:
+ for mor in rows:
+ for entry in mor.PropSet:
+ if entry.Name == "name":
+ print '[%s]' % entry.Val
+ else:
+ print '%s\t%s' % (entry.Name.split(".")[1], entry.Val)
def conv_multipath(value):
return " ".join(["%s %s" % (p.Name, p.PathState) for p in value.HostMultipathStateInfoPath])