]> granicus.if.org Git - icinga2/blob - doc/13-addons.md
Merge pull request #5906 from sahnd/feature/check_openmanage
[icinga2] / doc / 13-addons.md
1 # Icinga 2 Addons <a id="addons"></a>
2
3 ## Graphing <a id="addons-graphing"></a>
4
5 ### PNP <a id="addons-graphing-pnp"></a>
6
7 [PNP](https://www.pnp4nagios.org) is a graphing addon.
8
9 [PNP](https://www.pnp4nagios.org) is an addon which adds a graphical representation of the performance data collected
10 by the monitoring plugins. The data is stored as rrd (round robin database) files.
11
12 Use your distribution's package manager to install the `pnp4nagios` package.
13
14 If you're planning to use it, configure it to use the
15 [bulk mode with npcd and npcdmod](https://docs.pnp4nagios.org/pnp-0.6/modes#bulk_mode_with_npcd_and_npcdmod)
16 in combination with Icinga 2's [PerfdataWriter](14-features.md#performance-data). NPCD collects the performance
17 data files which Icinga 2 generates.
18
19 Enable performance data writer in icinga 2
20
21     # icinga2 feature enable perfdata
22
23 Configure npcd to use the performance data created by Icinga 2:
24
25     vim /etc/pnp4nagios/npcd.cfg
26
27 Set `perfdata_spool_dir = /var/spool/icinga2/perfdata` and restart the `npcd` daemon.
28
29 There's also an Icinga Web 2 module for direct PNP graph integration
30 available at [Icinga Exchange](https://exchange.icinga.com/icinga/PNP).
31
32 More information on [action_url as attribute](13-addons.md#addons-graphing-pnp-action-url)
33 and [graph template names](13-addons.md#addons-graphing-pnp-custom-templates).
34
35
36 ### Graphite <a id="addons-graphing-graphite"></a>
37
38 [Graphite](https://graphite.readthedocs.org/en/latest/) is a time-series database
39 storing collected metrics and making them available through restful apis
40 and web interfaces.
41
42 Graphite consists of 3 software components:
43
44 * carbon -- a Twisted daemon that listens for time-series data
45 * whisper -- a simple database library for storing time-series data (similar in design to RRD)
46 * graphite webapp -- a Django webapp that renders graphs on-demand using Cairo
47
48 Use the [GraphiteWriter](14-features.md#graphite-carbon-cache-writer) feature
49 for sending real-time metrics from Icinga 2 to Graphite.
50
51     # icinga2 feature enable graphite
52
53 There are Graphite addons available for collecting the performance data files too (e.g. `Graphios`).
54
55 A popular alternative frontend for Graphite is for example [Grafana](https://grafana.org).
56
57 ### InfluxDB <a id="addons-graphing-influxdb"></a>
58
59 [InfluxDB](https://influxdb.com) is a time series, metrics, and analytics database.
60 It’s written in Go and has no external dependencies.
61
62 Use the [InfluxdbWriter](14-features.md#influxdb-writer) feature
63 for sending real-time metrics from Icinga 2 to InfluxDB.
64
65     # icinga2 feature enable influxdb
66
67 A popular frontend for InfluxDB is for example [Grafana](https://grafana.org).
68
69 ## Visualization <a id="addons-visualization"></a>
70
71 ### Icinga Reporting <a id="addons-visualization-reporting"></a>
72
73 By enabling the [DB IDO](14-features.md#db-ido) feature you can use the
74 [Icinga Reporting package](https://docs.icinga.com/latest/en/reporting.html).
75
76 ### NagVis <a id="addons-visualization-nagvis"></a>
77
78 By using either [Livestatus](14-features.md#setting-up-livestatus) or
79 [DB IDO](14-features.md#db-ido) as a backend you can create your own network maps
80 based on your monitoring configuration and status data using [NagVis](https://www.nagvis.org).
81
82 The configuration in nagvis.ini.php should look like this for Livestatus for example:
83
84     [backend_live_1]
85     backendtype="mklivestatus"
86     socket="unix:/var/run/icinga2/cmd/livestatus"
87
88 If you are planning an integration into Icinga Web 2, look at [this module](https://github.com/Icinga/icingaweb2-module-nagvis).
89
90 ### Thruk <a id="addons-visualization-thruk"></a>
91
92 [Thruk](https://www.thruk.org) is an alternative web interface which can be used with Icinga 2
93 and the [Livestatus](14-features.md#setting-up-livestatus) feature.
94
95 ## Log Monitoring <a id="log-monitoring"></a>
96
97 Using [Logstash](https://www.elastic.co/guide/en/logstash/current/introduction.html) or
98 [Graylog](https://www.graylog.org) in your infrastructure and correlate events with your monitoring
99 is even simpler these days.
100
101 * Use the `GelfWriter` feature to write Icinga 2's check and notification events to Graylog or Logstash.
102 * Configure the logstash `nagios` output to send passive traps to Icinga 2 using the external command pipe.
103 * Execute a plugin to check Graylog alert streams.
104
105 More details can be found in [this blog post](https://www.icinga.com/2014/12/02/team-icinga-at-osmc-2014/).
106
107 ## Notification Scripts and Interfaces <a id="notification-scripts-interfaces"></a>
108
109 There's a variety of resources available, for example different notification scripts such as:
110
111 * E-Mail ([examples](03-monitoring-basics.md#alert-notifications) provided)
112 * SMS
113 * Pager (XMPP, etc.)
114 * Twitter
115 * IRC
116 * Ticket systems
117 * etc.
118
119 Additionally external services can be [integrated with Icinga 2](https://www.icinga.com/products/integrations/):
120
121 * [Pagerduty](https://www.icinga.com/partners/pagerduty/)
122 * [VictorOps](https://www.icinga.com/partners/victorops/)
123 * [StackStorm](https://www.icinga.com/partners/stackstorm/)
124
125 More information can be found on the [Icinga Website](https://www.icinga.com/).
126
127 ## Configuration Management Tools <a id="configuration-tools"></a>
128
129 If you require your favourite configuration tool to export the Icinga 2 configuration, please get in
130 touch with their developers. The Icinga project does not provide a configuration web interface
131 yet. Follow the [Icinga Blog](https://www.icinga.com/blog/) for updates on this topic.
132
133 If you're looking for puppet manifests, chef cookbooks, ansible recipes, etc. -- we're happy
134 to integrate them upstream, so please get in touch with the [Icinga team](https://www.icinga.com/community/get-involved/).
135
136 These tools are currently in development and require feedback and tests:
137
138 * [Ansible Roles](https://github.com/Icinga/icinga2-ansible)
139 * [Puppet Module](https://github.com/Icinga/puppet-icinga2)
140 * [Chef Cookbook](https://github.com/Icinga/chef-icinga2)
141
142 ## More Addon Integration Hints <a id="addon-integration-hints"></a>
143
144 ### PNP Action Url <a id="addons-graphing-pnp-action-url"></a>
145
146 They work in a similar fashion for Icinga 2 and are used for 1.x web interfaces (Icinga Web 2 doesn't require
147 the action url attribute in its own module).
148
149     template Host "pnp-hst" {
150       action_url = "/pnp4nagios/graph?host=$HOSTNAME$"
151     }
152
153     template Service "pnp-svc" {
154       action_url = "/pnp4nagios/graph?host=$HOSTNAME$&srv=$SERVICEDESC$"
155     }
156
157 ### PNP Custom Templates with Icinga 2 <a id="addons-graphing-pnp-custom-templates"></a>
158
159 PNP automatically determines the graph template from the check command name (or the argument's name).
160 This behavior changed in Icinga 2 compared to Icinga 1.x. Though there are certain possibilities to
161 fix this:
162
163 * Create a symlink for example from the `templates.dist/check_ping.php` template to the actual check name in Icinga 2 (`templates/ping4.php`)
164 * Pass the check command name inside the [format template configuration](14-features.md#writing-performance-data-files)
165
166 The latter becomes difficult with agent based checks like NRPE or SSH where the first command argument acts as
167 graph template identifier. There is the possibility to define the pnp template name as custom attribute
168 and use that inside the formatting templates as `SERVICECHECKCOMMAND` for instance.
169
170 Example for services:
171
172     # vim /etc/icinga2/features-enabled/perfdata.conf
173
174     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$"
175
176     # vim /etc/icinga2/conf.d/services.conf
177
178     template Service "pnp-svc" {
179       action_url = "/pnp4nagios/graph?host=$HOSTNAME$&srv=$SERVICEDESC$"
180       vars.pnp_check_arg1 = ""
181     }
182
183     apply Service "nrpe-check" {
184       import "pnp-svc"
185       check_command = nrpe
186       vars.nrpe_command = "check_disk"
187
188       vars.pnp_check_arg1 = "!$nrpe_command$"
189     }
190
191 If there are warnings about unresolved macros, make sure to specify a default value for `vars.pnp_check_arg1` inside the
192
193 In PNP, the custom template for nrpe is then defined in `/etc/pnp4nagios/custom/nrpe.cfg`
194 and the additional command arg string will be seen in the xml too for other templates.