lovoo / ipmi_exporter

IPMI Exporter for prometheus.io, written in Go.
BSD 3-Clause "New" or "Revised" License
80 stars 32 forks source link

Support remote hosts #29

Open carlbennett opened 7 years ago

carlbennett commented 7 years ago

I'd like command line parameters added to the exporter so I could specify a remote host and login credentials to the ipmitool.

For example, if I were to specify ipmi_exporter -remote.host=10.x.x.x -remote.user=ADMIN -remote.password=supersecretpw, I'd want it to export from the ipmitool but include ipmitool -H 10.x.x.x -U ADMIN -P supersecretpw <command> instead of just ipmitool <command>

candlerb commented 6 years ago

Even better if the auth credentials were stored in a file (like snmp_exporter), and selected by means of a URL parameter. This avoids having to use the same creds for every host. e.g.

/metrics?host=10.1.2.3&auth=prod1

where some yml file has:

prod1:
  username: ADMIN
  password: supersecretpw
dfredell commented 6 years ago

This is a little hackish but it works. Since https://github.com/lovoo/ipmi_exporter/blob/4c54ecc2bb53341cad990784aaba762e46b115fe/collector/collector.go#L151 just appends sensor to the -ipmi.path parameter you can do ./ipmi_exporter_linux_amd64 -ipmi.path "/usr/bin/ipmitool -H REMOTEIP -P PASSWORD -U USER -I lanplus" to remotely connect to another ipmi host.

You can test it out first with /usr/bin/ipmitool -H REMOTEIP -P PASSWORD -U USER -I lanplus sensor

I have -I lanplus on there because my remote talks in IPMI 2.0, not 1.5.

0ddmean commented 6 years ago

It is possible to run multiple exporters on prometheus host in docker containers in order to monitor multiple remote ipmi interfaces: docker run -d --name ipmi_exporter0 -p 127.0.0.1:9289:9289 lovoo/ipmi_exporter:latest -ipmi.path "/usr/local/bin/ipmitool -H REMOTEIP1 -P PASSWORD -U USER" docker run -d --name ipmi_exporter1 -p 127.0.0.1:19289:9289 lovoo/ipmi_exporter:latest -ipmi.path "/usr/local/bin/ipmitool -H REMOTEIP1 -P PASSWORD -U USER" docker run -d --name ipmi_exporter2 -p 127.0.0.1:29289:9289 lovoo/ipmi_exporter:latest -ipmi.path "/usr/local/bin/ipmitool -H REMOTEIP2 -P PASSWORD -U USER"

0ddmean commented 6 years ago

I also noticed that there is an old version of ipmitools used in lovoo/ipmi_exporter docker container which was built without lanplus interfaces support , so here is a Dockerfile with latest ipmitools version from Debian repos:

FROM debian:stretch
ENV DEBIAN_FRONTEND noninteractive
RUN apt-get update && apt-get install -y curl ipmitool
RUN curl -LO https://github.com/lovoo/ipmi_exporter/releases/download/2.1.0/ipmi_exporter_linux_amd64 && \
    cp ipmi_exporter_linux_amd64 /usr/bin/ipmi_exporter && \
    chmod +x /usr/bin/ipmi_exporter

EXPOSE 9289

ENTRYPOINT [ "/usr/bin/ipmi_exporter" ]