[TC-99] api/{version}/cdns/:cdn_name/health returns the health of all cdns
Project: http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/commit/0bb748f9 Tree: http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/tree/0bb748f9 Diff: http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/diff/0bb748f9 Branch: refs/heads/master Commit: 0bb748f9ee5e4b9737629554146e34b6eb9a2f19 Parents: 224eab5 Author: Amir Yeshurun <am...@qwilt.com> Authored: Mon Jan 30 22:38:38 2017 +0200 Committer: Jeremy Mitchell <mitchell...@gmail.com> Committed: Mon Feb 6 10:53:01 2017 -0700 ---------------------------------------------------------------------- traffic_ops/app/lib/API/Cdn.pm | 8 +++++++- traffic_ops/app/lib/MojoPlugins/Health.pm | 3 +++ 2 files changed, 10 insertions(+), 1 deletion(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/blob/0bb748f9/traffic_ops/app/lib/API/Cdn.pm ---------------------------------------------------------------------- diff --git a/traffic_ops/app/lib/API/Cdn.pm b/traffic_ops/app/lib/API/Cdn.pm index e56541b..1621430 100644 --- a/traffic_ops/app/lib/API/Cdn.pm +++ b/traffic_ops/app/lib/API/Cdn.pm @@ -434,8 +434,14 @@ sub capacity { sub health { my $self = shift; + my $args = {}; - return $self->get_cache_health(); + my $cdn_name = $self->param('name'); + if (defined($cdn_name)) { + $args->{'cdn_name'} = $cdn_name; + } + + return $self->get_cache_health($args); } sub routing { http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/blob/0bb748f9/traffic_ops/app/lib/MojoPlugins/Health.pm ---------------------------------------------------------------------- diff --git a/traffic_ops/app/lib/MojoPlugins/Health.pm b/traffic_ops/app/lib/MojoPlugins/Health.pm index b06c33f..857df7c 100755 --- a/traffic_ops/app/lib/MojoPlugins/Health.pm +++ b/traffic_ops/app/lib/MojoPlugins/Health.pm @@ -159,6 +159,9 @@ sub register { cachegroups => [], }; + $self->app->log->debug("get_cache_health() - " . + Data::Dumper->Dump([$args, [keys(%{$rascal_data})]], [qw(args rascal_keys)])); + my $cachegroup_data = {}; my $capacity_data = { total => 0 };