From 9b70f3d9187f52f1ef0998c969409d679c226c31 Mon Sep 17 00:00:00 2001 From: jpappa200 Date: Thu, 10 Nov 2022 19:25:00 -0500 Subject: [PATCH 01/11] added HUP to reload config --- tc-health-client/tc-health-client.service | 1 + 1 file changed, 1 insertion(+) 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 From a19194f61054f5cbc5e27e7e077d5d1cd4705c2b Mon Sep 17 00:00:00 2001 From: jpappa200 Date: Thu, 10 Nov 2022 19:25:56 -0500 Subject: [PATCH 02/11] updated to traffic ops api V4 --- tc-health-client/tmagent/tmagent.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) 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 From f236fc317d7827f8de8e7bba77bffa171b5c165e Mon Sep 17 00:00:00 2001 From: jpappa200 Date: Mon, 14 Nov 2022 11:39:44 -0500 Subject: [PATCH 03/11] added OR to work around MonitorTypeName name change --- tc-health-client/tmagent/tmagent.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/tc-health-client/tmagent/tmagent.go b/tc-health-client/tmagent/tmagent.go index 54243b4d35..09225f9cc8 100644 --- a/tc-health-client/tmagent/tmagent.go +++ b/tc-health-client/tmagent/tmagent.go @@ -656,7 +656,9 @@ func (pi *ParentInfo) GetTOData(cfg *config.Cfg) error { if *sv.CDNName != cfg.CDNName { continue } - if sv.Type == tc.MonitorTypeName && tc.CacheStatus(*sv.Status) == tc.CacheStatusOnline { + // added OR because MonitorTypeName has been updated to 'TRAFFIC_MONITOR' and TO still has then listed as 'RASCAL' + // this will allow it to work either way and can be removed once TO is updated. + if (sv.Type == tc.MonitorTypeName || sv.Type == "RASCAL") && tc.CacheStatus(*sv.Status) == tc.CacheStatusOnline { fqdn := *sv.HostName + "." + *sv.DomainName toData.Monitors[fqdn] = struct{}{} continue From 932cc1200dae7eaa81b8a72af5d8635c24d68d53 Mon Sep 17 00:00:00 2001 From: jpappa200 Date: Mon, 14 Nov 2022 13:35:12 -0500 Subject: [PATCH 04/11] added changelog entry --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 8f970f9013..73221cf199 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -23,6 +23,7 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/). - [#7176](https://github.com/apache/trafficcontrol/pull/7176) *ATC Build system* Support building ATC for the `aarch64` CPU architecture ### Changed +- [#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 - [#2564](https://github.com/apache/trafficcontrol/issues/2564) Renamed RASCAL references to TRAFFIC_MONITOR - [#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. From f072efa64041b682bd8303d7fb6be69fb836a8d3 Mon Sep 17 00:00:00 2001 From: jpappa200 Date: Mon, 14 Nov 2022 13:35:34 -0500 Subject: [PATCH 05/11] updated documentation for config changes --- tc-health-client/README.md | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) 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**. From cf32bcb67f1fac3b2b2beade6b356dab3e07de0c Mon Sep 17 00:00:00 2001 From: jpappa200 Date: Mon, 14 Nov 2022 14:58:50 -0500 Subject: [PATCH 06/11] removed OR just using shared constant --- tc-health-client/tmagent/tmagent.go | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/tc-health-client/tmagent/tmagent.go b/tc-health-client/tmagent/tmagent.go index 09225f9cc8..54243b4d35 100644 --- a/tc-health-client/tmagent/tmagent.go +++ b/tc-health-client/tmagent/tmagent.go @@ -656,9 +656,7 @@ func (pi *ParentInfo) GetTOData(cfg *config.Cfg) error { if *sv.CDNName != cfg.CDNName { continue } - // added OR because MonitorTypeName has been updated to 'TRAFFIC_MONITOR' and TO still has then listed as 'RASCAL' - // this will allow it to work either way and can be removed once TO is updated. - if (sv.Type == tc.MonitorTypeName || sv.Type == "RASCAL") && tc.CacheStatus(*sv.Status) == tc.CacheStatusOnline { + if sv.Type == tc.MonitorTypeName && tc.CacheStatus(*sv.Status) == tc.CacheStatusOnline { fqdn := *sv.HostName + "." + *sv.DomainName toData.Monitors[fqdn] = struct{}{} continue From 68bd6704dcf1412b9d178e57c55fb44c8bbc788b Mon Sep 17 00:00:00 2001 From: jpappa200 Date: Mon, 14 Nov 2022 14:59:39 -0500 Subject: [PATCH 07/11] reordered to fix past poor conflict resolution --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 6501175bfa..f67a285a78 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -23,12 +23,12 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/). - [#7176](https://github.com/apache/trafficcontrol/pull/7176) *ATC Build system* Support building ATC for the `aarch64` CPU architecture ### Changed -- [#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 - [#2564](https://github.com/apache/trafficcontrol/issues/2564) Renamed RASCAL references to TRAFFIC_MONITOR - [#2564](https://github.com/apache/trafficcontrol/issues/2564) *Traffic Ops, Traffic Monitor* Renamed RASCAL references to TRAFFIC_MONITOR - [#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 From 0baf2038309f9e5106cf583e79adf889ca05351b Mon Sep 17 00:00:00 2001 From: jpappa200 Date: Mon, 14 Nov 2022 17:16:57 -0500 Subject: [PATCH 08/11] added RascalTypeName const --- lib/go-tc/enum.go | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/lib/go-tc/enum.go b/lib/go-tc/enum.go index 7a5b622b95..c50d8a1881 100644 --- a/lib/go-tc/enum.go +++ b/lib/go-tc/enum.go @@ -143,6 +143,15 @@ const MonitorTypeName = "TRAFFIC_MONITOR" // properly, and new code should not check this. const MonitorProfilePrefix = "TRAFFIC_MONITOR" +// RascalTypeName is the Name of the Type which must be assigned to a server +// for it to be treated as a Traffic Monitor instance by ATC. +// +// "Rascal" is a legacy name for Traffic Monitor. +// +// Note that there is, in general, no guarantee that a Type with this name +// exists in Traffic Ops at any given time. +const RascalTypeName = "RASCAL" + // RouterTypeName is the Name of the Type which must be assigned to a server // for it to be treated as a Traffic Router instance by ATC. // From b10caccc0b6576f3447aa23cc21a72b0fcbc2236 Mon Sep 17 00:00:00 2001 From: jpappa200 Date: Mon, 14 Nov 2022 17:17:32 -0500 Subject: [PATCH 09/11] Added OR to check for RASCAL or TRAFFIC_MONITOR --- tc-health-client/tmagent/tmagent.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tc-health-client/tmagent/tmagent.go b/tc-health-client/tmagent/tmagent.go index 54243b4d35..9d38f85595 100644 --- a/tc-health-client/tmagent/tmagent.go +++ b/tc-health-client/tmagent/tmagent.go @@ -656,7 +656,7 @@ func (pi *ParentInfo) GetTOData(cfg *config.Cfg) error { if *sv.CDNName != cfg.CDNName { continue } - if sv.Type == tc.MonitorTypeName && tc.CacheStatus(*sv.Status) == tc.CacheStatusOnline { + if (sv.Type == tc.MonitorTypeName || sv.Type == tc.RascalTypeName) && tc.CacheStatus(*sv.Status) == tc.CacheStatusOnline { fqdn := *sv.HostName + "." + *sv.DomainName toData.Monitors[fqdn] = struct{}{} continue From fb1fa3487b87fe124b5002264ba24b1176d773dc Mon Sep 17 00:00:00 2001 From: jpappa200 Date: Thu, 17 Nov 2022 09:28:13 -0500 Subject: [PATCH 10/11] removed "RASCAL" constant --- lib/go-tc/enum.go | 9 --------- 1 file changed, 9 deletions(-) diff --git a/lib/go-tc/enum.go b/lib/go-tc/enum.go index c50d8a1881..7a5b622b95 100644 --- a/lib/go-tc/enum.go +++ b/lib/go-tc/enum.go @@ -143,15 +143,6 @@ const MonitorTypeName = "TRAFFIC_MONITOR" // properly, and new code should not check this. const MonitorProfilePrefix = "TRAFFIC_MONITOR" -// RascalTypeName is the Name of the Type which must be assigned to a server -// for it to be treated as a Traffic Monitor instance by ATC. -// -// "Rascal" is a legacy name for Traffic Monitor. -// -// Note that there is, in general, no guarantee that a Type with this name -// exists in Traffic Ops at any given time. -const RascalTypeName = "RASCAL" - // RouterTypeName is the Name of the Type which must be assigned to a server // for it to be treated as a Traffic Router instance by ATC. // From 38f98b49d3a27f08669ca933879058926984d4bc Mon Sep 17 00:00:00 2001 From: jpappa200 Date: Thu, 17 Nov 2022 09:28:58 -0500 Subject: [PATCH 11/11] removed OR in server type check --- tc-health-client/tmagent/tmagent.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tc-health-client/tmagent/tmagent.go b/tc-health-client/tmagent/tmagent.go index 9d38f85595..54243b4d35 100644 --- a/tc-health-client/tmagent/tmagent.go +++ b/tc-health-client/tmagent/tmagent.go @@ -656,7 +656,7 @@ func (pi *ParentInfo) GetTOData(cfg *config.Cfg) error { if *sv.CDNName != cfg.CDNName { continue } - if (sv.Type == tc.MonitorTypeName || sv.Type == tc.RascalTypeName) && tc.CacheStatus(*sv.Status) == tc.CacheStatusOnline { + if sv.Type == tc.MonitorTypeName && tc.CacheStatus(*sv.Status) == tc.CacheStatusOnline { fqdn := *sv.HostName + "." + *sv.DomainName toData.Monitors[fqdn] = struct{}{} continue