# Description I've createtd this python script to collect Power data to analyse Watts, Volts and Amperes. If there is a better solution, feel free to replace me. Usage: ``` usage: redfish_exporter.py [-h] [--config CONFIG] [--port PORT] Redfish Prometheus Exporter options: -h, --help show this help message and exit --config CONFIG Path to config file --port PORT Override port from config file ``` # Install ## Requirements Dependencies: * see requirements.txt ## Configuration Create `config.yaml`: ```yaml --- interval: 5 port: 8000 username: user1 password: secret hosts: - srv1-112.mgmt.wtb1.ch.abainfra.net - srv2-112.mgmt.wtb1.ch.abainfra.net - srv3-112.mgmt.wtb1.ch.abainfra.net - srv4-112.mgmt.wtb1.ch.abainfra.net ``` or: ```yaml --- interval: 5 port: 8000 username: user1 password: secret1 hosts: - fqdn: srv1-112.mgmt.wtb1.ch.abainfra.net username: user2 password: secret2 - fqdn: srv2-112.mgmt.wtb1.ch.abainfra.net username: user3 password: secret3 - fqdn: srv3-112.mgmt.wtb1.ch.abainfra.net username: user4 password: secret4 - fqdn: srv4-112.mgmt.wtb1.ch.abainfra.net username: user5 password: secret5 ``` The `port`, `interval` are optional and can be overwritten by argument. Save default values are hardcoded. # Use as Container ``` docker build -t redfish_exporter . docker run -it --rm --name redfish_exporter_app -p 8000:8000 redfish_exporter:latest ``` # Legacy way ```bash mkdir /srv/redfish-exporter ``` ## Python dependencies ```bash cd /srv/redfish-exporter python3 -m venv venv source venv/bin/activate pip install -r requirements.txt ``` ## Create user ```bash sudo useradd -r -s /bin/false redfish ``` ## Install systemd unit file ```bash sudo cp redfish-exporter.service /etc/systemd/system/redfish-exporter.service sudo systemctl daemon-reload sudo systemctl enable --now redfish-exporter.service ``` # Usefull oneliners ## public IP with curl ```bash curl icanhazip.com curl -4 icanhazip.com curl -6 icanhazip.com curl 'https://api.ipify.org?format=json' curl 'https://api64.ipify.org?format=json' ```