You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@trafficcontrol.apache.org by el...@apache.org on 2017/01/09 21:13:05 UTC

[1/4] incubator-trafficcontrol git commit: fix TM2 to log missing health poll URLs

Repository: incubator-trafficcontrol
Updated Branches:
  refs/heads/master 02e399f34 -> 9328758e5


fix TM2 to log missing health poll URLs


Project: http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/commit/26d3b0f3
Tree: http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/tree/26d3b0f3
Diff: http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/diff/26d3b0f3

Branch: refs/heads/master
Commit: 26d3b0f3ff6b49f313daccc284d55df8167d38a7
Parents: f846459
Author: Robert Butts <ro...@gmail.com>
Authored: Mon Jan 9 11:27:38 2017 -0700
Committer: Jeff Elsloo <je...@cable.comcast.com>
Committed: Mon Jan 9 14:11:58 2017 -0700

----------------------------------------------------------------------
 .../experimental/traffic_monitor/manager/monitorconfig.go        | 4 ++++
 1 file changed, 4 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/blob/26d3b0f3/traffic_monitor/experimental/traffic_monitor/manager/monitorconfig.go
----------------------------------------------------------------------
diff --git a/traffic_monitor/experimental/traffic_monitor/manager/monitorconfig.go b/traffic_monitor/experimental/traffic_monitor/manager/monitorconfig.go
index 5307382..c9d9005 100644
--- a/traffic_monitor/experimental/traffic_monitor/manager/monitorconfig.go
+++ b/traffic_monitor/experimental/traffic_monitor/manager/monitorconfig.go
@@ -223,6 +223,10 @@ func monitorConfigListen(
 			}
 
 			url := monitorConfig.Profile[srv.Profile].Parameters.HealthPollingURL
+			if url == "" {
+				log.Errorf("monitor config server %v profile %v has no polling URL; can't poll", srv.HostName, srv.Profile)
+				continue
+			}
 			r := strings.NewReplacer(
 				"${hostname}", srv.IP,
 				"${interface_name}", srv.InterfaceName,


[3/4] incubator-trafficcontrol git commit: Fix TM2 for EDGE*, MID* types

Posted by el...@apache.org.
Fix TM2 for EDGE*, MID* types


Project: http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/commit/ae293c87
Tree: http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/tree/ae293c87
Diff: http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/diff/ae293c87

Branch: refs/heads/master
Commit: ae293c8703b67dd6e8926743b1fd180f8e6a71f3
Parents: 02e399f
Author: Robert Butts <ro...@gmail.com>
Authored: Mon Jan 9 11:25:09 2017 -0700
Committer: Jeff Elsloo <je...@cable.comcast.com>
Committed: Mon Jan 9 14:11:58 2017 -0700

----------------------------------------------------------------------
 .../experimental/traffic_monitor/enum/enum.go         | 14 ++++++--------
 1 file changed, 6 insertions(+), 8 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/blob/ae293c87/traffic_monitor/experimental/traffic_monitor/enum/enum.go
----------------------------------------------------------------------
diff --git a/traffic_monitor/experimental/traffic_monitor/enum/enum.go b/traffic_monitor/experimental/traffic_monitor/enum/enum.go
index 77f8ea4..733bba5 100644
--- a/traffic_monitor/experimental/traffic_monitor/enum/enum.go
+++ b/traffic_monitor/experimental/traffic_monitor/enum/enum.go
@@ -10,9 +10,9 @@ package enum
  * to you under the Apache License, Version 2.0 (the
  * "License"); you may not use this file except in compliance
  * with the License.  You may obtain a copy of the License at
- * 
+ *
  *   http://www.apache.org/licenses/LICENSE-2.0
- * 
+ *
  * Unless required by applicable law or agreed to in writing,
  * software distributed under the License is distributed on an
  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
@@ -21,7 +21,6 @@ package enum
  * under the License.
  */
 
-
 import (
 	"strings"
 )
@@ -65,14 +64,13 @@ func (t CacheType) String() string {
 // CacheTypeFromString returns a cache type object from its string representation, or CacheTypeInvalid if the string is not a valid type.
 func CacheTypeFromString(s string) CacheType {
 	s = strings.ToLower(s)
-	switch s {
-	case "edge":
+	if strings.HasPrefix(s, "edge") {
 		return CacheTypeEdge
-	case "mid":
+	}
+	if strings.HasPrefix(s, "mid") {
 		return CacheTypeMid
-	default:
-		return CacheTypeInvalid
 	}
+	return CacheTypeInvalid
 }
 
 // DSType is the Delivery Service type. HTTP, DNS, etc.


[2/4] incubator-trafficcontrol git commit: Fix TM2 for nonexistent health params

Posted by el...@apache.org.
Fix TM2 for nonexistent health params


Project: http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/commit/f8464599
Tree: http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/tree/f8464599
Diff: http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/diff/f8464599

Branch: refs/heads/master
Commit: f8464599a3558d0d3308572d8a5c32fc3a0ee3c9
Parents: ae293c8
Author: Robert Butts <ro...@gmail.com>
Authored: Mon Jan 9 11:27:01 2017 -0700
Committer: Jeff Elsloo <je...@cable.comcast.com>
Committed: Mon Jan 9 14:11:58 2017 -0700

----------------------------------------------------------------------
 .../traffic_monitor/health/cache_health.go      | 36 +++++++++++---------
 1 file changed, 19 insertions(+), 17 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/blob/f8464599/traffic_monitor/experimental/traffic_monitor/health/cache_health.go
----------------------------------------------------------------------
diff --git a/traffic_monitor/experimental/traffic_monitor/health/cache_health.go b/traffic_monitor/experimental/traffic_monitor/health/cache_health.go
index 5dfa0c2..b57d143 100644
--- a/traffic_monitor/experimental/traffic_monitor/health/cache_health.go
+++ b/traffic_monitor/experimental/traffic_monitor/health/cache_health.go
@@ -8,9 +8,9 @@ package health
  * to you under the Apache License, Version 2.0 (the
  * "License"); you may not use this file except in compliance
  * with the License.  You may obtain a copy of the License at
- * 
+ *
  *   http://www.apache.org/licenses/LICENSE-2.0
- * 
+ *
  * Unless required by applicable law or agreed to in writing,
  * software distributed under the License is distributed on an
  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
@@ -19,10 +19,8 @@ package health
  * under the License.
  */
 
-
 import (
 	"fmt"
-	"math"
 	"strconv"
 	"strings"
 	"time"
@@ -98,25 +96,26 @@ func GetVitals(newResult *cache.Result, prevResult *cache.Result, mc *traffic_op
 
 // getKbpsThreshold returns the numeric kbps threshold, from the Traffic Ops string value. If there is a parse error, it logs a warning and returns the max floating point number, signifying no limit
 // TODO add float64 to Traffic Ops Client interface
-func getKbpsThreshold(threshStr string) int64 {
+func getKbpsThreshold(threshStr string) (int64, bool) {
 	if len(threshStr) == 0 {
-		log.Errorf("Empty Traffic Ops HealthThresholdAvailableBandwidthInKbps; setting no limit.\n")
-		return math.MaxInt64
+		return 0, false
 	}
 	if threshStr[0] == '>' {
 		threshStr = threshStr[1:]
 	}
 	thresh, err := strconv.ParseInt(threshStr, 10, 64)
 	if err != nil {
-		log.Errorf("Failed to parse Traffic Ops HealthThresholdAvailableBandwidthInKbps, setting no limit: '%v'\n", err)
-		return math.MaxInt64
+		return 0, false
 	}
-	return thresh
+	return thresh, true
 }
 
 // TODO add time.Duration to Traffic Ops Client interface
-func getQueryThreshold(threshInt int64) time.Duration {
-	return time.Duration(threshInt) * time.Millisecond
+func getQueryThreshold(threshInt int64) (time.Duration, bool) {
+	if threshInt == 0 {
+		return 0, false
+	}
+	return time.Duration(threshInt) * time.Millisecond, true
 }
 
 func cacheCapacityKbps(result cache.Result) int64 {
@@ -132,6 +131,9 @@ func EvalCache(result cache.Result, mc *traffic_ops.TrafficMonitorConfigMap) (bo
 		log.Errorf("Cache %v got invalid status from Traffic Ops '%v' - treating as Reported\n", result.ID, toServer.Status)
 	}
 	params := mc.Profile[toServer.Profile].Parameters
+	kbpsThreshold, hasKbpsThreshold := getKbpsThreshold(params.HealthThresholdAvailableBandwidthInKbps)
+	queryTimeThreshold, hasQueryTimeThreshold := getQueryThreshold(int64(params.HealthThresholdQueryTime))
+
 	switch {
 	case status == enum.CacheStatusAdminDown:
 		return false, "set to " + status.String()
@@ -142,12 +144,12 @@ func EvalCache(result cache.Result, mc *traffic_ops.TrafficMonitorConfigMap) (bo
 		return true, "set to " + status.String()
 	case result.Error != nil:
 		return false, fmt.Sprintf("error: %v", result.Error)
-	case result.Vitals.LoadAvg > params.HealthThresholdLoadAvg:
+	case result.Vitals.LoadAvg > params.HealthThresholdLoadAvg && params.HealthThresholdLoadAvg != 0:
 		return false, fmt.Sprintf("load average %f exceeds threshold %f", result.Vitals.LoadAvg, params.HealthThresholdLoadAvg)
-	case result.Vitals.KbpsOut > cacheCapacityKbps(result)-getKbpsThreshold(params.HealthThresholdAvailableBandwidthInKbps):
-		return false, fmt.Sprintf("%dkbps exceeds max %dkbps", result.Vitals.KbpsOut, getKbpsThreshold(params.HealthThresholdAvailableBandwidthInKbps))
-	case result.RequestTime > getQueryThreshold(int64(params.HealthThresholdQueryTime)):
-		return false, fmt.Sprintf("request time %v exceeds max %v", result.RequestTime, getQueryThreshold(int64(params.HealthThresholdQueryTime)))
+	case hasKbpsThreshold && result.Vitals.KbpsOut > cacheCapacityKbps(result)-kbpsThreshold:
+		return false, fmt.Sprintf("%dkbps exceeds max %dkbps", result.Vitals.KbpsOut, kbpsThreshold)
+	case hasQueryTimeThreshold && result.RequestTime > queryTimeThreshold:
+		return false, fmt.Sprintf("request time %v exceeds max %v", result.RequestTime, queryTimeThreshold)
 	default:
 		return result.Available, "reported"
 	}


[4/4] incubator-trafficcontrol git commit: This closes #171.

Posted by el...@apache.org.
This closes #171.


Project: http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/commit/9328758e
Tree: http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/tree/9328758e
Diff: http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/diff/9328758e

Branch: refs/heads/master
Commit: 9328758e54d3b93c174bccd488ae3a52b2891f45
Parents: 26d3b0f
Author: Jeff Elsloo <je...@cable.comcast.com>
Authored: Mon Jan 9 14:12:45 2017 -0700
Committer: Jeff Elsloo <je...@cable.comcast.com>
Committed: Mon Jan 9 14:12:45 2017 -0700

----------------------------------------------------------------------

----------------------------------------------------------------------