You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@trafficcontrol.apache.org by zr...@apache.org on 2022/11/17 15:32:09 UTC

[trafficcontrol] branch master updated: update health-client to v4 API (#7192)

This is an automated email from the ASF dual-hosted git repository.

zrhoffman pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/trafficcontrol.git


The following commit(s) were added to refs/heads/master by this push:
     new 7aec31abe6 update health-client to v4 API (#7192)
7aec31abe6 is described below

commit 7aec31abe6c600f9f7836c77c0e22c6f3c2936b3
Author: Joe Pappano <jo...@cable.comcast.com>
AuthorDate: Thu Nov 17 10:32:02 2022 -0500

    update health-client to v4 API (#7192)
    
    * added HUP to reload config
    
    * updated to traffic ops api V4
    
    * added OR to work around MonitorTypeName name change
    
    * added changelog entry
    
    * updated documentation for config changes
    
    * removed OR just using shared constant
    
    * reordered to fix past poor conflict resolution
    
    * added  RascalTypeName const
    
    * Added OR to check for RASCAL or TRAFFIC_MONITOR
    
    * removed "RASCAL" constant
    
    * removed OR in server type check
---
 CHANGELOG.md                              | 1 +
 tc-health-client/README.md                | 7 ++++---
 tc-health-client/tc-health-client.service | 1 +
 tc-health-client/tmagent/tmagent.go       | 4 ++--
 4 files changed, 8 insertions(+), 5 deletions(-)

diff --git a/CHANGELOG.md b/CHANGELOG.md
index 7fb8d0d0fd..b06786ec1c 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -26,6 +26,7 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/).
 - [#7063](https://github.com/apache/trafficcontrol/pull/7063) *Traffic Ops* Python client now uses Traffic Ops API 4.1 by default.
 - [#6981](https://github.com/apache/trafficcontrol/pull/6981) *Traffic Portal* Obscures sensitive text in Delivery Service "Raw Remap" fields, private SSL keys, "Header Rewrite" rules, and ILO interface passwords by default.
 - [#7037](https://github.com/apache/trafficcontrol/pull/7037) *Traffic Router* Uses Traffic Ops API 4.0 by default
+- [#7191](https://github.com/apache/trafficcontrol/issues/7191) *tc-health-client* Uses Traffic Ops API 4.0. Also added reload option to systemd service file
 
 ### Fixed
 - [#7179](https://github.com/apache/trafficcontrol/issues/7179) *Traffic Portal* Fixed search filter for Delivery Service Table
diff --git a/tc-health-client/README.md b/tc-health-client/README.md
index 8801dae8c0..54b77e78f3 100644
--- a/tc-health-client/README.md
+++ b/tc-health-client/README.md
@@ -56,9 +56,10 @@ otherwise unavailable, the tc-health-client will utilize the **Traffic Server**
 and **Traffic Monitor** has determined that the marked down host is now available, 
 the client will then utilize the **Traffic Server** tool to mark the host back up.
 
-Also on each polling cycle the configuration file, **tc-health-client.json** is 
-checked and a new config is reloaded if the file has changed since the last 
-polling cycle.  The **Traffic Monitors** list is refreshed from **Traffic Ops**.
+Any changes to **tc-health-client.json** will require sending a SIGHUP to the running
+process. This will cause the tc-health-client to read the config file and load any
+changes, the **Traffic Monitors** list will be refreshed from **Traffic Ops**.
+**systemctl reload tc-health-client** can also be used to send a SIGHUP.  
 
 If errors are encountered while polling a Traffic Monitor, the error is logged
 and the **Traffic Monitors** list is refreshed from **Traffic Ops**.
diff --git a/tc-health-client/tc-health-client.service b/tc-health-client/tc-health-client.service
index 5202ce9780..9edcd67527 100644
--- a/tc-health-client/tc-health-client.service
+++ b/tc-health-client/tc-health-client.service
@@ -23,6 +23,7 @@ Requires=trafficserver.service
 
 [Service]
 ExecStart=/usr/bin/tc-health-client -vv
+ExecReload=/bin/kill -HUP $MAINPID
 Restart=always
 RestartSec=5
 PIDFile=/run/tc-health-client.pid
diff --git a/tc-health-client/tmagent/tmagent.go b/tc-health-client/tmagent/tmagent.go
index ea282a64f7..54243b4d35 100644
--- a/tc-health-client/tmagent/tmagent.go
+++ b/tc-health-client/tmagent/tmagent.go
@@ -38,7 +38,7 @@ import (
 	"github.com/apache/trafficcontrol/lib/go-tc"
 	"github.com/apache/trafficcontrol/tc-health-client/config"
 	"github.com/apache/trafficcontrol/tc-health-client/util"
-	toclient "github.com/apache/trafficcontrol/traffic_ops/v3-client"
+	toclient "github.com/apache/trafficcontrol/traffic_ops/v4-client"
 
 	"gopkg.in/yaml.v2"
 )
@@ -636,7 +636,7 @@ func (pi *ParentInfo) GetTOData(cfg *config.Cfg) error {
 		}
 	}
 
-	srvs, _, err := toData.TOClient.GetServersWithHdr(nil, nil)
+	srvs, _, err := toData.TOClient.GetServers(toclient.NewRequestOptions())
 	if err != nil {
 		// next time we'll login again and get a new session.
 		toData.TOClient = nil