icinga2/doc/3.11-performance-data.md

64 lines
2.4 KiB
Markdown

## Performance Data
When a service check is executed plugins should provide so-called
`performance data`. Next to that additional check performance data
can be fetched using Icinga 2 runtime macros such as the check latency
or the current service state.
The performance data may be passed to external applications which
then generate nice graphs for historical reporting and trending.
Well-known addons processing Icinga performance data are PNP4Nagios,
inGraph and Graphite.
> **Note**
>
> As there are no real host checks in Icinga 2, there is no performance
> data generated for hosts.
### Writing Performance Data Files
PNP4Nagios and inGraph use performance data collector daemons to fetch
the current performance files for their backend updates.
Therefore the Icinga 2 `PerfdataWriter` object allows you to define
the output template format backed with Icinga 2 runtime macros.
format_template = "DATATYPE::SERVICEPERFDATA\tTIMET::$TIMET$\tHOSTNAME::$HOSTNAME$\tSERVICEDESC::$SERVICEDESC$\tSERVICEPERFDATA::$SERVICEPERFDATA$\tSERVICECHECKCOMMAND::$SERVICECHECKCOMMAND$\tHOSTSTATE::$HOSTSTATE$\tHOSTSTATETYPE::$HOSTSTATETYPE$\tSERVICESTATE::$SERVICESTATE$\tSERVICESTATETYPE::$SERVICESTATETYPE$",
The default template is already provided with the Icinga 2 feature configuration
which can be enabled using
# i2enfeature perfdata
By default all performance data files are rotated in a 15 seconds interval into
the `/var/spool/icinga2/perfdata/` directory as `service-perfdata.<timestamp>`.
External collectors need to parse the rotated performance data files and then
remove the processed files.
> **Note**
>
> If you enable this feature by accident and no collector daemon is processing
> these files, the filesystem's inodes may run out. Make sure to watch the
> `localhost` service check `disks` and define your own inode warning
> and critical thresholds.
### Graphite Carbon Cache Writer
While there are some Graphite collector scripts for Icinga 1.x available it's
more reasonable to directly process the check and plugin performance in memory
in Icinga 2. Once there are new metrics available, Icinga 2 will directly
write these to the defined Graphite Carbon daemon tcp socket.
You can enable the feature using
# i2enfeature graphite
The `GraphiteWriter` object expects the Graphite Carbon Cache socket listening
at `127.0.0.1` on port `2003` by default.
The current naming schema is
icinga.<hostname>.<servicename>.<metricname>