This repository has been archived by the owner on Mar 26, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Refactoring Redfish exporter to gofish library
- Loading branch information
1 parent
0edf416
commit b57bb5c
Showing
25 changed files
with
539 additions
and
600 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,21 @@ | ||
FROM fedora:34 | ||
FROM gportal/golang:latest | ||
|
||
COPY pm_exporter /usr/local/bin/pm_exporter | ||
RUN chmod +x /usr/local/bin/pm_exporter | ||
# Import application source | ||
COPY ./ /opt/app-root/src | ||
|
||
ENTRYPOINT [ "/usr/local/bin/pm_exporter" ] | ||
# Change working directory | ||
WORKDIR /opt/app-root/src | ||
|
||
# Build binary for Latency Service | ||
RUN go build -v -o "${APP_ROOT}/redfish_exporter" cmd/main.go && \ | ||
setcap cap_net_bind_service+ep "${APP_ROOT}/redfish_exporter" | ||
|
||
# Finally delete application source | ||
RUN rm -rf /opt/app-root/src/* | ||
|
||
EXPOSE 9096 | ||
|
||
RUN /usr/bin/fix-permissions ${APP_ROOT} && \ | ||
/usr/bin/fix-permissions /data/ | ||
|
||
CMD ["/opt/app-root/redfish_exporter"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,71 +1,13 @@ | ||
# pm_exporter | ||
# Redfish Prometheus Exporter | ||
|
||
[![Build](https://github.com/GPORTALcloud/pm_exporter/actions/workflows/pm_exporter.yml/badge.svg?branch=main)](https://github.com/GPORTALcloud/pm_exporter/actions/workflows/pm_exporter.yml) | ||
### This is WIP. | ||
|
||
!!! STILL UNDER DEVELOPMENT !!! | ||
Redfish Exporter is providing generic metrics fetched from Redfish endpoints. | ||
|
||
pm_exporter is providing metrics fetched from platform management endpoints (such as iDRAC or ILO) and exposing those through HTTP for making those readable for prometheus. | ||
|
||
For fetching those details the platform management specific API's are used (such as Redfish for iDRAC). | ||
Those metrics are getting persisted within the runtime for the duration specified through command line arguments. | ||
|
||
The list of platform managements to fetch details from is stored within a yaml file, each platform management needs to be defined there, | ||
including their credentials, address and types. In addition, this config file allows adding | ||
custom labels to the metrics which can be used for example for passing the id of the server within your | ||
own inventory system or the switch the platform management is connected to. | ||
|
||
Metrics which are getting collected: | ||
|
||
| metric | Type | description | | ||
| ------------------------------ |:-------:| :-----------------------------------------------| | ||
| pm_platform_management_up | gauge | Defines if the platform management is reachable | | ||
| pm_powersupply_health | gauge | Indicates the health status of the Power Supply | | ||
| pm_battery_health | gauge | Indicates the health status of the Battery | | ||
| pm_cpu_health | gauge | Indicates the health status of the CPU | | ||
| pm_fan_health | gauge | Indicates the health status of the Fan | | ||
| pm_storage_health | gauge | Indicates the health status of the Storage | | ||
| pm_temperature_health | gauge | Indicates the health status of the Temperature | | ||
| pm_intrusion_health | gauge | Indicates if the chassis is closed or not | | ||
| pm_license_health | gauge | Indicates if the license is still valid | | ||
| pm_memory_health | gauge | Indicates the health status of the Memory | | ||
| pm_overall_health | gauge | Indicates if any of the health metrics are bad | | ||
|
||
Platform Managements are getting implemented once there is a host needs to get monitored, this list will grow with time. | ||
|
||
Currently supported: | ||
* iDRAC (redfish) | ||
|
||
|
||
## Install | ||
There are different ways of running the pm_exporter. | ||
|
||
### Precompiled binaries | ||
Precompiled binaries are getting created with each workflow run. Just download the artifact below "Actions" and | ||
place them wherever you want. | ||
|
||
### Docker images | ||
pm_exporter is getting build and published to the Docker and Github registry. | ||
|
||
You can just launch your own pm_exporter instance using the following command (arguments you're fine with the default you can just omit) | ||
|
||
``` | ||
docker run -d --name pm_exporter --rm \ | ||
-v /local/config.yml:/etc/pm_exporter.yml \ | ||
msniveau/pm_exporter \ | ||
--config.file=/etc/pm_exporter.yml \ | ||
--web.listen-address=0.0.0.0:9096 \ | ||
--web.enable-lifecycle \ | ||
--metrics.persist_duration=5m \ | ||
--metrics.refresh_interval=1m \ | ||
--worker.count=5 | ||
``` | ||
|
||
## Command line arguments | ||
| argument | default | description | | ||
| ------------------------- |:----------------------:| :------------------------------------------------------| | ||
| --config.file | /etc/pm_exporter.yml | Config file location | | ||
| -metric.persist_duration | 1m30s | Duration metrics are getting persisted | | ||
| -metric.refresh_interval | 1m | Interval metrics are getting fetched | | ||
| -web.enable-lifecycle | false | Adds the /-/reload endpoint for config reload | | ||
| -web.listen-address | 0.0.0.0:9096 | Listen address the HTTP server runs on | | ||
| -worker.count | 10 | The amount of workers used for fetching the metrics | | ||
Tested with: | ||
* HPE ILO4 | ||
* HPE ILO5 | ||
* Dell iDRAC 8 | ||
* Dell iDRAC 9 | ||
* AsRockRack | ||
* SuperMicro SuperServer |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,21 +1,6 @@ | ||
--- | ||
|
||
platform_managements: | ||
- host: https://192.168.0.1 | ||
username: root | ||
password: toor | ||
type: IDRAC | ||
labels: | ||
funny: labels | ||
- host: https://192.168.0.2 | ||
username: root | ||
password: toor | ||
type: IDRAC | ||
labels: | ||
customer: 1337 | ||
- host: https://192.168.0.3 | ||
username: root | ||
password: toor | ||
type: IDRAC | ||
labels: | ||
internal_name: host00123 | ||
# Redfish Default Credentials | ||
redfish: | ||
username: root | ||
password: toor |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,44 @@ | ||
module github.com/GPORTALcloud/pm_exporter | ||
module github.com/g-portal/redfish_exporter | ||
|
||
go 1.16 | ||
go 1.22 | ||
|
||
require ( | ||
github.com/fsnotify/fsnotify v1.4.9 | ||
github.com/gin-gonic/gin v1.9.1 | ||
github.com/prometheus/client_golang v1.19.0 | ||
github.com/stmcginnis/gofish v0.15.0 | ||
gopkg.in/yaml.v2 v2.4.0 | ||
) | ||
|
||
require ( | ||
github.com/beorn7/perks v1.0.1 // indirect | ||
github.com/bytedance/sonic v1.11.3 // indirect | ||
github.com/cespare/xxhash/v2 v2.2.0 // indirect | ||
github.com/chenzhuoyu/base64x v0.0.0-20230717121745-296ad89f973d // indirect | ||
github.com/chenzhuoyu/iasm v0.9.1 // indirect | ||
github.com/gabriel-vasile/mimetype v1.4.3 // indirect | ||
github.com/gin-contrib/sse v0.1.0 // indirect | ||
github.com/go-playground/locales v0.14.1 // indirect | ||
github.com/go-playground/universal-translator v0.18.1 // indirect | ||
github.com/go-playground/validator/v10 v10.19.0 // indirect | ||
github.com/goccy/go-json v0.10.2 // indirect | ||
github.com/json-iterator/go v1.1.12 // indirect | ||
github.com/klauspost/cpuid/v2 v2.2.7 // indirect | ||
github.com/kr/text v0.2.0 // indirect | ||
github.com/leodido/go-urn v1.4.0 // indirect | ||
github.com/mattn/go-isatty v0.0.20 // indirect | ||
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect | ||
github.com/modern-go/reflect2 v1.0.2 // indirect | ||
github.com/pelletier/go-toml/v2 v2.2.0 // indirect | ||
github.com/prometheus/client_model v0.6.0 // indirect | ||
github.com/prometheus/common v0.51.1 // indirect | ||
github.com/prometheus/procfs v0.13.0 // indirect | ||
github.com/twitchyliquid64/golang-asm v0.15.1 // indirect | ||
github.com/ugorji/go/codec v1.2.12 // indirect | ||
golang.org/x/arch v0.7.0 // indirect | ||
golang.org/x/crypto v0.21.0 // indirect | ||
golang.org/x/net v0.22.0 // indirect | ||
golang.org/x/sys v0.18.0 // indirect | ||
golang.org/x/text v0.14.0 // indirect | ||
google.golang.org/protobuf v1.33.0 // indirect | ||
gopkg.in/yaml.v3 v3.0.1 // indirect | ||
) |
Oops, something went wrong.