Skip to content

Commit

Permalink
Merge branch 'master' into feature/display-documentation-4820
Browse files Browse the repository at this point in the history
Conflicts:
	modules/doc/library/Doc/DocParser.php
  • Loading branch information
lippserd committed Aug 19, 2014
2 parents f52b3f7 + 2f54ff4 commit 1c74fd7
Show file tree
Hide file tree
Showing 58 changed files with 771 additions and 394 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Expand Up @@ -36,6 +36,9 @@ config/preferences/*.ini
# Application logfiles
var/log/*.log

# Packaging
/debian
*.tar.gz
*.komodoproject


4 changes: 2 additions & 2 deletions .vagrant-puppet/files/etc/icinga2/conf.d/test-config.conf
@@ -1,6 +1,6 @@
object CheckCommand "dummy-host" {
import "plugin-check-command"
command = [ PluginDir + "/libexec/test_hostcheck.pl" ]
command = [ PluginDir + "/test_hostcheck.pl" ]
arguments = {
"--type" = "$check_type$"
"--failchance" = "$check_failchance$"
Expand All @@ -18,7 +18,7 @@ object CheckCommand "dummy-host" {

object CheckCommand "dummy-service" {
import "plugin-check-command"
command = [ PluginDir + "/libexec/test_servicecheck.pl" ]
command = [ PluginDir + "/test_servicecheck.pl" ]
arguments = {
"--total-critical-on-host" = "$check_critical_on_host$"
"--total-warning-on-host" = "$check_warning_on_host$"
Expand Down
7 changes: 6 additions & 1 deletion .vagrant-puppet/files/etc/icingaweb/menu.ini
Expand Up @@ -18,10 +18,15 @@ title = "Configuration"
url = "config"
priority = 300

[System.Modules]
title = "Modules"
url = "config/modules"
priority = 400

[System.ApplicationLog]
title = "Application log"
url = "list/applicationlog"
priority = 400
priority = 500

[Logout]
url = "authentication/logout"
Expand Down
46 changes: 20 additions & 26 deletions .vagrant-puppet/manifests/default.pp
Expand Up @@ -3,10 +3,14 @@
include pgsql
include openldap

Exec { path => '/bin:/usr/bin:/sbin' }
Exec { path => '/bin:/usr/bin:/sbin:/usr/sbin' }

$icingaVersion = '1.11.2'
$icinga2Version = '2.0.0'
$icingaVersion = '1.11.5'
$icinga2Version = '2.0.1'
$pluginVersion = '2.0'
$livestatusVersion = '1.2.4p5'
$phantomjsVersion = '1.9.1'
$casperjsVersion = '1.0.2'

exec { 'create-mysql-icinga-db':
unless => 'mysql -uicinga -picinga icinga',
Expand Down Expand Up @@ -72,10 +76,10 @@
--with-htmurl=/icinga-mysql --with-httpd-conf-file=/etc/httpd/conf.d/icinga-mysql.conf \
--with-cgiurl=/icinga-mysql/cgi-bin \
--with-http-auth-file=/usr/share/icinga/htpasswd.users \
--with-plugin-dir=/usr/lib64/nagios/plugins/libexec',
--with-plugin-dir=/usr/lib64/nagios/plugins',
creates => '/usr/local/icinga-mysql',
make => 'make all && make fullinstall install-config',
require => [ User['icinga'], Cmmi['icinga-plugins'], Package['apache'] ],
require => [ User['icinga'], Class['monitoring-plugins'], Package['apache'] ],
notify => Service['apache']
}

Expand All @@ -98,10 +102,10 @@
--with-htmurl=/icinga-pgsql --with-httpd-conf-file=/etc/httpd/conf.d/icinga-pgsql.conf \
--with-cgiurl=/icinga-pgsql/cgi-bin \
--with-http-auth-file=/usr/share/icinga/htpasswd.users \
--with-plugin-dir=/usr/lib64/nagios/plugins/libexec',
--with-plugin-dir=/usr/lib64/nagios/plugins',
creates => '/usr/local/icinga-pgsql',
make => 'make all && make fullinstall install-config',
require => [ User['icinga'], Cmmi['icinga-plugins'], Package['apache'] ],
require => [ User['icinga'], Class['monitoring-plugins'], Package['apache'] ],
notify => Service['apache']
}

Expand Down Expand Up @@ -206,20 +210,11 @@
require => Class['apache']
}

cmmi { 'icinga-plugins':
url => 'https://www.monitoring-plugins.org/download/nagios-plugins-1.5.tar.gz',
output => 'nagios-plugins-1.5.tar.gz',
flags => '--prefix=/usr/lib64/nagios/plugins \
--with-nagios-user=icinga --with-nagios-group=icinga \
--with-cgiurl=/icinga-mysql/cgi-bin',
creates => '/usr/lib64/nagios/plugins/libexec',
make => 'make && make install',
require => User['icinga']
}
include monitoring-plugins

cmmi { 'mk-livestatus':
url => 'http://mathias-kettner.de/download/mk-livestatus-1.2.2p1.tar.gz',
output => 'mk-livestatus-1.2.2p1.tar.gz',
url => "http://mathias-kettner.de/download/mk-livestatus-${livestatusVersion}.tar.gz",
output => "mk-livestatus-${livestatusVersion}.tar.gz",
flags => '--prefix=/usr/local/icinga-mysql --exec-prefix=/usr/local/icinga-mysql',
creates => '/usr/local/icinga-mysql/lib/mk-livestatus',
make => 'make && make install',
Expand Down Expand Up @@ -262,14 +257,14 @@
}

class { 'phantomjs':
url => 'https://phantomjs.googlecode.com/files/phantomjs-1.9.1-linux-x86_64.tar.bz2',
output => 'phantomjs-1.9.1-linux-x86_64.tar.bz2',
url => "https://phantomjs.googlecode.com/files/phantomjs-${phantomjsVersion}-linux-x86_64.tar.bz2",
output => "phantomjs-${phantomjsVersion}-linux-x86_64.tar.bz2",
creates => '/usr/local/phantomjs'
}

class { 'casperjs':
url => 'https://github.com/n1k0/casperjs/tarball/1.0.2',
output => 'casperjs-1.0.2.tar.gz',
url => "https://github.com/n1k0/casperjs/tarball/${casperjsVersion}",
output => "casperjs-${casperjsVersion}.tar.gz",
creates => '/usr/local/casperjs'
}

Expand Down Expand Up @@ -421,11 +416,10 @@

exec { 'populate-icinga2-mysql-db':
unless => 'mysql -uicinga2 -picinga2 icinga2 -e "SELECT * FROM icinga_dbversion;" &> /dev/null',
command => "mysql -uroot icinga2 < /usr/share/doc/icinga2-ido-mysql-$icinga2Version/schema/mysql.sql",
command => 'mysql -uroot icinga2 < /usr/share/icinga2-ido-mysql/schema/mysql.sql',
require => [ Exec['create-mysql-icinga2-db'], Package['icinga2-ido-mysql'] ]
}


file { '/etc/icinga2/features-available/ido-mysql.conf':
source => 'puppet:////vagrant/.vagrant-puppet/files/etc/icinga2/features-available/ido-mysql.conf',
owner => 'icinga',
Expand Down Expand Up @@ -574,7 +568,7 @@
}

define populate_monitoring_test_config_plugins {
file { "/usr/lib64/nagios/plugins/libexec/${name}":
file { "/usr/lib64/nagios/plugins/${name}":
owner => 'icinga',
group => 'icinga',
source => "/usr/local/share/misc/monitoring_test_config/plugins/${name}",
Expand Down
9 changes: 9 additions & 0 deletions .vagrant-puppet/modules/monitoring-plugins/manifests/init.pp
@@ -0,0 +1,9 @@
class monitoring-plugins {
include epel

# nagios plugins from epel
package { 'nagios-plugins-all':
ensure => installed,
require => Class['epel']
}
}
69 changes: 62 additions & 7 deletions README.md
Expand Up @@ -2,13 +2,59 @@

## Table of Contents

1. [Vagrant - Virtual development environment](#vagrant)
0. [General Information](#general information)
1. [Installation](#installation)
2. [Support](#support)
3. [Vagrant - Virtual development environment](#vagrant)

## General Information

`Icinga Web 2` is the next generation monitoring web interface, framework
and CLI tool developed by the [Icinga Project](https://www.icinga.org/community/team/).

Responsive and fast, rewritten from scratch supporting multiple backends and
providing a CLI tool. Compatible with Icinga Core 2.x and 1.x.

Check the Icinga website for some [insights](https://www.icinga.org/icinga/screenshots/icinga-web-2/).

> **Note**
>
> `Icinga Web 2` is still in development and not meant for production deployment.
> Watch the [development roadmap](https://dev.icinga.org/projects/icingaweb2/roadmap)
> and [Icinga website](https://www.icinga.org/) for release schedule updates!
## Installation

Please navigate to [doc/installation.md](doc/installation.md) for updated details.

## Support

Please head over to the [community support channels](https://www.icinga.org/icinga/faq/get-help/)
in case of questions, bugs, etc.

Please make sure to provide the following details:

* OS, distribution, version
* PHP and/or MySQL/PostgreSQL version
* Which browser and its version
* Screenshot and problem description


## Vagrant

> **Note** that the deployment of the virtual machine is tested against Vagrant starting with version 1.1.
### Requirements

* Vagrant 1.2+
* Virtualbox 4.2.16+
* a fairly powerful hardware (quad core, 4gb ram, fast hdd)

> **Note**
>
> The deployment of the virtual machine is tested against Vagrant starting with version 1.2.
> Unfortunately older versions will not work.
### General

The Icinga Web 2 project ships with a Vagrant virtual machine that integrates
the source code with various services and example data in a controlled
environment. This enables developers and users to test Livestatus, status.dat,
Expand All @@ -17,7 +63,9 @@ have to do is install Vagrant and run:

vagrant up

> **Note** that the first boot of the vm takes a fairly long time because
> **Note**
>
> The first boot of the vm takes a fairly long time because
> you'll download a plain CentOS base box and Vagrant will automatically
> provision the environment on the first go.
Expand Down Expand Up @@ -68,7 +116,7 @@ After you should be able to browse [localhost:8080/icingaweb](http://localhost:8
**Installed files**:

* `/usr/share/icinga/htpasswd.users` account information for logging into the Icinga classic web interface for both icinga instances
* `/usr/lib64/nagios/plugins` Nagios Plugins for both icinga instances
* `/usr/lib64/nagios/plugins` Monitoring Plugins for all Icinga instances

#### Icinga with IDOUtils using a MySQL database

Expand Down Expand Up @@ -196,12 +244,13 @@ code style issues.

#### Icinga 2

**Installation path**: `/usr/local/icinga2`
Installed from the Icinga [snapshot package repository](http://packages.icinga.org/epel/).
The configuration is located in `/etc/icinga2`.

**Example usage**:

cd /usr/local/icinga2
./sbin/icinga2 -c etc/icinga2/icinga2.conf.dist
/etc/init.d/icinga2 (start|stop|restart|reload)


## Log into Icinga Web 2

Expand All @@ -211,3 +260,9 @@ If you've configure LDAP as authentication backend (which is the default) use th
> **Password**: password
Have a look at [LDAP example data](#ldap example data) for more accounts.

Using MySQL as backend:

> **Username**: icingaadmin
> **Password**: icinga
33 changes: 24 additions & 9 deletions application/controllers/AuthenticationController.php
Expand Up @@ -14,6 +14,7 @@
use Icinga\Exception\NotReadableError;
use Icinga\Exception\ConfigurationError;
use Icinga\User;
use Icinga\Web\Session;
use Icinga\Web\Url;

/**
Expand All @@ -34,12 +35,17 @@ class AuthenticationController extends ActionController
public function loginAction()
{
$auth = $this->Auth();
$this->view->form = new LoginForm();
$this->view->form->setRequest($this->_request);
$this->view->form = $form = new LoginForm();
$form->setRequest($this->_request);
$this->view->title = $this->translate('Icingaweb Login');

try {
$redirectUrl = Url::fromPath($this->params->get('redirect', 'dashboard'));
$redirectUrl = $this->view->form->getValue('redirect');
if ($redirectUrl) {
$redirectUrl = Url::fromPath($redirectUrl);
} else {
$redirectUrl = Url::fromPath('dashboard');
}

if ($auth->isAuthenticated()) {
$this->rerenderLayout()->redirectNow($redirectUrl);
Expand Down Expand Up @@ -71,12 +77,20 @@ public function loginAction()
}
}
}
} elseif ($this->view->form->isSubmittedAndValid()) {
$user = new User($this->view->form->getValue('username'));
$password = $this->view->form->getValue('password');
} elseif ($form->isSubmittedAndValid()) {
$user = new User($form->getValue('username'));
$password = $form->getValue('password');
$backendsTried = 0;
$backendsWithError = 0;

$redirectUrl = $form->getValue('redirect');

if ($redirectUrl) {
$redirectUrl = Url::fromPath($redirectUrl);
} else {
$redirectUrl = Url::fromPath('dashboard');
}

foreach ($chain as $backend) {
if ($backend instanceof AutoLoginBackend) {
continue;
Expand Down Expand Up @@ -111,14 +125,14 @@ public function loginAction()
);
}
if ($backendsWithError) {
$this->view->form->addNote(
$form->addNote(
$this->translate(
'Note that not all authentication backends are available for authentication because they'
. ' have errors. Please check the system log or Icinga Web 2 log for more information'
)
);
}
$this->view->form->getElement('password')->addError($this->translate('Incorrect username or password'));
$form->getElement('password')->addError($this->translate('Incorrect username or password'));
}
} catch (Exception $e) {
$this->view->errorInfo = $e->getMessage();
Expand All @@ -131,9 +145,10 @@ public function loginAction()
public function logoutAction()
{
$auth = $this->Auth();
$isRemoteUser = $auth->getUser()->isRemoteUser();
$auth->removeAuthorization();

if ($auth->isAuthenticatedFromRemoteUser()) {
if ($isRemoteUser === true) {
$this->_helper->layout->setLayout('login');
$this->_response->setHttpResponseCode(401);
} else {
Expand Down
10 changes: 6 additions & 4 deletions application/controllers/ConfigController.php
Expand Up @@ -48,9 +48,6 @@ public function init()
))->add('logging', array(
'title' => 'Logging',
'url' => 'config/logging'
))->add('modules', array(
'title' => 'Modules',
'url' => 'config/modules'
));
}

Expand All @@ -70,7 +67,7 @@ public function indexAction()
$form->setConfiguration(IcingaConfig::app());
$form->setRequest($this->_request);
if ($form->isSubmittedAndValid()) {
if (!$this->writeConfigFile($form->getConfig(), 'config')) {
if (!$this->writeConfigFile($form->getConfig(), 'config')) {
return;
}
Notification::success('New configuration has successfully been stored');
Expand Down Expand Up @@ -107,6 +104,11 @@ public function loggingAction()
*/
public function modulesAction()
{
$this->view->tabs = Widget::create('tabs')->add('modules', array(
'title' => 'Modules',
'url' => 'config/modules'
));

$this->view->tabs->activate('modules');
$this->view->modules = Icinga::app()->getModuleManager()->select()
->from('modules')
Expand Down
4 changes: 3 additions & 1 deletion application/controllers/LayoutController.php
Expand Up @@ -18,7 +18,9 @@ class LayoutController extends ActionController
*/
public function menuAction()
{
$this->view->menuRenderer = new MenuRenderer(Menu::fromConfig()->order(), Url::fromRequest()->getRelativeUrl());
$this->view->menuRenderer = new MenuRenderer(
Menu::fromConfig()->order(), Url::fromRequest()->without('renderLayout')->getRelativeUrl()
);
}

/**
Expand Down

0 comments on commit 1c74fd7

Please sign in to comment.