2017-07-12 20:46:12 +02:00
|
|
|
|
# Icinga 2 Addons <a id="addons"></a>
|
2014-05-23 01:01:06 +02:00
|
|
|
|
|
2017-07-12 20:46:12 +02:00
|
|
|
|
## Graphing <a id="addons-graphing"></a>
|
2014-05-23 01:01:06 +02:00
|
|
|
|
|
2017-07-12 20:46:12 +02:00
|
|
|
|
### PNP <a id="addons-graphing-pnp"></a>
|
2015-03-07 15:52:56 +01:00
|
|
|
|
|
2017-04-06 22:03:48 +02:00
|
|
|
|
[PNP](https://www.pnp4nagios.org) is a graphing addon.
|
2015-03-07 15:52:56 +01:00
|
|
|
|
|
2017-04-06 22:03:48 +02:00
|
|
|
|
[PNP](https://www.pnp4nagios.org) is an addon which adds a graphical representation of the performance data collected
|
2015-03-07 15:52:56 +01:00
|
|
|
|
by the monitoring plugins. The data is stored as rrd (round robin database) files.
|
|
|
|
|
|
|
|
|
|
Use your distribution's package manager to install the `pnp4nagios` package.
|
|
|
|
|
|
2016-05-23 14:14:59 +02:00
|
|
|
|
If you're planning to use it, configure it to use the
|
2017-04-06 22:03:48 +02:00
|
|
|
|
[bulk mode with npcd and npcdmod](https://docs.pnp4nagios.org/pnp-0.6/modes#bulk_mode_with_npcd_and_npcdmod)
|
2016-08-13 15:59:06 +02:00
|
|
|
|
in combination with Icinga 2's [PerfdataWriter](14-features.md#performance-data). NPCD collects the performance
|
2015-02-12 10:29:21 +01:00
|
|
|
|
data files which Icinga 2 generates.
|
2014-05-23 01:01:06 +02:00
|
|
|
|
|
2015-03-07 15:52:56 +01:00
|
|
|
|
Enable performance data writer in icinga 2
|
|
|
|
|
|
|
|
|
|
# icinga2 feature enable perfdata
|
|
|
|
|
|
|
|
|
|
Configure npcd to use the performance data created by Icinga 2:
|
|
|
|
|
|
|
|
|
|
vim /etc/pnp4nagios/npcd.cfg
|
|
|
|
|
|
|
|
|
|
Set `perfdata_spool_dir = /var/spool/icinga2/perfdata` and restart the `npcd` daemon.
|
|
|
|
|
|
|
|
|
|
There's also an Icinga Web 2 module for direct PNP graph integration
|
2016-12-08 17:38:41 +01:00
|
|
|
|
available at [Icinga Exchange](https://exchange.icinga.com/icinga/PNP).
|
2015-03-07 15:52:56 +01:00
|
|
|
|
|
2016-08-13 15:59:06 +02:00
|
|
|
|
More information on [action_url as attribute](13-addons.md#addons-graphing-pnp-action-url)
|
|
|
|
|
and [graph template names](13-addons.md#addons-graphing-pnp-custom-templates).
|
2015-03-07 15:52:56 +01:00
|
|
|
|
|
|
|
|
|
|
2017-07-12 20:46:12 +02:00
|
|
|
|
### Graphite <a id="addons-graphing-graphite"></a>
|
2015-03-07 15:52:56 +01:00
|
|
|
|
|
2017-04-06 22:03:48 +02:00
|
|
|
|
[Graphite](https://graphite.readthedocs.org/en/latest/) is a time-series database
|
2015-03-07 15:52:56 +01:00
|
|
|
|
storing collected metrics and making them available through restful apis
|
|
|
|
|
and web interfaces.
|
|
|
|
|
|
|
|
|
|
Graphite consists of 3 software components:
|
|
|
|
|
|
2016-05-23 14:14:59 +02:00
|
|
|
|
* carbon -- a Twisted daemon that listens for time-series data
|
|
|
|
|
* whisper -- a simple database library for storing time-series data (similar in design to RRD)
|
|
|
|
|
* graphite webapp -- a Django webapp that renders graphs on-demand using Cairo
|
2015-03-07 15:52:56 +01:00
|
|
|
|
|
2016-08-13 15:59:06 +02:00
|
|
|
|
Use the [GraphiteWriter](14-features.md#graphite-carbon-cache-writer) feature
|
2015-03-07 15:52:56 +01:00
|
|
|
|
for sending real-time metrics from Icinga 2 to Graphite.
|
|
|
|
|
|
2015-04-08 16:03:06 +02:00
|
|
|
|
# icinga2 feature enable graphite
|
2015-03-07 15:52:56 +01:00
|
|
|
|
|
|
|
|
|
There are Graphite addons available for collecting the performance data files too (e.g. `Graphios`).
|
|
|
|
|
|
2017-04-06 22:03:48 +02:00
|
|
|
|
A popular alternative frontend for Graphite is for example [Grafana](https://grafana.org).
|
2014-05-23 01:01:06 +02:00
|
|
|
|
|
2017-07-12 20:46:12 +02:00
|
|
|
|
### InfluxDB <a id="addons-graphing-influxdb"></a>
|
2015-09-16 15:00:12 +02:00
|
|
|
|
|
|
|
|
|
[InfluxDB](https://influxdb.com) is a time series, metrics, and analytics database.
|
|
|
|
|
It’s written in Go and has no external dependencies.
|
|
|
|
|
|
2016-08-13 15:59:06 +02:00
|
|
|
|
Use the [InfluxdbWriter](14-features.md#influxdb-writer) feature
|
2016-04-19 13:54:41 +02:00
|
|
|
|
for sending real-time metrics from Icinga 2 to InfluxDB.
|
2015-09-16 15:00:12 +02:00
|
|
|
|
|
2016-04-19 13:54:41 +02:00
|
|
|
|
# icinga2 feature enable influxdb
|
2015-09-16 15:00:12 +02:00
|
|
|
|
|
2017-04-06 22:03:48 +02:00
|
|
|
|
A popular frontend for InfluxDB is for example [Grafana](https://grafana.org).
|
2014-05-23 01:01:06 +02:00
|
|
|
|
|
2017-07-12 20:46:12 +02:00
|
|
|
|
## Visualization <a id="addons-visualization"></a>
|
2014-05-23 01:01:06 +02:00
|
|
|
|
|
2017-07-12 20:46:12 +02:00
|
|
|
|
### Icinga Reporting <a id="addons-visualization-reporting"></a>
|
2014-05-23 01:01:06 +02:00
|
|
|
|
|
2016-08-13 15:59:06 +02:00
|
|
|
|
By enabling the [DB IDO](14-features.md#db-ido) feature you can use the
|
2016-12-08 17:38:41 +01:00
|
|
|
|
[Icinga Reporting package](https://docs.icinga.com/latest/en/reporting.html).
|
2014-05-23 01:01:06 +02:00
|
|
|
|
|
2017-07-12 20:46:12 +02:00
|
|
|
|
### NagVis <a id="addons-visualization-nagvis"></a>
|
2014-05-23 01:01:06 +02:00
|
|
|
|
|
2016-08-13 15:59:06 +02:00
|
|
|
|
By using either [Livestatus](14-features.md#setting-up-livestatus) or
|
|
|
|
|
[DB IDO](14-features.md#db-ido) as a backend you can create your own network maps
|
2017-04-06 22:03:48 +02:00
|
|
|
|
based on your monitoring configuration and status data using [NagVis](https://www.nagvis.org).
|
2014-05-23 01:01:06 +02:00
|
|
|
|
|
2015-09-16 15:00:12 +02:00
|
|
|
|
The configuration in nagvis.ini.php should look like this for Livestatus for example:
|
|
|
|
|
|
|
|
|
|
[backend_live_1]
|
|
|
|
|
backendtype="mklivestatus"
|
|
|
|
|
socket="unix:/var/run/icinga2/cmd/livestatus"
|
|
|
|
|
|
2016-02-03 03:41:34 +01:00
|
|
|
|
If you are planning an integration into Icinga Web 2, look at [this module](https://github.com/Icinga/icingaweb2-module-nagvis).
|
2015-09-16 15:00:12 +02:00
|
|
|
|
|
2017-07-12 20:46:12 +02:00
|
|
|
|
### Thruk <a id="addons-visualization-thruk"></a>
|
2014-05-23 01:01:06 +02:00
|
|
|
|
|
2017-04-06 22:03:48 +02:00
|
|
|
|
[Thruk](https://www.thruk.org) is an alternative web interface which can be used with Icinga 2
|
2016-08-13 15:59:06 +02:00
|
|
|
|
and the [Livestatus](14-features.md#setting-up-livestatus) feature.
|
2014-05-23 01:01:06 +02:00
|
|
|
|
|
2017-07-12 20:46:12 +02:00
|
|
|
|
## Log Monitoring <a id="log-monitoring"></a>
|
2015-03-07 15:52:56 +01:00
|
|
|
|
|
2015-09-16 15:00:12 +02:00
|
|
|
|
Using [Logstash](https://www.elastic.co/guide/en/logstash/current/introduction.html) or
|
|
|
|
|
[Graylog](https://www.graylog.org) in your infrastructure and correlate events with your monitoring
|
2015-03-07 15:52:56 +01:00
|
|
|
|
is even simpler these days.
|
|
|
|
|
|
|
|
|
|
* Use the `GelfWriter` feature to write Icinga 2's check and notification events to Graylog or Logstash.
|
|
|
|
|
* Configure the logstash `nagios` output to send passive traps to Icinga 2 using the external command pipe.
|
|
|
|
|
* Execute a plugin to check Graylog alert streams.
|
|
|
|
|
|
2016-12-08 17:38:41 +01:00
|
|
|
|
More details can be found in [this blog post](https://www.icinga.com/2014/12/02/team-icinga-at-osmc-2014/).
|
2015-03-07 15:52:56 +01:00
|
|
|
|
|
2017-07-12 20:46:12 +02:00
|
|
|
|
## Notification Scripts and Interfaces <a id="notification-scripts-interfaces"></a>
|
2015-06-23 16:19:54 +02:00
|
|
|
|
|
2015-11-07 09:57:40 +01:00
|
|
|
|
There's a variety of resources available, for example different notification scripts such as:
|
2015-06-23 16:19:54 +02:00
|
|
|
|
|
2017-07-12 20:46:12 +02:00
|
|
|
|
* E-Mail ([examples](03-monitoring-basics.md#alert-notifications) provided)
|
2015-06-23 16:19:54 +02:00
|
|
|
|
* SMS
|
|
|
|
|
* Pager (XMPP, etc.)
|
|
|
|
|
* Twitter
|
|
|
|
|
* IRC
|
|
|
|
|
* Ticket systems
|
|
|
|
|
* etc.
|
|
|
|
|
|
2016-12-08 17:38:41 +01:00
|
|
|
|
Additionally external services can be [integrated with Icinga 2](https://www.icinga.com/products/integrations/):
|
2015-06-23 16:19:54 +02:00
|
|
|
|
|
2016-12-08 17:38:41 +01:00
|
|
|
|
* [Pagerduty](https://www.icinga.com/partners/pagerduty/)
|
|
|
|
|
* [VictorOps](https://www.icinga.com/partners/victorops/)
|
|
|
|
|
* [StackStorm](https://www.icinga.com/partners/stackstorm/)
|
2015-06-23 16:19:54 +02:00
|
|
|
|
|
2016-12-08 17:38:41 +01:00
|
|
|
|
More information can be found on the [Icinga Website](https://www.icinga.com/).
|
2015-06-23 16:19:54 +02:00
|
|
|
|
|
2017-07-12 20:46:12 +02:00
|
|
|
|
## Configuration Management Tools <a id="configuration-tools"></a>
|
2015-03-07 15:52:56 +01:00
|
|
|
|
|
2016-05-23 14:14:59 +02:00
|
|
|
|
If you require your favourite configuration tool to export the Icinga 2 configuration, please get in
|
2015-03-07 15:52:56 +01:00
|
|
|
|
touch with their developers. The Icinga project does not provide a configuration web interface
|
2016-12-08 17:38:41 +01:00
|
|
|
|
yet. Follow the [Icinga Blog](https://www.icinga.com/blog/) for updates on this topic.
|
2015-03-07 15:52:56 +01:00
|
|
|
|
|
2016-05-23 14:14:59 +02:00
|
|
|
|
If you're looking for puppet manifests, chef cookbooks, ansible recipes, etc. -- we're happy
|
2018-10-18 09:32:14 +02:00
|
|
|
|
to integrate them upstream, so please get in touch with the [Icinga team](https://icinga.com/community/).
|
2015-03-07 15:52:56 +01:00
|
|
|
|
|
|
|
|
|
These tools are currently in development and require feedback and tests:
|
|
|
|
|
|
|
|
|
|
* [Ansible Roles](https://github.com/Icinga/icinga2-ansible)
|
|
|
|
|
* [Puppet Module](https://github.com/Icinga/puppet-icinga2)
|
|
|
|
|
* [Chef Cookbook](https://github.com/Icinga/chef-icinga2)
|
|
|
|
|
|
2017-07-12 20:46:12 +02:00
|
|
|
|
## More Addon Integration Hints <a id="addon-integration-hints"></a>
|
2015-01-23 14:15:57 +01:00
|
|
|
|
|
2017-07-12 20:46:12 +02:00
|
|
|
|
### PNP Action Url <a id="addons-graphing-pnp-action-url"></a>
|
2015-01-23 14:15:57 +01:00
|
|
|
|
|
2015-03-07 15:52:56 +01:00
|
|
|
|
They work in a similar fashion for Icinga 2 and are used for 1.x web interfaces (Icinga Web 2 doesn't require
|
|
|
|
|
the action url attribute in its own module).
|
2015-01-23 14:15:57 +01:00
|
|
|
|
|
2016-11-29 17:07:41 +01:00
|
|
|
|
template Host "pnp-hst" {
|
2015-03-07 15:52:56 +01:00
|
|
|
|
action_url = "/pnp4nagios/graph?host=$HOSTNAME$"
|
|
|
|
|
}
|
2015-01-23 14:15:57 +01:00
|
|
|
|
|
2015-03-07 15:52:56 +01:00
|
|
|
|
template Service "pnp-svc" {
|
|
|
|
|
action_url = "/pnp4nagios/graph?host=$HOSTNAME$&srv=$SERVICEDESC$"
|
|
|
|
|
}
|
2015-01-23 14:15:57 +01:00
|
|
|
|
|
2017-07-12 20:46:12 +02:00
|
|
|
|
### PNP Custom Templates with Icinga 2 <a id="addons-graphing-pnp-custom-templates"></a>
|
2015-01-23 14:15:57 +01:00
|
|
|
|
|
2015-03-07 15:52:56 +01:00
|
|
|
|
PNP automatically determines the graph template from the check command name (or the argument's name).
|
|
|
|
|
This behavior changed in Icinga 2 compared to Icinga 1.x. Though there are certain possibilities to
|
|
|
|
|
fix this:
|
2015-01-23 14:15:57 +01:00
|
|
|
|
|
2015-03-07 15:52:56 +01:00
|
|
|
|
* Create a symlink for example from the `templates.dist/check_ping.php` template to the actual check name in Icinga 2 (`templates/ping4.php`)
|
2016-08-13 15:59:06 +02:00
|
|
|
|
* Pass the check command name inside the [format template configuration](14-features.md#writing-performance-data-files)
|
2015-01-23 14:15:57 +01:00
|
|
|
|
|
2015-03-07 15:52:56 +01:00
|
|
|
|
The latter becomes difficult with agent based checks like NRPE or SSH where the first command argument acts as
|
|
|
|
|
graph template identifier. There is the possibility to define the pnp template name as custom attribute
|
|
|
|
|
and use that inside the formatting templates as `SERVICECHECKCOMMAND` for instance.
|
2015-01-23 14:15:57 +01:00
|
|
|
|
|
2015-03-07 15:52:56 +01:00
|
|
|
|
Example for services:
|
2015-01-23 14:15:57 +01:00
|
|
|
|
|
2015-03-07 15:52:56 +01:00
|
|
|
|
# vim /etc/icinga2/features-enabled/perfdata.conf
|
2015-01-23 14:15:57 +01:00
|
|
|
|
|
2015-03-26 07:50:46 +01:00
|
|
|
|
service_format_template = "DATATYPE::SERVICEPERFDATA\tTIMET::$icinga.timet$\tHOSTNAME::$host.name$\tSERVICEDESC::$service.name$\tSERVICEPERFDATA::$service.perfdata$\tSERVICECHECKCOMMAND::$service.check_command$$pnp_check_arg1$\tHOSTSTATE::$host.state$\tHOSTSTATETYPE::$host.state_type$\tSERVICESTATE::$service.state$\tSERVICESTATETYPE::$service.state_type$"
|
2015-01-23 14:15:57 +01:00
|
|
|
|
|
2015-03-07 15:52:56 +01:00
|
|
|
|
# vim /etc/icinga2/conf.d/services.conf
|
2015-01-23 14:15:57 +01:00
|
|
|
|
|
2015-03-07 15:52:56 +01:00
|
|
|
|
template Service "pnp-svc" {
|
|
|
|
|
action_url = "/pnp4nagios/graph?host=$HOSTNAME$&srv=$SERVICEDESC$"
|
|
|
|
|
vars.pnp_check_arg1 = ""
|
|
|
|
|
}
|
2015-01-23 14:15:57 +01:00
|
|
|
|
|
2015-03-07 15:52:56 +01:00
|
|
|
|
apply Service "nrpe-check" {
|
|
|
|
|
import "pnp-svc"
|
|
|
|
|
check_command = nrpe
|
|
|
|
|
vars.nrpe_command = "check_disk"
|
2015-01-23 14:15:57 +01:00
|
|
|
|
|
2015-03-07 15:52:56 +01:00
|
|
|
|
vars.pnp_check_arg1 = "!$nrpe_command$"
|
|
|
|
|
}
|
2015-01-23 14:15:57 +01:00
|
|
|
|
|
2016-05-23 14:14:59 +02:00
|
|
|
|
If there are warnings about unresolved macros, make sure to specify a default value for `vars.pnp_check_arg1` inside the
|
2015-01-23 14:15:57 +01:00
|
|
|
|
|
2015-03-07 15:52:56 +01:00
|
|
|
|
In PNP, the custom template for nrpe is then defined in `/etc/pnp4nagios/custom/nrpe.cfg`
|
2015-03-26 07:50:46 +01:00
|
|
|
|
and the additional command arg string will be seen in the xml too for other templates.
|