Merge branch 'master' into feature/deduplicate-puppet-code-6842

Conflicts:
	.vagrant-puppet/manifests/default.pp
This commit is contained in:
Alexander Klimov 2014-08-15 12:41:27 +02:00
commit 2245989bdf
26 changed files with 404 additions and 205 deletions

3
.gitignore vendored
View File

@ -36,6 +36,9 @@ config/preferences/*.ini
# Application logfiles
var/log/*.log
# Packaging
/debian
*.tar.gz
*.komodoproject

View File

@ -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

View File

@ -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',

View File

@ -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'));

View File

@ -3,10 +3,19 @@ Alias @web_path@ "@prefix@/public"
<Directory "@prefix@/public">
Options SymLinksIfOwnerMatch
AllowOverride None
<IfModule mod_authz_core.c>
# Apache 2.4
<RequireAll>
Require all granted
</RequireAll>
</IfModule>
<IfModule !mod_authz_core.c>
# Apache 2.2
Order allow,deny
Allow from all
# new directive needed in Apache 2.4.3+
#Require all granted
</IfModule>
SetEnv ICINGAWEB_CONFIGDIR @icingaweb_config_path@

View File

@ -1,16 +1,37 @@
# $Id$
# Authority: The icinga devel team <icinga-devel at lists.icinga.org>
# Upstream: The icinga devel team <icinga-devel at lists.icinga.org>
# 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 <info@icinga.org>
# * @license http://www.gnu.org/licenses/gpl-2.0.txt GPL, version 2
# * @author Icinga Development Team <info@icinga.org>
# *
# */
%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
@ -37,15 +58,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 +130,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 +151,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 +213,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 +223,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 +241,3 @@ fi
%attr(0755,root,root) /usr/bin/icingacli
%changelog
* Tue May 11 2014 Michael Friedrich <michael.friedrich@netways.de> - 0.0.1-1
- initial creation

View File

@ -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));
}
}
}

View File

@ -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))) {

View File

@ -130,7 +130,7 @@ class Url
// 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);
$fragment = self::stripUrlFragment($url);
$urlParts = parse_url($url);
if (isset($urlParts['path'])) {
if ($baseUrl !== '' && strpos($urlParts['path'], $baseUrl) === 0) {
@ -144,8 +144,7 @@ class Url
$params = UrlParams::fromQueryString($urlParts['query'])->mergeValues($params);
}
$fragment = self::getUrlFragment($url);
if ($fragment !== '') {
if ($fragment) {
$urlObject->setAnchor($fragment);
}
@ -154,34 +153,20 @@ class Url
}
/**
* Get the fragment of a given url
* Remove the fragment-part of a given url and return it
*
* @param string $url The url containing the fragment.
* @param string $url The url to strip its fragment from
*
* @return string The fragment without the '#'
* @return null|string The stripped fragment, without the '#'
*/
protected static function getUrlFragment($url)
protected static function stripUrlFragment(&$url)
{
$url = parse_url($url);
if (isset($url['fragment'])) {
return $url['fragment'];
} else {
return '';
if (preg_match('@#(.*)$@', $url, $matches)) {
$url = str_replace('#' . $matches[1], '', $url);
return $matches[1];
}
}
/**
* 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
*

View File

@ -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())
)
)
);

View File

@ -10,28 +10,33 @@ $cf = $this->getHelper('CommandForm');
<div class="content processinfo">
<p>Backend <strong><?= $this->backendName; ?></strong>
<?= $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'); ?>.
<table class="avp">
<tbody>
<tr>
<th>Last status update</th>
<th><?= $this->translate('Last status update'); ?></th>
<td><?= $this->timeSince($ps->status_update_time) ?> ago</td>
</tr>
<tr>
<th>Last check command</th>
<th><?= $this->translate('Last check command'); ?></th>
<td><?= $this->timeSince($ps->last_command_check) ?> ago</td>
</tr>
<tr>
<th>Global host event handler</th>
<td><?= $ps->global_host_event_handler ? $ps->global_host_event_handler : 'Not set' ?></td>
<th><?= $this->translate('Global host event handler'); ?></th>
<td><?= $ps->global_host_event_handler ? $ps->global_host_event_handler : $this->translate('Not set'); ?></td>
</tr>
<tr>
<th>Global service event handler</th>
<td><?= $ps->global_service_event_handler ? $ps->global_service_event_handler : 'Not set' ?></td>
<th><?= $this->translate('Global service event handler'); ?></th>
<td><?= $ps->global_service_event_handler ? $ps->global_service_event_handler : $this->translate('Not set'); ?></td>
</tr>
<tr>
<th>Notifications enabled</th>
<th><?= $this->translate('Notifications enabled'); ?></th>
<td><?= $cf->toggleSubmitForm(
'',
$ps->notifications_enabled,
@ -41,15 +46,18 @@ $cf = $this->getHelper('CommandForm');
array('global' => '1')
) ?>
<?php if ($ps->notifications_enabled === '1'): ?>
<a rel="tooltip" title="Disable notifications for a specific time on a program-wide basis" href="<?= $this->href('monitoring/command/disablenotificationswithexpire') ?>" data-base-target="_next">Temporarily disable</a>
<a rel="tooltip" title="<?= $this->translate('Disable notifications for a specific time on a program-wide basis'); ?>"
href="<?= $this->href('monitoring/command/disablenotificationswithexpire') ?>" data-base-target="_next">
<?= $this->translate('Temporarily disable'); ?>
</a>
<?php elseif ($ps->disable_notif_expire_time): ?>
Will be re-enabled in <strong><?= $this->timeUntil($ps->disable_notif_expire_time) ?></strong>
<?= sprintf($this->translate('Will be re-enabled in %s'), '<strong>' . $this->timeUntil($ps->disable_notif_expire_time) . '</strong>'); ?>
</div>
<?php endif; ?>
</td>
</tr>
<tr>
<th>Execute active service checks</th>
<th><?= $this->translate('Execute active service checks'); ?></th>
<td><?= $cf->toggleSubmitForm(
'',
$ps->active_service_checks_enabled,
@ -60,7 +68,7 @@ Will be re-enabled in <strong><?= $this->timeUntil($ps->disable_notif_expire_tim
) ?></td>
</tr>
<tr>
<th>Accept passive service checks</th>
<th><?= $this->translate('Accept passive service checks'); ?></th>
<td><?= $cf->toggleSubmitForm(
'',
$ps->passive_service_checks_enabled,
@ -71,7 +79,7 @@ Will be re-enabled in <strong><?= $this->timeUntil($ps->disable_notif_expire_tim
) ?></td>
</tr>
<tr>
<th>Execute active host checks</th>
<th><?= $this->translate('Execute active host checks'); ?></th>
<td><?= $cf->toggleSubmitForm(
'',
$ps->active_host_checks_enabled,
@ -82,7 +90,7 @@ Will be re-enabled in <strong><?= $this->timeUntil($ps->disable_notif_expire_tim
) ?></td>
</tr>
<tr>
<th>Accept passive host checks</th>
<th><?= $this->translate('Accept passive host checks'); ?></th>
<td><?= $cf->toggleSubmitForm(
'',
$ps->passive_host_checks_enabled,
@ -93,7 +101,7 @@ Will be re-enabled in <strong><?= $this->timeUntil($ps->disable_notif_expire_tim
) ?></td>
</tr>
<tr>
<th>Eventhandlers enabled</th>
<th><?= $this->translate('Eventhandlers enabled'); ?></th>
<td><?= $cf->toggleSubmitForm(
'',
$ps->event_handlers_enabled,
@ -104,7 +112,7 @@ Will be re-enabled in <strong><?= $this->timeUntil($ps->disable_notif_expire_tim
) ?></td>
</tr>
<tr>
<th>Obsessing over host checks</th>
<th><?= $this->translate('Obsessing over host checks'); ?></th>
<td><?= $cf->toggleSubmitForm(
'',
$ps->obsess_over_hosts,
@ -115,7 +123,7 @@ Will be re-enabled in <strong><?= $this->timeUntil($ps->disable_notif_expire_tim
) ?></td>
</tr>
<tr>
<th>Obsessing over service checks</th>
<th><?= $this->translate('Obsessing over service checks'); ?></th>
<td><?= $cf->toggleSubmitForm(
'',
$ps->obsess_over_services,
@ -126,7 +134,7 @@ Will be re-enabled in <strong><?= $this->timeUntil($ps->disable_notif_expire_tim
) ?></td>
</tr>
<tr>
<th>Flap detection enabled</th>
<th><?= $this->translate('Flap detection enabled'); ?></th>
<td><?= $cf->toggleSubmitForm(
'',
$ps->flap_detection_enabled,
@ -137,7 +145,7 @@ Will be re-enabled in <strong><?= $this->timeUntil($ps->disable_notif_expire_tim
) ?></td>
</tr>
<tr>
<th>Process performance data</th>
<th><?= $this->translate('Process performance data'); ?></th>
<td><?= $cf->toggleSubmitForm(
'',
$ps->process_performance_data,
@ -148,17 +156,17 @@ Will be re-enabled in <strong><?= $this->timeUntil($ps->disable_notif_expire_tim
) ?></td>
</tr>
<tr>
<th>Monitoring Process</th>
<th><?= $this->translate('Monitoring Process'); ?></th>
<td><?= $cf->labelSubmitForm(
'Restart',
'Restart the monitoring process',
$this->translate('Restart'),
$this->translate('Restart the monitoring process'),
'',
'restartprocess'
) ?>
<!--<?=
$cf->labelSubmitForm(
'Shutdown monitoring process',
'Shutdown the monitoring process',
$this->translate('Shutdown monitoring process'),
$this->translate('Shutdown the monitoring process'),
'btn-cta',
'shutdownprocess'
);

View File

@ -31,12 +31,12 @@ foreach ($object->comments as $comment) {
);
$list[] = sprintf(
'<tr><th>%s (%s)</th><td data-base-target="_self">%s (%s) %s</td></tr>',
'<tr><th>%s (%s)</th><td><table><tr><td style="vertical-align: top;" data-base-target="_self">%s (%s):</td><td style="padding-left: .5em;">%s</td></tr></table></td></tr>',
$this->escape($comment->author),
$this->timeSince($comment->timestamp),
$iconForm,
ucfirst($comment->type),
$text
str_replace(array('\r\n', '\n'), '<br>', $text)
);
}

View File

@ -42,11 +42,11 @@ foreach ($object->downtimes as $downtime) {
) : $this->escape($downtime->comment);
$list[] = sprintf(
'<tr><th>%s</th><td data-base-target="_self">%s %s: %s</td></tr>',
'<tr><th>%s</th><td><table><tr><td style="vertical-align: top;" data-base-target="_self">%s %s:</td><td style="padding-left: .5em;">%s</td></tr></table></td></tr>',
$this->escape($downtime->author),
$iconForm,
$state,
$text
str_replace(array('\r\n', '\n'), '<br>', $text)
);
}

View File

@ -1,57 +0,0 @@
Requirements
============
Disabled SELinux for sending commands via external command pipe
provided by Icinga (2) Core.
# setenforce 0
Webinterface Login
==================
The default credentials using the internal MySQL database are
icingaadmin:icinga
Internal MySQL DB Setup
=======================
# mysql -u root -p
CREATE USER `icingaweb`@`localhost` IDENTIFIED BY 'icingaweb';
CREATE DATABASE `icingaweb`;
GRANT ALL PRIVILEGES ON `icingaweb`.* TO `icingaweb`@`localhost`;
FLUSH PRIVILEGES;
quit
# mysql icingaweb < /usr/share/doc/icingaweb2-*/schema/accounts.mysql.sql
# mysql icingaweb < /usr/share/doc/icingaweb2-*/schema/preferences.mysql.sql
Modules
=======
The monitoring module is enabled by default.
Backend configuration
=====================
/etc/icingaweb/resources.ini
contains the database backend information. By default
the Icinga IDO DB is used by the monitoring module in
/etc/icingaweb/modules/monitoring/backends.ini
The external command pipe is required for sending commands
and configured for Icinga 2 in
/etc/icingaweb/modules/monitoring/instances.ini
Support
=======
Please use one of the listed support channels at https://support.icinga.org

View File

@ -1,12 +0,0 @@
Alias /icingaweb /usr/share/icingaweb/public
<Directory "/usr/share/icingaweb/public">
Options -Indexes
AllowOverride All
Order allow,deny
Allow from all
EnableSendfile Off
</Directory>

View File

@ -1,7 +0,0 @@
RewriteEngine on
RewriteBase /icingaweb
RewriteCond %{REQUEST_FILENAME} -s [OR]
RewriteCond %{REQUEST_FILENAME} -l [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^.*$ - [NC,L]
RewriteRule ^.*$ index.php [NC,L]

View File

@ -1,6 +0,0 @@
<?php
// {{{ICINGA_LICENSE_HEADER}}}
// {{{ICINGA_LICENSE_HEADER}}}
require_once dirname(__DIR__). '/library/Icinga/Application/webrouter.php';

89
packages/rpm/README.md Normal file
View File

@ -0,0 +1,89 @@
# Icinga Web 2 README for RPM Packages
This file will describe how to install Icinga Web 2 from an RPM
package (RHEL/CentOS/Fedora, SLES/OpenSUSE).
## Requirements
* EPEL/OBS Repository for Zend Framework
* Apache 2.2+
* PHP 5.3+, Zend Framework, PHP PDO MySQL/PostgreSQL, PHP LDAP (optional)
* MySQL or PostgreSQL for internal DB
* Icinga 1.x or 2.x providing an IDO database (default: `icinga`)
* Icinga 1.x or 2.x providing an external command pipe (default: `icinga2.cmd`)
### SELinux
Disabled SELinux for sending commands via external command pipe
provided by Icinga (2) Core.
setenforce 0
## Webinterface Login
The default credentials using the internal MySQL database are
`icingaadmin:icinga`
## Support
Please use one of the listed support channels at https://support.icinga.org
## Internal DB Setup
Decide whether to use MySQL or PostgreSQL.
### MySQL
mysql -u root -p
CREATE USER `icingaweb`@`localhost` IDENTIFIED BY 'icingaweb';
CREATE DATABASE `icingaweb`;
GRANT ALL PRIVILEGES ON `icingaweb`.* TO `icingaweb`@`localhost`;
FLUSH PRIVILEGES;
quit
mysql -u root -p icingaweb < /usr/share/doc/icingaweb2-*/schema/accounts.mysql.sql
mysql -u root -p icingaweb < /usr/share/doc/icingaweb2-*/schema/preferences.mysql.sql
### PostgreSQL
sudo su postgres
psql
postgres=# CREATE USER icingaweb WITH PASSWORD 'icingaweb';
postgres=# CREATE DATABASE icingaweb;
postgres=# \q
Add the `cingaweb` user for trusted authentication to your `pg_hba.conf` file
in `/var/lib/pgsql/data/pg_hba.conf` and restart the PostgreSQL server.
local icingaweb icingaweb trust
host icingaweb icingaweb 127.0.0.1/32 trust
host icingaweb icingaweb ::1/128 trust
Now install the `icingaweb` schema
bash$ psql -U icingaweb -a -f /usr/share/doc/icingaweb2-*/schema/accounts.pgsql.sql
bash$ psql -U icingaweb -a -f /usr/share/doc/icingaweb2-*/schema/preferences.pgsql.sql
## Configuration
### Module Configuration
The monitoring module is enabled by default.
### Backend configuration
`/etc/icingaweb/resources.ini` contains the database backend information.
By default the Icinga 2 DB IDO is used by the monitoring module in
`/etc/icingaweb/modules/monitoring/backends.ini`
The external command pipe is required for sending commands
and configured for Icinga 2 in
`/etc/icingaweb/modules/monitoring/instances.ini`
### Authentication configuration
The `/etc/icingaweb/authentication.ini` file uses the internal database as
default. This requires the database being installed properly before
allowing users to login via web console.

View File

@ -0,0 +1,32 @@
Alias /icingaweb "/usr/share/icingaweb/public"
<Directory "/usr/share/icingaweb/public">
Options SymLinksIfOwnerMatch
AllowOverride None
<IfModule mod_authz_core.c>
# Apache 2.4
<RequireAll>
Require all granted
</RequireAll>
</IfModule>
<IfModule !mod_authz_core.c>
# Apache 2.2
Order allow,deny
Allow from all
</IfModule>
SetEnv ICINGAWEB_CONFIGDIR /etc/icingaweb
EnableSendfile Off
RewriteEngine on
RewriteBase /icingaweb/
RewriteCond %{REQUEST_FILENAME} -s [OR]
RewriteCond %{REQUEST_FILENAME} -l [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^.*$ - [NC,L]
RewriteRule ^.*$ index.php [NC,L]
</Directory>

View File

@ -0,0 +1,6 @@
[autologin]
backend = autologin
[internal_db_authentication]
backend = db
resource = internal_db

View File

@ -0,0 +1,8 @@
[localdb]
type = ido
resource = "ido"
[locallive]
disabled = "1"
type = livestatus
resource = livestatus

View File

@ -0,0 +1,2 @@
[icinga]
path = "/var/run/icinga2/cmd/icinga2.cmd"

View File

@ -0,0 +1,28 @@
[internal_db]
type = db
db = mysql
host = localhost
port = 3306
password = icingaweb
username = icingaweb
dbname = icingaweb
[ido]
type = db
db = mysql
host = localhost
port = 3306
password = icinga
username = icinga
dbname = icinga
[livestatus]
type = livestatus
socket = /var/run/icinga2/cmd/livestatus
[logfile]
type = file
filename = "/var/log/icingaweb/icingaweb.log"
fields = "/^(?<datetime>[0-9]{4}(-[0-9]{2}){2}T[0-9]{2}(:[0-9]{2}){2}(\\+[0-9]{2}:[0-9]{2})?) - (?<loglevel>[A-Za-z]+) - (?<message>.*)$/"
; format: PCRE
;

6
packages/rpm/usr/bin/icingacli Executable file
View File

@ -0,0 +1,6 @@
#!/usr/bin/php
<?php
use Icinga\Application\Cli;
require_once '/usr/share/icingaweb/library/Icinga/Application/Cli.php';
Cli::start()->dispatch();

View File

@ -355,12 +355,20 @@
$target = self.getLinkTargetFor($form);
if (method === 'GET') {
url = icinga.utils.addUrlParams(url, $form.serializeObject());
var dataObj = $form.serializeObject();
if (typeof autosubmit === 'undefined' || ! autosubmit) {
if ($button.length && $button.attr('name') !== 'undefined') {
dataObj[$button.attr('name')] = $button.attr('value');
}
}
url = icinga.utils.addUrlParams(url, dataObj);
} else {
data = $form.serializeArray();
if (typeof autosubmit === 'undefined' || ! autosubmit) {
if ($button.length) {
if ($button.length && $button.attr('name') !== 'undefined') {
data.push({
name: $button.attr('name'),
value: $button.attr('value')

View File

@ -0,0 +1,24 @@
<?php
// {{{ICINGA_LICENSE_HEADER}}}
// {{{ICINGA_LICENSE_HEADER}}}
namespace Tests\Icinga\Regression;
use Icinga\Test\BaseTestCase;
use Icinga\Web\Url;
/**
* Regression-Test for bug #6284
*
* href-helper drops URL fragments.
*
* @see https://dev.icinga.org/issues/6284
*/
class Bug6284Test extends BaseTestCase
{
public function testWhetherUrlFromPathDoesNotDropFragments()
{
$url = 'some/route/with#anchor';
$this->assertEquals($url, Url::fromPath($url)->getRelativeUrl());
}
}