diff --git a/app/RestService.php b/app/RestService.php index 9059855f5287f8df4dce6242ef5d76cee19f6e6f..295067f38f685b3d453805ad5351ce11f21e38a5 100644 --- a/app/RestService.php +++ b/app/RestService.php @@ -69,9 +69,12 @@ class RestService { $apiObjects[$value2] = []; $temp = static::getSimpleAll($value2); - foreach ($temp as $k => $val) + if(isset($temp)) { - $apiObjects[$value2][$val->id] = $val; + foreach ($temp as $k => $val) + { + $apiObjects[$value2][$val->id] = $val; + } } } } @@ -131,39 +134,42 @@ class RestService public static function getAll($apiname) { $result = static::getSimpleAll($apiname); - $apiObjects = static::getCurrentObjectOptions(); - $fkList = static::getFKList($GLOBALS['currentobject']["form"]); - foreach ($result as $key1 => $value1) - { - foreach ($fkList as $key2 => $value2) + if(count($result)) + { + $apiObjects = static::getCurrentObjectOptions(); + $fkList = static::getFKList($GLOBALS['currentobject']["form"]); + foreach ($result as $key1 => $value1) { - if(isset($value1->$key2) && - !(isset($GLOBALS['config']['apisObjects'][$apiname]["form"][$key2]["isArray"]) && - $GLOBALS['config']['apisObjects'][$apiname]["form"][$key2]["isArray"]==true)) + foreach ($fkList as $key2 => $value2) { - if(is_array($value2)) + if(isset($value1->$key2) && + !(isset($GLOBALS['config']['apisObjects'][$apiname]["form"][$key2]["isArray"]) && + $GLOBALS['config']['apisObjects'][$apiname]["form"][$key2]["isArray"]==true)) { - $cont = true; + if(is_array($value2)) + { + $cont = true; - foreach ($value2 as $key3 => $value3) - { - if($cont && isset($apiObjects[$value3][$value1->$key2])) + foreach ($value2 as $key3 => $value3) { - $current = $apiObjects[$value3][$value1->$key2]; - $result[$key1]->$key2 = Tools::convertToField($current,$value3); - $cont = false; + if($cont && isset($apiObjects[$value3][$value1->$key2])) + { + $current = $apiObjects[$value3][$value1->$key2]; + $result[$key1]->$key2 = Tools::convertToField($current,$value3); + $cont = false; + } } } - } - else - { - $current = $apiObjects[$value2][$value1->$key2]; - $result[$key1]->$key2 = Tools::convertToField($current,$value2); + else + { + $current = $apiObjects[$value2][$value1->$key2]; + $result[$key1]->$key2 = Tools::convertToField($current,$value2); + } } } } - } + } return static::parseResults($result); } diff --git a/app/Service/Colosseum/ApplicationService.php b/app/Service/Colosseum/ApplicationService.php index be7cbcb6ec12bca74c65b1dd664021ea41cecac2..8169e2bdafa069bba4d30aff77858d5d6019566a 100644 --- a/app/Service/Colosseum/ApplicationService.php +++ b/app/Service/Colosseum/ApplicationService.php @@ -75,27 +75,27 @@ class ApplicationService extends ColosseumService { $url ="/$apiname/$val"; //GET APPLICATION BY ID - $result = static::parseResult(static::getResponse($url,'GET', '')); + $result = parent::getSimpleOne($apiname,$val); //GET ApplicationComponent BY application id - $applicationComponents = static::parseResults(static::getResponse("/ac",'GET', '')); + $applicationComponents = parent::getSimpleAll("applicationComponent"); $result->applicationComponents = []; $result->applicationComponentsById = []; foreach ($applicationComponents as $key => $value) { if($result->id == $value->application) { - $component = static::parseResult(static::getResponse("/lifecycleComponent/".$value->component,'GET', '')); + $component = parent::getSimpleOne("component",$value->component); $value->components = [$component]; $result->applicationComponentsById[$value->id] = $value; $result->applicationComponents[] = $value; } - } //GET portReq BY application id - $portReqs = static::parseResults(static::getResponse("/portReq",'GET', '')); + $portReqs = parent::getSimpleAll("requiredPort"); $result->portReqs = []; + foreach ($portReqs as $key => $value) { if(array_key_exists ( $value->applicationComponent , $result->applicationComponentsById)) @@ -106,7 +106,7 @@ class ApplicationService extends ColosseumService } //GET portProv BY application id - $portProvs = static::parseResults(static::getResponse("/portProv",'GET', '')); + $portProvs = parent::getSimpleAll("providedPort"); $result->portProvs = []; foreach ($portProvs as $key => $value) { @@ -118,7 +118,7 @@ class ApplicationService extends ColosseumService } //GET COMMUCICATION by ... - $communications = static::parseResults(static::getResponse("/communication",'GET', '')); + $communications = parent::getSimpleAll("communication"); $result->communications = []; foreach ($communications as $key => $value) { @@ -131,5 +131,4 @@ class ApplicationService extends ColosseumService } return static::parseResult($result); } - } \ No newline at end of file diff --git a/app/Service/Colosseum/VirtualMachineService.php b/app/Service/Colosseum/VirtualMachineService.php index 23f3c1f68412442b35878d50ec84d2f571c5d44b..b6ce740c97888dbca7ee8b1dd25b67d6d5f277b2 100644 --- a/app/Service/Colosseum/VirtualMachineService.php +++ b/app/Service/Colosseum/VirtualMachineService.php @@ -30,12 +30,12 @@ class VirtualMachineService extends ColosseumService { $url ="/$apiname/$val"; //GET VM BY ID - $result = static::parseResult(static::getResponse($url,'GET', '', $apiname)); + $result = parent::getOne($apiname,$val); //GET monitorInstance $result->monitorInstances = []; //$result->monitorInstancesById = []; - $monitorInstances = static::parseResults(static::getResponse("/monitorInstance",'GET', '', $apiname)); + $monitorInstances = parent::getSimpleAll("monitorInstance"); foreach ($monitorInstances as $key => $value) { if($result->id == $value->virtualMachine) @@ -51,10 +51,10 @@ class VirtualMachineService extends ColosseumService { //"rawMonitor","composedMonitor","constantMonitor" - $rawMonitors = static::parseResults(static::getResponse("/rawMonitor",'GET', '', $apiname)); - $composedMonitors = static::parseResults(static::getResponse("/composedMonitor",'GET', '', $apiname)); - $constantMonitors = static::parseResults(static::getResponse("/constantMonitor",'GET', '', $apiname)); - $sensorDescriptions = static::parseResults(static::getResponse("/sensorDescription",'GET', '', $apiname)); + $rawMonitors = parent::getSimpleAll("rawMonitor"); + $composedMonitors = parent::getSimpleAll("composedMonitor"); + $constantMonitors = parent::getSimpleAll("constantMonitor"); + $sensorDescriptions = parent::getSimpleAll("sensorDescription"); $rawMonitorsById = Tools::getKeyValueArray($rawMonitors); $composedMonitorsById = Tools::getKeyValueArray($composedMonitors); diff --git a/app/Service/KairosService.php b/app/Service/KairosService.php index 84a4b7b17403c62d8deeb2cfc7b7a3c6316d541f..471ee8ae82073c410cfb77df7941245404dd8783 100644 --- a/app/Service/KairosService.php +++ b/app/Service/KairosService.php @@ -51,8 +51,14 @@ class KairosService extends RestService ) ); - $url = isset($chartInfo->apiEndpoint)?"http://".$chartInfo->apiEndpoint:$GLOBALS['config']['apis']['kairosapi']['url']; - $url = $url.":8080/api/v1/datapoints/query"; + if(isset($chartInfo->apiEndpoint)) + { + $url = "http://".$chartInfo->apiEndpoint.":8080/api/v1/datapoints/query"; + } + else + { + $url = $GLOBALS['config']['apis']['kairosapi']['url']; + } $option = array( 'metrics' => [$metric], diff --git a/config/metrics.json b/config/metrics.json index a1ea0af3f12f311e927a9721b554c6b5f2e3c345..6e33634d0da6b719b6718c4cf4c5276dd2ed5d6f 100644 --- a/config/metrics.json +++ b/config/metrics.json @@ -6,6 +6,12 @@ "start_relative":{"value":"1","unit":"hours"} }, "de.uniulm.omi.cloudiator.visor.sensors.MemoryUsageSensor" : + { + "aggregator": {"name":"avg"}, + "interval": {"value":"1","unit":"seconds"}, + "start_relative":{"value":"1","unit":"hours"} + }, + "default" : { "aggregator": {"name":"avg"}, "interval": {"value":"1","unit":"seconds"}, diff --git a/executionware-ui-apis.json b/executionware-ui-apis.json index bbf16d1fbad7f4e1fe836d5ee623bb28a3a5e76b..9b2b0b238d79cac8a3f7d3632b9afa987a426014 100644 --- a/executionware-ui-apis.json +++ b/executionware-ui-apis.json @@ -6,7 +6,7 @@ }, "kairosapi" : { "name": "kairosapi", - "url": "http://52.21.93.224", + "url": "http://52.21.93.224:8080/api/v1/datapoints/query", "controller": "KairosController", "router": "KairosRouter" } diff --git a/public/js/controller/Charts/ChartsController.js b/public/js/controller/Charts/ChartsController.js index 812a793d5ebf4f4d0360824134706241d1879496..e264f79cdadf6a74321914e9bd4217ff795762ac 100644 --- a/public/js/controller/Charts/ChartsController.js +++ b/public/js/controller/Charts/ChartsController.js @@ -24,6 +24,17 @@ crudControllers.controller('ChartsCtrl', function($scope,$interval,$http,ajaxFactory) { $scope.url = "kairosapi/charts"; + + $scope.init2 = function(id,metricName = null,apiEndpoint=null) + { + monitorInstance = {}; + monitorInstance.id = id; + monitorInstance.metricName = metricName; + monitorInstance.apiEndpoint = apiEndpoint; + $scope.init(monitorInstance); + } + + $scope.init = function(monitorInstance) { $scope.graphDetails = {}; diff --git a/public/partials/rawMonitor-detail.html b/public/partials/rawMonitor-detail.html index e2832aa4a9f5f2ca96d80e0a9b7dde13b602f992..89aea5a6401806380b41325267c778bb6593b367 100644 --- a/public/partials/rawMonitor-detail.html +++ b/public/partials/rawMonitor-detail.html @@ -9,7 +9,7 @@