This is an automated email from the ASF dual-hosted git repository. ocket8888 pushed a commit to branch 5.1.x in repository https://gitbox.apache.org/repos/asf/trafficcontrol.git
commit 48a63985da651bdfd6b090d951f3d95f747aa495 Author: mattjackson220 <[email protected]> AuthorDate: Thu Apr 22 10:17:20 2021 -0600 Fixed TM to report ONLINE caches as available (#5776) (cherry picked from commit 6ba291470cc18ed86b79921ce28a41af594b3770) --- CHANGELOG.md | 2 +- traffic_monitor/datareq/cachestate.go | 15 +++++++++++++++ traffic_monitor/manager/monitorconfig.go | 2 +- 3 files changed, 17 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 267275a..a14594a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -11,7 +11,7 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/). - Fixed an issue where Traffic Ops becoming unavailable caused Traffic Monitor to segfault and crash - [#5754](https://github.com/apache/trafficcontrol/issues/5754) - Ensure Health Threshold Parameters use legacy format for legacy Monitoring Config handler - [#5695](https://github.com/apache/trafficcontrol/issues/5695) - Ensure vitals are calculated only against monitored interfaces - +- Fixed Traffic Monitor to report `ONLINE` caches as available. - [#5744](https://github.com/apache/trafficcontrol/issues/5744) - Sort TM Delivery Service States page by DS name ## [5.1.1] - 2021-03-19 diff --git a/traffic_monitor/datareq/cachestate.go b/traffic_monitor/datareq/cachestate.go index 4597e2e..2482744 100644 --- a/traffic_monitor/datareq/cachestate.go +++ b/traffic_monitor/datareq/cachestate.go @@ -38,6 +38,9 @@ import ( // the polled interface data. const NotFoundStatus = "unavailable - interface not found" +// OnlineStatus is the status value of all interfaces that are associated with an ONLINE server. +const OnlineStatus = "available - server ONLINE" + // CacheStatus contains summary stat data about the given cache. type CacheStatus struct { Type *string `json:"type,omitempty"` @@ -183,6 +186,11 @@ func createCacheStatuses( } } + if serverInfo.ServerStatus == tc.CacheStatusOnline.String() { + infStatus.Status = OnlineStatus + infStatus.Available = true + } + interfaceStatuses[interfaceName] = infStatus } @@ -235,6 +243,13 @@ func createCacheStatuses( log.Infof("Error getting cache %v health span: %v\n", cacheName, err) } + if serverInfo.ServerStatus == tc.CacheStatusOnline.String() { + cacheStatus.Why = "ONLINE - available" + cacheStatus.Available.IPv4 = serverInfo.IPv4() != "" + cacheStatus.Available.IPv6 = serverInfo.IPv6() != "" + cacheStatus.ProcessedAvailable = cacheStatus.Available.IPv4 || cacheStatus.Available.IPv6 + } + statii[cacheName] = CacheStatus{ Type: &cacheTypeStr, LoadAverage: &loadAverage, diff --git a/traffic_monitor/manager/monitorconfig.go b/traffic_monitor/manager/monitorconfig.go index 4f44042..719720c 100644 --- a/traffic_monitor/manager/monitorconfig.go +++ b/traffic_monitor/manager/monitorconfig.go @@ -240,7 +240,7 @@ func monitorConfigListen( srvStatus := tc.CacheStatusFromString(srv.ServerStatus) if srvStatus == tc.CacheStatusOnline { - localStates.AddCache(cacheName, tc.IsAvailable{IsAvailable: true}) + localStates.AddCache(cacheName, tc.IsAvailable{IsAvailable: true, Ipv6Available: srv.IPv6() != "", Ipv4Available: srv.IPv4() != ""}) continue } if srvStatus == tc.CacheStatusOffline {
