-
Notifications
You must be signed in to change notification settings - Fork 5
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
connection failure parsed as json #23
Comments
Is there a code sample for this? Jus an unreachable URL or something? It will depend on where the message comes from, but it might be possible to provide exception handling. |
it is a connection failure - i suspect a dns lookup failure could result in this |
It looks like the failure to connect is passed up the chain, and it should die (or probably more appropriately This can then be more appropriately handled via something like |
Richlv, I tested with a bogus DNS name, and I get a very clean error:
Here's my test code: #!/usr/bin/env perl
use strict;
use warnings;
use Zabbix::Tiny;
use Data::Dumper;
my $zabbix = Zabbix::Tiny->new(
server => 'https://zabbix.domain.fake',
password => 'whosgonna',
user => 'fakepass',
);
my $hosts = $zabbix->do( 'host.get' );
print Dumper $hosts; I KNOW that i had seen errors like you state before, but I'm not getting them now. Are you able to reproduce? |
haven't tried to reproduce at will, but i believe it might be resulting from a dns lookup failure, not from a negative lookup (where the actual request succeeded) |
Let me know if you find a way to reproduce it. It looks like the error message in the original report is the same as the failure I'm getting now - I'm just getting it cleanly. That is to say that rather than get a JSON encoding error like: I get the actual contents of the message: As I said, I actually observed the same error at one point shortly after you reported this (the script was run with cron, so i never got around to debugging it at the time), so I have seem the same problem as well, but I'm not able to reproduce. Let me know what you find, but for the sake of 'cleanliness' I'm going to close this issue in a week if we can't figure out how to reproduce (it's easy to re-open :) ) Thank you! |
thank you a lot, makes sense. will try to reproduce it |
not completely sure whether this is something fixable in Zabbix::Tiny, but the current behaviour seems hard to handle on the module-using side.
if the connection to the api fails, the outcome is :
it would be great if the connection failure could be detected and there was a suggested way to detect it (so that the module user could retry, for example)
The text was updated successfully, but these errors were encountered: