Skip to content

Commit

Permalink
minor enhancement (#2)
Browse files Browse the repository at this point in the history
* start refactoring

* add labels for server name and type + firmware version

* Compatibility with older iLO versions (#2)

* Compatibility with older iLO versions

* Update README repository info

* Changed default port to 9100

* Changed default port to the one registered at https://github.com/prometheus/prometheus/wiki/Default-port-allocations
Updated README with metics output from older iLO devices
  • Loading branch information
Sispheor authored and joeds13 committed Mar 16, 2018
1 parent 18b2d83 commit 05f6e71
Show file tree
Hide file tree
Showing 8 changed files with 233 additions and 126 deletions.
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@ FROM python:2.7-alpine
ADD . /usr/src/hpilo_exporter
RUN pip install -e /usr/src/hpilo_exporter
ENTRYPOINT ["hpilo-exporter"]
EXPOSE 8080
EXPOSE 9416
113 changes: 85 additions & 28 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,17 +1,20 @@
# HP iLO Metrics Exporter

Exports HP Server Integrated Lights Out (iLO) heath_at_a_glance states to Prometheus gauges, from either a single server (via command line flags) or multiple servers (via query string parameters)
Blackbox likes exporter used to exports HP Server Integrated Lights Out (iLO) states to Prometheus.

### Gauges

Here are the status code of gauge
```
0 - OK
1 - Degraded
2 - Dead (Other)
```

### iLO

### Output example

Example of status of your iLO
```
health_at_a_glance:
battery: {status: OK}
Expand All @@ -23,59 +26,113 @@ health_at_a_glance:
processor: {status: OK}
storage: {status: Degraded}
temperature: {status: OK}
vrm: {status: Ok}
drive: {status: Ok}
```

### Output

The returned output would be:
```
hpilo_battery 0.0
hpilo_storage 1.0
hpilo_fans 0.0
hpilo_bios_hardware 0.0
hpilo_memory 0.0
hpilo_power_supplies 0.0
hpilo_processor 0.0
hpilo_network 2.0
hpilo_temperature 0.0
hpilo_battery{product_name="ProLiant DL360 Gen9",server_name="name.fqdn.domain"} 0.0
hpilo_storage{product_name="ProLiant DL360 Gen9",server_name="name.fqdn.domain"} 1.0
hpilo_fans{product_name="ProLiant DL360 Gen9",server_name="name.fqdn.domain"} 0.0
hpilo_bios_hardware{product_name="ProLiant DL360 Gen9",server_name="name.fqdn.domain"} 0.0
hpilo_memory{product_name="ProLiant DL360 Gen9",server_name="name.fqdn.domain"} 0.0
hpilo_power_supplies{product_name="ProLiant DL360 Gen9",server_name="name.fqdn.domain"} 0.0
hpilo_processor{product_name="ProLiant DL360 Gen9",server_name="name.fqdn.domain"} 0.0
hpilo_network{product_name="ProLiant DL360 Gen9",server_name="name.fqdn.domain"} 2.0
hpilo_temperature{product_name="ProLiant DL360 Gen9",server_name="name.fqdn.domain"} 0.0
hpilo_vrm{product_name="ProLiant DL380 Gen6",server_name="name.fqdn.domain"} 0.0
hpilo_drive{product_name="ProLiant DL380 Gen6",server_name="name.fqdn.domain"} 0.0
hpilo_firmware_version{product_name="ProLiant DL360 Gen9",server_name="name.fqdn.domain"} 2.5
```

## Installing
### Installing

You can install exporter on the server directly or on separate machine.
To run, you must have `Python` and `pip` installed.

To install with `pip`:

```
pip install -e $HPILO_EXPORTER_DIR
```

Then just:
```
hpilo-exporter [--address=0.0.0.0 --port=9416 --endpoint="/metrics"]
```

### Docker

Prebuild images are available from the docker repository:
```
hpilo-exporter [--address=0.0.0.0 --port=8080 --ilo-host=127.0.0.1 --ilo-port=443 --ilo-user=monitoring --ilo-password=monitoring]
idnt/hpilo-exporter:latest
```

## Docker

To run the container, assuming it has been built locally:
To build the image yourself
```
docker build --rm -t hpilo-exporter .
```

`docker run -p 8080:8080 hpilo-exporter:latest --ilo-addr=127.0.0.1 --ilo-user=monitoring --ilo-password=monitoring`
To run the container
```
docker run -p 9416:9416 hpilo-exporter:latest
```

Example Docker Compose:
You can then call the web server on the defined endpoint, `/metrics` by default.
```
curl 'http://127.0.0.1:9416/metrics?ilo_host=127.0.0.1&ilo_port=443&ilo_user=admin&ilo_password=admin'
```

Passing argument to the docker run command
```
hpilo-exporter:
command: --address=0.0.0.0 --port=8080 --ilo-host=127.0.0.1 --ilo-port=443 --ilo-user=monitoring --ilo-password=monitoring
image: hpilo-exporter:latest
ports:
- "8080:8080"
docker run -p 9416:9416 hpilo-exporter:latest --port 9416 --ilo_user my_user --ilo_password my_secret_password
```

## Multi iLO communication
### Docker compose

Using query string parameters to the `/metrics` endpoint you can point the exporter to different iLO's
Here is an example of Docker Compose deployment:

```yml
hpilo:
image: my.registry/hpilo-exporter
ports:
- 9416:9416
command:
- '--port=9416'
deploy:
placement:
constraints:
- node.hostname == my_node.domain
```
curl 'http://127.0.0.1:8080/metrics?ilo_host=127.0.0.1&ilo_port=9018&ilo_user=admin&ilo_password=admin'

### Kubernetes

A helm chart is available at [prometheus-helm-addons](https://github.com/IDNT/prometheus-helm-addons).

### Prometheus config

Assuming:
- the exporter is available on `http://hpilo:9416`
- you use same the port,username and password for all your iLO

```yml
- job_name: 'hpilo'
scrape_interval: 1m
params:
ilo_port: ['443']
ilo_user: ['my_ilo_user']
ilo_password: ['my_ilo_password']
static_configs:
- targets:
- ilo_fqdn.domain

relabel_configs:
- source_labels: [__address__]
target_label: __param_ilo_host
- source_labels: [__param_ilo_host]
target_label: ilo_host
- target_label: __address__
replacement: hpilo:8082 # hpilo exporter.
```

6 changes: 3 additions & 3 deletions setup.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
import io
from setuptools import setup, find_packages
import sys

VERSION = "0.3.3"
VERSION = "0.3.4"
PACKAGE_NAME = "hpilo-exporter"
SOURCE_DIR_NAME = "src"

Expand All @@ -11,6 +10,7 @@ def readme():
with io.open('README.md', 'r', encoding='utf-8') as f:
return f.read()


setup(
name=PACKAGE_NAME,
version=VERSION,
Expand Down Expand Up @@ -40,7 +40,7 @@ def readme():
],
entry_points={
'console_scripts': [
'hpilo-exporter = hpilo_exporter.__main__:main',
'hpilo-exporter = hpilo_exporter.main:main',
],
}
)
2 changes: 1 addition & 1 deletion src/hpilo_exporter/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
from hpilo_exporter.exporter import iLOExporterServer

23 changes: 0 additions & 23 deletions src/hpilo_exporter/__main__.py

This file was deleted.

0 comments on commit 05f6e71

Please sign in to comment.