Skip to content

Commit

Permalink
Merge pull request #21 from wbollock/feat/nagioscore_support
Browse files Browse the repository at this point in the history
feat: Nagios Core support
  • Loading branch information
wbollock authored Oct 3, 2022
2 parents 61051cf + b277b32 commit 3a8e27d
Show file tree
Hide file tree
Showing 2 changed files with 412 additions and 191 deletions.
42 changes: 40 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,12 @@
![Go Report Card](https://goreportcard.com/badge/github.com/wbollock/nagios_exporter)
[![contributions](https://img.shields.io/badge/contributions-welcome-brightgreen.svg?style=flat")](https://github.com/wbollock/nagios_exporter/issues)


A Prometheus exporter currently supporting:

* Nagios XI
* Nagios Core 4
* Nagios Core 3
* CheckMK

It includes metrics on the current state and configuration of Nagios. This includes the number of hosts, services, and information about their monitoring setup. For example, this exporter will output the number of flapping hosts, passive checks, or hosts in downtime.

Expand All @@ -21,6 +23,7 @@ Practical use cases for this exporter may include:
This exporter does not output Nagios check results as Prometheus metrics; it is designed to export metrics of the Nagios monitoring server itself for meta-monitoring.

## Table of Contents

- [nagios_exporter](#nagios_exporter)
- [Table of Contents](#table-of-contents)
- [Configuration](#configuration)
Expand Down Expand Up @@ -56,6 +59,29 @@ To see all available configuration flags:
./prometheus-nagios-exporter -h
```

### Nagios Core 3/4 support

This exporter also supports Nagios Core 3/4 and CheckMK, albeit with a subset of metrics and reliance on the `nagiosstats` binary. There is no RESTful API for either monitoring platform, so the exporter must be run directly on the Nagios host and have access to execute `nagiostats`.

It is also recommended to pass the path of the Nagios configuration

Typical location and usage of the binary:

* Nagios Core 3/4:
* `--nagios.stats_binary`: `/usr/local/nagios/bin/nagiostats`
* `--nagios.config_path`: `/usr/local/nagios/etc/nagios.cfg`
* CheckMK:
* `--nagios.stats_binary`: `/omd/sites/<your-site>/bin/nagiostats`
* `--nagios.config_path`: `/omd/sites/<your-site>/tmp/nagios/nagios.cfg`

Example usage:

```bash
./nagios_exporter --nagios.stats_binary "/usr/local/nagios/bin/nagiostats" --nagios.config_path "/usr/local/nagios/etc/nagios.cfg"
```

Note that this flag nullifies all others. It cannot be used in conjunction with the Nagios XI API.

## Installation

### Debian/RPM package
Expand Down Expand Up @@ -93,12 +119,24 @@ Import the [dashboard](grafana/dashboard.json) template ([instructions](https://

## Troubleshooting

Ensure `nagios_up` returns `1`, otherwise please check your API key and Nagios reachability, such as:
Ensure `nagios_up` returns `1`.

### NagiosXI

Please check your API key and Nagios reachability:

```bash
curl -GET "http://<nagios_url>/nagiosxi/api/v1/objects/host?apikey=<apikey>&pretty=1"
```

### Nagios Core 3/4, CheckMK

Ensure the user running the Nagios Exporter can execute `nagiostats` fully:

```bash
sudo su <prometheus-user> -s /bin/bash -c "/usr/local/nagios/bin/nagiostats -c /usr/local/nagios/etc/nagios.cfg"
```

## Resources Used

* [haproxy_expoter](https://github.com/prometheus/haproxy_exporter/blob/main/haproxy_exporter.go)
Expand Down
Loading

0 comments on commit 3a8e27d

Please sign in to comment.