snmp: warn if snmp call timeout

If the snmp call timeout because the host is unreachable
just warn the operator.

We can't really known what happen with the snmp error.
That's why the change just filter on "timeout" word.

Change-Id: I564b290c1e07882a7591a003c4da3ac6034ac794
(cherry picked from commit 988a2f3f2d)
This commit is contained in:
Mehdi Abaakouk 2017-10-12 16:58:26 +02:00 committed by Mehdi Abaakouk (sileht)
parent aa6bd89077
commit d9340c88f0
1 changed files with 9 additions and 5 deletions

View File

@ -161,11 +161,15 @@ class GenericHardwareDeclarativePollster(plugin_base.PollsterBase):
parsed_url,
i_cache[identifier]))
except Exception as err:
LOG.exception('inspector call failed for %(ident)s '
'host %(host)s: %(err)s',
dict(ident=identifier,
host=parsed_url.hostname,
err=err))
msg = ('inspector call failed for %(ident)s '
'host %(host)s: %(err)s' %
dict(ident=identifier,
host=parsed_url.hostname,
err=err))
if "timeout" in str(err):
LOG.warning(msg)
else:
LOG.exception(msg)
return itertools.chain(*sample_iters)
def generate_samples(self, host_url, data):