Use the [GraphiteWriter](14-features.md#graphite-carbon-cache-writer) feature
for sending real-time metrics from Icinga 2 to Graphite.
- # icinga2 feature enable graphite
+```
+# icinga2 feature enable graphite
+```
A popular alternative frontend for Graphite is for example [Grafana](https://grafana.org).
Use the [InfluxdbWriter](14-features.md#influxdb-writer) feature
for sending real-time metrics from Icinga 2 to InfluxDB.
- # icinga2 feature enable influxdb
+```
+# icinga2 feature enable influxdb
+```
A popular frontend for InfluxDB is for example [Grafana](https://grafana.org).
If you're planning to use it, configure it to use the
[bulk mode with npcd and npcdmod](https://docs.pnp4nagios.org/pnp-0.6/modes#bulk_mode_with_npcd_and_npcdmod)
-in combination with Icinga 2's [PerfdataWriter](14-features.md#performance-data). NPCD collects the performance
+in combination with Icinga 2's [PerfdataWriter](14-features.md#writing-performance-data-files). NPCD collects the performance
data files which Icinga 2 generates.
Enable performance data writer in icinga 2
- # icinga2 feature enable perfdata
+```
+# icinga2 feature enable perfdata
+```
Configure npcd to use the performance data created by Icinga 2:
- vim /etc/pnp4nagios/npcd.cfg
+```
+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
available at [Icinga Exchange](https://exchange.icinga.com/icinga/PNP).
-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).
-
-
## Visualization <a id="addons-visualization"></a>
### Maps <a id="addons-visualization-maps"></a>
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"
+```
+[backend_live_1]
+backendtype="mklivestatus"
+socket="unix:/var/run/icinga2/cmd/livestatus"
+```
If you are planning an integration into Icinga Web 2, look at [this module](https://github.com/Icinga/icingaweb2-module-nagvis).
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).
- template Host "pnp-hst" {
- action_url = "/pnp4nagios/graph?host=$HOSTNAME$"
- }
-
- template Service "pnp-svc" {
- action_url = "/pnp4nagios/graph?host=$HOSTNAME$&srv=$SERVICEDESC$"
- }
-
-### PNP Custom Templates with Icinga 2 <a id="addons-graphing-pnp-custom-templates"></a>
-
-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:
-
-* Create a symlink for example from the `templates.dist/check_ping.php` template to the actual check name in Icinga 2 (`templates/ping4.php`)
-* Pass the check command name inside the [format template configuration](14-features.md#writing-performance-data-files)
-
-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.
-
-Example for services:
-
- # vim /etc/icinga2/features-enabled/perfdata.conf
-
- 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$"
-
- # vim /etc/icinga2/conf.d/services.conf
-
- template Service "pnp-svc" {
- action_url = "/pnp4nagios/graph?host=$HOSTNAME$&srv=$SERVICEDESC$"
- vars.pnp_check_arg1 = ""
- }
-
- apply Service "nrpe-check" {
- import "pnp-svc"
- check_command = nrpe
- vars.nrpe_command = "check_disk"
-
- vars.pnp_check_arg1 = "!$nrpe_command$"
- }
+```
+template Host "pnp-hst" {
+ action_url = "/pnp4nagios/graph?host=$HOSTNAME$"
+}
-If there are warnings about unresolved macros, make sure to specify a default value for `vars.pnp_check_arg1` inside the
+template Service "pnp-svc" {
+ action_url = "/pnp4nagios/graph?host=$HOSTNAME$&srv=$SERVICEDESC$"
+}
+```
-In PNP, the custom template for nrpe is then defined in `/etc/pnp4nagios/custom/nrpe.cfg`
-and the additional command arg string will be seen in the xml too for other templates.