Merge pull request #7765 from Icinga/bugfix/opentsdb-graphite-reconnect

Graphite/OpenTSDB: Ensure that Reconnect failure is detected
This commit is contained in:
Michael Friedrich 2020-01-27 14:32:26 +01:00 committed by GitHub
commit e1939368b2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 14 additions and 1 deletions

View File

@ -194,6 +194,10 @@ void GraphiteWriter::ReconnectInternal()
} catch (const std::exception& ex) {
Log(LogWarning, "GraphiteWriter")
<< "Can't connect to Graphite on host '" << GetHost() << "' port '" << GetPort() << ".'";
SetConnected(false);
throw;
}
SetConnected(true);

View File

@ -115,8 +115,10 @@ void OpenTsdbWriter::ReconnectTimerHandler()
if (GetConnected())
return;
double startTime = Utility::GetTime();
Log(LogNotice, "OpenTsdbWriter")
<< "Reconnect to OpenTSDB TSD on host '" << GetHost() << "' port '" << GetPort() << "'.";
<< "Reconnecting to OpenTSDB TSD on host '" << GetHost() << "' port '" << GetPort() << "'.";
/*
* We're using telnet as input method. Future PRs may change this into using the HTTP API.
@ -129,9 +131,16 @@ void OpenTsdbWriter::ReconnectTimerHandler()
} catch (const std::exception& ex) {
Log(LogWarning, "OpenTsdbWriter")
<< "Can't connect to OpenTSDB on host '" << GetHost() << "' port '" << GetPort() << ".'";
SetConnected(false);
return;
}
SetConnected(true);
Log(LogInformation, "OpenTsdbWriter")
<< "Finished reconnecting to OpenTSDB in " << std::setw(2) << Utility::GetTime() - startTime << " second(s).";
}
/**