redfish_exporter server dies when non-existant IP or hostname is queried.
sbates130272 opened this issue · 5 comments
When running redfish_exporter
we can cause it to fatally error by entering an IP or hostname that does not exist in the redfish.yml
configuration file. This is not a robust solution because we can't expect the client to always get things right and we can't expect IP addresses and hostnames to always be constant and always be online.
Make the application more robust and return a sane message if the client tries to scrape a target that is not in the configuration file.
vidar:~/redfish_exporter$ ./redfish_exporter --config.file=redfish-hostnames.yml --log.level=debug
INFO[0000] redfish_exporter version , build reversion , build branch , build at on host vidar 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[0002] Scraping target 1.2.3.4 source="main.go:40"
FATA[0002] Error getting credentialfor target 1.2.3.4 file: no credentials found for target 1.2.3.4 source="main.go:45"
I realized this issue before, at that time it was only used in our internal, so no neefto fix this as we have accurate list of servers.
I will take some time to find a solution for it, but may not be so quick.
Thanks @jenningsloy318. We may also devote some engineering cycles to this by forking your repo and sending PRs back to you.
Awsome, very Appreciate your contribution.
Hi @sbates130272 I update the code of error handling, can you please build it and tried it again ?
Actually, I usually add a default password in the config, when no password found, it will use the default one, this can also resolve such issue.
Thanks @jenningsloy318. I can confirm that master now does not fail if I enter an non-existant hostname **as long as I also add a default credential section to the redfish.yml
config file.
I think in order to close this issue we need to update the README.md
to include that. I have a couple of other things I would like to add to that file so I will do a PR for that.