Skip to content

Commit

Permalink
Merge branch 'develop'
Browse files Browse the repository at this point in the history
  • Loading branch information
Frescha committed Mar 24, 2014
2 parents ef37a87 + 72c917e commit 07af768
Show file tree
Hide file tree
Showing 143 changed files with 11,626 additions and 7,645 deletions.
24 changes: 20 additions & 4 deletions changelog
Original file line number Diff line number Diff line change
@@ -1,7 +1,23 @@
########################
Shinken WebUI CHANGELOG
########################
=======================

ENHANCEMENT
## Version 1.1 :
Enhancements:
- included minemap view in main menu
- included host groups view in main menu
- included custom views for linux and windows hosts
Add a custom_view=linux or custom_view=windows attribute in host definition to add this view in WebUI element view
- included icon sets for host and services
Use service/host as icon_set attribute in service/host definition to use this icon_set in WebUI
- refresh rate parameter added in WebUI.cfg parameters to define pages refresh rate
- element view includes more information
- Shinken logo on login form


Fixes:

## Version 1.0 :
Enhancements:

Fixes:

FIXES
208 changes: 197 additions & 11 deletions doc/index.rst
Original file line number Diff line number Diff line change
@@ -1,19 +1,205 @@
.. raw:: LaTeX
.. _webui_index:

\newpage
=======================
WebUI module
=======================

Shinken includes a self sufficient Web User Interface, which includes its own web server (No need to setup Apache or Microsoft IIS)

WebUI module
============
Shinken WebUI is started at the same time Shinken itself does, and is configured using the main Shinken configuration file by setting a few basic parameters.

Overview
=========
Enable the webui **module** in shinken-specific.cfg configuration file that is on the server where your Arbiter is installed.

::

## Module: WebUI
## Loaded by: Broker
# The Shinken web interface and integrated web server.

define module {
module_name WebUI
module_type webui
host 0.0.0.0 ; All interfaces = 0.0.0.0
port 7767
auth_secret CHANGE_ME ; CHANGE THIS or someone could forge
; cookies!!
allow_html_output 1 ; Allow or not HTML chars in plugins output.
; WARNING: Allowing can be a security issue.
max_output_length 100 ; Maximum output length for plugin output in webui
manage_acl 1 ; Use contacts ACL. 0 allow actions for all.
play_sound 0 ; Play sound on new non-acknowledged problems.
login_text Login to the Shinken WebUI - Live System; Text in the login form.

refresh_period 60 ; Number of seconds between each page refresh
; Default value is 60 seconds

## Modules for WebUI
# - Apache_passwd = Use an htpasswd file for auth backend.
# - ActiveDir_UI = Use AD for auth backend (and retrieve photos).
# - Cfg_password = Use the password setted in Shinken contact for auth.
# - PNP_UI = Use PNP graphs in the UI.
# - GRAPHITE_UI = Use graphs from Graphite time series database.
# - Mongodb = Save user preferences to a Mongodb database
# - SQLitedb = Save user preferences to a SQLite database
modules Apache_passwd, Cfg_password, PNP_UI, Mongodb, Glances_UI

## Advanced Options
# Don't use them as long as you don't know what you are doing!

#http_backend auto ; Choice is: auto, wsgiref, cherrypy, flup,
; flupscgi, paste, tornado, twisted or gevent.
; Leave auto to find the best available.
#remote_user_enable 1 ; If WebUI is behind a web server which
; has already authentified user, enable.
#remote_user_enable 2 ; Look for remote user in the WSGI environment
; instead of the HTTP header. This allows
; for fastcgi (flup) and scgi (flupscgi)
; integration, eg. with the apache modules.
#remote_user_variable X_Remote_User ; Set to the HTTP header containing
; the authentificated user s name, which
; must be a Shinken contact.
# If you got external plugins (pages) to load on webui
#additional_plugins_dir
#embeded_graph 1 ; If we don't want to publish graphing tools
; and embed graph in html code
}

Authentification modules
========================

The WebUI use modules to lookup your user password and allow to authenticate or not.

By default it is using the auth-cfg-password module, which will look into your contact definition for the password parameter.

Shinken contact - auth-cfg-password
====================================

How to install:

::
shinken install auth-cfg-password

The simpliest is to use the users added as Shinken contacts

How to configure the module:

::

define module {
module_name Cfg_password
module_type cfg_password_webui
}

Apache htpasswd - auth-htpasswd
===============================
This module uses an Apache passwd file (htpasswd) as authentification backend. All it needs is the full path of the file.

How to install:

::

shinken install auth-htpasswd

How to configure the module:

::

define module {
module_name Apache_passwd
module_type passwd_webui

# WARNING: put the full PATH for this value!
passwd /etc/shinken/htpasswd.users
}

Check the owner (must be Shinken user) and mode (must be readable) of this file.

If you don't have such a file you can generate one with the “htpasswd” command (in Debian's “apache2-utils” package), or from websites like htaccessTools.

Active Directory / OpenLDAP - ad_webui
======================================
This module allows to lookup passwords into both Active Directory or OpenLDAP entries.

How to install:

::
shinken install auth-active-directory

How to configure the module:

::

define module {
module_name ActiveDir_UI
module_type ad_webui
ldap_uri ldaps://adserver
username user
password password
basedn DC=google,DC=com

# For mode you can switch between ad (active dir)
# and openldap
mode ad
}

Change “adserver” by your own dc server, and set the “user/password” to an account with read access on the basedn for searching the user entries.

Change “mode” from “ad” to “openldap” to make the module ready to authenticate against an OpenLDAP directory service.

You could also find module sample in shinken.specific.cfg.

User photos
-----------
In the WebUI users can see each others photos.
At this point only the “ad_webui” module allows to import and display photos in the WebUI. There is no configuration: if you add the “ad_webui” module it will import contact photos automatically.

User preferences modules
========================

The WebUI use mongodb to store all user preferences, dashboards and other information.

To enable user preferences do the following:

install mongodb using the Shinken installation script: cd /usr/local/shinken ; ./install -a mongodb
add “Mongodb” to your WebUI module list as done in the example at the top of this page

Metrology graph modules
=======================

You can link the WebUI so it will present graphs from other tools, like PNP4Nagios or Graphite. All you need is to declare such modules (there are already samples in the default configuration) and add them in the WebUI modules definition.

PNP graphs
----------
You can ask for a PNP integration with a pnp_webui module. Here is its definition:

::

# Use PNP graphs in the WebUI
define module {
module_name PNP_UI
module_type pnp_webui
uri http://YOURSERVERNAME/pnp4nagios/ ; put the real PNP uri here. YOURSERVERNAME must be changed
; to the hostname of the PNP server
}

This part must be splitted and sent in all module repositories
Shinken will automatically replace YOURSERVERNAME with the broker hostname at runtime to try and make it work for you, but you MUST change it to the appropriate value.

.. raw:: LaTeX
Graphite graphs
----------------
You can ask for Graphite graphs with the graphite_ui definition.

\newpage
::

.. toctree::
define module {
module_name GRAPHITE_UI
module_type graphite_webui
uri http://YOURSERVERNAME/ ; put the real GRAPHITE uri here. YOURSERVERNAME must be changed
; to the hostname of the GRAPHITE server
}

webui_devel
webui_search
webui_ssl_certificates
Shinken will automatically replace YOURSERVERNAME with the broker hostname at runtime to try and make it work for you, but you MUST change it to the appropriate value.
8 changes: 0 additions & 8 deletions doc/webui_devel.rst
Original file line number Diff line number Diff line change
Expand Up @@ -122,14 +122,6 @@ For an if it's also easy:



Which javascript lib are you using?
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~


It's mootools 1.3 with all options :)




What to do?
~~~~~~~~~~~~
Expand Down
3 changes: 3 additions & 0 deletions etc/modules/webui.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,9 @@ define module {
play_sound 0 ; Play sound on new non-acknowledged problems.
login_text Login to the Shinken WebUI - Live System; Text in the login form.

refresh_period 60 ; Number of seconds between each page refresh
; Default value is 60 seconds

## Modules for WebUI
# - Apache_passwd = Use an htpasswd file for auth backend.
# - ActiveDir_UI = Use AD for auth backend (and retrieve photos).
Expand Down
61 changes: 61 additions & 0 deletions module/config_parser.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
#!/usr/bin/python

# -*- coding: utf-8 -*-

# Copyright (C) 2009-2014:
# Gabes Jean, [email protected]
# Gerhard Lausser, [email protected]
# Gregory Starck, [email protected]
# Hartmut Goebel, [email protected]
#
# This file is part of Shinken.
#
# Shinken is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# Shinken is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with Shinken. If not, see <http://www.gnu.org/licenses/>.

### Will be populated by the UI with it's own value

# config_parser
class config_parser(object):

def __init__(self, comment_char = '#', option_char = '=', allow_duplicates = False, strip_quotes = True):
self.comment_char = comment_char
self.option_char = option_char
self.allow_duplicates = allow_duplicates
self.strip_quotes = True

def parse_config(self, filename):
self.options = {}
config_file = open(filename)
for line in config_file:
if self.comment_char in line:
line, comment = line.split(self.comment_char, 1)
if self.option_char in line:
option, value = line.split(self.option_char, 1)
option = option.strip()
value = value.strip()
value = value.strip('"\'')
if self.allow_duplicates:
if option in self.options:
if not type(self.options[option]) == list:
old_value = self.options[option]
self.options[option] = [value] + [old_value]
else:
self.options[option] += [value]
else:
self.options[option] = value
else:
self.options[option] = value
config_file.close()
return self.options

24 changes: 11 additions & 13 deletions module/helper.py
Original file line number Diff line number Diff line change
Expand Up @@ -626,23 +626,25 @@ def get_icon_state(self, obj):
# Get
def get_navi(self, total, pos, step=30):
step = float(step)
nb_pages = math.ceil(total / step)
current_page = int(pos / step)
nb_pages = math.ceil(total / step) if step <> 0 else 0
current_page = int(pos / step) if step <> 0 else 0

step = int(step)

res = []

nb_max_items = 2

if nb_pages == 0 or nb_pages == 1:
return None

if current_page >= 2:
if current_page >= nb_max_items:
# Name, start, end, is_current
res.append((u'« First', 0, step, False))
res.append(('...', None, None, False))

#print "Range,", current_page - 1, current_page + 1
for i in xrange(current_page - 1, current_page + 2):
for i in xrange(current_page - (nb_max_items / 2), current_page + 1 + (nb_max_items / 2)):
if i < 0:
continue
#print "Doing PAGE", i
Expand All @@ -653,19 +655,15 @@ def get_navi(self, total, pos, step=30):
continue

end = int((i+1) * step)
res.append(('%d' % (i+1), start, end, is_current))
res.append(('Page %d' % (i+1), start, end, is_current))

if current_page < nb_pages - 2:
start = int((nb_pages - 1) * step)
end = int(nb_pages * step)
if current_page < nb_pages - nb_max_items:
start = int((nb_pages - (nb_max_items - 1)) * step)
end = int(total)
# end = int(nb_pages * step)
res.append(('...', None, None, False))
res.append((u'Last »', start, end, False))

#print "Total:", total, "pos", pos, "step", step
#print "nb pages", nb_pages, "current_page", current_page

#print "Res", res

return res

# Get a perfometer part for html printing
Expand Down
Loading

0 comments on commit 07af768

Please sign in to comment.