Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

redfish_exporter server dies when non-existant IP or hostname is queried. #7

Closed
sbates130272 opened this issue Apr 29, 2020 · 5 comments

Comments

@sbates130272
Copy link
Contributor

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"
@sbates130272 sbates130272 changed the title redfish_exporter server dies when non-existand IP or hostname is queried. redfish_exporter server dies when non-existant IP or hostname is queried. Apr 29, 2020
@jenningsloy318
Copy link
Owner

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.

@sbates130272
Copy link
Contributor Author

Thanks @jenningsloy318. We may also devote some engineering cycles to this by forking your repo and sending PRs back to you.

@jenningsloy318
Copy link
Owner

Awsome, very Appreciate your contribution.

@jenningsloy318
Copy link
Owner

jenningsloy318 commented Apr 30, 2020

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.

@sbates130272
Copy link
Contributor Author

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants