diff --git a/.gitignore b/.gitignore
index ef44d81c9..1444ecfb2 100644
--- a/.gitignore
+++ b/.gitignore
@@ -36,6 +36,9 @@ config/preferences/*.ini
# Application logfiles
var/log/*.log
+# Packaging
/debian
+*.tar.gz
+*.komodoproject
diff --git a/.vagrant-puppet/files/etc/icinga2/conf.d/test-config.conf b/.vagrant-puppet/files/etc/icinga2/conf.d/test-config.conf
index 412307328..f25df325b 100644
--- a/.vagrant-puppet/files/etc/icinga2/conf.d/test-config.conf
+++ b/.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$"
@@ -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$"
diff --git a/.vagrant-puppet/files/etc/icingaweb/menu.ini b/.vagrant-puppet/files/etc/icingaweb/menu.ini
index f01ebaecc..d6f342655 100644
--- a/.vagrant-puppet/files/etc/icingaweb/menu.ini
+++ b/.vagrant-puppet/files/etc/icingaweb/menu.ini
@@ -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"
diff --git a/.vagrant-puppet/manifests/default.pp b/.vagrant-puppet/manifests/default.pp
index 121b7813f..86065d8fc 100644
--- a/.vagrant-puppet/manifests/default.pp
+++ b/.vagrant-puppet/manifests/default.pp
@@ -3,10 +3,14 @@ include mysql
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',
@@ -72,10 +76,10 @@ cmmi { 'icinga-mysql':
--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']
}
@@ -98,10 +102,10 @@ cmmi { 'icinga-pgsql':
--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']
}
@@ -206,20 +210,11 @@ exec { 'icinga-htpasswd':
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',
@@ -262,14 +257,14 @@ exec { 'populate-openldap':
}
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'
}
@@ -421,11 +416,10 @@ package { 'icinga2-ido-mysql':
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',
@@ -574,7 +568,7 @@ populate_monitoring_test_config { ['commands', 'contacts', 'dependencies',
}
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}",
diff --git a/.vagrant-puppet/modules/monitoring-plugins/manifests/init.pp b/.vagrant-puppet/modules/monitoring-plugins/manifests/init.pp
new file mode 100644
index 000000000..6dc7be09d
--- /dev/null
+++ b/.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']
+ }
+}
\ No newline at end of file
diff --git a/README.md b/README.md
index 5974d5de0..16eb1444a 100644
--- a/README.md
+++ b/README.md
@@ -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,
@@ -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.
@@ -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
@@ -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
@@ -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
+
diff --git a/application/controllers/AuthenticationController.php b/application/controllers/AuthenticationController.php
index bbb475989..a6a5345ed 100644
--- a/application/controllers/AuthenticationController.php
+++ b/application/controllers/AuthenticationController.php
@@ -14,6 +14,7 @@ use Icinga\Exception\AuthenticationException;
use Icinga\Exception\NotReadableError;
use Icinga\Exception\ConfigurationError;
use Icinga\User;
+use Icinga\Web\Session;
use Icinga\Web\Url;
/**
@@ -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);
@@ -71,12 +77,20 @@ class AuthenticationController extends ActionController
}
}
}
- } 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;
@@ -111,14 +125,14 @@ class AuthenticationController extends ActionController
);
}
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();
@@ -131,9 +145,10 @@ class AuthenticationController extends ActionController
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 {
diff --git a/application/controllers/ConfigController.php b/application/controllers/ConfigController.php
index 31739c30e..45be1d3fd 100644
--- a/application/controllers/ConfigController.php
+++ b/application/controllers/ConfigController.php
@@ -48,9 +48,6 @@ class ConfigController extends BaseConfigController
))->add('logging', array(
'title' => 'Logging',
'url' => 'config/logging'
- ))->add('modules', array(
- 'title' => 'Modules',
- 'url' => 'config/modules'
));
}
@@ -70,7 +67,7 @@ class ConfigController extends BaseConfigController
$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');
@@ -107,6 +104,11 @@ class ConfigController extends BaseConfigController
*/
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')
diff --git a/application/controllers/LayoutController.php b/application/controllers/LayoutController.php
index 2d1abfb72..8df5c2c21 100644
--- a/application/controllers/LayoutController.php
+++ b/application/controllers/LayoutController.php
@@ -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()
+ );
}
/**
diff --git a/application/forms/Authentication/LoginForm.php b/application/forms/Authentication/LoginForm.php
index cbe25b623..0eff8006c 100644
--- a/application/forms/Authentication/LoginForm.php
+++ b/application/forms/Authentication/LoginForm.php
@@ -5,6 +5,7 @@
namespace Icinga\Form\Authentication;
use Icinga\Web\Form;
+use Icinga\Web\Url;
/**
* Class LoginForm
@@ -16,12 +17,19 @@ class LoginForm extends Form
*/
protected function create()
{
+ $url = Url::fromRequest()->without('renderLayout');
+
$this->setName('form_login');
$this->addElement('text', 'username', array(
'label' => t('Username'),
'placeholder' => t('Please enter your username...'),
'required' => true,
));
+ $redir = $this->addElement('hidden', 'redirect');
+ $redirectUrl = $url->shift('redirect');
+ if ($redirectUrl) {
+ $this->setDefault('redirect', $redirectUrl);
+ }
$this->addElement('password', 'password', array(
'label' => t('Password'),
@@ -34,6 +42,7 @@ class LoginForm extends Form
} else {
$this->getElement('username')->setAttrib('class', 'autofocus');
}
+ $this->setAction((string) $url);
$this->setSubmitLabel('Login');
}
}
diff --git a/application/forms/Config/GeneralForm.php b/application/forms/Config/GeneralForm.php
index ced24401c..debb27d44 100644
--- a/application/forms/Config/GeneralForm.php
+++ b/application/forms/Config/GeneralForm.php
@@ -93,7 +93,6 @@ class GeneralForm extends Form
foreach (Translator::getAvailableLocaleCodes() as $language) {
$languages[$language] = $language;
}
- $languages[Translator::DEFAULT_LOCALE] = Translator::DEFAULT_LOCALE;
$this->addElement(
'select',
diff --git a/application/forms/Preference/GeneralForm.php b/application/forms/Preference/GeneralForm.php
index fbc8f8d74..204ddc51d 100644
--- a/application/forms/Preference/GeneralForm.php
+++ b/application/forms/Preference/GeneralForm.php
@@ -33,7 +33,6 @@ class GeneralForm extends Form
foreach (Translator::getAvailableLocaleCodes() as $language) {
$languages[$language] = $language;
}
- $languages[Translator::DEFAULT_LOCALE] = Translator::DEFAULT_LOCALE;
$prefs = $this->getUserPreferences();
$useDefaultLanguage = $this->getRequest()->getParam('default_language', !$prefs->has('app.language'));
diff --git a/application/layouts/scripts/body.phtml b/application/layouts/scripts/body.phtml
index be9531adc..a40715458 100644
--- a/application/layouts/scripts/body.phtml
+++ b/application/layouts/scripts/body.phtml
@@ -38,7 +38,7 @@ if ($notifications->hasMessages()) {
-
data-icinga-module="= $moduleName ?>" data-icinga-url="= Url::fromRequest() ?>"= $refresh ?> style="display: block">
+
data-icinga-module="= $moduleName ?>" data-icinga-url="= Url::fromRequest()->without('renderLayout') ?>"= $refresh ?> style="display: block">
= $this->render('inline.phtml') ?>
diff --git a/application/layouts/scripts/layout.phtml b/application/layouts/scripts/layout.phtml
index b4fd504ed..32c4879b4 100644
--- a/application/layouts/scripts/layout.phtml
+++ b/application/layouts/scripts/layout.phtml
@@ -44,6 +44,7 @@ $iframeClass = $isIframe ? ' iframe' : '';
+
diff --git a/application/layouts/scripts/parts/navigation.phtml b/application/layouts/scripts/parts/navigation.phtml
index c689db54a..8b557e32f 100644
--- a/application/layouts/scripts/parts/navigation.phtml
+++ b/application/layouts/scripts/parts/navigation.phtml
@@ -14,5 +14,5 @@ if (! $this->auth()->isAuthenticated()) {
-= new MenuRenderer(Menu::fromConfig()->order(), Url::fromRequest()->getRelativeUrl()); ?>
+= new MenuRenderer(Menu::fromConfig()->order(), Url::fromRequest()->without('renderLayout')->getRelativeUrl()); ?>
diff --git a/application/views/scripts/authentication/logout.phtml b/application/views/scripts/authentication/logout.phtml
index eb0d6dc44..9b03d190f 100644
--- a/application/views/scripts/authentication/logout.phtml
+++ b/application/views/scripts/authentication/logout.phtml
@@ -7,10 +7,7 @@
in every further request until the browser was closed. To allow logout and to allow the user to change the
logged-in user this JavaScript provides a workaround to force a new authentication prompt in most browsers.
-->
-
-
-
-
+
= t('Logging out...'); ?>
= t(
@@ -19,37 +16,19 @@
'browser session.'
); ?>
-
-
-
-
diff --git a/config/menu.ini b/config/menu.ini
index 65959c93a..075f4230e 100644
--- a/config/menu.ini
+++ b/config/menu.ini
@@ -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"
diff --git a/etc/apache/icingaweb.conf.in b/etc/apache/icingaweb.conf.in
index 0451abf5b..3884aea5a 100644
--- a/etc/apache/icingaweb.conf.in
+++ b/etc/apache/icingaweb.conf.in
@@ -3,10 +3,19 @@ Alias @web_path@ "@prefix@/public"
Options SymLinksIfOwnerMatch
AllowOverride None
- Order allow,deny
- Allow from all
- # new directive needed in Apache 2.4.3+
- #Require all granted
+
+
+ # Apache 2.4
+
+ Require all granted
+
+
+
+
+ # Apache 2.2
+ Order allow,deny
+ Allow from all
+
SetEnv ICINGAWEB_CONFIGDIR @icingaweb_config_path@
diff --git a/icingaweb2.spec b/icingaweb2.spec
index b1cb3d2e5..cfdcdafc2 100644
--- a/icingaweb2.spec
+++ b/icingaweb2.spec
@@ -1,16 +1,37 @@
-# $Id$
-# Authority: The icinga devel team
-# Upstream: The icinga devel team
-# ExcludeDist: el4 el3
+#/**
+# * This file is part of Icinga Web 2.
+# *
+# * Icinga Web 2 - Head for multiple monitoring backends.
+# * Copyright (C) 2014 Icinga Development Team
+# *
+# * This program 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; either version 2
+# * of the License, or (at your option) any later version.
+# *
+# * This program 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 General Public License for more details.
+# *
+# * You should have received a copy of the GNU General Public License
+# * along with this program; if not, write to the Free Software
+# * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+# *
+# * @copyright 2014 Icinga Development Team
+# * @license http://www.gnu.org/licenses/gpl-2.0.txt GPL, version 2
+# * @author Icinga Development Team
+# *
+# */
-%define revision 0
+%define revision 1
%define configdir %{_sysconfdir}/icingaweb
%define sharedir %{_datadir}/icingaweb
%define prefixdir %{_datadir}/icingaweb
%define logdir %{sharedir}/log
%define usermodparam -a -G
-#%define logdir %{_localstatedir}/log/icingaweb
+%define logdir %{_localstatedir}/log/icingaweb
%if "%{_vendor}" == "suse"
%define phpname php5
@@ -19,11 +40,12 @@
%endif
# SLE 11 = 1110
%if 0%{?suse_version} == 1110
+%define phpname php53
%define apache2modphpname apache2-mod_php53
%define usermodparam -A
%endif
-%if "%{_vendor}" == "redhat" || 0%{?suse_version} == 1110
+%if "%{_vendor}" == "redhat"
%define phpname php
%define phpzendname php-ZendFramework
%endif
@@ -37,15 +59,15 @@
%define apacheconfdir %{_sysconfdir}/apache2/conf.d
%define apacheuser wwwrun
%define apachegroup www
-%define extcmdfile1x %{_localstatedir}/icinga/rw/icinga.cmd
-%define livestatussocket1x %{_localstatedir}/icinga/rw/live
+%define extcmdfile %{_localstatedir}/run/icinga2/cmd/icinga.cmd
+%define livestatussocket %{_localstatedir}/run/icinga2/cmd/livestatus
%endif
%if "%{_vendor}" == "redhat"
%define apacheconfdir %{_sysconfdir}/httpd/conf.d
%define apacheuser apache
%define apachegroup apache
-%define extcmdfile-1x %{_localstatedir}/spool/icinga/cmd/icinga.cmd
-%define livestatussocket1x %{_localstatedir}/spool/icinga/cmd/live
+%define extcmdfile %{_localstatedir}/run/icinga2/cmd/icinga.cmd
+%define livestatussocket %{_localstatedir}/run/icinga2/cmd/livestatus
%endif
Summary: Open Source host, service and network monitoring Web UI
@@ -109,8 +131,8 @@ Requires: php-Icinga
%description
-IcingaWeb for Icinga 2 or Icinga 1.x using status data,
-IDOUtils or Livestatus as backend provider.
+Icinga Web 2 for Icinga 2 or Icinga 1.x using multiple backends
+for example DB IDO.
%package -n icingacli
Summary: Icinga CLI
@@ -130,58 +152,54 @@ Requires: %{phpzendname}
%description -n php-Icinga
-Icinga Web 2 PHP Libraries shared with icingacli.
-
-
+Icinga Web 2 PHP Libraries required by the web frontend and cli tool.
%prep
-#%setup -q -n %{name}-%{version}
-%setup -q -n %{name}
+#VERSION=0.0.1; git archive --format=tar --prefix=icingaweb2-$VERSION/ HEAD | gzip >icingaweb2-$VERSION.tar.gz
+%setup -q -n %{name}-%{version}
%build
-cat > README.RHEL.SUSE <<"EOF"
-IcingaWeb for RHEL and SUSE
-===========================
-
-Please check ./doc/installation.md
-for requirements and database setup.
-EOF
-
%install
[ "%{buildroot}" != "/" ] && [ -d "%{buildroot}" ] && rm -rf %{buildroot}
# prepare configuration for sub packages
# install rhel apache config
-install -D -m0644 packages/rhel/etc/httpd/conf.d/icingaweb.conf %{buildroot}/%{apacheconfdir}/icingaweb.conf
+install -D -m0644 packages/rpm/etc/httpd/conf.d/icingaweb.conf %{buildroot}/%{apacheconfdir}/icingaweb.conf
# install public, library, modules
%{__mkdir} -p %{buildroot}/%{sharedir}
%{__mkdir} -p %{buildroot}/%{logdir}
+%{__mkdir} -p %{buildroot}/%{_sysconfdir}/icingaweb
+%{__mkdir} -p %{buildroot}/%{_sysconfdir}/dashboard
+%{__mkdir} -p %{buildroot}/%{_sysconfdir}/icingaweb/modules
+%{__mkdir} -p %{buildroot}/%{_sysconfdir}/icingaweb/modules/monitoring
%{__mkdir} -p %{buildroot}/%{_sysconfdir}/icingaweb/enabledModules
%{__cp} -r application library modules public %{buildroot}/%{sharedir}/
-# install index.php
-install -m0644 packages/rhel/usr/share/icingaweb/public/index.php %{buildroot}/%{sharedir}/public/index.php
-
-# use the vagrant config for configuration for now - TODO
-%{__cp} -r .vagrant-puppet/files/etc/icingaweb %{buildroot}/%{_sysconfdir}/
-
-# we use the default 'icinga' database
-sed -i 's/icinga2/icinga/g' %{buildroot}/%{_sysconfdir}/icingaweb/resources.ini
+## config
+# use the default menu.ini for application and monitoring mobule
+install -D -m0644 config/menu.ini %{buildroot}/%{_sysconfdir}/icingaweb/menu.ini
+install -D -m0644 config/modules/monitoring/menu.ini %{buildroot}/%{_sysconfdir}/icingaweb/modules/monitoring/menu.ini
+# authentication is db only
+install -D -m0644 packages/rpm/etc/icingaweb/authentication.ini %{buildroot}/%{_sysconfdir}/icingaweb/authentication.ini
+# custom resource paths
+install -D -m0644 packages/rpm/etc/icingaweb/resources.ini %{buildroot}/%{_sysconfdir}/icingaweb/resources.ini
+# dashboard
+install -D -m0644 config/dashboard/dashboard.ini %{buildroot}/%{_sysconfdir}/icingaweb/dashboard/dashboard.ini
+# monitoring module (icinga2)
+install -D -m0644 packages/rpm/etc/icingaweb/modules/monitoring/backends.ini %{buildroot}/%{_sysconfdir}/icingaweb/modules/monitoring/backends.ini
+install -D -m0644 packages/rpm/etc/icingaweb/modules/monitoring/instances.ini %{buildroot}/%{_sysconfdir}/icingaweb/modules/monitoring/instances.ini
# enable the monitoring module by default
ln -s %{sharedir}/modules/monitoring %{buildroot}/%{_sysconfdir}/icingaweb/enabledModules/monitoring
+## config
# install icingacli
-install -D -m0755 bin/icingacli %{buildroot}/usr/bin/icingacli
-
-# install sql schema files as example
-
-# delete all *.in files
+install -D -m0755 packages/rpm/usr/bin/icingacli %{buildroot}/usr/bin/icingacli
%pre
# Add apacheuser in the icingacmd group
@@ -196,9 +214,6 @@ if [ $? -eq 0 ]; then
%{_sbindir}/usermod %{usermodparam} icingacmd %{apacheuser}
fi
-# uncomment if building from git
-# %{__rm} -rf %{buildroot}%{_datadir}/icinga2-web/.git
-
%preun
%post
@@ -209,14 +224,13 @@ fi
%files
# main dirs
%defattr(-,root,root)
-%doc etc/schema doc packages/rhel/README
+%doc etc/schema doc packages/rpm/README.md
%attr(755,%{apacheuser},%{apachegroup}) %{sharedir}/public
%attr(755,%{apacheuser},%{apachegroup}) %{sharedir}/modules
# configs
%defattr(-,root,root)
%config(noreplace) %attr(-,root,root) %{apacheconfdir}/icingaweb.conf
-%dir %{configdir}
-%config(noreplace) %attr(775,%{apacheuser},%{apachegroup}) %{configdir}
+%config(noreplace) %attr(-,%{apacheuser},%{apachegroup}) %{configdir}
# logs
%attr(2775,%{apacheuser},%{apachegroup}) %dir %{logdir}
@@ -228,6 +242,3 @@ fi
%attr(0755,root,root) /usr/bin/icingacli
%changelog
-* Tue May 11 2014 Michael Friedrich - 0.0.1-1
-- initial creation
-
diff --git a/library/Icinga/Authentication/Backend/AutoLoginBackend.php b/library/Icinga/Authentication/Backend/AutoLoginBackend.php
index d793b50dd..16373bb6c 100644
--- a/library/Icinga/Authentication/Backend/AutoLoginBackend.php
+++ b/library/Icinga/Authentication/Backend/AutoLoginBackend.php
@@ -53,6 +53,7 @@ class AutoLoginBackend extends UserBackend
{
if (isset($_SERVER['REMOTE_USER'])) {
$username = $_SERVER['REMOTE_USER'];
+ $user->setRemoteUserInformation($username, 'REMOTE_USER');
if ($this->stripUsernameRegexp !== null) {
$stripped = preg_replace($this->stripUsernameRegexp, '', $username);
if ($stripped !== false) {
diff --git a/library/Icinga/Authentication/Manager.php b/library/Icinga/Authentication/Manager.php
index 01964ef00..ec49aa416 100644
--- a/library/Icinga/Authentication/Manager.php
+++ b/library/Icinga/Authentication/Manager.php
@@ -30,12 +30,6 @@ class Manager
*/
private $user;
- /**
- * If the user was authenticated from the REMOTE_USER server variable
- *
- * @var Boolean
- */
- private $fromRemoteUser = false;
private function __construct()
{
@@ -117,6 +111,13 @@ class Manager
public function authenticateFromSession()
{
$this->user = Session::getSession()->get('user');
+
+ if ($this->user !== null && $this->user->isRemoteUser() === true) {
+ list($originUsername, $field) = $this->user->getRemoteUserInformation();
+ if (array_key_exists($field, $_SERVER) && $_SERVER[$field] !== $originUsername) {
+ $this->removeAuthorization();
+ }
+ }
}
/**
@@ -204,35 +205,4 @@ class Manager
{
return $this->user->getGroups();
}
-
- /**
- * Tries to authenticate the user from the session, and then from the REMOTE_USER superglobal, that can be set by
- * an external authentication provider.
- */
- public function authenticateFromRemoteUser()
- {
- if (array_key_exists('REMOTE_USER', $_SERVER)) {
- $this->fromRemoteUser = true;
- }
- $this->authenticateFromSession();
- if ($this->user !== null) {
- if (array_key_exists('REMOTE_USER', $_SERVER) && $this->user->getUsername() !== $_SERVER["REMOTE_USER"]) {
- // Remote user has changed, clear all sessions
- $this->removeAuthorization();
- }
- return;
- }
- if (array_key_exists('REMOTE_USER', $_SERVER) && $_SERVER["REMOTE_USER"]) {
- $this->user = new User($_SERVER["REMOTE_USER"]);
- $this->persistCurrentUser();
- }
- }
-
- /**
- * If the session was established from the REMOTE_USER server variable.
- */
- public function isAuthenticatedFromRemoteUser()
- {
- return $this->fromRemoteUser;
- }
}
diff --git a/library/Icinga/Cli/Command.php b/library/Icinga/Cli/Command.php
index 081be318c..acb2462e4 100644
--- a/library/Icinga/Cli/Command.php
+++ b/library/Icinga/Cli/Command.php
@@ -7,6 +7,7 @@ namespace Icinga\Cli;
use Icinga\Cli\Screen;
use Icinga\Util\Translator;
use Icinga\Cli\Params;
+use Icinga\Application\Config;
use Icinga\Application\ApplicationBootstrap as App;
use Exception;
@@ -23,6 +24,10 @@ abstract class Command
protected $commandName;
protected $actionName;
+ private $config;
+
+ private $configs;
+
protected $defaultActionName = 'default';
public function __construct(App $app, $moduleName, $commandName, $actionName, $initialize = true)
@@ -41,6 +46,51 @@ abstract class Command
}
}
+ public function Config($file = null)
+ {
+ if ($this->isModule()) {
+ return $this->getModuleConfig($file);
+ } else {
+ return $this->getMainConfig($file);
+ }
+ }
+
+ private function getModuleConfig($file = null)
+ {
+ if ($file === null) {
+ if ($this->config === null) {
+ $this->config = Config::module($this->moduleName);
+ }
+ return $this->config;
+ } else {
+ if (! array_key_exists($file, $this->configs)) {
+ $this->configs[$file] = Config::module($this->moduleName, $file);
+ }
+ return $this->configs[$file];
+ }
+ }
+
+ private function getMainConfig($file = null)
+ {
+ if ($file === null) {
+ if ($this->config === null) {
+ $this->config = Config::app();
+ }
+ return $this->config;
+ } else {
+ if (! array_key_exists($file, $this->configs)) {
+ $this->configs[$file] = Config::module($module, $file);
+ }
+ return $this->configs[$file];
+ }
+ return $this->config;
+ }
+
+ public function isModule()
+ {
+ return substr(get_class($this), 0, 14) === 'Icinga\\Module\\';
+ }
+
public function setParams(Params $params)
{
$this->params = $params;
diff --git a/library/Icinga/Protocol/Commandpipe/CommandPipe.php b/library/Icinga/Protocol/Commandpipe/CommandPipe.php
index 91be222cd..8d149dd20 100644
--- a/library/Icinga/Protocol/Commandpipe/CommandPipe.php
+++ b/library/Icinga/Protocol/Commandpipe/CommandPipe.php
@@ -109,7 +109,19 @@ class CommandPipe
*/
public function send($command)
{
- $this->transport->send($command);
+ $this->transport->send($this->escape($command));
+ }
+
+ /**
+ * Return the given command string with escaped newlines
+ *
+ * @param string $command The command string to escape
+ *
+ * @return string The escaped command string
+ */
+ public function escape($command)
+ {
+ return str_replace(array("\r", "\n"), array('\r', '\n'), $command);
}
/**
@@ -121,16 +133,14 @@ class CommandPipe
public function sendCommand(Command $command, array $objects = array())
{
if ($command->provideGlobalCommand() === true) {
- $this->transport->send($command->getGlobalCommand());
+ $this->send($command->getGlobalCommand());
} else {
foreach ($objects as $object) {
$objectType = $this->getObjectType($object);
if ($objectType === self::TYPE_SERVICE) {
- $this->transport->send(
- $command->getServiceCommand($object->host_name, $object->service_description)
- );
+ $this->send($command->getServiceCommand($object->host_name, $object->service_description));
} else {
- $this->transport->send($command->getHostCommand($object->host_name));
+ $this->send($command->getHostCommand($object->host_name));
}
}
}
diff --git a/library/Icinga/User.php b/library/Icinga/User.php
index 848877850..13f62881a 100644
--- a/library/Icinga/User.php
+++ b/library/Icinga/User.php
@@ -58,6 +58,18 @@ class User
*/
protected $additionalInformation = array();
+ /**
+ * Information if the user is external authenticated
+ *
+ * Keys:
+ *
+ * 0: origin username
+ * 1: origin field name
+ *
+ * @var array
+ */
+ protected $remoteUserInformation = array();
+
/**
* Set of permissions
*
@@ -401,4 +413,35 @@ class User
{
$this->messages = null;
}
+
+ /**
+ * Set additional remote user information
+ *
+ * @param stirng $username
+ * @param string $field
+ */
+ public function setRemoteUserInformation($username, $field)
+ {
+ $this->remoteUserInformation = array($username, $field);
+ }
+
+ /**
+ * Get additional remote user information
+ *
+ * @return array
+ */
+ public function getRemoteUserInformation()
+ {
+ return $this->remoteUserInformation;
+ }
+
+ /**
+ * Return true if user has remote user information set
+ *
+ * @return bool
+ */
+ public function isRemoteUser()
+ {
+ return (count($this->remoteUserInformation)) ? true : false;
+ }
}
diff --git a/library/Icinga/Util/Translator.php b/library/Icinga/Util/Translator.php
index 111e414ad..fd01812b3 100644
--- a/library/Icinga/Util/Translator.php
+++ b/library/Icinga/Util/Translator.php
@@ -115,7 +115,7 @@ class Translator
*/
public static function getAvailableLocaleCodes()
{
- $codes = array();
+ $codes = array(static::DEFAULT_LOCALE);
foreach (array_values(self::$knownDomains) as $directory) {
$dh = opendir($directory);
while (false !== ($name = readdir($dh))) {
diff --git a/library/Icinga/Web/Controller/ActionController.php b/library/Icinga/Web/Controller/ActionController.php
index b28bddc37..13809e83d 100644
--- a/library/Icinga/Web/Controller/ActionController.php
+++ b/library/Icinga/Web/Controller/ActionController.php
@@ -254,10 +254,27 @@ class ActionController extends Zend_Controller_Action
*
* @throws \Exception
*/
- protected function redirectToLogin($afterLogin = '/dashboard')
+ protected function redirectToLogin($afterLogin = null)
{
+ $redir = null;
+ if ($afterLogin !== null) {
+ if (! $afterLogin instanceof Url) {
+ $afterLogin = Url::fromPath($afterLogin);
+ }
+ if ($this->isXhr()) {
+ $redir = '__SELF__';
+ } else {
+ // TODO: Ignore /?
+ $redir = $afterLogin->getRelativeUrl();
+ }
+ }
+
$url = Url::fromPath('authentication/login');
- $url->setParam('redirect', $afterLogin);
+
+ if ($redir) {
+ $url->setParam('redirect', $redir);
+ }
+
$this->rerenderLayout()->redirectNow($url);
}
@@ -273,6 +290,27 @@ class ActionController extends Zend_Controller_Action
return $this->getRequest()->isXmlHttpRequest();
}
+ protected function redirectXhr($url)
+ {
+ if (! $url instanceof Url) {
+ $url = Url::fromPath($url);
+ }
+
+ if ($this->rerenderLayout) {
+ $this->getResponse()->setHeader('X-Icinga-Rerender-Layout', 'yes');
+ }
+ if ($this->reloadCss) {
+ $this->getResponse()->setHeader('X-Icinga-Reload-Css', 'now');
+ }
+
+ $this->getResponse()
+ ->setHeader('X-Icinga-Redirect', rawurlencode($url->getAbsoluteUrl()))
+ ->sendHeaders();
+
+ // TODO: Session shutdown?
+ exit;
+ }
+
/**
* Redirect to a specific url, updating the browsers URL field
*
@@ -280,26 +318,13 @@ class ActionController extends Zend_Controller_Action
**/
public function redirectNow($url)
{
- if (! $url instanceof Url) {
- $url = Url::fromPath($url);
- }
- $url = preg_replace('~&~', '&', $url);
if ($this->isXhr()) {
- if ($this->rerenderLayout) {
- $this->getResponse()->setHeader('X-Icinga-Rerender-Layout', 'yes');
- }
- if ($this->reloadCss) {
- $this->getResponse()->setHeader('X-Icinga-Reload-Css', 'now');
- }
-
- $this->getResponse()
- ->setHeader('X-Icinga-Redirect', rawurlencode($url))
- ->sendHeaders();
-
- // TODO: Session shutdown?
- exit;
+ $this->redirectXhr($url);
} else {
- $this->_helper->Redirector->gotoUrlAndExit(Url::fromPath($url)->getRelativeUrl());
+ if (! $url instanceof Url) {
+ $url = Url::fromPath($url);
+ }
+ $this->_helper->Redirector->gotoUrlAndExit($url->getRelativeUrl());
}
}
@@ -362,6 +387,8 @@ class ActionController extends Zend_Controller_Action
'X-Icinga-Title',
rawurlencode($this->view->title . ' :: Icinga Web')
);
+ } else {
+ $resp->setHeader('X-Icinga-Title', rawurlencode('Icinga Web'));
}
if ($this->rerenderLayout) {
diff --git a/library/Icinga/Web/Url.php b/library/Icinga/Web/Url.php
index c705b68d7..ed3acf6a7 100644
--- a/library/Icinga/Web/Url.php
+++ b/library/Icinga/Web/Url.php
@@ -127,10 +127,6 @@ class Url
$baseUrl = $request->getBaseUrl();
$urlObject->setBaseUrl($baseUrl);
- // Fetch fragment manually and remove it from the url, to 'help' the parse_url() function
- // parsing the url properly. Otherwise calling the function with a fragment, but without a
- // query will cause unpredictable behaviour.
- $url = self::stripUrlFragment($url);
$urlParts = parse_url($url);
if (isset($urlParts['path'])) {
if ($baseUrl !== '' && strpos($urlParts['path'], $baseUrl) === 0) {
@@ -144,44 +140,14 @@ class Url
$params = UrlParams::fromQueryString($urlParts['query'])->mergeValues($params);
}
- $fragment = self::getUrlFragment($url);
- if ($fragment !== '') {
- $urlObject->setAnchor($fragment);
+ if (isset($urlParts['fragment'])) {
+ $urlObject->setAnchor($urlParts['fragment']);
}
$urlObject->setParams($params);
return $urlObject;
}
- /**
- * Get the fragment of a given url
- *
- * @param string $url The url containing the fragment.
- *
- * @return string The fragment without the '#'
- */
- protected static function getUrlFragment($url)
- {
- $url = parse_url($url);
- if (isset($url['fragment'])) {
- return $url['fragment'];
- } else {
- return '';
- }
- }
-
- /**
- * Remove the fragment-part of a given url
- *
- * @param string $url The url to strip from its fragment
- *
- * @return string The url without the fragment
- */
- protected static function stripUrlFragment($url)
- {
- return preg_replace('/#.*$/', '', $url);
- }
-
/**
* Overwrite the baseUrl
*
@@ -241,12 +207,12 @@ class Url
*
* @return string
*/
- public function getRelativeUrl()
+ public function getRelativeUrl($separator = '&')
{
if ($this->params->isEmpty()) {
return $this->path . $this->anchor;
} else {
- return $this->path . '?' . $this->params->setSeparator('&') . $this->anchor;
+ return $this->path . '?' . $this->params->toString($separator) . $this->anchor;
}
}
@@ -266,9 +232,9 @@ class Url
*
* @return string
*/
- public function getAbsoluteUrl()
+ public function getAbsoluteUrl($separator = '&')
{
- return $this->baseUrl . ($this->baseUrl !== '/' ? '/' : '') . $this->getRelativeUrl();
+ return $this->baseUrl . ($this->baseUrl !== '/' ? '/' : '') . $this->getRelativeUrl($separator);
}
/**
@@ -450,6 +416,6 @@ class Url
*/
public function __toString()
{
- return $this->getAbsoluteUrl();
+ return $this->getAbsoluteUrl('&');
}
}
diff --git a/library/Icinga/Web/UrlParams.php b/library/Icinga/Web/UrlParams.php
index 11fed8333..fa1b2a7f3 100644
--- a/library/Icinga/Web/UrlParams.php
+++ b/library/Icinga/Web/UrlParams.php
@@ -114,6 +114,18 @@ class UrlParams
return $ret;
}
+ public function addEncoded($param, $value = true)
+ {
+ $this->params[] = array($param, $this->cleanupValue($value));
+ $this->indexLastOne();
+ return $this;
+ }
+
+ protected function urlEncode($value)
+ {
+ return rawurlencode((string) $value);
+ }
+
/**
* Add the given parameter with the given value
*
@@ -127,9 +139,7 @@ class UrlParams
*/
public function add($param, $value = true)
{
- $this->params[] = array($param, $this->cleanupValue($value));
- $this->indexLastOne();
- return $this;
+ return $this->addEncoded($this->urlEncode($param), $this->urlEncode($value));
}
/**
@@ -198,7 +208,7 @@ class UrlParams
*/
public function unshift($param, $value)
{
- array_unshift($this->params, array($param, $this->cleanupValue($value)));
+ array_unshift($this->params, array($this->urlEncode($param), $this->urlEncode($value)));
$this->reIndexAll();
return $this;
}
@@ -224,7 +234,10 @@ class UrlParams
unset($this->params[$remove]);
}
- $this->params[$this->index[$param][0]] = array($param, $this->cleanupValue($value));
+ $this->params[$this->index[$param][0]] = array(
+ $this->urlEncode($param),
+ $this->urlEncode($this->cleanupValue($value))
+ );
$this->reIndexAll();
return $this;
@@ -243,7 +256,7 @@ class UrlParams
foreach ($this->index[$p] as $key) {
unset($this->params[$key]);
}
- $this->changed = true;
+ $changed = true;
}
}
@@ -303,10 +316,10 @@ class UrlParams
protected function parseQueryStringPart($part)
{
if (strpos($part, '=') === false) {
- $this->add($part, true);
+ $this->addEncoded($part, true);
} else {
list($key, $val) = preg_split('/=/', $part, 2);
- $this->add($key, $val);
+ $this->addEncoded($key, $val);
}
}
@@ -315,8 +328,11 @@ class UrlParams
return $this->params;
}
- public function __toString()
+ public function toString($separator = null)
{
+ if ($separator === null) {
+ $separator = $this->separator;
+ }
$parts = array();
foreach ($this->params as $p) {
if ($p[1] === true) {
@@ -325,7 +341,12 @@ class UrlParams
$parts[] = $p[0] . '=' . $p[1];
}
}
- return implode($this->separator, $parts);
+ return implode($separator, $parts);
+ }
+
+ public function __toString()
+ {
+ return $this->toString();
}
public static function fromQueryString($queryString = null)
diff --git a/library/Icinga/Web/Widget/Tabextension/DashboardAction.php b/library/Icinga/Web/Widget/Tabextension/DashboardAction.php
index 3d1c97ed0..241b83556 100644
--- a/library/Icinga/Web/Widget/Tabextension/DashboardAction.php
+++ b/library/Icinga/Web/Widget/Tabextension/DashboardAction.php
@@ -28,7 +28,7 @@ class DashboardAction implements Tabextension
'title' => 'Add To Dashboard',
'url' => Url::fromPath('dashboard/addurl'),
'urlParams' => array(
- 'url' => Url::fromRequest()->getRelativeUrl()
+ 'url' => rawurlencode(Url::fromRequest()->getRelativeUrl())
)
)
);
diff --git a/modules/monitoring/application/clicommands/ListCommand.php b/modules/monitoring/application/clicommands/ListCommand.php
index 42a377763..e6b86f4ef 100644
--- a/modules/monitoring/application/clicommands/ListCommand.php
+++ b/modules/monitoring/application/clicommands/ListCommand.php
@@ -72,6 +72,7 @@ class ListCommand extends Command
protected function showFormatted($query, $format, $columns)
{
+ $query = $query->getQuery();
switch($format) {
case 'json':
echo json_encode($query->fetchAll());
@@ -155,7 +156,7 @@ class ListCommand extends Command
'service_perfdata',
'service_last_state_change'
);
- $query = $this->getQuery('status', $columns)
+ $query = $this->getQuery('serviceStatus', $columns)
->order('host_name');
echo $this->renderStatusQuery($query);
}
@@ -167,6 +168,7 @@ class ListCommand extends Command
$screen = $this->screen;
$utils = new CliUtils($screen);
$maxCols = $screen->getColumns();
+ $query = $query->getQuery();
$rows = $query->fetchAll();
$count = $query->count();
$count = count($rows);
diff --git a/modules/monitoring/application/views/scripts/process/info.phtml b/modules/monitoring/application/views/scripts/process/info.phtml
index 350966c49..8fb9bd0e3 100644
--- a/modules/monitoring/application/views/scripts/process/info.phtml
+++ b/modules/monitoring/application/views/scripts/process/info.phtml
@@ -10,28 +10,33 @@ $cf = $this->getHelper('CommandForm');
Backend = $this->backendName; ?>
-= $ps->is_currently_running === '1' ? sprintf('has been running with PID %d ', $ps->process_id) . $this->prefixedTimeSince($ps->program_start_time) : 'is not running'; ?>.
+= $ps->is_currently_running === '1'
+ ? sprintf(
+ $this->translate('has been running with PID %d '),
+ $ps->process_id
+ ) . $this->prefixedTimeSince($ps->program_start_time)
+ : $this->translate('is not running'); ?>.
- Last status update
+ = $this->translate('Last status update'); ?>
= $this->timeSince($ps->status_update_time) ?> ago
- Last check command
+ = $this->translate('Last check command'); ?>
= $this->timeSince($ps->last_command_check) ?> ago
- Global host event handler
- = $ps->global_host_event_handler ? $ps->global_host_event_handler : 'Not set' ?>
+ = $this->translate('Global host event handler'); ?>
+ = $ps->global_host_event_handler ? $ps->global_host_event_handler : $this->translate('Not set'); ?>
- Global service event handler
- = $ps->global_service_event_handler ? $ps->global_service_event_handler : 'Not set' ?>
+ = $this->translate('Global service event handler'); ?>
+ = $ps->global_service_event_handler ? $ps->global_service_event_handler : $this->translate('Not set'); ?>
- Notifications enabled
+ = $this->translate('Notifications enabled'); ?>
= $cf->toggleSubmitForm(
'',
$ps->notifications_enabled,
@@ -41,15 +46,18 @@ $cf = $this->getHelper('CommandForm');
array('global' => '1')
) ?>
notifications_enabled === '1'): ?>
- Temporarily disable
+
+ = $this->translate('Temporarily disable'); ?>
+
disable_notif_expire_time): ?>
-Will be re-enabled in = $this->timeUntil($ps->disable_notif_expire_time) ?>
+= sprintf($this->translate('Will be re-enabled in %s'), '' . $this->timeUntil($ps->disable_notif_expire_time) . ' '); ?>
- Execute active service checks
+ = $this->translate('Execute active service checks'); ?>
= $cf->toggleSubmitForm(
'',
$ps->active_service_checks_enabled,
@@ -60,7 +68,7 @@ Will be re-enabled in = $this->timeUntil($ps->disable_notif_expire_tim
) ?>
- Accept passive service checks
+ = $this->translate('Accept passive service checks'); ?>
= $cf->toggleSubmitForm(
'',
$ps->passive_service_checks_enabled,
@@ -71,7 +79,7 @@ Will be re-enabled in = $this->timeUntil($ps->disable_notif_expire_tim
) ?>
- Execute active host checks
+ = $this->translate('Execute active host checks'); ?>
= $cf->toggleSubmitForm(
'',
$ps->active_host_checks_enabled,
@@ -82,7 +90,7 @@ Will be re-enabled in = $this->timeUntil($ps->disable_notif_expire_tim
) ?>
- Accept passive host checks
+ = $this->translate('Accept passive host checks'); ?>
= $cf->toggleSubmitForm(
'',
$ps->passive_host_checks_enabled,
@@ -93,7 +101,7 @@ Will be re-enabled in = $this->timeUntil($ps->disable_notif_expire_tim
) ?>
- Eventhandlers enabled
+ = $this->translate('Eventhandlers enabled'); ?>
= $cf->toggleSubmitForm(
'',
$ps->event_handlers_enabled,
@@ -104,7 +112,7 @@ Will be re-enabled in = $this->timeUntil($ps->disable_notif_expire_tim
) ?>
- Obsessing over host checks
+ = $this->translate('Obsessing over host checks'); ?>
= $cf->toggleSubmitForm(
'',
$ps->obsess_over_hosts,
@@ -115,7 +123,7 @@ Will be re-enabled in = $this->timeUntil($ps->disable_notif_expire_tim
) ?>
- Obsessing over service checks
+ = $this->translate('Obsessing over service checks'); ?>
= $cf->toggleSubmitForm(
'',
$ps->obsess_over_services,
@@ -126,7 +134,7 @@ Will be re-enabled in = $this->timeUntil($ps->disable_notif_expire_tim
) ?>
- Flap detection enabled
+ = $this->translate('Flap detection enabled'); ?>
= $cf->toggleSubmitForm(
'',
$ps->flap_detection_enabled,
@@ -137,7 +145,7 @@ Will be re-enabled in = $this->timeUntil($ps->disable_notif_expire_tim
) ?>
- Process performance data
+ = $this->translate('Process performance data'); ?>
= $cf->toggleSubmitForm(
'',
$ps->process_performance_data,
@@ -148,17 +156,17 @@ Will be re-enabled in = $this->timeUntil($ps->disable_notif_expire_tim
) ?>
- Monitoring Process
+ = $this->translate('Monitoring Process'); ?>
= $cf->labelSubmitForm(
- 'Restart',
- 'Restart the monitoring process',
+ $this->translate('Restart'),
+ $this->translate('Restart the monitoring process'),
'',
'restartprocess'
) ?>