jenningsloy318 / redfish_exporter

exporter to get metrics from redfish based hardware such as lenovo/dell/superc servers
Apache License 2.0
70 stars 62 forks source link

redfish_exporter error when using resolve to convert hostname to ip address. #6

Closed sbates130272 closed 4 years ago

sbates130272 commented 4 years ago

If we use a hostname in the redfish.yml configuration file the hostname->IP works as expected but then the lookup on the credentials appears to use the IP address and not the hostname to search for the security credentials. For example

hosts:
  asgard-ipmi:
    username: user
    password: pass

errors with the message

FATA[0000] Error getting credentialfor target 192.168.11.126 file: no credentials found for target 192.168.11.126  source="main.go:45"

Now 192.168.11.126 is the correct IP for asgard-ipmi in our network. So as explained above the name resolution works but the wrong key is used to index the credential information?

jenningsloy318 commented 4 years ago

Hi @sbates130272 Can you try it agin, from my testing, it works as expected i added entry into /etc/hosts

10.36.0.1 myhost

then use following config

hosts:
    myhost:
      username: admin
      password: pass

when issue command http://localhost:9610/redfish?target=myhost

 ./redfish_exporter --config.file redfish_exporter.yml 
INFO[0000] redfish_exporter version 0.10.1, build reversion c014da50d27d4fef5adb89c84da0a9a1b836f5e5, build branch master, build at 2020-04-25 10:40:58+08:00 on host W-PC0FWYTL  source="main.go:69"
INFO[0000] Starting redfish_exporter                     source="main.go:76"
INFO[0000] Loaded config file                            source="config.go:42"
INFO[0000] Listening on :9610                            source="main.go:125" 
INFO[0044] Scraping target myhost                        source="main.go:40"
INFO[0049] Errors occours when creating redfish client: Get "https://myhost/redfish/v1/": dial tcp 10.36.0.1:443: connect: connection refused  source="redfish_collector.go:113"
INFO[0049] Errors occours when creating redfish client: Get "https://myhost/redfish/v1/": dial tcp 10.36.0.1:443: connect: connection refused  source="redfish_collector.go:46"

it is testing for the ip lookup, but no such issue as you reported.

sbates130272 commented 4 years ago

Thanks @jenningsloy318 ! You are right. This is working and I will close the issue (but open a more complicated one ;-)). The issue was that I forgot to add our internal domain name to the hostnames in the redfish.yml file. Once I added eideticom.local to all the hostnames it worked as expected.