mirror of
https://github.com/Icinga/icingaweb2.git
synced 2025-07-07 05:54:25 +02:00
Merge remote-tracking branch 'origin/master' into feature/add-to-dashboard-4537
This commit is contained in:
commit
f3846645f0
@ -1,117 +1,62 @@
|
|||||||
|
# <a id="installation"></a> Installation
|
||||||
|
|
||||||
# Installation
|
The preferred way of installing Icinga Web 2 is to use the official package repositories depending on which operating
|
||||||
|
system and distribution you are running. But it is also possible to install Icinga Web 2 directly from source.
|
||||||
|
|
||||||
## Requirements
|
## <a id="installation-requirements"></a> Installing Requirements
|
||||||
|
|
||||||
* Apache2 with PHP >= 5.3.0 enabled
|
* A web server, e.g. Apache or nginx
|
||||||
* PHP Zend Framework
|
* PHP >= 5.3.0
|
||||||
* PHP with MySQL or PostgreSQL libraries
|
* MySQL or PostgreSQL PHP libraries when using a database for authentication or storing user preferences into a database
|
||||||
* MySQL or PostgreSQL server and client software
|
* LDAP PHP library when using Active Directory or LDAP for authentication
|
||||||
* Icinga 1.x or Icinga 2 as backend providers
|
* Icinga 1.x w/ Livestatus or IDO, Icinga 2 w/ Livestatus or IDO feature enabled
|
||||||
|
|
||||||
RHEL/CentOS requires the EPEL repository enabled (which provides the `php-ZendFramework`
|
## <a id="installation-from-package"></a> Installing Icinga Web 2 from Package
|
||||||
package). OpenSUSE requires the [server monitoring](https://build.opensuse.org/project/show/server:monitoring) repository (which provides the `php5-ZendFramework` package) enabled.
|
|
||||||
|
|
||||||
## configure && make
|
A guide on how to install Icinga Web 2 from package will follow shortly.
|
||||||
|
|
||||||
### Basic installation
|
## <a id="installation-from-source"></a> Installing Icinga Web 2 from Source
|
||||||
|
|
||||||
If you like to configurea and install icinga2-web from the command line or
|
**Step 1: Getting the Source**
|
||||||
if you want to create packages, configure and make is the best choice for installation.
|
|
||||||
|
|
||||||
./configure && make install && make install-apache2-config
|
First of all, you need to download the sources. Icinga Web 2 is available through a Git repository. You can clone this
|
||||||
|
repository either via git or http protocol using the following URLs:
|
||||||
|
|
||||||
will install the application to the default target (/usr/local/icinga2-web). Also
|
* git://git.icinga.org/icingaweb2.git
|
||||||
an apache configuration entry is added to your apache server, so you should restart
|
* http://git.icinga.org/icingaweb2.git
|
||||||
your web server according to your systems configuration.
|
|
||||||
|
|
||||||
### Installation directory
|
There is also a browsable version available at
|
||||||
|
[gi.icinga.org](https://git.icinga.org/?p=icingaweb2.git;a=summary "Icinga Web 2 Git Repository").
|
||||||
|
This version also offers snapshots for easy download which you can use if you do not have git present on your system.
|
||||||
|
|
||||||
If you want to install the application to a different directory, use the --prefix flag in your
|
````
|
||||||
configure call:
|
git clone git://git.icinga.org/icingaweb2.git
|
||||||
|
````
|
||||||
|
|
||||||
./configure --prefix=/my/target/directory
|
**Step 2: Install the Source**
|
||||||
|
|
||||||
|
Choose a target directory and move Icinga Web 2 there.
|
||||||
|
|
||||||
### Authentication
|
````
|
||||||
|
mv icingaweb2 /usr/share/icingaweb2
|
||||||
|
````
|
||||||
|
|
||||||
By default, icinga2-web will be installed to authenticate againts its internal database,
|
**Step 3: Configuring the Web Server**
|
||||||
but you can configure it to use ldap-authentication by adding the `--with-ldap-authentication`
|
|
||||||
flag. You must provide the authentication details for your ldap server by using the --with-ldap-* flags.
|
|
||||||
To see a full list of the flags, call `./configure --help`
|
|
||||||
|
|
||||||
### Icinga backend
|
Use `icingacli` to generate web server configuration for either Apache or nginx.
|
||||||
|
|
||||||
The default option for icinga2web is to configure all icinga backends with the default settings (for example
|
*Apache*
|
||||||
/usr/local/icinga/ as the icinga directory) but only enable statusdat. To use a different backend,
|
|
||||||
call `--with-icinga-backend=` and provide ido, livestatus or statusdat as an option. To further configure
|
|
||||||
your backend, take a look at the various options described in `./configure --help`
|
|
||||||
|
|
||||||
### Databases
|
````
|
||||||
|
./bin/icingacli setup config webserver apache
|
||||||
|
````
|
||||||
|
|
||||||
It is required to set up all used Databases correctly, which basically means to create all needed user accounts and to
|
*nginx*
|
||||||
create all database tables. You will find the installation guides for the different databases in the sections below:
|
|
||||||
|
|
||||||
*IMPORTANT*: Select a secure password instead of "icingaweb" and alter the config/authentication.ini accordingly.
|
````
|
||||||
|
./bin/icingacli setup config webserver nginx
|
||||||
|
````
|
||||||
|
|
||||||
|
**Step 4: Web Setup**
|
||||||
|
|
||||||
#### MySQL
|
Visit Icinga Web 2 in your browser and complete installation using the web setup.
|
||||||
|
|
||||||
1. Create the user and the database
|
|
||||||
|
|
||||||
|
|
||||||
mysql -u root -p
|
|
||||||
mysql> CREATE USER `icingaweb`@`localhost` IDENTIFIED BY 'icingaweb';
|
|
||||||
mysql> CREATE DATABASE `icingaweb`;
|
|
||||||
mysql> GRANT ALL PRIVILEGES ON `icingaweb`.* TO `icingaweb`@`localhost`;
|
|
||||||
mysql> FLUSH PRIVILEGES;
|
|
||||||
mysql> quit
|
|
||||||
|
|
||||||
|
|
||||||
2. Create all tables (You need to be in the icinga2-web folder)
|
|
||||||
|
|
||||||
> **Note**
|
|
||||||
>
|
|
||||||
> RPM packages install the schema into /usr/share/doc/icingaweb-<version>/schema
|
|
||||||
|
|
||||||
bash$ mysql -u root -p icingaweb < etc/schema/mysql.sql
|
|
||||||
|
|
||||||
|
|
||||||
#### PostgreSQL
|
|
||||||
|
|
||||||
1. Create the user and the database
|
|
||||||
|
|
||||||
|
|
||||||
sudo su postgres
|
|
||||||
psql
|
|
||||||
postgres=# CREATE USER icingaweb WITH PASSWORD 'icingaweb';
|
|
||||||
postgres=# CREATE DATABASE icingaweb;
|
|
||||||
postgres=# \q
|
|
||||||
|
|
||||||
|
|
||||||
2. Enable trust authentication on localhost
|
|
||||||
|
|
||||||
Add the following lines to your pg_hba.conf (etc/postgresql/X.x/main/pg_hba.conf under debian, /var/lib/pgsql/data/pg_hba.conf for Redhat/Fedora)
|
|
||||||
to enable trust authentication for the icingaweb user when connecting from the localhost.
|
|
||||||
|
|
||||||
local icingaweb icingaweb trust
|
|
||||||
host icingaweb icingaweb 127.0.0.1/32 trust
|
|
||||||
host icingaweb icingaweb ::1/128 trust
|
|
||||||
|
|
||||||
And restart your database ('service postgresql restart' or '/etc/init.d/postgresql-X.x reload' while being root)
|
|
||||||
|
|
||||||
|
|
||||||
3. Create all tables (You need to be in the icinga2-web folder)
|
|
||||||
|
|
||||||
> **Note**
|
|
||||||
>
|
|
||||||
> RPM packages install the schema into /usr/share/doc/icingaweb-<version>/schema
|
|
||||||
|
|
||||||
bash$ psql -U icingaweb -a -f etc/schema/pgsql.sql
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
Quick and Dirty
|
|
||||||
----------------
|
|
||||||
|
|
||||||
tdb.
|
|
||||||
|
@ -537,6 +537,24 @@ class Monitoring_ListController extends Controller
|
|||||||
}
|
}
|
||||||
$this->addTitleTab('eventhistory', $this->translate('Event Overview'));
|
$this->addTitleTab('eventhistory', $this->translate('Event Overview'));
|
||||||
|
|
||||||
|
$form = new EventOverviewForm();
|
||||||
|
$form->handleRequest($this->getRequest());
|
||||||
|
$this->view->form = $form;
|
||||||
|
|
||||||
|
if ($this->getRequest()->isPost()) {
|
||||||
|
// update filter string
|
||||||
|
$filters = $form->getFilter();
|
||||||
|
$url = $this->_request->getUrl();
|
||||||
|
$url->setQueryString($filters->toQueryString());
|
||||||
|
if ($this->getParam('sort') !== null) {
|
||||||
|
$url->setParam('sort', $this->getParam('sort'));
|
||||||
|
}
|
||||||
|
if ($this->getParam('dir') !== null) {
|
||||||
|
$url->setParam('dir', $this->getParam('dir'));
|
||||||
|
}
|
||||||
|
return $this->redirectNow($url);
|
||||||
|
}
|
||||||
|
|
||||||
$query = $this->backend->select()->from('eventHistory', array(
|
$query = $this->backend->select()->from('eventHistory', array(
|
||||||
'host_name',
|
'host_name',
|
||||||
'service_description',
|
'service_description',
|
||||||
@ -550,6 +568,9 @@ class Monitoring_ListController extends Controller
|
|||||||
'host',
|
'host',
|
||||||
'service'
|
'service'
|
||||||
));
|
));
|
||||||
|
if ($this->getParam('state')) {
|
||||||
|
$query->applyFilter(Filter::expression('state', '=', $this->getParam('state')));
|
||||||
|
}
|
||||||
|
|
||||||
$this->setupSortControl(array(
|
$this->setupSortControl(array(
|
||||||
'timestamp' => 'Occurence'
|
'timestamp' => 'Occurence'
|
||||||
|
160
modules/monitoring/application/forms/EventOverviewForm.php
Normal file
160
modules/monitoring/application/forms/EventOverviewForm.php
Normal file
@ -0,0 +1,160 @@
|
|||||||
|
<?php
|
||||||
|
// {{{ICINGA_LICENSE_HEADER}}}
|
||||||
|
// {{{ICINGA_LICENSE_HEADER}}}
|
||||||
|
|
||||||
|
namespace Icinga\Module\Monitoring\Forms;
|
||||||
|
|
||||||
|
use Icinga\Data\Filter\FilterNot;
|
||||||
|
use Icinga\Web\Url;
|
||||||
|
use \Zend_Form;
|
||||||
|
use Icinga\Web\Form;
|
||||||
|
use Icinga\Data\Filter\Filter;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Configure the filter for the event overview
|
||||||
|
*/
|
||||||
|
class EventOverviewForm extends Form
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Initialize this form
|
||||||
|
*/
|
||||||
|
public function init()
|
||||||
|
{
|
||||||
|
$this->setName('form_event_overview');
|
||||||
|
$this->setDecorators(array(
|
||||||
|
'FormElements',
|
||||||
|
array('HtmlTag', array('tag' => 'div', 'class' => 'hbox')),
|
||||||
|
'Form'
|
||||||
|
));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @see Form::createElements()
|
||||||
|
*/
|
||||||
|
public function createElements(array $formData)
|
||||||
|
{
|
||||||
|
$decorators = array(
|
||||||
|
array('Label', array('class' => 'optional')),
|
||||||
|
'ViewHelper',
|
||||||
|
array('HtmlTag', array('tag' => 'div', 'class' => 'hbox-item optionbox')),
|
||||||
|
);
|
||||||
|
|
||||||
|
$url = Url::fromRequest()->getAbsoluteUrl();
|
||||||
|
$this->addElement(
|
||||||
|
'checkbox',
|
||||||
|
'statechange',
|
||||||
|
array(
|
||||||
|
'label' => t('State Changes'),
|
||||||
|
'class' => 'autosubmit',
|
||||||
|
'decorators' => $decorators,
|
||||||
|
'value' => strpos($url, $this->stateChangeFilter()->toQueryString()) === false ? 0 : 1
|
||||||
|
)
|
||||||
|
);
|
||||||
|
$this->addElement(
|
||||||
|
'checkbox',
|
||||||
|
'downtime',
|
||||||
|
array(
|
||||||
|
'label' => t('Downtimes'),
|
||||||
|
'class' => 'autosubmit',
|
||||||
|
'decorators' => $decorators,
|
||||||
|
'value' => strpos($url, $this->downtimeFilter()->toQueryString()) === false ? 0 : 1
|
||||||
|
)
|
||||||
|
);
|
||||||
|
$this->addElement(
|
||||||
|
'checkbox',
|
||||||
|
'comment',
|
||||||
|
array(
|
||||||
|
'label' => t('Comments'),
|
||||||
|
'class' => 'autosubmit',
|
||||||
|
'decorators' => $decorators,
|
||||||
|
'value' => strpos($url, $this->commentFilter()->toQueryString()) === false ? 0 : 1
|
||||||
|
)
|
||||||
|
);
|
||||||
|
$this->addElement(
|
||||||
|
'checkbox',
|
||||||
|
'notification',
|
||||||
|
array(
|
||||||
|
'label' => t('Notifications'),
|
||||||
|
'class' => 'autosubmit',
|
||||||
|
'decorators' => $decorators,
|
||||||
|
'value' => strpos($url, $this->notificationFilter()->toQueryString()) === false ? 0 : 1
|
||||||
|
)
|
||||||
|
);
|
||||||
|
$this->addElement(
|
||||||
|
'checkbox',
|
||||||
|
'flapping',
|
||||||
|
array(
|
||||||
|
'label' => t('Flapping'),
|
||||||
|
'class' => 'autosubmit',
|
||||||
|
'decorators' => $decorators,
|
||||||
|
'value' => strpos($url, $this->flappingFilter()->toQueryString()) === false ? 0 : 1
|
||||||
|
)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return the corresponding filter-object
|
||||||
|
*
|
||||||
|
* @returns Filter
|
||||||
|
*/
|
||||||
|
public function getFilter()
|
||||||
|
{
|
||||||
|
$filters = array();
|
||||||
|
if ($this->getValue('statechange', 1)) {
|
||||||
|
$filters[] = $this->stateChangeFilter();
|
||||||
|
}
|
||||||
|
if ($this->getValue('comment', 1)) {
|
||||||
|
$filters[] = $this->commentFilter();
|
||||||
|
}
|
||||||
|
if ($this->getValue('notification', 1)) {
|
||||||
|
$filters[] = $this->notificationFilter();
|
||||||
|
}
|
||||||
|
if ($this->getValue('downtime', 1)) {
|
||||||
|
$filters[] = $this->downtimeFilter();
|
||||||
|
}
|
||||||
|
if ($this->getValue('flapping', 1)) {
|
||||||
|
$filters[] = $this->flappingFilter();
|
||||||
|
}
|
||||||
|
return Filter::matchAny($filters);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function stateChangeFilter()
|
||||||
|
{
|
||||||
|
return Filter::matchAny(
|
||||||
|
Filter::expression('type', '=', 'hard_state'),
|
||||||
|
Filter::expression('type', '=', 'soft_state')
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function commentFilter()
|
||||||
|
{
|
||||||
|
return Filter::matchAny(
|
||||||
|
Filter::expression('type', '=', 'comment'),
|
||||||
|
Filter::expression('type', '=', 'comment_deleted'),
|
||||||
|
Filter::expression('type', '=', 'dt_comment'),
|
||||||
|
Filter::expression('type', '=', 'dt_comment_deleted'),
|
||||||
|
Filter::expression('type', '=', 'ack')
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function notificationFilter()
|
||||||
|
{
|
||||||
|
return Filter::expression('type', '=', 'notify');
|
||||||
|
}
|
||||||
|
|
||||||
|
public function downtimeFilter()
|
||||||
|
{
|
||||||
|
return Filter::matchAny(
|
||||||
|
Filter::expression('type', '=', 'downtime_start'),
|
||||||
|
Filter::expression('type', '=', 'downtime_end')
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function flappingFilter()
|
||||||
|
{
|
||||||
|
return Filter::matchAny(
|
||||||
|
Filter::expression('type', '=', 'flapping'),
|
||||||
|
Filter::expression('type', '=', 'flapping_deleted')
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
@ -4,6 +4,9 @@
|
|||||||
<div style="margin: 1em" class="dontprint">
|
<div style="margin: 1em" class="dontprint">
|
||||||
<?= $this->translate('Sort by'); ?> <?= $this->sortControl->render($this); ?>
|
<?= $this->translate('Sort by'); ?> <?= $this->sortControl->render($this); ?>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<?= $form ?>
|
||||||
|
<br/>
|
||||||
<?= $this->widget('limiter', array('url' => $this->url, 'max' => $this->history->count())); ?>
|
<?= $this->widget('limiter', array('url' => $this->url, 'max' => $this->history->count())); ?>
|
||||||
<?= $this->paginationControl($history, null, null, array('preserve' => $this->preserve)); ?>
|
<?= $this->paginationControl($history, null, null, array('preserve' => $this->preserve)); ?>
|
||||||
</div>
|
</div>
|
||||||
|
@ -195,3 +195,19 @@ textarea {
|
|||||||
input, select, textarea {
|
input, select, textarea {
|
||||||
display: inline;
|
display: inline;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.optionbox {
|
||||||
|
margin-left: 0em;
|
||||||
|
margin-right: 3em;
|
||||||
|
}
|
||||||
|
|
||||||
|
.optionbox label {
|
||||||
|
max-width: 6.5em;
|
||||||
|
text-align: left;
|
||||||
|
vertical-align: middle;
|
||||||
|
margin-right: 0em;
|
||||||
|
}
|
||||||
|
|
||||||
|
.optionbox input {
|
||||||
|
vertical-align: middle;
|
||||||
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user