Module: check_mk
Branch: master
Commit: 6c95b11dbc381b48a5bffb09b2d1475933b391ed
URL: http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=6c95b11dbc381b…
Author: Mathias Kettner <mk(a)mathias-kettner.de>
Date: Tue Feb 21 17:31:52 2012 +0100
Updated bug entries #0609
---
.bugs/609 | 7 ++++---
1 files changed, 4 insertions(+), 3 deletions(-)
diff --git a/.bugs/609 b/.bugs/609
index d18b1bf..c776645 100644
--- a/.bugs/609
+++ b/.bugs/609
@@ -5,6 +5,7 @@ Date: 2012-01-30 22:18:13
Targetversion: 1.2.0
Class: bug
-Die Userverwaltung in WatoNG liest weder bestehende User aus der OMD htpasswd datei aus, noch werden die
-bestehenden User aus dieser Datei behalten wenn man einen User in WatoNG anlegt.
-Auch wenn das eigentlich Funktionieren sollte, tat es das noch bei keiner Seite die ich migriert habe.
+Die Userverwaltung in WatoNG liest weder bestehende User aus der OMD htpasswd
+datei aus, noch werden die bestehenden User aus dieser Datei behalten wenn
+man einen User in WatoNG anlegt. Auch wenn das eigentlich Funktionieren
+sollte, tat es das noch bei keiner Seite die ich migriert habe.
Module: check_mk
Branch: master
Commit: 7936c43a12d711fdeb52f3ebe2da38a5e168374e
URL: http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=7936c43a12d711…
Author: Mathias Kettner <mk(a)mathias-kettner.de>
Date: Tue Feb 21 16:24:10 2012 +0100
FIX: honor permissions for "bulk cleanup" and "bulk edit"
---
.bugs/620 | 8 ++++++--
ChangeLog | 1 +
web/htdocs/wato.py | 20 ++++++++++++++++++++
3 files changed, 27 insertions(+), 2 deletions(-)
diff --git a/.bugs/620 b/.bugs/620
index 4635053..849a473 100644
--- a/.bugs/620
+++ b/.bugs/620
@@ -1,8 +1,12 @@
Title: Bulk edit berücksichtigt die Nutzer Rechte nicht
Component: wato
-State: open
+Class: bug
+State: done
Date: 2012-01-18 10:30:06
Targetversion: 1.2.0
-Class: bug
Ich kann Hosts auf die ich keine Rechte habe über die Bulk Edit Funktion bearbeiten.
+
+2012-02-21 16:23:38: changed state open -> done
+Bulk edit und Bulk cleanup prüft jetzt die Rechte
+korrekt.
diff --git a/ChangeLog b/ChangeLog
index 3ef1d85..d9dddd8 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -24,6 +24,7 @@
users not created via WATO will not be lost.
* FIX: honor site disabling in replication module
* FIX: honor write permissions on folder in "bulk delete"
+ * FIX: honor permissions for "bulk cleanup" and "bulk edit"
Checks & Agents:
* hpux_if: fix missing default parameter errors
diff --git a/web/htdocs/wato.py b/web/htdocs/wato.py
index d8617f5..cb30ba3 100644
--- a/web/htdocs/wato.py
+++ b/web/htdocs/wato.py
@@ -2412,8 +2412,18 @@ def mode_bulk_edit(phase):
elif phase == "action":
if html.check_transaction():
+ config.need_permission("wato.edit_hosts")
changed_attributes = collect_attributes()
+ if "contactgroups" in changed_attributes:
+ if True != check_folder_permissions(g_folder, "write", False):
+ raise MKAuthException(_("Sorry. In order to change the permissions of a host you need write "
+ "access to the folder it is contained in."))
+
hostnames = get_hostnames_from_checkboxes()
+ # Check all permissions for doing any edit
+ for hostname in hostnames:
+ check_host_permissions(hostname)
+
for hostname in hostnames:
host = g_folder[".hosts"][hostname]
mark_affected_sites_dirty(g_folder, hostname)
@@ -2468,8 +2478,18 @@ def mode_bulk_cleanup(phase):
elif phase == "action":
if html.check_transaction():
+ config.need_permission("wato.edit_hosts")
to_clean = bulk_collect_cleaned_attributes()
+ if "contactgroups" in to_clean:
+ if True != check_folder_permissions(g_folder, "write", False):
+ raise MKAuthException(_("Sorry. In order to change the permissions of a host you need write "
+ "access to the folder it is contained in."))
hostnames = get_hostnames_from_checkboxes()
+
+ # Check all permissions for doing any edit
+ for hostname in hostnames:
+ check_host_permissions(hostname)
+
for hostname in hostnames:
mark_affected_sites_dirty(g_folder, hostname)
host = g_folder[".hosts"][hostname]
Module: check_mk
Branch: master
Commit: c15b19e259894ed028d751dca7b41fad99fe976a
URL: http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=c15b19e259894e…
Author: Mathias Kettner <mk(a)mathias-kettner.de>
Date: Tue Feb 21 16:11:43 2012 +0100
FIX: honor write permissions on folder in "bulk delete"
---
.bugs/619 | 7 +++++--
ChangeLog | 1 +
web/htdocs/wato.py | 14 +++++++++++---
3 files changed, 17 insertions(+), 5 deletions(-)
diff --git a/.bugs/619 b/.bugs/619
index 5cfca54..50dd1eb 100644
--- a/.bugs/619
+++ b/.bugs/619
@@ -1,8 +1,11 @@
Title: Bulk löschen berücksichtigt die Nutzer Rechte nicht
Component: wato
-State: open
+Class: bug
+State: done
Date: 2012-01-18 10:28:38
Targetversion: 1.2.0
-Class: bug
Ich kann als Nutzer ohne Rechte auf die Hosts in einem Folder alle Hosts löschen.
+
+2012-02-21 16:11:13: changed state open -> done
+Ist erledigt, wird nun geprüft.
diff --git a/ChangeLog b/ChangeLog
index b79678a..3ef1d85 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -23,6 +23,7 @@
* FIX: Do load *all* users from htpasswd, so passwords from
users not created via WATO will not be lost.
* FIX: honor site disabling in replication module
+ * FIX: honor write permissions on folder in "bulk delete"
Checks & Agents:
* hpux_if: fix missing default parameter errors
diff --git a/web/htdocs/wato.py b/web/htdocs/wato.py
index 5d3b2a2..d8617f5 100644
--- a/web/htdocs/wato.py
+++ b/web/htdocs/wato.py
@@ -848,6 +848,7 @@ def mode_folder(phase):
# Deletion
if html.var("_bulk_delete"):
config.need_permission("wato.manage_hosts")
+ check_folder_permissions(g_folder, "write")
return delete_hosts_after_confirm(selected_hosts)
# Move
@@ -974,9 +975,16 @@ def check_folder_permissions(folder, how, exception=True, user = None):
if c in cgs:
return True
- reason = _("Sorry, you have no permission on the folder '<b>%s</b>'. The folder's contact "
- "groups are <b>%s</b>, your contact groups are <b>%s</b>.") % \
- (folder["title"], ", ".join(cgs), ", ".join(user_cgs))
+ reason = _("Sorry, you have no permission on the folder '<b>%s</b>'. " % folder["title"])
+ if not cgs:
+ reason += _("The folder has no contact groups assigned to.")
+ else:
+ reason += _("The folder's contact groups are <b>%s</b>. " % ", ".join(cgs))
+ if user_cgs:
+ reason += _("Your contact groups are <b>%s</b>.") % ", ".join(user_cgs)
+ else:
+ reason += _("But you are not a member of any contact group.")
+
if exception:
raise MKAuthException(reason)
else:
Module: check_mk
Branch: master
Commit: 1618847f4db6cdbe2f8eca8ee33551f8cb60cf9e
URL: http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=1618847f4db6cd…
Author: Mathias Kettner <mk(a)mathias-kettner.de>
Date: Tue Feb 21 15:57:40 2012 +0100
Livestatus-API: do reconnect until timeout is used up
---
.bugs/608 | 7 +++-
.bugs/647 | 7 +++-
ChangeLog | 3 ++
web/htdocs/htmllib.py | 2 +-
web/htdocs/index.py | 1 +
web/htdocs/livestatus.py | 62 +++++++++++++++++++++++++++++++--------------
web/htdocs/wato.py | 7 +++--
7 files changed, 62 insertions(+), 27 deletions(-)
diff --git a/.bugs/608 b/.bugs/608
index ebd2214..483c818 100644
--- a/.bugs/608
+++ b/.bugs/608
@@ -1,9 +1,9 @@
Title: Sidebar Refresh bei Nagios Reload
Component: multisite
-State: open
+Class: nastiness
+State: done
Date: 2012-01-27 16:09:02
Targetversion: 1.2.0
-Class: nastiness
Wird über Wato ein Nagios Reload anstelle des Restart ausgeführt, braucht
das Neuladen des Livestatus Modules zu lange und die Sidebar läuf in einen
@@ -12,3 +12,6 @@ Livestatus Timeout und muss neu geladen werden.
Mathias: Ich denke wir lösen das Problem in der Livestatus-API für Python.
Wenn der Connect nicht klappt, probieren wir es eine Zeitlang. Dafür
gibt es ja eine Timeout-Einstellung.
+
+2012-02-21 15:57:25: changed state open -> done
+Das ist jetzt in livestatus.py umgesetzt.
diff --git a/.bugs/647 b/.bugs/647
index 681efb7..6d0a5a4 100644
--- a/.bugs/647
+++ b/.bugs/647
@@ -1,11 +1,14 @@
Title: Sidebar Reload macht während Nagios Restart Probleme
Component: multisite
-State: open
+Class: nastiness
+State: done
Date: 2012-02-06 12:46:07
Targetversion: future
-Class: nastiness
Man könnte so lange versuchen die Livestatus Verbindung aufzubauen
bis das Connect Timeout erreicht ist.
Momentan wird es nur einmal versucht. Dann wird mit "Connection reset by peer" abgebrochen.
+
+2012-02-21 15:56:50: changed state open -> done
+Now within the timeout a reconnect is tried.
diff --git a/ChangeLog b/ChangeLog
index d2be19b..b79678a 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -56,6 +56,9 @@
* FIX: Fixed preview table styling in view editor
* FIX: Multisite authed users without permission to multisite are
automatically logged out after showing the error message
+ * Retry livestatus connect until timeout is used up. This avoids
+ error messages when the core is being restarted
+
BI:
* New column (painter) for simplistic box display of tree.
diff --git a/web/htdocs/htmllib.py b/web/htdocs/htmllib.py
index 9d4ff21..807f7f0 100644
--- a/web/htdocs/htmllib.py
+++ b/web/htdocs/htmllib.py
@@ -978,7 +978,7 @@ class html:
return (omd_mode, omd_site)
def begin_foldable_container(self, treename, id, isopen, title, indent = True, first = False):
- # try to get persistet state of tree
+ # try to get persisted state of tree
tree_state = weblib.get_tree_states(treename)
if id in tree_state:
diff --git a/web/htdocs/index.py b/web/htdocs/index.py
index 4c13de4..6cffb43 100644
--- a/web/htdocs/index.py
+++ b/web/htdocs/index.py
@@ -139,6 +139,7 @@ def connect_to_livestatus(html):
else:
html.live = livestatus.SingleSiteConnection("unix:" + defaults.livestatus_unix_socket)
+ html.live.set_timeout(10) # default timeout is 10 seconds
html.site_status = { '': { "state" : "dead", "site" : config.site('') } }
v1, v2, ps = html.live.query_row("GET status\nColumns: livestatus_version program_version program_start")
html.site_status[''].update({ "state" : "online", "livestatus_version": v1, "program_version" : v2, "program_start" : ps })
diff --git a/web/htdocs/livestatus.py b/web/htdocs/livestatus.py
index eef1be3..c5211ce 100644
--- a/web/htdocs/livestatus.py
+++ b/web/htdocs/livestatus.py
@@ -194,7 +194,7 @@ class BaseConnection:
parts = url.split(":")
if parts[0] == "unix":
if len(parts) != 2:
- raise MKLivestatusConfigError("Invalid livestatus unix url: %s. "
+ raise MKLivestatusConfigError("Invalid livestatus unix URL: %s. "
"Correct example is 'unix:/var/run/nagios/rw/live'" % url)
self.socket = socket.socket(socket.AF_UNIX, socket.SOCK_STREAM)
target = parts[1]
@@ -204,21 +204,37 @@ class BaseConnection:
host = parts[1]
port = int(parts[2])
except:
- raise MKLivestatusConfigError("Invalid livestatus tcp url '%s'. "
+ raise MKLivestatusConfigError("Invalid livestatus tcp URL '%s'. "
"Correct example is 'tcp:somehost:6557'" % url)
self.socket = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
target = (host, port)
else:
- raise MKLivestatusConfigError("Invalid livestatus url '%s'. "
+ raise MKLivestatusConfigError("Invalid livestatus URL '%s'. "
"Must begin with 'tcp:' or 'unix:'" % url)
- try:
- if self.timeout:
- self.socket.settimeout(float(self.timeout))
- self.socket.connect(target)
- except Exception, e:
- self.socket = None
- raise MKLivestatusSocketError("Cannot connect to '%s': %s" % (self.socketurl, e))
+ # If a timeout is set, then we retry after a failure with mild
+ # a binary backoff.
+ if self.timeout:
+ before = time.time()
+ sleep_interval = 0.1
+
+ while True:
+ try:
+ if self.timeout:
+ self.socket.settimeout(float(sleep_interval))
+ self.socket.connect(target)
+ break
+ except Exception, e:
+ if self.timeout:
+ time_left = self.timeout - (time.time() - before)
+ # only try again, if there is substantial time left
+ if time_left > sleep_interval:
+ time.sleep(sleep_interval)
+ sleep_interval *= 1.5
+ continue
+
+ self.socket = None
+ raise MKLivestatusSocketError("Cannot connect to '%s': %s" % (self.socketurl, e))
if self.persist:
persistent_connections[self.socketurl] = self.socket
@@ -242,7 +258,7 @@ class BaseConnection:
self.send_query(query, add_headers)
return self.recv_response(query, add_headers)
- def send_query(self, query, add_headers = ""):
+ def send_query(self, query, add_headers = "", do_reconnect=True):
if self.socket == None:
self.connect()
if not query.endswith("\n"):
@@ -261,7 +277,15 @@ class BaseConnection:
del persistent_connections[self.socketurl]
self.successful_persistence = False
self.socket = None
- raise MKLivestatusSocketError(str(e))
+
+ if do_reconnect:
+ # Automatically try to reconnect in case of an error, but
+ # only once.
+ self.connect()
+ self.send_query(query, add_headers, False)
+ return
+
+ raise MKLivestatusSocketError("RC1:" + str(e))
# Reads a response from the livestatus socket. If the socket is closed
# by the livestatus server, we automatically make a reconnect and send
@@ -282,20 +306,20 @@ class BaseConnection:
raise MKLivestatusSocketError("Malformed output")
else:
raise MKLivestatusQueryError(code, data.strip())
- except MKLivestatusSocketClosed:
+
+ # In case of an IO error or the other side having
+ # closed the socket do a reconnect and try again, but
+ # only once
+ except (MKLivestatusSocketClosed, IOError), e:
self.disconnect()
if query:
+ time.sleep(0.1)
self.connect()
self.send_query(query, add_headers)
return self.recv_response() # do not send query again -> danger of infinite loop
else:
- raise
+ raise MKLivestatusSocketError(str(e))
- except IOError, e:
- self.socket = None
- if self.persist:
- del persistent_connections[self.socketurl]
- raise MKLivestatusSocketError(str(e))
def do_command(self, command):
if self.socket == None:
diff --git a/web/htdocs/wato.py b/web/htdocs/wato.py
index 5f90ed2..5d3b2a2 100644
--- a/web/htdocs/wato.py
+++ b/web/htdocs/wato.py
@@ -5741,11 +5741,12 @@ def mode_edit_site(phase):
# Timeout
html.write("<tr><td class=legend>")
- html.write(_("Connect Timeout<br><i>This setting limits the time Multisites waits for a connection "
+ html.write(_("Connect Timeout<br><i>This sets the time that Multisite waits for a connection "
"to the site to be established before the site is considered to be unreachable. "
- "If not set, the operating system defaults are begin used.</i>"))
+ "If not set, the operating system defaults are begin used and just one login attempt is being. "
+ "performed.</i>"))
html.write("</td><td class=content>")
- timeout = site.get("timeout", "")
+ timeout = site.get("timeout", 10)
html.number_input("timeout", timeout, size=2)
html.write(_(" seconds"))
html.write("</td></tr>")
Module: check_mk
Branch: master
Commit: e68eb858f1548c65d2c3d4141b8d576f90bb179e
URL: http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=e68eb858f1548c…
Author: Mathias Kettner <mk(a)mathias-kettner.de>
Date: Tue Feb 21 13:27:48 2012 +0100
Fixed manuals of akcp checks
---
checkman/akcp_sensor_humidity | 24 +++++++++++++-----------
checkman/akcp_sensor_temp | 27 ++++++++++-----------------
2 files changed, 23 insertions(+), 28 deletions(-)
diff --git a/checkman/akcp_sensor_humidity b/checkman/akcp_sensor_humidity
index 0842711..ee40c07 100644
--- a/checkman/akcp_sensor_humidity
+++ b/checkman/akcp_sensor_humidity
@@ -1,34 +1,36 @@
-title: Check AKCP Sensor Temperature
+title: Check AKCP Sensor Humidity
agents: snmp
author: Michael Nieporte <michael.nieporte(a)uk-essen.de>
license: GPL
distribution: check_mk
description:
- This check monitors the temperature of sensors attached
+ This check monitors the humidity of sensors attached
to AKCP SensorProbe.
item:
The item is the sensor description of the sensor as string.
perfdata:
- One variable: the current temperature in degrees celsius or fahrenheit.
+ the current humidity in percent, lower crit, lower warn, upper warn, upper crit
inventory:
- All available temperature sensors are automatically inventorized.
+ All available humidity sensors are automatically inventorized.
examples:
- # set default levels for all temperature sensors
- akcp_sensor_temp_defaultlevels = (28, 32)
+ # set default levels for all akcp humidity sensors
+ akcp_sensor_humidity_defaultlevels = (35, 40, 60, 65)
# to Overwrite the default levels levels for a sensor
checks += [
- ( 'hostname', "akcp_sensor_temp", 'sensor description', ( warn value, crit value) ),
+ ( 'hostname', "akcp_sensor_humidity", 'sensor description', ( lower crit, lower warn, upper warn, upper crit ) ),
]
[parameters]
-warning (int): temperature at which a warning level is triggered
-critical (int): critical level for temperature
+critical low (int): lower border for triggering critical level
+warning low (int): lower border for warning level
+warning high (int): upper border for triggering warning level
+critical high (int): upper border for critical level
[configuration]
-akcp_sensor_temp (int, int): default levels for warning
- and critical. Preset to {(28,32)}.
+akcp_sensor_humidity (int, int, int, int): default levels for lower critical lower warning
+ and upper warning, upper critical. Preset to ( 35, 40, 60, 65 ).
diff --git a/checkman/akcp_sensor_temp b/checkman/akcp_sensor_temp
index aab25ee..09754d4 100644
--- a/checkman/akcp_sensor_temp
+++ b/checkman/akcp_sensor_temp
@@ -1,36 +1,29 @@
-title: Check AKCP Sensor Humidity
+title: Check AKCP Sensor Temperature
agents: snmp
author: Michael Nieporte <michael.nieporte(a)uk-essen.de>
license: GPL
distribution:
description:
- This check monitors the humidity of sensors attached
+ This check monitors the temperature of sensors attached
to AKCP SensorProbe.
item:
The item is the sensor description of the sensor as string.
perfdata:
- the current humidity in percent, lower crit, lower warn, upper warn, upper crit
+ the current temperature in degree celsius
inventory:
- All available humidity sensors are automatically inventorized.
+ All available temperature sensors are automatically inventorized.
examples:
- # set default levels for all akcp humidity sensors
- akcp_sensor_humidity_defaultlevels = (35, 40, 60, 65)
-
- # to Overwrite the default levels levels for a sensor
- checks += [
- ( 'hostname', "akcp_sensor_humidity", 'sensor description', ( lower crit, lower warn, upper warn, upper crit ) ),
- ]
+ # set default levels for all akcp temperature sensors
+ akcp_sensor_temp_defaultlevels = (28, 34)
[parameters]
-critical low (int): lower border for triggering critical level
-warning low (int): lower border for warning level
-warning high (int): upper border for triggering warning level
-critical high (int): upper border for critical level
+warning (int): temperature in degrees at which the check goes warning
+critical (int): level for critical temperature
[configuration]
-akcp_sensor_humidity (int, int, int, int): default levels for lower critical lower warning
- and upper warning, upper critical. Preset to ( 35, 40, 60, 65 ).
+akcp_sensor_temp_defaultlevels (int, int): Default levels. This is
+preset to {(28, 32)}.