diff --git a/ADAPT/Monitoring/DECIDE.json b/ADAPT/Monitoring/DECIDE.json new file mode 100644 index 0000000000000000000000000000000000000000..58285f8a89abc32d0d7c3c363e03e5edfa36fe30 --- /dev/null +++ b/ADAPT/Monitoring/DECIDE.json @@ -0,0 +1,952 @@ +{ + "id" : "db4630ad-00e0-4d7a-966b-44288416bf21", + "name" : "Socks-shop", + "description" : "A generic microservices application", + "version" : "0.2.2-alpha", + "highTechnologicalRisk" : false, + "nfrs" : [ { + "type" : "Performance", + "tags" : [ "Application" ], + "abstractValue" : "High", + "value" : 100.0, + "unit" : "milliseconds" + }, { + "type" : "Availability", + "tags" : [ "Application" ], + "abstractValue" : "Medium", + "value" : 98.0, + "unit" : "percentage" + } ], + "microservices" : [ { + "id" : "15f66315-bd6b-41d5-837a-a0b94e188978", + "name" : "Front-end", + "classification" : "Computing Public IP", + "stateful" : false, + "programmingLanguage" : "NodeJs", + "tags" : [ "Application" ], + "publicIP" : true, + "endpoints" : [ "http://mircroservice1.com/service" ], + "deploymentOrder" : 0, + "detachableResources" : [ { + "id" : "01420849-546d-4c34-950b-5d7171c495f5", + "name" : "none", + "db" : false, + "sql" : false, + "classification" : "storage" + } ] + }, { + "id" : "2ffa33ff-1f6f-4197-9199-48b7040386d2", + "name" : "Order", + "classification" : "Computing", + "stateful" : false, + "programmingLanguage" : "Java", + "tags" : [ "Application" ], + "publicIP" : false, + "endpoints" : [ "http://mircroservice1.com/service" ], + "deploymentOrder" : 0, + "detachableResources" : [ { + "id" : "69d265aa-fb64-43b2-934a-a87278827c9c", + "name" : "Mongo", + "db" : true, + "sql" : false, + "classification" : "db" + } ] + }, { + "id" : "71948dd0-f8d0-4bfc-b262-50dd04661013", + "name" : "Payment", + "classification" : "Computing", + "stateful" : false, + "programmingLanguage" : "Go", + "tags" : [ "Application" ], + "publicIP" : false, + "endpoints" : [ "http://mircroservice1.com/service" ], + "deploymentOrder" : 0, + "detachableResources" : [ { + "id" : "7407e313-d2fc-44a9-8830-73c85d4d17c6", + "name" : "none", + "db" : false, + "sql" : false, + "classification" : "storage" + } ] + }, { + "id" : "0b7af2fb-52d9-435a-bb99-bd2b61ffa789", + "name" : "User", + "classification" : "Computing", + "stateful" : false, + "programmingLanguage" : "Go", + "tags" : [ "Application" ], + "publicIP" : false, + "endpoints" : [ "http://mircroservice1.com/service" ], + "deploymentOrder" : 0, + "detachableResources" : [ { + "id" : "d9bf985e-1a35-4d26-a499-b2fdc6830055", + "name" : "Mongo", + "db" : true, + "sql" : false, + "classification" : "db" + } ] + }, { + "id" : "52ee44fe-dcef-479d-a6f8-2b761cc65d07", + "name" : "Catalogue", + "classification" : "Computing", + "stateful" : false, + "programmingLanguage" : "Go", + "tags" : [ "Application" ], + "publicIP" : false, + "endpoints" : [ "http://mircroservice1.com/service" ], + "deploymentOrder" : 0, + "detachableResources" : [ { + "id" : "17151dde-ec54-488c-b9f1-638fd15b2c28", + "name" : "MySQL", + "db" : true, + "sql" : true, + "classification" : "db" + } ] + }, { + "id" : "0f53359b-bb7d-43bf-9c13-e944291e9ad4", + "name" : "Cart", + "classification" : "Computing", + "stateful" : false, + "programmingLanguage" : "Java", + "tags" : [ "Application" ], + "publicIP" : false, + "endpoints" : [ "http://mircroservice1.com/service" ], + "deploymentOrder" : 0, + "detachableResources" : [ { + "id" : "b6bfeb8d-f881-4e4f-9b0c-044506fd39d4", + "name" : "Mongo", + "db" : true, + "sql" : false, + "classification" : "db" + } ] + }, { + "id" : "de5d2442-09bc-4d59-99ff-ddfe5724fa5c", + "name" : "Shipping", + "classification" : "Computing", + "stateful" : false, + "programmingLanguage" : "Java", + "tags" : [ "Application" ], + "publicIP" : false, + "endpoints" : [ "http://mircroservice1.com/service" ], + "deploymentOrder" : 0, + "detachableResources" : [ { + "id" : "c57a1fbd-d0ef-43c4-912d-5b7a5d066320", + "name" : "RabbitMQ", + "db" : false, + "sql" : false, + "classification" : "queue system" + } ] + }, { + "id" : "eabad57d-7cae-4e2b-bebf-1d95b8534f53", + "name" : "Queue-Master", + "classification" : "Computing", + "stateful" : false, + "programmingLanguage" : "Java", + "tags" : [ "Application" ], + "publicIP" : false, + "endpoints" : [ "http://mircroservice1.com/service" ], + "deploymentOrder" : 0, + "detachableResources" : [ { + "id" : "e524abef-6814-4724-bad6-4ac048c917e0", + "name" : "none", + "db" : false, + "sql" : false, + "classification" : "storage" + } ] + } ], + "mcsla" : { + "sla" : { + "description" : "SockShop App Service Level Agreement", + "validityPeriod" : 0, + "objectives" : [ { + "termName" : "Availability", + "type" : "slo", + "value" : "99.8", + "unit" : "percentage", + "conditionStatement" : "greaterOrEqual", + "metrics" : [ { + "id" : "CSA_AV_001", + "scale" : "ratio", + "expression" : { + "expression" : "AVAILABILITY_AGGREGATION_SUMTYPE", + "expressionLanguage" : "predefined", + "unit" : "percentage" + }, + "underlyingMetrics" : [ { + "id" : "15f66315-bd6b-41d5-837a-a0b94e188978", + "scale" : "ratio", + "expression" : { + "expression" : "AVAILABILITY_MTBFMTTR", + "expressionLanguage" : "predefined", + "unit" : "percentage" + } + }, { + "id" : "2ffa33ff-1f6f-4197-9199-48b7040386d2", + "scale" : "ratio", + "expression" : { + "expression" : "AVAILABILITY_MTBFMTTR", + "expressionLanguage" : "predefined", + "unit" : "percentage" + } + }, { + "id" : "71948dd0-f8d0-4bfc-b262-50dd04661013", + "scale" : "ratio", + "expression" : { + "expression" : "AVAILABILITY_MTBFMTTR", + "expressionLanguage" : "predefined", + "unit" : "percentage" + } + }, { + "id" : "0b7af2fb-52d9-435a-bb99-bd2b61ffa789", + "scale" : "ratio", + "expression" : { + "expression" : "AVAILABILITY_MTBFMTTR", + "expressionLanguage" : "predefined", + "unit" : "percentage" + } + }, { + "id" : "52ee44fe-dcef-479d-a6f8-2b761cc65d07", + "scale" : "ratio", + "expression" : { + "expression" : "AVAILABILITY_MTBFMTTR", + "expressionLanguage" : "predefined", + "unit" : "percentage" + } + }, { + "id" : "0f53359b-bb7d-43bf-9c13-e944291e9ad4", + "scale" : "ratio", + "expression" : { + "expression" : "AVAILABILITY_MTBFMTTR", + "expressionLanguage" : "predefined", + "unit" : "percentage" + } + }, { + "id" : "de5d2442-09bc-4d59-99ff-ddfe5724fa5c", + "scale" : "ratio", + "expression" : { + "expression" : "AVAILABILITY_MTBFMTTR", + "expressionLanguage" : "predefined", + "unit" : "percentage" + } + }, { + "id" : "eabad57d-7cae-4e2b-bebf-1d95b8534f53", + "scale" : "ratio", + "expression" : { + "expression" : "AVAILABILITY_MTBFMTTR", + "expressionLanguage" : "predefined", + "unit" : "percentage" + } + } ] + } ] + }, { + "termName" : "Performance", + "type" : "slo", + "value" : "300.0", + "unit" : "millisecond", + "conditionStatement" : "lessOrEqual", + "metrics" : [ { + "id" : "CSA_PE_001", + "scale" : "ratio", + "expression" : { + "expression" : "AGGREGATION_MAXTYPE", + "expressionLanguage" : "predefined", + "unit" : "millisecond" + } + } ] + }, { + "termName" : "Location", + "type" : "sqo", + "value" : "europe", + "conditionStatement" : "equal" + }, { + "termName" : "Scalability", + "type" : "sqo", + "value" : "messageCount", + "conditionStatement" : "equal" + }, { + "termName" : "Cost", + "type" : "slo", + "value" : "10000.0", + "unit" : "euro", + "conditionStatement" : "less", + "metrics" : [ { + "id" : "CSA_CO_001", + "scale" : "ratio", + "expression" : { + "expression" : "AGGREGATION_SUMTYPE", + "expressionLanguage" : "predefined", + "unit" : "euro" + } + } ] + } ] + }, + "csSlas" : { + "15" : { + "description" : "C8_Germany", + "validityPeriod" : 0, + "coveredServices" : [ "Virtual Machine" ], + "objectives" : [ { + "termName" : "Region", + "type" : "sqo", + "value" : "Europe", + "conditionStatement" : "equal", + "metrics" : [ { + "id" : "CS15_001", + "descriptor" : "Location based on continents", + "scale" : "nominal", + "expression" : { + "expression" : "EMPTY", + "expressionLanguage" : "english" + } + } ] + }, { + "termName" : "Zone", + "type" : "sqo", + "value" : "Germany", + "conditionStatement" : "equal", + "metrics" : [ { + "id" : "CS15_001", + "descriptor" : "Location based on countries", + "scale" : "nominal", + "expression" : { + "expression" : "EMPTY", + "expressionLanguage" : "english" + } + } ] + }, { + "termName" : "Provider", + "type" : "sqo", + "value" : "Arsys", + "conditionStatement" : "equal", + "metrics" : [ { + "id" : "CS15_001", + "descriptor" : "Name of the cloud service provider", + "scale" : "nominal", + "expression" : { + "expression" : "EMPTY", + "expressionLanguage" : "english" + } + } ] + }, { + "termName" : "Availability", + "type" : "slo", + "value" : "99.9", + "unit" : "percentage", + "conditionStatement" : "greaterOrEqual", + "metrics" : [ { + "id" : "CS15_001", + "descriptor" : "Uptime during a time period", + "scale" : "ratio", + "expression" : { + "expression" : "AVAILABILITY_UPTIME_BC", + "expressionLanguage" : "predefined", + "unit" : "percentage" + } + } ] + }, { + "comment" : "Response time: Virtual Machine Performance", + "termName" : "Performance", + "type" : "slo", + "value" : "2", + "unit" : "millisecond", + "conditionStatement" : "lessOrEqual", + "metrics" : [ { + "id" : "CS15_001", + "descriptor" : "Response time for a request", + "scale" : "interval", + "expression" : { + "expression" : "EMPTY", + "expressionLanguage" : "predefined", + "unit" : "millisecond" + } + } ] + }, { + "comment" : "Legal Level/Certifications", + "termName" : "Legal Level", + "type" : "sqo", + "value" : "Legal Level 2", + "conditionStatement" : "equal", + "metrics" : [ { + "id" : "CS15_001", + "descriptor" : "Pre defined legal levels", + "scale" : "ordinal", + "expression" : { + "expression" : "EMPTY", + "expressionLanguage" : "english" + } + } ] + }, { + "termName" : "Cost", + "type" : "slo", + "value" : "150", + "unit" : "euro", + "conditionStatement" : "less", + "metrics" : [ { + "id" : "CS15_001", + "descriptor" : "Cost limitation", + "scale" : "ratio", + "expression" : { + "expression" : "EMPTY", + "expressionLanguage" : "predefined" + } + } ] + } ] + }, + "28" : { + "description" : "g3.8xlarge", + "validityPeriod" : 0, + "coveredServices" : [ "Virtual Machine" ], + "objectives" : [ { + "termName" : "Region", + "type" : "sqo", + "value" : "North America", + "conditionStatement" : "equal", + "metrics" : [ { + "id" : "CS28_001", + "descriptor" : "Location based on continents", + "scale" : "nominal", + "expression" : { + "expression" : "EMPTY", + "expressionLanguage" : "english" + } + } ] + }, { + "termName" : "Zone", + "type" : "sqo", + "value" : "United States", + "conditionStatement" : "equal", + "metrics" : [ { + "id" : "CS28_001", + "descriptor" : "Location based on countries", + "scale" : "nominal", + "expression" : { + "expression" : "EMPTY", + "expressionLanguage" : "english" + } + } ] + }, { + "termName" : "Provider", + "type" : "sqo", + "value" : "Amazon", + "conditionStatement" : "equal", + "metrics" : [ { + "id" : "CS28_001", + "descriptor" : "Name of the cloud service provider", + "scale" : "nominal", + "expression" : { + "expression" : "EMPTY", + "expressionLanguage" : "english" + } + } ] + }, { + "termName" : "Availability", + "type" : "slo", + "value" : "99.8", + "unit" : "percentage", + "conditionStatement" : "greaterOrEqual", + "metrics" : [ { + "id" : "CS28_001", + "descriptor" : "Uptime during a time period", + "scale" : "ratio", + "expression" : { + "expression" : "AVAILABILITY_UPTIME_BC", + "expressionLanguage" : "predefined", + "unit" : "percentage" + } + } ] + }, { + "comment" : "Response time: Virtual Machine Performance", + "termName" : "Performance", + "type" : "slo", + "value" : "2", + "unit" : "millisecond", + "conditionStatement" : "lessOrEqual", + "metrics" : [ { + "id" : "CS28_001", + "descriptor" : "Response time for a request", + "scale" : "interval", + "expression" : { + "expression" : "EMPTY", + "expressionLanguage" : "predefined", + "unit" : "millisecond" + } + } ] + }, { + "comment" : "Legal Level/Certifications", + "termName" : "Legal Level", + "type" : "sqo", + "value" : "Legal Level 2", + "conditionStatement" : "equal", + "metrics" : [ { + "id" : "CS28_001", + "descriptor" : "Pre defined legal levels", + "scale" : "ordinal", + "expression" : { + "expression" : "EMPTY", + "expressionLanguage" : "english" + } + } ] + }, { + "termName" : "Cost", + "type" : "slo", + "value" : "2209", + "unit" : "euro", + "conditionStatement" : "less", + "metrics" : [ { + "id" : "CS28_001", + "descriptor" : "Cost limitation", + "scale" : "ratio", + "expression" : { + "expression" : "EMPTY", + "expressionLanguage" : "predefined" + } + } ] + } ] + }, + "38" : { + "description" : "A2v2", + "validityPeriod" : 0, + "coveredServices" : [ "Virtual Machine" ], + "objectives" : [ { + "termName" : "Region", + "type" : "sqo", + "value" : "Europe", + "conditionStatement" : "equal", + "metrics" : [ { + "id" : "CS38_001", + "descriptor" : "Location based on continents", + "scale" : "nominal", + "expression" : { + "expression" : "EMPTY", + "expressionLanguage" : "english" + } + } ] + }, { + "termName" : "Zone", + "type" : "sqo", + "value" : "Ireland", + "conditionStatement" : "equal", + "metrics" : [ { + "id" : "CS38_001", + "descriptor" : "Location based on countries", + "scale" : "nominal", + "expression" : { + "expression" : "EMPTY", + "expressionLanguage" : "english" + } + } ] + }, { + "termName" : "Provider", + "type" : "sqo", + "value" : "Azure", + "conditionStatement" : "equal", + "metrics" : [ { + "id" : "CS38_001", + "descriptor" : "Name of the cloud service provider", + "scale" : "nominal", + "expression" : { + "expression" : "EMPTY", + "expressionLanguage" : "english" + } + } ] + }, { + "termName" : "Availability", + "type" : "slo", + "value" : "95", + "unit" : "percentage", + "conditionStatement" : "greaterOrEqual", + "metrics" : [ { + "id" : "CS38_001", + "descriptor" : "Uptime during a time period", + "scale" : "ratio", + "expression" : { + "expression" : "AVAILABILITY_UPTIME_BC", + "expressionLanguage" : "predefined", + "unit" : "percentage" + } + } ] + }, { + "comment" : "Response time: Virtual Machine Performance", + "termName" : "Performance", + "type" : "slo", + "value" : "5", + "unit" : "millisecond", + "conditionStatement" : "lessOrEqual", + "metrics" : [ { + "id" : "CS38_001", + "descriptor" : "Response time for a request", + "scale" : "interval", + "expression" : { + "expression" : "EMPTY", + "expressionLanguage" : "predefined", + "unit" : "millisecond" + } + } ] + }, { + "comment" : "Legal Level/Certifications", + "termName" : "Legal Level", + "type" : "sqo", + "value" : "Legal Level 2", + "conditionStatement" : "equal", + "metrics" : [ { + "id" : "CS38_001", + "descriptor" : "Pre defined legal levels", + "scale" : "ordinal", + "expression" : { + "expression" : "EMPTY", + "expressionLanguage" : "english" + } + } ] + }, { + "termName" : "Cost", + "type" : "slo", + "value" : "93,60", + "unit" : "euro", + "conditionStatement" : "less", + "metrics" : [ { + "id" : "CS38_001", + "descriptor" : "Cost limitation", + "scale" : "ratio", + "expression" : { + "expression" : "EMPTY", + "expressionLanguage" : "predefined" + } + } ] + } ] + } + } + }, + "containers" : [ { + "imageName" : "my-traefik", + "imageTag" : "1", + "dockerPrivateRegistryIp" : "54.221.168.175", + "dockerPrivateRegistryPort" : 8200, + "hostname" : "front-end", + "restart" : "always", + "command" : [ "--consul", "--consul.endpoint=54.221.168.175:8500", "--consul.prefix=Socks-shop/traefik" ], + "entrypoint" : [ "traefik" ], + "dockerHostNodeName" : "node-2", + "consulKvProviderNodeName" : "node-1", + "addConsulService" : 1, + "consulServicePort" : 80, + "addConsulTraefikRules" : 0, + "portMapping" : [ { + "hostPort" : "80", + "containerPort" : "80" + }, { + "hostPort" : "8082", + "containerPort" : "8082" + }, { + "hostPort" : "9411", + "containerPort" : "9411" + } ], + "endpoints" : [ { + "protocol" : "http", + "port" : 80 + } ], + "dockerPrivateRegistryPassword" : "d3cid3", + "containerName" : "traefik-private", + "dockerPrivateRegistryUser" : "decide-user" + }, { + "imageName" : "weaveworksdemos/catalogue", + "imageTag" : "latest", + "hostname" : "catalogue", + "restart" : "always", + "dockerHostNodeName" : "node-2", + "networks" : [ "catalogue-network" ], + "environment" : [ "ZIPKIN=http://TBD_zipkin-ip:8493/api/v1/spans" ], + "consulKvProviderNodeName" : "node-1", + "addConsulService" : 1, + "consulServicePort" : 8480, + "addConsulTraefikRules" : 1, + "portMapping" : [ { + "hostPort" : "8480", + "containerPort" : "80" + } ], + "endpoints" : [ { + "protocol" : "http", + "port" : 8480 + } ], + "containerName" : "catalogue" + }, { + "imageName" : "weaveworksdemos/catalogue-db", + "imageTag" : "latest", + "hostname" : "catalogue-db", + "restart" : "always", + "dockerHostNodeName" : "node-2", + "networks" : [ "catalogue-network" ], + "environment" : [ "MYSQL_ROOT_PASSWORD=$${MYSQL_ROOT_PASSWORD}", "MYSQL_ALLOW_EMPTY_PASSWORD=true", "MYSQL_DATABASE=socksdb" ], + "containerName" : "catalogue-db" + }, { + "imageName" : "weaveworksdemos/user-db", + "imageTag" : "latest", + "hostname" : "user-db", + "restart" : "always", + "dockerHostNodeName" : "node-1", + "networks" : [ "user-network" ], + "containerName" : "user-db" + }, { + "imageName" : "weaveworksdemos/user", + "imageTag" : "latest", + "hostname" : "user", + "restart" : "always", + "dockerHostNodeName" : "node-1", + "networks" : [ "user-network" ], + "environment" : [ "MONGO_HOST=user-db:27017" ], + "consulKvProviderNodeName" : "node-1", + "addConsulService" : 1, + "consulServicePort" : 8485, + "addConsulTraefikRules" : 1, + "portMapping" : [ { + "hostPort" : "8485", + "containerPort" : "80" + } ], + "endpoints" : [ { + "protocol" : "http", + "port" : 8485 + } ], + "containerName" : "user", + "hostMapping" : [ { + "ip" : "", + "referencedContainerName" : "traefik-private", + "host" : "zipkin" + } ] + }, { + "imageName" : "mongo", + "imageTag" : "latest", + "hostname" : "carts-db", + "restart" : "always", + "dockerHostNodeName" : "node-1", + "networks" : [ "carts-network" ], + "containerName" : "carts-db" + }, { + "imageName" : "weaveworksdemos/carts", + "imageTag" : "latest", + "hostname" : "user", + "restart" : "always", + "dockerHostNodeName" : "node-1", + "networks" : [ "carts-network" ], + "environment" : [ "JAVA_OPTS=-Xms64m -Xmx128m -XX:PermSize=32m -XX:MaxPermSize=64m -XX:+UseG1GC -Djava.security.egd=file:/dev/urandom", "ZIPKIN=TBD_traefik-ip" ], + "consulKvProviderNodeName" : "node-1", + "addConsulService" : 1, + "consulServicePort" : 8481, + "addConsulTraefikRules" : 1, + "portMapping" : [ { + "hostPort" : "8481", + "containerPort" : "80" + } ], + "endpoints" : [ { + "protocol" : "http", + "port" : 8481 + } ], + "containerName" : "carts" + }, { + "imageName" : "openzipkin/zipkin", + "imageTag" : "latest", + "hostname" : "zipkin", + "restart" : "always", + "dockerHostNodeName" : "node-1", + "environment" : [ "reschedule=on-node-failure" ], + "addConsulService" : 1, + "consulServicePort" : 9411, + "addConsulTraefikRules" : 1, + "portMapping" : [ { + "hostPort" : "8493", + "containerPort" : "9411" + } ], + "endpoints" : [ { + "protocol" : "http", + "port" : 9411 + } ], + "containerName" : "zipkin" + }, { + "imageName" : "weaveworksdemos/front-end", + "imageTag" : "latest", + "hostname" : "front-end", + "restart" : "always", + "dockerHostNodeName" : "node-2", + "addConsulService" : 1, + "consulServicePort" : 8479, + "addConsulTraefikRules" : 1, + "portMapping" : [ { + "hostPort" : "8479", + "containerPort" : "8079" + } ], + "endpoints" : [ { + "protocol" : "http", + "port" : 8479, + "skipRule" : 1, + "containerNameOverride" : "shop-front-end" + } ], + "containerName" : "front-end", + "hostMapping" : [ { + "ip" : "", + "referencedContainerName" : "traefik-private", + "host" : "catalogue" + }, { + "ip" : "", + "referencedContainerName" : "traefik-private", + "host" : "carts" + }, { + "ip" : "", + "referencedContainerName" : "traefik-private", + "host" : "user" + }, { + "ip" : "", + "referencedContainerName" : "zipkin", + "host" : "zipkin" + } ] + }, { + "imageName" : "weaveworksdemos/shipping", + "imageTag" : "latest", + "hostname" : "shipping", + "restart" : "always", + "dockerHostNodeName" : "node-2", + "networks" : [ "shipping-network" ], + "environment" : [ "ZIPKIN=http://TBD_zipkin-ip}" ], + "consulKvProviderNodeName" : "node-1", + "addConsulService" : 1, + "consulServicePort" : 8483, + "addConsulTraefikRules" : 1, + "portMapping" : [ { + "hostPort" : "8483", + "containerPort" : "80" + } ], + "endpoints" : [ { + "protocol" : "http", + "port" : 8483 + } ], + "containerName" : "shipping" + }, { + "imageName" : "weaveworksdemos/queue-master", + "imageTag" : "latest", + "hostname" : "queue-master", + "restart" : "always", + "dockerHostNodeName" : "node-2", + "networks" : [ "shipping-network" ], + "volumeMapping" : [ { + "hostPath" : "/var/run/docker.sock", + "containerPath" : "/var/run/docker.sock" + } ], + "containerName" : "queue-master" + }, { + "imageName" : "rabbitmq", + "imageTag" : "3.6.8", + "hostname" : "rabbitmq", + "restart" : "always", + "dockerHostNodeName" : "node-2", + "networks" : [ "shipping-network" ], + "containerName" : "rabbitmq" + }, { + "imageName" : "weaveworksdemos/orders", + "imageTag" : "latest", + "hostname" : "orders", + "restart" : "always", + "dockerHostNodeName" : "node-2", + "networks" : [ "orders-network" ], + "environment" : [ "ZIPKIN=http://TBD_zipkin-ip}" ], + "consulKvProviderNodeName" : "node-1", + "addConsulService" : 1, + "consulServicePort" : 8482, + "addConsulTraefikRules" : 1, + "portMapping" : [ { + "hostPort" : "8482", + "containerPort" : "80" + } ], + "endpoints" : [ { + "protocol" : "http", + "port" : 8482 + } ], + "containerName" : "orders" + }, { + "imageName" : "mongo", + "imageTag" : "latest", + "hostname" : "orders-db", + "restart" : "always", + "dockerHostNodeName" : "node-2", + "networks" : [ "orders-network" ], + "containerName" : "orders-db" + }, { + "imageName" : "weaveworksdemos/payment", + "imageTag" : "latest", + "hostname" : "payment", + "restart" : "always", + "dockerHostNodeName" : "node-2", + "environment" : [ "ZIPKIN=http://TBD_zipkin-ip}", "reschedule=on-node-failure" ], + "consulKvProviderNodeName" : "node-1", + "addConsulService" : 1, + "consulServicePort" : 8484, + "addConsulTraefikRules" : 1, + "portMapping" : [ { + "hostPort" : "8484", + "containerPort" : "80" + } ], + "endpoints" : [ { + "protocol" : "http", + "port" : 8484 + } ], + "containerName" : "payment" + } ], + "virtualMachines" : [ { + "vmSoftwareId" : "21b7ebed-5076-43b6-8351-0e06cf16eedc", + "vmResourceId" : "27b1fb7b-2fd9-4042-8902-e4996e0bc420", + "vmRegionId" : "d112253a-951f-417a-a1f1-3a892bf35a45", + "instanceTypeId" : "f554e8a1-29d8-48e5-bd68-c01417576628", + "keyPairId" : "dbe5cc42-1f33-4ca4-b761-aec1c46a76fe", + "dockerPrivateRegistryIp" : "54.221.168.175", + "dockerHostNodeName" : "node-1", + "dockerHostPublicIp" : "82.223.100.123", + "vmUser" : "root", + "openedPort" : "22,80,8000-9000,9411", + "dockerPrivateRegistryPort" : "8200" + }, { + "vmSoftwareId" : "21b7ebed-5076-43b6-8351-0e06cf16eedc", + "vmResourceId" : "27b1fb7b-2fd9-4042-8902-e4996e0bc420", + "vmRegionId" : "d112253a-951f-417a-a1f1-3a892bf35a45", + "instanceTypeId" : "f554e8a1-29d8-48e5-bd68-c01417576628", + "keyPairId" : "dbe5cc42-1f33-4ca4-b761-aec1c46a76fe", + "dockerPrivateRegistryIp" : "54.221.168.175", + "dockerHostNodeName" : "node-2", + "dockerHostPublicIp" : "82.223.2.216", + "vmUser" : "root", + "openedPort" : "22,80,8000-9000,9411", + "dockerPrivateRegistryPort" : "8200" + } ], + "recommendedPatterns" : [ { + "title" : "Resiliency Management Process", + "uriRef" : "http://decideh2020.eu/resources/patterns/resiliency-management-process", + "tags" : [ "Application" ], + "positiveImpacts" : [ "availability" ], + "categories" : [ "optimization" ], + "selected" : true + }, { + "title" : "Compliant Data Replication", + "uriRef" : "http://decideh2020.eu/resources/patterns/compliant-data-replication", + "tags" : [ "Application" ], + "positiveImpacts" : [ "location" ], + "categories" : [ "optimization", "deployment" ], + "selected" : true + }, { + "title" : "Elasticity Manager", + "uriRef" : "http://decideh2020.eu/resources/patterns/elasticity-manager", + "tags" : [ "Application" ], + "positiveImpacts" : [ "scalability" ], + "categories" : [ "deployment" ], + "selected" : true + } ], + "schema" : [ { + "microservices" : [ "[15f66315-bd6b-41d5-837a-a0b94e188978", " 2ffa33ff-1f6f-4197-9199-48b7040386d2", " 69d265aa-fb64-43b2-934a-a87278827c9c", " 71948dd0-f8d0-4bfc-b262-50dd04661013", " 52ee44fe-dcef-479d-a6f8-2b761cc65d07", " 17151dde-ec54-488c-b9f1-638fd15b2c28", " de5d2442-09bc-4d59-99ff-ddfe5724fa5c", " c57a1fbd-d0ef-43c4-912d-5b7a5d066320", " eabad57d-7cae-4e2b-bebf-1d95b8534f53]" ], + "csId" : "56", + "index" : 1689678579 + }, { + "microservices" : [ "[0b7af2fb-52d9-435a-bb99-bd2b61ffa789", " d9bf985e-1a35-4d26-a499-b2fdc6830055", " 0f53359b-bb7d-43bf-9c13-e944291e9ad4", " b6bfeb8d-f881-4e4f-9b0c-044506fd39d4]" ], + "csId" : "55", + "index" : 1689679104 + } ], + "monitoring" : { + "status" : true, + "urls" : [ "http://85.91.40.245:8093" ] + }, + "applicationInstanceId" : "f6229960-201c-4f56-af96-b4659a95299d", + "consulJoinIp" : "54.221.168.175" +} \ No newline at end of file diff --git a/ADAPT/Monitoring/eu.decideh2020.adapt.monitoring.server/.project b/ADAPT/Monitoring/eu.decideh2020.adapt.monitoring.server/.project new file mode 100644 index 0000000000000000000000000000000000000000..d60dd707afcb30029dd6b21440def801d0ae5b5a --- /dev/null +++ b/ADAPT/Monitoring/eu.decideh2020.adapt.monitoring.server/.project @@ -0,0 +1,23 @@ +<?xml version="1.0" encoding="UTF-8"?> +<projectDescription> + <name>eu.decideh2020.adapt.monitoring.server</name> + <comment></comment> + <projects> + </projects> + <buildSpec> + <buildCommand> + <name>org.eclipse.jdt.core.javabuilder</name> + <arguments> + </arguments> + </buildCommand> + <buildCommand> + <name>org.eclipse.m2e.core.maven2Builder</name> + <arguments> + </arguments> + </buildCommand> + </buildSpec> + <natures> + <nature>org.eclipse.jdt.core.javanature</nature> + <nature>org.eclipse.m2e.core.maven2Nature</nature> + </natures> +</projectDescription> diff --git a/ADAPT/Monitoring/eu.decideh2020.adapt.monitoring.server/.swagger-codegen-ignore b/ADAPT/Monitoring/eu.decideh2020.adapt.monitoring.server/.swagger-codegen-ignore new file mode 100644 index 0000000000000000000000000000000000000000..c5fa491b4c557bf997d5dd21797de782545dc9e5 --- /dev/null +++ b/ADAPT/Monitoring/eu.decideh2020.adapt.monitoring.server/.swagger-codegen-ignore @@ -0,0 +1,23 @@ +# Swagger Codegen Ignore +# Generated by swagger-codegen https://github.com/swagger-api/swagger-codegen + +# Use this file to prevent files from being overwritten by the generator. +# The patterns follow closely to .gitignore or .dockerignore. + +# As an example, the C# client generator defines ApiClient.cs. +# You can make changes and tell Swagger Codgen to ignore just this file by uncommenting the following line: +#ApiClient.cs + +# You can match any string of characters against a directory, file or extension with a single asterisk (*): +#foo/*/qux +# The above matches foo/bar/qux and foo/baz/qux, but not foo/bar/baz/qux + +# You can recursively match patterns against a directory, file or extension with a double asterisk (**): +#foo/**/qux +# This matches foo/bar/qux, foo/baz/qux, and foo/bar/baz/qux + +# You can also negate patterns with an exclamation (!). +# For example, you can ignore all files in a docs folder with the file extension .md: +#docs/*.md +# Then explicitly reverse the ignore rule for a single file: +#!docs/README.md diff --git a/ADAPT/Monitoring/eu.decideh2020.adapt.monitoring.server/.swagger-codegen/VERSION b/ADAPT/Monitoring/eu.decideh2020.adapt.monitoring.server/.swagger-codegen/VERSION new file mode 100644 index 0000000000000000000000000000000000000000..a6254504e40175d135cea7feb34ad31fa0d0bca3 --- /dev/null +++ b/ADAPT/Monitoring/eu.decideh2020.adapt.monitoring.server/.swagger-codegen/VERSION @@ -0,0 +1 @@ +2.3.1 \ No newline at end of file diff --git a/ADAPT/Monitoring/eu.decideh2020.adapt.monitoring.server/README.md b/ADAPT/Monitoring/eu.decideh2020.adapt.monitoring.server/README.md new file mode 100644 index 0000000000000000000000000000000000000000..0847c17f72aa4e17ce4e11421d3bf8781de1ca77 --- /dev/null +++ b/ADAPT/Monitoring/eu.decideh2020.adapt.monitoring.server/README.md @@ -0,0 +1,23 @@ +# Swagger Jersey generated server + +## Overview +This server was generated by the [swagger-codegen](https://github.com/swagger-api/swagger-codegen) project. By using the +[OpenAPI-Spec](https://github.com/swagger-api/swagger-core/wiki) from a remote server, you can easily generate a server stub. This +is an example of building a swagger-enabled JAX-RS server. + +This example uses the [JAX-RS](https://jax-rs-spec.java.net/) framework. + +To run the server, please execute the following: + +``` +mvn clean package jetty:run +``` + +You can then view the swagger listing here: + +``` +http://localhost:8080/monitoringmanager/swagger.json +``` + +Note that if you have configured the `host` to be something other than localhost, the calls through +swagger-ui will be directed to that host and not localhost! \ No newline at end of file diff --git a/ADAPT/Monitoring/eu.decideh2020.adapt.monitoring.server/pom.xml b/ADAPT/Monitoring/eu.decideh2020.adapt.monitoring.server/pom.xml index 0e7fba1f422a28bb48b222ef5df8c21a96105912..ce06ad47d9059ec723ce013834cc6a3c2ffc71ef 100644 --- a/ADAPT/Monitoring/eu.decideh2020.adapt.monitoring.server/pom.xml +++ b/ADAPT/Monitoring/eu.decideh2020.adapt.monitoring.server/pom.xml @@ -3,9 +3,8 @@ <groupId>eu.decideh2020</groupId> <artifactId>seu.decideh2020.adapt.monitoring.server</artifactId> <packaging>jar</packaging> - <name>swagger-jaxrs-server</name> + <name>adapt.monitoring.server</name> <version>1.0.0</version> - <licenses> <license> <name>Unlicense</name> @@ -13,7 +12,6 @@ <distribution>repo</distribution> </license> </licenses> - <build> <sourceDirectory>src/main/java</sourceDirectory> <plugins> @@ -99,6 +97,21 @@ </resources> </build> <dependencies> + <!-- <dependency> + <groupId>eu.decideh2020</groupId> + <artifactId>eu.decideh2020.ACSmI.monitoring.client</artifactId> + <version>1.0.0</version> +</dependency>--> + <!-- <dependency> + <groupId>eu.decideh2020</groupId> + <artifactId>eu.decideh2020.ACSmI.monitoring.client</artifactId> + <version>1.0.0</version> +</dependency>--> +<dependency> + <groupId>eu.decideh2020</groupId> + <artifactId>eu.decideh2020.telegraf.configparser</artifactId> + <version>0.0.1-SNAPSHOT</version> +</dependency> <dependency> <groupId>eu.DECIDEh2020</groupId> <artifactId>mcsla-core</artifactId> @@ -151,12 +164,12 @@ <dependency> <groupId>com.fasterxml.jackson.datatype</groupId> <artifactId>jackson-datatype-joda</artifactId> - <version>${jackson-version}</version> + <version>${jackson-jaxrs-version}</version> </dependency> <dependency> <groupId>com.fasterxml.jackson.jaxrs</groupId> <artifactId>jackson-jaxrs-json-provider</artifactId> - <version>${jackson-version}</version> + <version>${jackson-jaxrs-version}</version> </dependency> <!-- Base64 encoding that works in both JVM and Android --> <dependency> @@ -187,10 +200,12 @@ <java.version>1.7</java.version> <maven.compiler.source>${java.version}</maven.compiler.source> <maven.compiler.target>${java.version}</maven.compiler.target> - <swagger-core-version>1.5.15</swagger-core-version> + <swagger-core-version>1.5.18</swagger-core-version> <jetty-version>9.2.9.v20150224</jetty-version> <jersey2-version>2.22.2</jersey2-version> - <jackson-version>2.8.9</jackson-version> + <cxf-version>3.1.11</cxf-version> + <!-- <jackson-version>2.8.9</jackson-version> --> + <jackson-jaxrs-version>2.9.1</jackson-jaxrs-version> <junit-version>4.12</junit-version> <logback-version>1.1.7</logback-version> <servlet-api-version>2.5</servlet-api-version> diff --git a/ADAPT/Monitoring/eu.decideh2020.adapt.monitoring.server/src/gen/java/eu/decideh2020/adapt/monitoring/server/api/ApiApi.java b/ADAPT/Monitoring/eu.decideh2020.adapt.monitoring.server/src/gen/java/eu/decideh2020/adapt/monitoring/server/api/ApiApi.java new file mode 100644 index 0000000000000000000000000000000000000000..1d5b3d0e27c2bcbb1c5ce2d78ecc05ff090055ec --- /dev/null +++ b/ADAPT/Monitoring/eu.decideh2020.adapt.monitoring.server/src/gen/java/eu/decideh2020/adapt/monitoring/server/api/ApiApi.java @@ -0,0 +1,158 @@ +package eu.decideh2020.adapt.monitoring.server.api; + +import io.swagger.annotations.ApiParam; +import io.swagger.jaxrs.*; + +import java.util.Map; +import java.util.List; +import java.io.InputStream; + +import org.glassfish.jersey.media.multipart.FormDataContentDisposition; +import org.glassfish.jersey.media.multipart.FormDataParam; + +import eu.decideh2020.adapt.monitoring.server.api.ApiApiService; +import eu.decideh2020.adapt.monitoring.server.api.NotFoundException; +import eu.decideh2020.adapt.monitoring.server.api.factories.ApiApiServiceFactory; +import eu.decideh2020.adapt.monitoring.server.model.*; + +import javax.servlet.ServletConfig; +import javax.ws.rs.core.Context; +import javax.ws.rs.core.Response; +import javax.ws.rs.core.SecurityContext; +import javax.ws.rs.*; +import javax.validation.constraints.*; + +@Path("/api") + + +@io.swagger.annotations.Api(description = "the api API") +@javax.annotation.Generated(value = "io.swagger.codegen.languages.JavaJerseyServerCodegen", date = "2018-03-26T08:06:54.399Z") +public class ApiApi { + private final ApiApiService delegate; + + public ApiApi(@Context ServletConfig servletContext) { + ApiApiService delegate = null; + + if (servletContext != null) { + String implClass = servletContext.getInitParameter("ApiApi.implementation"); + if (implClass != null && !"".equals(implClass.trim())) { + try { + delegate = (ApiApiService) Class.forName(implClass).newInstance(); + } catch (Exception e) { + throw new RuntimeException(e); + } + } + } + + if (delegate == null) { + delegate = ApiApiServiceFactory.getApiApi(); + } + + this.delegate = delegate; + } + + @POST + @Path("/alert") + @Consumes({ "alert/json" }) + @Produces({ "*/*" }) + @io.swagger.annotations.ApiOperation(value = "createAlert", notes = "Creates an alert to be included in ADAPT monitoring", response = Alert.class, tags={ "alert", }) + @io.swagger.annotations.ApiResponses(value = { + @io.swagger.annotations.ApiResponse(code = 200, message = "Alert Created", response = Alert.class), + + @io.swagger.annotations.ApiResponse(code = 401, message = "Unauthorized", response = Void.class) }) + public Response createAlertUsingPOST(@ApiParam(value = "" ,required=true) Alert alert +,@Context SecurityContext securityContext) + throws NotFoundException { + return delegate.createAlertUsingPOST(alert,securityContext); + } + + @POST + @Path("/applications") + @Consumes({ "application/json" }) + @Produces({ "*/*" }) + @io.swagger.annotations.ApiOperation(value = "createApplication", notes = "Creates an application to be included in ADAPT monitoring", response = Application.class, tags={ "application", }) + @io.swagger.annotations.ApiResponses(value = { + @io.swagger.annotations.ApiResponse(code = 200, message = "Application monitoring Created", response = Application.class), + + @io.swagger.annotations.ApiResponse(code = 401, message = "Unauthorized", response = Void.class), + + @io.swagger.annotations.ApiResponse(code = 403, message = "Forbidden", response = Void.class), + + @io.swagger.annotations.ApiResponse(code = 404, message = "Not Found", response = Void.class) }) + public Response createApplicationUsingPOST(@ApiParam(value = "" ,required=true) Application application +,@Context SecurityContext securityContext) + throws NotFoundException { + return delegate.createApplicationUsingPOST(application,securityContext); + } + @DELETE + @Path("/applications/{appdescuri}") + @Consumes({ "application/json" }) + @Produces({ "*/*" }) + @io.swagger.annotations.ApiOperation(value = "deleteApplication", notes = "", response = Void.class, tags={ "application", }) + @io.swagger.annotations.ApiResponses(value = { + @io.swagger.annotations.ApiResponse(code = 200, message = "App deleted form the monitoring list", response = Void.class), + + @io.swagger.annotations.ApiResponse(code = 204, message = "No Content", response = Void.class), + + @io.swagger.annotations.ApiResponse(code = 401, message = "Unauthorized", response = Void.class), + + @io.swagger.annotations.ApiResponse(code = 403, message = "Forbidden", response = Void.class) }) + public Response deleteApplicationUsingDELETE(@ApiParam(value = "id",required=true) @PathParam("appdescuri") String appdescuri +,@Context SecurityContext securityContext) + throws NotFoundException { + return delegate.deleteApplicationUsingDELETE(appdescuri,securityContext); + } + @GET + @Path("/applications") + @Consumes({ "application/json" }) + @Produces({ "*/*" }) + @io.swagger.annotations.ApiOperation(value = "getAllApplications", notes = "Gets the list of all the applications in ADAPT monitoring, including their id and the status", response = Application.class, responseContainer = "List", tags={ "application", }) + @io.swagger.annotations.ApiResponses(value = { + @io.swagger.annotations.ApiResponse(code = 200, message = "the list of simulations is being returned", response = Application.class, responseContainer = "List"), + + @io.swagger.annotations.ApiResponse(code = 401, message = "Unauthorized", response = Void.class), + + @io.swagger.annotations.ApiResponse(code = 403, message = "Forbidden", response = Void.class), + + @io.swagger.annotations.ApiResponse(code = 404, message = "Not Found", response = Void.class) }) + public Response getAllApplicationsUsingGET(@Context SecurityContext securityContext) + throws NotFoundException { + return delegate.getAllApplicationsUsingGET(securityContext); + } + @GET + @Path("/applications/{appdescuri}") + @Consumes({ "application/json" }) + @Produces({ "*/*" }) + @io.swagger.annotations.ApiOperation(value = "getApplicationstatus", notes = "Gets the status wrt monitoring of a given application", response = Application.class, tags={ "application", }) + @io.swagger.annotations.ApiResponses(value = { + @io.swagger.annotations.ApiResponse(code = 200, message = "Specific app monitoring is returned", response = Application.class), + + @io.swagger.annotations.ApiResponse(code = 401, message = "Unauthorized", response = Void.class), + + @io.swagger.annotations.ApiResponse(code = 403, message = "Forbidden", response = Void.class), + + @io.swagger.annotations.ApiResponse(code = 404, message = "Not Found", response = Void.class) }) + public Response getApplicationUsingGET(@ApiParam(value = "id",required=true) @PathParam("appdescuri") String appdescuri +,@Context SecurityContext securityContext) + throws NotFoundException { + return delegate.getApplicationUsingGET(appdescuri,securityContext); + } + @PUT + @Path("/applications/{appdescuri}") + @Consumes({ "application/json" }) + @Produces({ "*/*" }) + @io.swagger.annotations.ApiOperation(value = "updateApplication", notes = "Updates the monitoring status of a given application", response = Application.class, tags={ "application", }) + @io.swagger.annotations.ApiResponses(value = { + @io.swagger.annotations.ApiResponse(code = 200, message = "Status updated", response = Application.class), + + @io.swagger.annotations.ApiResponse(code = 401, message = "Unauthorized", response = Void.class), + + @io.swagger.annotations.ApiResponse(code = 403, message = "Forbidden", response = Void.class), + + @io.swagger.annotations.ApiResponse(code = 404, message = "Not Found", response = Void.class) }) + public Response updateApplicationUsingPUT(@ApiParam(value = "id",required=true) @PathParam("appdescuri") String appdescuri +,@Context SecurityContext securityContext) + throws NotFoundException { + return delegate.updateApplicationUsingPUT(appdescuri,securityContext); + } +} diff --git a/ADAPT/Monitoring/eu.decideh2020.adapt.monitoring.server/src/gen/java/eu/decideh2020/adapt/monitoring/server/api/ApiApiService.java b/ADAPT/Monitoring/eu.decideh2020.adapt.monitoring.server/src/gen/java/eu/decideh2020/adapt/monitoring/server/api/ApiApiService.java new file mode 100644 index 0000000000000000000000000000000000000000..4447f9079c89584a32ea6a15cf3bb4a490cabae0 --- /dev/null +++ b/ADAPT/Monitoring/eu.decideh2020.adapt.monitoring.server/src/gen/java/eu/decideh2020/adapt/monitoring/server/api/ApiApiService.java @@ -0,0 +1,22 @@ +package eu.decideh2020.adapt.monitoring.server.api; + +import org.glassfish.jersey.media.multipart.FormDataContentDisposition; + +import eu.decideh2020.adapt.monitoring.server.api.*; +import eu.decideh2020.adapt.monitoring.server.model.*; + +import java.util.List; +import java.io.InputStream; + +import javax.ws.rs.core.Response; +import javax.ws.rs.core.SecurityContext; +import javax.validation.constraints.*; +@javax.annotation.Generated(value = "io.swagger.codegen.languages.JavaJerseyServerCodegen", date = "2018-03-26T08:06:54.399Z") +public abstract class ApiApiService { + public abstract Response createAlertUsingPOST(Alert alert,SecurityContext securityContext) throws NotFoundException; + public abstract Response createApplicationUsingPOST(Application application,SecurityContext securityContext) throws NotFoundException; + public abstract Response deleteApplicationUsingDELETE(String appdescuri,SecurityContext securityContext) throws NotFoundException; + public abstract Response getAllApplicationsUsingGET(SecurityContext securityContext) throws NotFoundException; + public abstract Response getApplicationUsingGET(String appdescuri,SecurityContext securityContext) throws NotFoundException; + public abstract Response updateApplicationUsingPUT(String appdescuri,SecurityContext securityContext) throws NotFoundException; +} diff --git a/ADAPT/Monitoring/eu.decideh2020.adapt.monitoring.server/src/gen/java/eu/decideh2020/adapt/monitoring/server/api/ApiException.java b/ADAPT/Monitoring/eu.decideh2020.adapt.monitoring.server/src/gen/java/eu/decideh2020/adapt/monitoring/server/api/ApiException.java new file mode 100644 index 0000000000000000000000000000000000000000..fede0a506ec87d6f8613e7f7d073f902c1f224f4 --- /dev/null +++ b/ADAPT/Monitoring/eu.decideh2020.adapt.monitoring.server/src/gen/java/eu/decideh2020/adapt/monitoring/server/api/ApiException.java @@ -0,0 +1,10 @@ +package eu.decideh2020.adapt.monitoring.server.api; + +@javax.annotation.Generated(value = "io.swagger.codegen.languages.JavaJerseyServerCodegen", date = "2018-05-15T15:32:55.738Z") +public class ApiException extends Exception{ + private int code; + public ApiException (int code, String msg) { + super(msg); + this.code = code; + } +} diff --git a/ADAPT/Monitoring/eu.decideh2020.adapt.monitoring.server/src/gen/java/eu/decideh2020/adapt/monitoring/server/api/ApiOriginFilter.java b/ADAPT/Monitoring/eu.decideh2020.adapt.monitoring.server/src/gen/java/eu/decideh2020/adapt/monitoring/server/api/ApiOriginFilter.java new file mode 100644 index 0000000000000000000000000000000000000000..eabdb0db17cd363c086063423b77f684322bd45d --- /dev/null +++ b/ADAPT/Monitoring/eu.decideh2020.adapt.monitoring.server/src/gen/java/eu/decideh2020/adapt/monitoring/server/api/ApiOriginFilter.java @@ -0,0 +1,22 @@ +package eu.decideh2020.adapt.monitoring.server.api; + +import java.io.IOException; + +import javax.servlet.*; +import javax.servlet.http.HttpServletResponse; + +@javax.annotation.Generated(value = "io.swagger.codegen.languages.JavaJerseyServerCodegen", date = "2018-05-15T15:32:55.738Z") +public class ApiOriginFilter implements javax.servlet.Filter { + public void doFilter(ServletRequest request, ServletResponse response, + FilterChain chain) throws IOException, ServletException { + HttpServletResponse res = (HttpServletResponse) response; + res.addHeader("Access-Control-Allow-Origin", "*"); + res.addHeader("Access-Control-Allow-Methods", "GET, POST, DELETE, PUT"); + res.addHeader("Access-Control-Allow-Headers", "Content-Type"); + chain.doFilter(request, response); + } + + public void destroy() {} + + public void init(FilterConfig filterConfig) throws ServletException {} +} \ No newline at end of file diff --git a/ADAPT/Monitoring/eu.decideh2020.adapt.monitoring.server/src/gen/java/eu/decideh2020/adapt/monitoring/server/api/ApiResponseMessage.java b/ADAPT/Monitoring/eu.decideh2020.adapt.monitoring.server/src/gen/java/eu/decideh2020/adapt/monitoring/server/api/ApiResponseMessage.java new file mode 100644 index 0000000000000000000000000000000000000000..4100ffa2a17205534ebe0e81433f0b5b6b333180 --- /dev/null +++ b/ADAPT/Monitoring/eu.decideh2020.adapt.monitoring.server/src/gen/java/eu/decideh2020/adapt/monitoring/server/api/ApiResponseMessage.java @@ -0,0 +1,69 @@ +package eu.decideh2020.adapt.monitoring.server.api; + +import javax.xml.bind.annotation.XmlTransient; + +@javax.xml.bind.annotation.XmlRootElement +@javax.annotation.Generated(value = "io.swagger.codegen.languages.JavaJerseyServerCodegen", date = "2018-05-15T15:32:55.738Z") +public class ApiResponseMessage { + public static final int ERROR = 1; + public static final int WARNING = 2; + public static final int INFO = 3; + public static final int OK = 4; + public static final int TOO_BUSY = 5; + + int code; + String type; + String message; + + public ApiResponseMessage(){} + + public ApiResponseMessage(int code, String message){ + this.code = code; + switch(code){ + case ERROR: + setType("error"); + break; + case WARNING: + setType("warning"); + break; + case INFO: + setType("info"); + break; + case OK: + setType("ok"); + break; + case TOO_BUSY: + setType("too busy"); + break; + default: + setType("unknown"); + break; + } + this.message = message; + } + + @XmlTransient + public int getCode() { + return code; + } + + public void setCode(int code) { + this.code = code; + } + + public String getType() { + return type; + } + + public void setType(String type) { + this.type = type; + } + + public String getMessage() { + return message; + } + + public void setMessage(String message) { + this.message = message; + } +} diff --git a/ADAPT/Monitoring/eu.decideh2020.adapt.monitoring.server/src/gen/java/eu/decideh2020/adapt/monitoring/server/api/JacksonJsonProvider.java b/ADAPT/Monitoring/eu.decideh2020.adapt.monitoring.server/src/gen/java/eu/decideh2020/adapt/monitoring/server/api/JacksonJsonProvider.java new file mode 100644 index 0000000000000000000000000000000000000000..8fc1a1abc3606a7057d87e9492179d06081f40f4 --- /dev/null +++ b/ADAPT/Monitoring/eu.decideh2020.adapt.monitoring.server/src/gen/java/eu/decideh2020/adapt/monitoring/server/api/JacksonJsonProvider.java @@ -0,0 +1,29 @@ +package eu.decideh2020.adapt.monitoring.server.api; + +import com.fasterxml.jackson.databind.DeserializationFeature; +import com.fasterxml.jackson.databind.ObjectMapper; +import com.fasterxml.jackson.databind.SerializationFeature; + +import com.fasterxml.jackson.datatype.joda.*; + +import com.fasterxml.jackson.jaxrs.json.JacksonJaxbJsonProvider; + +import javax.ws.rs.Produces; +import javax.ws.rs.core.MediaType; +import javax.ws.rs.ext.Provider; + +@Provider +@Produces({MediaType.APPLICATION_JSON}) +public class JacksonJsonProvider extends JacksonJaxbJsonProvider { + + public JacksonJsonProvider() { + + ObjectMapper objectMapper = new ObjectMapper() + .disable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES) + .disable(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS) + .registerModule(new JodaModule()) + .setDateFormat(new RFC3339DateFormat()); + + setMapper(objectMapper); + } +} \ No newline at end of file diff --git a/ADAPT/Monitoring/eu.decideh2020.adapt.monitoring.server/src/gen/java/eu/decideh2020/adapt/monitoring/server/api/NotFoundException.java b/ADAPT/Monitoring/eu.decideh2020.adapt.monitoring.server/src/gen/java/eu/decideh2020/adapt/monitoring/server/api/NotFoundException.java new file mode 100644 index 0000000000000000000000000000000000000000..1ef04e66a6424254543ba58501dfdf0d9fdf323b --- /dev/null +++ b/ADAPT/Monitoring/eu.decideh2020.adapt.monitoring.server/src/gen/java/eu/decideh2020/adapt/monitoring/server/api/NotFoundException.java @@ -0,0 +1,10 @@ +package eu.decideh2020.adapt.monitoring.server.api; + +@javax.annotation.Generated(value = "io.swagger.codegen.languages.JavaJerseyServerCodegen", date = "2018-03-26T08:06:54.399Z") +public class NotFoundException extends ApiException { + private int code; + public NotFoundException (int code, String msg) { + super(code, msg); + this.code = code; + } +} diff --git a/ADAPT/Monitoring/eu.decideh2020.adapt.monitoring.server/src/gen/java/eu/decideh2020/adapt/monitoring/server/api/RFC3339DateFormat.java b/ADAPT/Monitoring/eu.decideh2020.adapt.monitoring.server/src/gen/java/eu/decideh2020/adapt/monitoring/server/api/RFC3339DateFormat.java new file mode 100644 index 0000000000000000000000000000000000000000..507ad89f04ead00902cf83a6f3455494d36efcf9 --- /dev/null +++ b/ADAPT/Monitoring/eu.decideh2020.adapt.monitoring.server/src/gen/java/eu/decideh2020/adapt/monitoring/server/api/RFC3339DateFormat.java @@ -0,0 +1,19 @@ +package eu.decideh2020.adapt.monitoring.server.api; + +import com.fasterxml.jackson.databind.util.ISO8601DateFormat; +import com.fasterxml.jackson.databind.util.ISO8601Utils; + +import java.text.FieldPosition; +import java.util.Date; + +public class RFC3339DateFormat extends ISO8601DateFormat { + + // Same as ISO8601DateFormat but serializing milliseconds. + @Override + public StringBuffer format(Date date, StringBuffer toAppendTo, FieldPosition fieldPosition) { + String value = ISO8601Utils.format(date, true); + toAppendTo.append(value); + return toAppendTo; + } + +} \ No newline at end of file diff --git a/ADAPT/Monitoring/eu.decideh2020.adapt.monitoring.server/src/gen/java/eu/decideh2020/adapt/monitoring/server/api/StringUtil.java b/ADAPT/Monitoring/eu.decideh2020.adapt.monitoring.server/src/gen/java/eu/decideh2020/adapt/monitoring/server/api/StringUtil.java new file mode 100644 index 0000000000000000000000000000000000000000..26cc7210a6c81294233c0753ca1aabe85a3f9a28 --- /dev/null +++ b/ADAPT/Monitoring/eu.decideh2020.adapt.monitoring.server/src/gen/java/eu/decideh2020/adapt/monitoring/server/api/StringUtil.java @@ -0,0 +1,42 @@ +package eu.decideh2020.adapt.monitoring.server.api; + +@javax.annotation.Generated(value = "io.swagger.codegen.languages.JavaJerseyServerCodegen", date = "2018-03-26T08:06:54.399Z") +public class StringUtil { + /** + * Check if the given array contains the given value (with case-insensitive comparison). + * + * @param array The array + * @param value The value to search + * @return true if the array contains the value + */ + public static boolean containsIgnoreCase(String[] array, String value) { + for (String str : array) { + if (value == null && str == null) return true; + if (value != null && value.equalsIgnoreCase(str)) return true; + } + return false; + } + + /** + * Join an array of strings with the given separator. + * <p> + * Note: This might be replaced by utility method from commons-lang or guava someday + * if one of those libraries is added as dependency. + * </p> + * + * @param array The array of strings + * @param separator The separator + * @return the resulting string + */ + public static String join(String[] array, String separator) { + int len = array.length; + if (len == 0) return ""; + + StringBuilder out = new StringBuilder(); + out.append(array[0]); + for (int i = 1; i < len; i++) { + out.append(separator).append(array[i]); + } + return out.toString(); + } +} diff --git a/ADAPT/Monitoring/eu.decideh2020.adapt.monitoring.server/src/gen/java/eu/decideh2020/adapt/monitoring/server/model/Alert.java b/ADAPT/Monitoring/eu.decideh2020.adapt.monitoring.server/src/gen/java/eu/decideh2020/adapt/monitoring/server/model/Alert.java new file mode 100644 index 0000000000000000000000000000000000000000..fcc3a22d56059a2abf14073d4aa6c37b9447b34b --- /dev/null +++ b/ADAPT/Monitoring/eu.decideh2020.adapt.monitoring.server/src/gen/java/eu/decideh2020/adapt/monitoring/server/model/Alert.java @@ -0,0 +1,141 @@ +/* + * adapt monitoring API + * adapt monitoring API documentation.This API describes the methods to access the ADAPT monitoring functionalities + * + * OpenAPI spec version: 0.0.1 + * + * + * NOTE: This class is auto generated by the swagger code generator program. + * https://github.com/swagger-api/swagger-codegen.git + * Do not edit the class manually. + */ + + +package eu.decideh2020.adapt.monitoring.server.model; + +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import javax.validation.constraints.*; + +/** + * Alert + */ +@javax.annotation.Generated(value = "io.swagger.codegen.languages.JavaJerseyServerCodegen", date = "2018-05-02T12:11:42.283Z") +public class Alert { + @JsonProperty("alid") + private String alid = null; + + @JsonProperty("altype") + private String altype = null; + + @JsonProperty("appdescuri") + private String appdescuri = null; + + public Alert alid(String alid) { + this.alid = alid; + return this; + } + + /** + * Get alid + * @return alid + **/ + @JsonProperty("alid") + @ApiModelProperty(required = true, value = "") + @NotNull + public String getAlid() { + return alid; + } + + public void setAlid(String alid) { + this.alid = alid; + } + + public Alert altype(String altype) { + this.altype = altype; + return this; + } + + /** + * Get altype + * @return altype + **/ + @JsonProperty("altype") + @ApiModelProperty(required = true, value = "") + @NotNull + public String getAltype() { + return altype; + } + + public void setAltype(String altype) { + this.altype = altype; + } + + public Alert appdescuri(String appdescuri) { + this.appdescuri = appdescuri; + return this; + } + + /** + * Get appdescuri + * @return appdescuri + **/ + @JsonProperty("appdescuri") + @ApiModelProperty(required = true, value = "") + @NotNull + public String getAppdescuri() { + return appdescuri; + } + + public void setAppdescuri(String appdescuri) { + this.appdescuri = appdescuri; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + Alert alert = (Alert) o; + return Objects.equals(this.alid, alert.alid) && + Objects.equals(this.altype, alert.altype) && + Objects.equals(this.appdescuri, alert.appdescuri); + } + + @Override + public int hashCode() { + return Objects.hash(alid, altype, appdescuri); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class Alert {\n"); + + sb.append(" alid: ").append(toIndentedString(alid)).append("\n"); + sb.append(" altype: ").append(toIndentedString(altype)).append("\n"); + sb.append(" appdescuri: ").append(toIndentedString(appdescuri)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} + diff --git a/ADAPT/Monitoring/eu.decideh2020.adapt.monitoring.server/src/gen/java/eu/decideh2020/adapt/monitoring/server/model/Application.java b/ADAPT/Monitoring/eu.decideh2020.adapt.monitoring.server/src/gen/java/eu/decideh2020/adapt/monitoring/server/model/Application.java new file mode 100644 index 0000000000000000000000000000000000000000..87ea243cf53c9361bdf1c4c2d23310b6fb49c224 --- /dev/null +++ b/ADAPT/Monitoring/eu.decideh2020.adapt.monitoring.server/src/gen/java/eu/decideh2020/adapt/monitoring/server/model/Application.java @@ -0,0 +1,187 @@ +/* + * adapt monitoring API + * adapt monitoring API documentation This API describes the methods to access the ADAPT monitoring functionalities. This version updates de methods that need monid. In this version these methods include the appdescuri in their body + * + * OpenAPI spec version: 0.0.1 + * + * + * NOTE: This class is auto generated by the swagger code generator program. + * https://github.com/swagger-api/swagger-codegen.git + * Do not edit the class manually. + */ + + +package eu.decideh2020.adapt.monitoring.server.model; + +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import javax.validation.constraints.*; + +/** + * Application + */ +@javax.annotation.Generated(value = "io.swagger.codegen.languages.JavaJerseyServerCodegen", date = "2018-03-26T08:06:54.399Z") +public class Application { + @JsonProperty("monid") + private String monid = null; + + @JsonProperty("appdescuri") + private String appdescuri = null; + + @JsonProperty("status") + private String status = null; + + @JsonProperty("user") + private String user = null; + + @JsonProperty("password") + private String password = null; + + public Application monid(String monid) { + this.monid = monid; + return this; + } + + /** + * Get monid + * @return monid + **/ + @JsonProperty("monid") + @ApiModelProperty(value = "") + public String getMonid() { + return monid; + } + + public void setMonid(String monid) { + this.monid = monid; + } + + public Application appdescuri(String appdescuri) { + this.appdescuri = appdescuri; + return this; + } + + /** + * Get appdescuri + * @return appdescuri + **/ + @JsonProperty("appdescuri") + @ApiModelProperty(required = true, value = "") + @NotNull + public String getAppdescuri() { + return appdescuri; + } + + public void setAppdescuri(String appdescuri) { + this.appdescuri = appdescuri; + } + + public Application status(String status) { + this.status = status; + return this; + } + + /** + * Get status + * @return status + **/ + @JsonProperty("status") + @ApiModelProperty(value = "") + public String getStatus() { + return status; + } + + public void setStatus(String status) { + this.status = status; + } + + public Application user(String user) { + this.user = user; + return this; + } + + /** + * Get user + * @return user + **/ + @JsonProperty("user") + @ApiModelProperty(value = "") + public String getUser() { + return user; + } + + public void setUser(String user) { + this.user = user; + } + + public Application password(String password) { + this.password = password; + return this; + } + + /** + * Get password + * @return password + **/ + @JsonProperty("password") + @ApiModelProperty(value = "") + public String getPassword() { + return password; + } + + public void setPassword(String password) { + this.password = password; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + Application application = (Application) o; + return Objects.equals(this.monid, application.monid) && + Objects.equals(this.appdescuri, application.appdescuri) && + Objects.equals(this.status, application.status) && + Objects.equals(this.user, application.user) && + Objects.equals(this.password, application.password); + } + + @Override + public int hashCode() { + return Objects.hash(monid, appdescuri, status, user, password); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class Application {\n"); + + sb.append(" monid: ").append(toIndentedString(monid)).append("\n"); + sb.append(" appdescuri: ").append(toIndentedString(appdescuri)).append("\n"); + sb.append(" status: ").append(toIndentedString(status)).append("\n"); + sb.append(" user: ").append(toIndentedString(user)).append("\n"); + sb.append(" password: ").append(toIndentedString(password)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} + diff --git a/ADAPT/Monitoring/eu.decideh2020.adapt.monitoring.server/src/main/java/eu/decideh2020/adapt/monitoring/server/api/Bootstrap.java b/ADAPT/Monitoring/eu.decideh2020.adapt.monitoring.server/src/main/java/eu/decideh2020/adapt/monitoring/server/api/Bootstrap.java new file mode 100644 index 0000000000000000000000000000000000000000..6d2029c0708a8d874154a98f01dc4ea9bd20558f --- /dev/null +++ b/ADAPT/Monitoring/eu.decideh2020.adapt.monitoring.server/src/main/java/eu/decideh2020/adapt/monitoring/server/api/Bootstrap.java @@ -0,0 +1,31 @@ +package eu.decideh2020.adapt.monitoring.server.api; + +import io.swagger.jaxrs.config.SwaggerContextService; +import io.swagger.models.*; + +import io.swagger.models.auth.*; + +import javax.servlet.http.HttpServlet; +import javax.servlet.ServletContext; +import javax.servlet.ServletConfig; +import javax.servlet.ServletException; + +public class Bootstrap extends HttpServlet { + @Override + public void init(ServletConfig config) throws ServletException { + Info info = new Info() + .title("Swagger Server") + .description("adapt monitoring API documentation") + .termsOfService("") + .contact(new Contact() + .email("")) + .license(new License() + .name("") + .url("http://unlicense.org")); + + ServletContext context = config.getServletContext(); + Swagger swagger = new Swagger().info(info); + + new SwaggerContextService().withServletConfig(config).updateSwagger(swagger); + } +} diff --git a/ADAPT/Monitoring/eu.decideh2020.adapt.monitoring.server/src/main/java/eu/decideh2020/adapt/monitoring/server/api/factories/ApiApiServiceFactory.java b/ADAPT/Monitoring/eu.decideh2020.adapt.monitoring.server/src/main/java/eu/decideh2020/adapt/monitoring/server/api/factories/ApiApiServiceFactory.java new file mode 100644 index 0000000000000000000000000000000000000000..79fc04ae943a31c8cf8cb14d3a6f334f7e4289ca --- /dev/null +++ b/ADAPT/Monitoring/eu.decideh2020.adapt.monitoring.server/src/main/java/eu/decideh2020/adapt/monitoring/server/api/factories/ApiApiServiceFactory.java @@ -0,0 +1,13 @@ +package eu.decideh2020.adapt.monitoring.server.api.factories; + +import eu.decideh2020.adapt.monitoring.server.api.ApiApiService; +import eu.decideh2020.adapt.monitoring.server.api.impl.ApiApiServiceImpl; + +@javax.annotation.Generated(value = "io.swagger.codegen.languages.JavaJerseyServerCodegen", date = "2018-03-26T08:06:54.399Z") +public class ApiApiServiceFactory { + private final static ApiApiService service = new ApiApiServiceImpl(); + + public static ApiApiService getApiApi() { + return service; + } +} diff --git a/ADAPT/Monitoring/eu.decideh2020.adapt.monitoring.server/src/main/java/eu/decideh2020/adapt/monitoring/server/api/impl/ApiApiServiceImpl.java b/ADAPT/Monitoring/eu.decideh2020.adapt.monitoring.server/src/main/java/eu/decideh2020/adapt/monitoring/server/api/impl/ApiApiServiceImpl.java index 946eace3b138f396524ff3d9e163c329dd53fc1d..139f8cb28ba9c13f12161006a400ee330bb9c2c3 100644 --- a/ADAPT/Monitoring/eu.decideh2020.adapt.monitoring.server/src/main/java/eu/decideh2020/adapt/monitoring/server/api/impl/ApiApiServiceImpl.java +++ b/ADAPT/Monitoring/eu.decideh2020.adapt.monitoring.server/src/main/java/eu/decideh2020/adapt/monitoring/server/api/impl/ApiApiServiceImpl.java @@ -19,6 +19,7 @@ CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFT OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. *Contributors (in alphabetical order): +*Alberto Molinuevo Tecnalia *Gorka Benguria Tecnalia *Iñaki Etxaniz Tecnalia *Juncal Alonso Tecnalia @@ -38,11 +39,10 @@ import javax.ws.rs.core.Response; import javax.ws.rs.core.SecurityContext; @javax.annotation.Generated(value = "io.swagger.codegen.languages.JavaJerseyServerCodegen", date = "2018-03-26T08:06:54.399Z") public class ApiApiServiceImpl extends ApiApiService { - //Creating a list for the application monitoring objects + //Creating a list for the application monitoring objects (check if this list is initialized every time the Post is generated), if so declare it as a static variable ArrayList<Application> AppMonitoringlist = new ArrayList<Application>(); //Creating a list for the alerts objects ArrayList<Alert> Alertlist = new ArrayList<Alert>(); - @Override public Response createApplicationUsingPOST(Application application, SecurityContext securityContext) throws NotFoundException { //Adds a new application to the monitoring list, visualize the application (opening a web browser) and returns the created object @@ -51,6 +51,7 @@ public class ApiApiServiceImpl extends ApiApiService { int numero = (int) (Math.random() * 100) + 1; String monid=Integer.toString(numero); //monid=appdescinstance (monid); + //Call ACSmI monitoring //Call to configure monitoring configuration currentconfiguration=new configuration(); currentconfiguration.apply(); @@ -62,17 +63,18 @@ public class ApiApiServiceImpl extends ApiApiService { return Response.ok(application).build(); } @Override - public Response deleteApplicationUsingDELETE(String appdescuri, SecurityContext securityContext) throws NotFoundException { - // Changes the current status of the element of the list to "notmonitored" + public Response deleteApplicationUsingDELETE(String appdescinstanceid, SecurityContext securityContext) throws NotFoundException { + //Instead of giving the appdescuri , ADAPT DO should provide the appinstanceid + //Changes the current status of the element of the list to "notmonitored" for (int i=0;i<AppMonitoringlist.size();i++) { - if (AppMonitoringlist.get(i).getMonid().equals(appdescuri)) { - // monitoringvisualization currentvisualization= new monitoringvisualization(); - //currentvisualization.closevisualize(AppMonitoringlist.get(i)); - //AppMonitoringlist.remove(i); + if (AppMonitoringlist.get(i).getMonid().equals(appdescinstanceid)) { + //Stop the monitoring (Stop telegraf) change the App description monitoring url and status (Monitoring object) in the App description) + Stopmonitoring stopcurrentmonitoring= new Stopmonitoring(appdescinstanceid); + //Change the status of the App Monitoring list to not monitored AppMonitoringlist.get(i).setStatus("notmonitored"); } } - + // Returns all the AppMonitoring list return Response.ok(AppMonitoringlist).build(); } @Override diff --git a/ADAPT/Monitoring/eu.decideh2020.adapt.monitoring.server/src/main/java/eu/decideh2020/adapt/monitoring/server/api/impl/Assessment.java b/ADAPT/Monitoring/eu.decideh2020.adapt.monitoring.server/src/main/java/eu/decideh2020/adapt/monitoring/server/api/impl/Assessment.java index d5be6da05164673e4c1bf968c198ed135bfdfee3..3ef77236899746b67af6993c2d8c0c490c8c9393 100644 --- a/ADAPT/Monitoring/eu.decideh2020.adapt.monitoring.server/src/main/java/eu/decideh2020/adapt/monitoring/server/api/impl/Assessment.java +++ b/ADAPT/Monitoring/eu.decideh2020.adapt.monitoring.server/src/main/java/eu/decideh2020/adapt/monitoring/server/api/impl/Assessment.java @@ -1,6 +1,39 @@ +/**************************************************************** +*Copyright (c) 2017 Tecnalia. +*Licensed under MIT License (the "License"); +*Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is furnished +to do so, subject to the following conditions: +*The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. +* +* +*THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, +INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A +PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT +HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF +CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE +OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +*Contributors (in alphabetical order): +*Alberto Molinuevo Tecnalia +*Gorka Benguria Tecnalia +*Iñaki Etxaniz Tecnalia +*Juncal Alonso Tecnalia +*Leire Orue-Echevarria Tecnalia +*Maria Jose Lopez Tecnalia +*Marisa Escalante Tecnalia +* +*Initially developed in the context of DECIDE EU project www.DECIDE-h2020.eu +*****************************************************************************/ package eu.decideh2020.adapt.monitoring.server.api.impl; import java.util.ArrayList; +import java.util.Timer; +import java.util.TimerTask; import java.util.HashMap; import java.util.List; import java.util.Map; @@ -15,7 +48,8 @@ import eu.DECIDEh2020.mcsla.core.metrics.MetricsContext; import eu.DECIDEh2020.mcsla.core.metrics.ServiceObjectiveMetrics; public class Assessment { - public Assessment (AppDescription currentAppdesc) { + //The assessment needs to be included in a timer (recursive until the stop is requested) + public Assessment (AppDescription currentAppdesc) { //MCSLA assessment for the current application List <Microservice> microservices = currentAppdesc.getMicroservices(); List <Nfr> nfrs=currentAppdesc.getNfrs(); @@ -23,14 +57,17 @@ public class Assessment { { if (nf instanceof AvailabilityNfr) { AvailabilityNfr availabilityNfr = (AvailabilityNfr) nf; - System.out.println ("NFR kind "+availabilityNfr.getType()); - System.out.println ("NFR value "+availabilityNfr.getValue()); - System.out.println ("NFR tag "+availabilityNfr.getTags()); + //System.out.println ("NFR kind "+availabilityNfr.getType()); + //System.out.println ("NFR value "+availabilityNfr.getValue()); + //System.out.println ("NFR tag "+availabilityNfr.getTags()); //Create the metrics context and get the availability objective of the application MetricsContext context = MetricsContext.create(currentAppdesc); ServiceObjectiveMetrics availabilityMetrics = context.getAppMetrics().get("Availability"); //Configure and load dashboard 1 for availability; //Repeat this every X seconds, in this case 4 times + //Timer assessmentTimer=new Timer(); + //The task for the assessment Timer starts now (0) and is being repeated every 1000 ms + //assessmentTimer.scheduleAtFixedRate(new Taskassessment(), 0, 1000); long Monitoreduptimebegin=1; for (int indice=0;indice<4; indice++) { //Declare the hashMap to store the monitored values of the microservices @@ -40,11 +77,11 @@ public class Assessment { List <Long> MonitoredValuesMs= new ArrayList <Long>(); //Read the monitored values from the InfluxDB long Monitoreduptimebeginms=Monitoreduptimebegin + 1; - System.out.println ("Monitoreduptimebeginms"+Monitoreduptimebeginms); + //System.out.println ("Monitoreduptimebeginms"+Monitoreduptimebeginms); long Monitoreddowntimebeginms=Monitoreduptimebeginms+1; - System.out.println ("Monitoreddowntimebeginms"+Monitoreddowntimebeginms); + //System.out.println ("Monitoreddowntimebeginms"+Monitoreddowntimebeginms); long Monitoredauptimeagainms=Monitoreddowntimebeginms+1; - System.out.println ("Monitoredauptimeagainms"+Monitoredauptimeagainms); + //System.out.println ("Monitoredauptimeagainms"+Monitoredauptimeagainms); MonitoredValuesMs.add(Monitoreduptimebeginms); MonitoredValuesMs.add(Monitoreddowntimebeginms); MonitoredValuesMs.add(Monitoredauptimeagainms); @@ -52,12 +89,12 @@ public class Assessment { //Add the monitored values to a Hashmap microservicesResults.put(ms.getId(),MonitoredValuesMs); List<String> endpoints = ms.getEndpoints(); - System.out.println ("Microservice name"+ms.getName()); - System.out.println("Microservice id"+ms.getId()); - System.out.println("Micorservices endpoints"+endpoints); - System.out.println("Microservices tags"+ms.getTags()); - System.out.println("Microservices containersid"+ms.getContainerRef()); - System.out.println ("Microservice safe methods"+ms.getSafeMethods()); + //System.out.println ("Microservice name"+ms.getName()); + //System.out.println("Microservice id"+ms.getId()); + //System.out.println("Micorservices endpoints"+endpoints); + //System.out.println("Microservices tags"+ms.getTags()); + //System.out.println("Microservices containersid"+ms.getContainerRef()); + //System.out.println ("Microservice safe methods"+ms.getSafeMethods()); } //Assess the monitored values against the MCSLA and write it in the InfluxDB EvaluationResult<Double> result = availabilityMetrics.evaluate(microservicesResults); @@ -70,9 +107,9 @@ public class Assessment { } if (nf instanceof PerformanceNfr) { PerformanceNfr performanceNfr = (PerformanceNfr) nf; - System.out.println ("NFR kind "+performanceNfr.getType()); - System.out.println ("NFR value "+performanceNfr.getAbstractValue()); - System.out.println ("NFR tag "+performanceNfr.getTags()); + //System.out.println ("NFR kind "+performanceNfr.getType()); + //System.out.println ("NFR value "+performanceNfr.getAbstractValue()); + //System.out.println ("NFR tag "+performanceNfr.getTags()); //Create the metrics context and get the availability objective of the application MetricsContext context = MetricsContext.create(currentAppdesc); ServiceObjectiveMetrics performanceMetrics = context.getAppMetrics().get("Performance"); @@ -86,10 +123,10 @@ public class Assessment { Long monitoredresponsetime=(long) (Math.random() * 100) + 1; //Add the monitored values to the list measuredValues.add(monitoredresponsetime); - System.out.println ("measuredValues"+measuredValues); - System.out.println ("Microservice name"+ms.getName()); - System.out.println("Microservice id"+ms.getId()); - System.out.println("Microservices tags"+ms.getTags()); + //System.out.println ("measuredValues"+measuredValues); + //System.out.println ("Microservice name"+ms.getName()); + //System.out.println("Microservice id"+ms.getId()); + //System.out.println("Microservices tags"+ms.getTags()); } //Assess the monitored values against the MCSLA and write it in the InfluxDB EvaluationResult<Double> result = performanceMetrics.evaluate(measuredValues); diff --git a/ADAPT/Monitoring/eu.decideh2020.adapt.monitoring.server/src/main/java/eu/decideh2020/adapt/monitoring/server/api/impl/Stopmonitoring.java b/ADAPT/Monitoring/eu.decideh2020.adapt.monitoring.server/src/main/java/eu/decideh2020/adapt/monitoring/server/api/impl/Stopmonitoring.java new file mode 100644 index 0000000000000000000000000000000000000000..f231d68701d7ffb1ed59653b730e51d36e7fd4ec --- /dev/null +++ b/ADAPT/Monitoring/eu.decideh2020.adapt.monitoring.server/src/main/java/eu/decideh2020/adapt/monitoring/server/api/impl/Stopmonitoring.java @@ -0,0 +1,83 @@ +/**************************************************************** +*Copyright (c) 2017 Tecnalia. +*Licensed under MIT License (the "License"); +*Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is furnished +to do so, subject to the following conditions: +*The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. +* +* +*THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, +INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A +PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT +HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF +CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE +OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +*Contributors (in alphabetical order): +*Alberto Molinuevo Tecnalia +*Gorka Benguria Tecnalia +*Iñaki Etxaniz Tecnalia +*Juncal Alonso Tecnalia +*Leire Orue-Echevarria Tecnalia +*Maria Jose Lopez Tecnalia +*Marisa Escalante Tecnalia + +*Initially developed in the context of DECIDE EU project www.DECIDE-h2020.eu +*****************************************************************************/ +package eu.decideh2020.adapt.monitoring.server.api.impl; + +import java.io.IOException; + +import eu.DECIDEh2020.appManager.models.AppDescription; +import eu.decideh2020.telegraf.file.FileParser; +import eu.decideh2020.telegraf.file.FileWriter; + +public class Stopmonitoring { + public Stopmonitoring (String stopmonid) { + //load the telegraf.conf + FileParser parser=null; + try { + //parser = new FileParser("/etc/telegraf/telegraf.conf"); + //I use this telegraf location to test + try { + parser = new FileParser("D:\\2017-Decide\\telegraftemplate\\telegraf.conf"); + } catch (IOException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + } catch (InstantiationException e1) { + // TODO Auto-generated catch block + e1.printStackTrace(); + } catch (IllegalAccessException e1) { + // TODO Auto-generated catch block + e1.printStackTrace(); + } catch (ClassNotFoundException e1) { + // TODO Auto-generated catch block + e1.printStackTrace(); + } + //For each the telegrafobject check if it needs to be stopped (with the monid==stopmonid) and comment the corresponding plugin. + for (telegrafobject telegrafelement:configuration.telegrafdata){ + if (telegrafelement.getMonid().equals(stopmonid)){ + int pluginindex=telegrafelement.getPluginindex(); + try { + parser.changePluginComment("inputs.http_response", pluginindex, true); + try { + FileWriter.writeFile("D:\\2017-Decide\\telegraftemplate\\telegraf.conf", parser.getDocument()); + } catch (IOException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + } catch (CloneNotSupportedException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + } + } + +} +} \ No newline at end of file diff --git a/ADAPT/Monitoring/eu.decideh2020.adapt.monitoring.server/src/main/java/eu/decideh2020/adapt/monitoring/server/api/impl/Taskassessment.java b/ADAPT/Monitoring/eu.decideh2020.adapt.monitoring.server/src/main/java/eu/decideh2020/adapt/monitoring/server/api/impl/Taskassessment.java new file mode 100644 index 0000000000000000000000000000000000000000..17dfd5d33be23c569dff0f669ab7dfe4e10bc0bc --- /dev/null +++ b/ADAPT/Monitoring/eu.decideh2020.adapt.monitoring.server/src/main/java/eu/decideh2020/adapt/monitoring/server/api/impl/Taskassessment.java @@ -0,0 +1,50 @@ +/**************************************************************** +*Copyright (c) 2017 Tecnalia. +*Licensed under MIT License (the "License"); +*Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is furnished +to do so, subject to the following conditions: +*The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. +* +* +*THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, +INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A +PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT +HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF +CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE +OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +*Contributors (in alphabetical order): +*Alberto Molinuevo Tecnalia +*Gorka Benguria Tecnalia +*Iñaki Etxaniz Tecnalia +*Juncal Alonso Tecnalia +*Leire Orue-Echevarria Tecnalia +*Maria Jose Lopez Tecnalia +*Marisa Escalante Tecnalia +* +*Initially developed in the context of DECIDE EU project www.DECIDE-h2020.eu +*****************************************************************************/ +package eu.decideh2020.adapt.monitoring.server.api.impl; + +import java.util.TimerTask; + +public class Taskassessment extends TimerTask { + String monstatus="monitored"; + @Override + public void run () { + // TODO Auto-generated method stub + if ( monstatus.equalsIgnoreCase("monitored") ) { + System.out.println ("Mon status"+monstatus); + } else { + System.out.println("Monitoring stopped"); + //timer.cancel(); // Not necessary because + System.out.println ("Mon status"+monstatus); + } + +} +} diff --git a/ADAPT/Monitoring/eu.decideh2020.adapt.monitoring.server/src/main/java/eu/decideh2020/adapt/monitoring/server/api/impl/acsmicall.java b/ADAPT/Monitoring/eu.decideh2020.adapt.monitoring.server/src/main/java/eu/decideh2020/adapt/monitoring/server/api/impl/acsmicall.java new file mode 100644 index 0000000000000000000000000000000000000000..f6897c9c2d67def732d382fd20b5007505a01cdd --- /dev/null +++ b/ADAPT/Monitoring/eu.decideh2020.adapt.monitoring.server/src/main/java/eu/decideh2020/adapt/monitoring/server/api/impl/acsmicall.java @@ -0,0 +1,36 @@ +/**************************************************************** +*Copyright (c) 2017 Tecnalia. +*Licensed under MIT License (the "License"); +*Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is furnished +to do so, subject to the following conditions: +*The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. +* +* +*THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, +INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A +PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT +HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF +CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE +OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +*Contributors (in alphabetical order): +*Alberto Molinuevo Tecnalia +*Gorka Benguria Tecnalia +*Iñaki Etxaniz Tecnalia +*Juncal Alonso Tecnalia +*Leire Orue-Echevarria Tecnalia +*Maria Jose Lopez Tecnalia +*Marisa Escalante Tecnalia +* +*Initially developed in the context of DECIDE EU project www.DECIDE-h2020.eu +*****************************************************************************/ +package eu.decideh2020.adapt.monitoring.server.api.impl; +//import eu.decideh2020.ACSmI.monitoring.client.model.*; +public class acsmicall { + //Resourcemonitoring resourcemonitroing; +} diff --git a/ADAPT/Monitoring/eu.decideh2020.adapt.monitoring.server/src/main/java/eu/decideh2020/adapt/monitoring/server/api/impl/configuration.java b/ADAPT/Monitoring/eu.decideh2020.adapt.monitoring.server/src/main/java/eu/decideh2020/adapt/monitoring/server/api/impl/configuration.java index 756670a56b283ddc244e2bc5fb08f121abd3187b..9bfa4d200d205c00a404b571fc948c68e3248909 100644 --- a/ADAPT/Monitoring/eu.decideh2020.adapt.monitoring.server/src/main/java/eu/decideh2020/adapt/monitoring/server/api/impl/configuration.java +++ b/ADAPT/Monitoring/eu.decideh2020.adapt.monitoring.server/src/main/java/eu/decideh2020/adapt/monitoring/server/api/impl/configuration.java @@ -19,6 +19,7 @@ CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFT OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. *Contributors (in alphabetical order): +*Alberto Molinuevo Tecnalia *Gorka Benguria Tecnalia *Iñaki Etxaniz Tecnalia *Juncal Alonso Tecnalia @@ -36,6 +37,8 @@ import java.nio.file.Path; import java.nio.file.Paths; import java.util.ArrayList; import java.util.List; +import java.util.Timer; + import eu.DECIDEh2020.appManager.*; import eu.DECIDEh2020.appManager.exceptions.AppManagerException; import eu.DECIDEh2020.appManager.exceptions.DECIDEValidationException; @@ -46,7 +49,8 @@ import eu.DECIDEh2020.appManager.models.Microservice; import eu.DECIDEh2020.appManager.models.Monitoring; import eu.DECIDEh2020.appManager.models.VirtualMachine; public class configuration { - + //Create a List of telegraf objects to create the corresponding data for telegraf configuration + static List <telegrafobject> telegrafdata = new ArrayList<telegrafobject>(); void apply () { //load and read appdescription with the app-controller System.out.println("temp folder is: "+System.getProperty("java.io.tmpdir")); @@ -58,14 +62,17 @@ public class configuration { //gitRef to be changed to the common gitlab //String gitRef="https://git.code.tecnalia.com/decide/SockShop_AppDescription.git"; //Local DECIDE.json - String gitRef="https://git.code.tecnalia.com/j2018b/106776.git"; - //HPE's DECIDE.json - //String gitRef="https://git.code.tecnalia.com/decide/adapt-do-demo/blob/master/Socks-shop/DECIDE.json"; - String gitusername="juncal.alonso@tecnalia.com"; - String gitpassword="Tecnalia.2018"; + //PUBLIC decide repo + //String gitRef=""; + //String gitusername=""; + //String gitpassword=""; AppManager appManager = null; try { appManager = AppManager.open(gitRef, gitusername, gitpassword, localappdescpath); + //accessing a subfolder in the git repository + appManager.setDescriptor("Sockshop/DECIDE.json"); + //accessing a subfolder in the public DECIDE git repository + //appManager.setDescriptor("ADAPT/test/DECIDE.json"); } catch (AppManagerException e) { // TODO Auto-generated catch block e.printStackTrace(); @@ -81,82 +88,57 @@ public class configuration { e.printStackTrace(); } List <Microservice> microservices = description.getMicroservices(); + System.out.println("microservicios"+microservices.size()); List <VirtualMachine> virtualmachines=description.getVirtualMachines(); List <Container> containers=description.getContainers(); Monitoring monitoring=new Monitoring(); + String monid=description.getApplicationInstanceId(); //Get the needed values from the appdescription to configure telegraf - //Create a List of telegraf objects to create the corresponding urls for the httpresponse plugin - List <telegrafobject> telegrafdata = new ArrayList<telegrafobject>(); for (Microservice ms:microservices) { Microservice currentms = ms; telegrafobject listobject=new telegrafobject(); listobject.setMicroserviceid(currentms.getId()); listobject.setSafemethod(currentms.getSafeMethods()); + listobject.setMonid(monid); + listobject.setComponentappdescription(description); //This is null. To be asked to Paolo.String container=currentms.getContainerId(); String container="mscontainerID"; for (Container cn:containers){ Container currentcontainer = cn; - System.out.println("restart"+currentcontainer.getRestart()); - System.out.println("container"+container); //This is null. To be asked to Paolo Simon.System.out.println("current container"+currentcontainer.getName()); if (currentcontainer.getRestart().equals(container)) { - System.out.println("entra if containers"); //supposing that we only have one endpoint listobject.setPort(cn.getEndpoints().get(0).getPort()); - //for (VirtualMachine vm:virtualmachines) { - //{if (vm.getDockerHostNodeName.equals(cn.getDockerHostNodeName())) - //listobject.setIp(vm.getDockerHostPublicIp); - //System.out.println("entra for virtualmachines"); - listobject.setIp("ip"); - //} + for (VirtualMachine vm:virtualmachines) { + if (vm.getDockerHostNodeName().equals(cn.getDockerHostNodeName())) { + listobject.setIp(vm.getDockerHostPublicIp()); + } + } } } + //Adding the telegraf object to the list telegrafdata.add(listobject); } - //create the urls to be included in the telegraf for the http_response input plugin - List<URL> telegrafurls=new ArrayList <URL>(); - //I create one object in telegrafsata to test. Then it should be erased. - telegrafobject listobject=new telegrafobject(); - listobject.setMicroserviceid("microservice1"); - listobject.setIp("ipmicorservice1"); - listobject.setPort(80); - List <String> Safemethod=new ArrayList <String>(); - Safemethod.add("safemethodms1"); - listobject.setSafemethod(Safemethod); - System.out.println("listobject ip"+listobject.getIp()); - telegrafdata.add(listobject); - //System.out.println("telegrafdata list objetc ip"+telegrafdata.get(1).getIp()); - //for (telegrafobject object:telegrafdata) - //{ - //System.out.println("object ip "+object.getIp()); - //try { - //URL microserviceurl = new URL("http", object.getIp(), object.getPort(), object.getSafemethodt().get(0)); - //System.out.println("microserviceurl"+microserviceurl); - //telegrafurls.add(microserviceurl); - //} catch (MalformedURLException e1) { - // TODO Auto-generated catch block - //e1.printStackTrace(); - //} - //} - //Write microserviceurls in telegraf - //set up influxDB? //set up telegraf: configure input and output plugins and data based on the app description info + try { + configuretelegraf currenttelegrafconfiguration=new configuretelegraf (telegrafdata); + } catch (IOException e1) { + //TODO Auto-generated catch block + e1.printStackTrace(); + } //Assess the MCSLA continuously Assessment currentAssessment= new Assessment(description); - //Configure grafana and complete the monitoring + //Configure grafana and complete the monitoring onject for the App description List<String> urlsMonitoring=new ArrayList<String>(); + //Get the url for grafana urlsMonitoring.add("http://85.91.40.245:8093"); - System.out.println("monitoring urls"+urlsMonitoring.get(0)); - //Write down monitoring in appdescription //Write down monitoring url in appdescription - //boolean st = monitoring.getStatus(); - monitoring.setStatus(true); - boolean st = monitoring.getStatus(); - System.out.println ("Monitoring status"+st); monitoring.setUrls(urlsMonitoring); - System.out.println("url dashboard"+monitoring.getUrls()); + //Write down monitoring status in appdescription + monitoring.setStatus(true); + //Write down monitoring object status in desription object description.setMonitoring(monitoring); try { appManager.writeAndSync(description, "monitoring status changed"); @@ -172,14 +154,17 @@ public class configuration { localAppDesc = System.getProperty("java.io.tmpdir"); localAppDesc = localAppDesc+"\\"+System.currentTimeMillis(); Path localappdescpath=Paths.get(localAppDesc); - //gitRef to be changed to the common gitlab - //String gitRef="https://git.code.tecnalia.com/decide/SockShop_AppDescription.git"; - String gitRef="https://git.code.tecnalia.com/j2018b/106776.git"; - String gitusername="juncal.alonso@tecnalia.com"; - String gitpassword="Tecnalia.2018"; + //PUBLIC decide repo + //String gitRef=""; + //String gitusername=""; + //String gitpassword=""; AppManager appManager = null; try { appManager = AppManager.open(gitRef, gitusername, gitpassword, localappdescpath); + //accessing a subfolder in the git repository + appManager.setDescriptor("Sockshop/DECIDE.json"); + //accessing a subfolder in the public DECIDE git repository + //appManager.setDescriptor("ADAPT/test/DECIDE.json"); } catch (AppManagerException e) { // TODO Auto-generated catch block e.printStackTrace(); diff --git a/ADAPT/Monitoring/eu.decideh2020.adapt.monitoring.server/src/main/java/eu/decideh2020/adapt/monitoring/server/api/impl/configuretelegraf.java b/ADAPT/Monitoring/eu.decideh2020.adapt.monitoring.server/src/main/java/eu/decideh2020/adapt/monitoring/server/api/impl/configuretelegraf.java new file mode 100644 index 0000000000000000000000000000000000000000..2fef86a477e35f29a553f6ff4a8261d1df6eb619 --- /dev/null +++ b/ADAPT/Monitoring/eu.decideh2020.adapt.monitoring.server/src/main/java/eu/decideh2020/adapt/monitoring/server/api/impl/configuretelegraf.java @@ -0,0 +1,107 @@ +/**************************************************************** +*Copyright (c) 2017 Tecnalia. +*Licensed under MIT License (the "License"); +*Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is furnished +to do so, subject to the following conditions: +*The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. +* +* +*THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, +INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A +PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT +HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF +CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE +OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +*Contributors (in alphabetical order): +*Alberto Molinuevo Tecnalia +*Gorka Benguria Tecnalia +*Iñaki Etxaniz Tecnalia +*Juncal Alonso Tecnalia +*Leire Orue-Echevarria Tecnalia +*Maria Jose Lopez Tecnalia +*Marisa Escalante Tecnalia +* +*Initially developed in the context of DECIDE EU project www.DECIDE-h2020.eu +*****************************************************************************/ +package eu.decideh2020.adapt.monitoring.server.api.impl; + +import java.io.IOException; +import java.net.URL; +import java.util.ArrayList; +import java.util.List; + +import eu.decideh2020.telegraf.file.FileParser; +import eu.decideh2020.telegraf.file.FileViewer; +import eu.decideh2020.telegraf.file.FileWriter; +public class configuretelegraf { + public configuretelegraf (List<telegrafobject> telegrafdata) throws IOException { + FileParser parser=null; + try { + //parser = new FileParser("/etc/telegraf/telegraf.conf"); + //I use this telegraf location to test + parser = new FileParser("D:\\2017-Decide\\telegraftemplate\\telegraf.conf"); + } catch (InstantiationException e1) { + // TODO Auto-generated catch block + e1.printStackTrace(); + } catch (IllegalAccessException e1) { + // TODO Auto-generated catch block + e1.printStackTrace(); + } catch (ClassNotFoundException e1) { + // TODO Auto-generated catch block + e1.printStackTrace(); + } + + //Here the values introduced are the ones corresponding to the Sock shop application deployed in Tecnalia.The correct code to be included + //when the integration with ADAPTDO is completed so that the parameters in the telegraf are the ones of the real applicaiton deployed by ADAPTDO is commented + List <String> urls= new ArrayList<String>(); + urls.add("http://sockshop:18082/customers"); + urls.add("http://sockshop:18081/health"); + urls.add("http://sockshop:18083/catalogue"); + urls.add("http://sockshop:8079"); + int index=0; + for (telegrafobject telegrafobject:telegrafdata) + { + try { + //We only insert the 4 adressess currently in the shockshop, this will change with the real data from the AppDescription + if (index<4) { + //Comments the "template plugins" + parser.changePluginComment("inputs.ping",1, true); + parser.changePluginComment("inputs.http_response",1, true); + int pluginsnumber; + pluginsnumber=parser.countPluginsByName("inputs.http_response"); + parser.duplicatePlugin("inputs.http_response"); + //URL microserviceport = new URL("http",td.getIp(),Integer.toString(telegrafobject.getPort())); + //URL microserviceurl=new URL(microserviceport+telegrafobject.getSafemethod().get(0)); + //url=microserviceurl.toString(); + //These values are harcoded because the current application description hasn't got the corresponding values + String url=urls.get(index); + //Changes the values of the needed properties in the duplicated plugin + parser.changePropertyValue("inputs.http_response",pluginsnumber+1, "address", url); + //Uncomments the duplicated plugin + parser.changePluginComment("inputs.http_response",pluginsnumber+1,false); + telegrafobject.setPluginindex(pluginsnumber+1); + index=index+1; + } else { + telegrafobject.setPluginindex(index); + index=index+1; + } + } catch (CloneNotSupportedException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + }} + // Writedown the new telegraf.conf file + try { + FileWriter.writeFile("D:\\2017-Decide\\telegraftemplate\\telegraf.conf", parser.getDocument()); + } catch (CloneNotSupportedException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + } + //set up influxDB output plugin when needed +} diff --git a/ADAPT/Monitoring/eu.decideh2020.adapt.monitoring.server/src/main/java/eu/decideh2020/adapt/monitoring/server/api/impl/dashboard.java b/ADAPT/Monitoring/eu.decideh2020.adapt.monitoring.server/src/main/java/eu/decideh2020/adapt/monitoring/server/api/impl/dashboard.java new file mode 100644 index 0000000000000000000000000000000000000000..bff2fde83eb7ff565b6be0cdcc010de12b743817 --- /dev/null +++ b/ADAPT/Monitoring/eu.decideh2020.adapt.monitoring.server/src/main/java/eu/decideh2020/adapt/monitoring/server/api/impl/dashboard.java @@ -0,0 +1,55 @@ +/**************************************************************** +*Copyright (c) 2017 Tecnalia. +*Licensed under MIT License (the "License"); +*Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is furnished +to do so, subject to the following conditions: +*The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. +* +* +*THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, +INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A +PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT +HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF +CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE +OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +*Contributors (in alphabetical order): +*Gorka Benguria Tecnalia +*Iñaki Etxaniz Tecnalia +*Juncal Alonso Tecnalia +*Leire Orue-Echevarria Tecnalia +*Maria Jose Lopez Tecnalia +*Marisa Escalante Tecnalia +* +*Initially developed in the context of DECIDE EU project www.DECIDE-h2020.eu +*****************************************************************************/ +//package eu.decideh2020.adapt.monitoring.server.api.impl; +//import com.appnexus.grafana.client.GrafanaClient; +//import com.appnexus.grafana.client.models.Dashboard; +//import com.appnexus.grafana.client.models.GrafanaDashboard; +//import com.appnexus.grafana.configuration.GrafanaConfiguration; +//public class dashboard { + //Setup the client + //String myhost="grafanahost"; + //GrafanaConfiguration myconfiguration =new GrafanaConfiguration(); + //GrafanaClient grafanaClient = new GrafanaClient(myconfiguration); + + //Setup the dashboard + //String DASHBOARD_NAME = "new_dashboard"; + + //Dashboard dashboard = new Dashboard().title(DASHBOARD_NAME).version(0); + + //GrafanaDashboard grafanaDashboard = new GrafanaDashboard().dashboard(dashboard); + + //Make API calls + //grafanaClient.createDashboard(grafanaDashboard); + + //grafanaClient.getDashboard(DASHBOARD_NAME); + + //grafanaClient.deleteDashboard(DASHBOARD_NAME); +//} diff --git a/ADAPT/Monitoring/eu.decideh2020.adapt.monitoring.server/src/main/java/eu/decideh2020/adapt/monitoring/server/api/impl/telegrafobject.java b/ADAPT/Monitoring/eu.decideh2020.adapt.monitoring.server/src/main/java/eu/decideh2020/adapt/monitoring/server/api/impl/telegrafobject.java index a64ae3caf7a46622537da36a7b0917accc04615a..d68d9f6757c39ce363d7220dcccfb51723d90eb3 100644 --- a/ADAPT/Monitoring/eu.decideh2020.adapt.monitoring.server/src/main/java/eu/decideh2020/adapt/monitoring/server/api/impl/telegrafobject.java +++ b/ADAPT/Monitoring/eu.decideh2020.adapt.monitoring.server/src/main/java/eu/decideh2020/adapt/monitoring/server/api/impl/telegrafobject.java @@ -1,12 +1,49 @@ +/**************************************************************** +*Copyright (c) 2017 Tecnalia. +*Licensed under MIT License (the "License"); +*Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is furnished +to do so, subject to the following conditions: +*The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. +* +* +*THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, +INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A +PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT +HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF +CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE +OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +*Contributors (in alphabetical order): +*Alberto Molinuevo Tecnalia +*Gorka Benguria Tecnalia +*Iñaki Etxaniz Tecnalia +*Juncal Alonso Tecnalia +*Leire Orue-Echevarria Tecnalia +*Maria Jose Lopez Tecnalia +*Marisa Escalante Tecnalia +* +*Initially developed in the context of DECIDE EU project www.DECIDE-h2020.eu +*****************************************************************************/ package eu.decideh2020.adapt.monitoring.server.api.impl; import java.util.List; +import eu.DECIDEh2020.appManager.models.AppDescription; + + public class telegrafobject { private String Microserviceid; private String Ip; private Integer Port; private List <String> Safemethod; + private String monid; + private AppDescription componentappdescription; + private Integer pluginindex; public String getMicroserviceid() { return Microserviceid; @@ -30,10 +67,34 @@ public class telegrafobject { public void setPort(Integer Port) { this.Port = Port; } - public List <String> getSafemethodt() { + public List <String> getSafemethod() { return Safemethod; } public void setSafemethod(List<String> Safemethod) { this.Safemethod = Safemethod; } + + public String getMonid() { + return monid; + } + + public void setMonid(String monid) { + this.monid = monid; + } + + public AppDescription getComponentappdescription() { + return componentappdescription; + } + + public void setComponentappdescription(AppDescription componentappdescription) { + this.componentappdescription = componentappdescription; + } + + public Integer getPluginindex() { + return pluginindex; + } + + public void setPluginindex(Integer pluginindex) { + this.pluginindex = pluginindex; + } } diff --git a/ADAPT/Monitoring/eu.decideh2020.adapt.monitoring.server/src/main/resources/adaptmon.properties b/ADAPT/Monitoring/eu.decideh2020.adapt.monitoring.server/src/main/resources/adaptmon.properties new file mode 100644 index 0000000000000000000000000000000000000000..c5f7af1c702deb1c727ad7d25557e498c3b53a1c --- /dev/null +++ b/ADAPT/Monitoring/eu.decideh2020.adapt.monitoring.server/src/main/resources/adaptmon.properties @@ -0,0 +1 @@ +adaptMonitoring.appDescriptionLocalPath=D:\\2017-Decide\\appdescfolder diff --git a/ADAPT/Monitoring/eu.decideh2020.adapt.monitoring.server/src/main/resources/swagger/swagger.json b/ADAPT/Monitoring/eu.decideh2020.adapt.monitoring.server/src/main/resources/swagger/swagger.json new file mode 100644 index 0000000000000000000000000000000000000000..724ec1e30d9a10414b7177448209333ae83d0f46 --- /dev/null +++ b/ADAPT/Monitoring/eu.decideh2020.adapt.monitoring.server/src/main/resources/swagger/swagger.json @@ -0,0 +1,297 @@ +{ + "swagger": "2.0", + "info": { + "description": "adapt monitoring API documentation.This API describes the methods to access the ADAPT monitoring functionalities. This version updates de methods that need monid. In this version these methods include the appdescuri in their body.", + "version": "0.0.1", + "title": "adapt monitoring API" + }, + "host": "85.91.40.245:8088", + "basePath": "/monitoringmanager", + "schemes": [ + "http" + ], + "tags": [ + { + "name": "application", + "description": "adapt application tag" + } + ], + "paths": { + "/api/applications": { + "get": { + "description": "Gets the list of all the applications in ADAPT monitoring, including their id and the status", + "tags": [ + "application" + ], + "summary": "getAllApplications", + "operationId": "getAllApplicationsUsingGET", + "consumes": [ + "application/json" + ], + "produces": [ + "*/*" + ], + "responses": { + "200": { + "description": "The list of all the monitoring elements in ADAPT monitoring is being returned", + "schema": { + "type": "array", + "items": { + "$ref": "#/definitions/Application" + } + } + }, + "401": { + "description": "Unauthorized" + }, + "403": { + "description": "Forbidden" + }, + "404": { + "description": "Not Found" + } + } + }, + "post": { + "description": "Creates an application to be included in ADAPT monitoring", + "tags": [ + "application" + ], + "summary": "createApplication", + "operationId": "createApplicationUsingPOST", + "consumes": [ + "application/json" + ], + "produces": [ + "*/*" + ], + "parameters": [ + { + "in": "body", + "name": "application", + "required": true, + "schema": { + "$ref": "#/definitions/Application" + } + } + ], + "responses": { + "200": { + "description": "Application monitoring Created", + "schema": { + "$ref": "#/definitions/Application" + } + }, + "401": { + "description": "Unauthorized" + }, + "403": { + "description": "Forbidden" + }, + "404": { + "description": "Not Found" + } + } + } + }, + "/api/applications/{appdescuri}": { + "get": { + "description": "Gets the status wrt monitoring of a given application", + "tags": [ + "application" + ], + "summary": "getApplicationstatus", + "operationId": "getApplicationUsingGET", + "consumes": [ + "application/json" + ], + "produces": [ + "*/*" + ], + "parameters": [ + { + "name": "appdescuri", + "in": "path", + "description": "application description uri", + "required": true, + "type": "string" + } + ], + "responses": { + "200": { + "description": "Specific app monitoring is returned", + "schema": { + "$ref": "#/definitions/Application" + } + }, + "401": { + "description": "Unauthorized" + }, + "403": { + "description": "Forbidden" + }, + "404": { + "description": "Not Found" + } + } + }, + "delete": { + "tags": [ + "application" + ], + "summary": "deleteApplication", + "operationId": "deleteApplicationUsingDELETE", + "consumes": [ + "application/json" + ], + "produces": [ + "*/*" + ], + "parameters": [ + { + "name": "appdescuri", + "in": "path", + "description": "application description uri", + "required": true, + "type": "string" + } + ], + "responses": { + "200": { + "description": "App deleted form the monitoring list" + }, + "204": { + "description": "No Content" + }, + "401": { + "description": "Unauthorized" + }, + "403": { + "description": "Forbidden" + } + } + }, + "put": { + "description": "Updates the monitoring status of a given application", + "tags": [ + "application" + ], + "summary": "updateApplication", + "operationId": "updateApplicationUsingPUT", + "consumes": [ + "application/json" + ], + "produces": [ + "*/*" + ], + "parameters": [ + { + "in": "path", + "name": "appdescuri", + "description": "application description uri", + "required": true, + "type": "string" + } + ], + "responses": { + "200": { + "description": "Status updated", + "schema": { + "$ref": "#/definitions/Application" + } + }, + "401": { + "description": "Unauthorized" + }, + "403": { + "description": "Forbidden" + }, + "404": { + "description": "Not Found" + } + } + } + }, + "/api/alert": { + "post": { + "description": "Creates an alert to be included in ADAPT monitoring", + "tags": [ + "alert" + ], + "summary": "createAlert", + "operationId": "createAlertUsingPOST", + "consumes": [ + "alert/json" + ], + "produces": [ + "*/*" + ], + "parameters": [ + { + "in": "body", + "name": "Alert", + "required": true, + "schema": { + "$ref": "#/definitions/Alert" + } + } + ], + "responses": { + "200": { + "description": "Alert Created", + "schema": { + "$ref": "#/definitions/Alert" + } + }, + "401": { + "description": "Unauthorized" + } + } + } + } + }, + "definitions": { + "Application": { + "type": "object", + "required": [ + "appdescuri" + ], + "properties": { + "monid": { + "type": "string" + }, + "appdescuri": { + "type": "string" + }, + "status": { + "type": "string" + }, + "user": { + "type": "string" + }, + "password": { + "type": "string" + } + } + }, + "Alert": { + "type": "object", + "required": [ + "alid", + "altype", + "appdescuri" + ], + "properties": { + "alid": { + "type": "string" + }, + "altype": { + "type": "string" + }, + "appdescuri": { + "type": "string" + } + } + } + } +} \ No newline at end of file diff --git a/ADAPT/Monitoring/eu.decideh2020.adapt.monitoring.server/src/main/webapp/WEB-INF/web.xml b/ADAPT/Monitoring/eu.decideh2020.adapt.monitoring.server/src/main/webapp/WEB-INF/web.xml new file mode 100644 index 0000000000000000000000000000000000000000..9f16c7024b7a7906c926b6b8310549698d4df635 --- /dev/null +++ b/ADAPT/Monitoring/eu.decideh2020.adapt.monitoring.server/src/main/webapp/WEB-INF/web.xml @@ -0,0 +1,63 @@ +<?xml version="1.0" encoding="ISO-8859-1"?> +<web-app version="2.4" xmlns="http://java.sun.com/xml/ns/j2ee" + xmlns:j2ee="http://java.sun.com/xml/ns/j2ee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd"> + + <servlet> + <servlet-name>jersey</servlet-name> + <servlet-class>org.glassfish.jersey.servlet.ServletContainer</servlet-class> + <init-param> + <param-name>jersey.config.server.provider.packages</param-name> + <param-value> + io.swagger.jaxrs.listing, + io.swagger.sample.resource, + eu.decideh2020.adapt.monitoring.server.api + </param-value> + </init-param> + <init-param> + <param-name>jersey.config.server.provider.classnames</param-name> + <param-value>org.glassfish.jersey.media.multipart.MultiPartFeature</param-value> + </init-param> + <init-param> + <param-name>jersey.config.server.wadl.disableWadl</param-name> + <param-value>true</param-value> + </init-param> + <load-on-startup>1</load-on-startup> + </servlet> + + <servlet> + <servlet-name>Jersey2Config</servlet-name> + <servlet-class>io.swagger.jersey.config.JerseyJaxrsConfig</servlet-class> + <init-param> + <param-name>api.version</param-name> + <param-value>1.0.0</param-value> + </init-param> + <init-param> + <param-name>swagger.api.title</param-name> + <param-value>Swagger Server</param-value> + </init-param> + <init-param> + <param-name>swagger.api.basepath</param-name> + <param-value>http://localhost:8080/monitoringmanager</param-value> + </init-param> + + <load-on-startup>2</load-on-startup> + </servlet> + <servlet> + <servlet-name>Bootstrap</servlet-name> + <servlet-class>eu.decideh2020.adapt.monitoring.server.api.Bootstrap</servlet-class> + <load-on-startup>2</load-on-startup> + </servlet> + <servlet-mapping> + <servlet-name>jersey</servlet-name> + <url-pattern>/monitoringmanager/*</url-pattern> + </servlet-mapping> + <filter> + <filter-name>ApiOriginFilter</filter-name> + <filter-class>eu.decideh2020.adapt.monitoring.server.api.ApiOriginFilter</filter-class> + </filter> + <filter-mapping> + <filter-name>ApiOriginFilter</filter-name> + <url-pattern>/*</url-pattern> + </filter-mapping> +</web-app> diff --git a/ADAPT/Monitoring/eu.decideh2020.int.adapt.monitoring.grafana.server.src.dvp/src/main/docker/config/dashboards/MultiCloudApplicationavailability27112018.json b/ADAPT/Monitoring/eu.decideh2020.int.adapt.monitoring.grafana.server.src.dvp/src/main/docker/config/dashboards/MultiCloudApplicationavailability27112018.json new file mode 100644 index 0000000000000000000000000000000000000000..be602ae9ea5a4aae431a0e6b0a22bdadf0badea5 --- /dev/null +++ b/ADAPT/Monitoring/eu.decideh2020.int.adapt.monitoring.grafana.server.src.dvp/src/main/docker/config/dashboards/MultiCloudApplicationavailability27112018.json @@ -0,0 +1,555 @@ +{ + "__inputs": [ + { + "name": "DS_DECIDEH2020ADAPT", + "label": "decideh2020adapt", + "description": "", + "type": "datasource", + "pluginId": "influxdb", + "pluginName": "InfluxDB" + } + ], + "__requires": [ + { + "type": "grafana", + "id": "grafana", + "name": "Grafana", + "version": "5.1.3" + }, + { + "type": "datasource", + "id": "influxdb", + "name": "InfluxDB", + "version": "5.0.0" + }, + { + "type": "panel", + "id": "table", + "name": "Table", + "version": "5.0.0" + } + ], + "annotations": { + "list": [ + { + "builtIn": 1, + "datasource": "-- Grafana --", + "enable": true, + "hide": true, + "iconColor": "rgba(0, 211, 255, 1)", + "name": "Annotations & Alerts", + "type": "dashboard" + } + ] + }, + "editable": true, + "gnetId": null, + "graphTooltip": 0, + "id": null, + "links": [], + "panels": [ + { + "columns": [], + "datasource": "decideh2020adapt", + "description": "", + "fontSize": "100%", + "gridPos": { + "h": 6, + "w": 10, + "x": 0, + "y": 0 + }, + "hideTimeOverride": false, + "id": 10, + "interval": "10s", + "links": [], + "pageSize": 10, + "repeat": null, + "scroll": true, + "showHeader": true, + "sort": { + "col": 0, + "desc": true + }, + "styles": [ + { + "alias": "Time stamp", + "dateFormat": "YYYY-MM-DD HH:mm:ss", + "link": false, + "pattern": "Time", + "type": "date" + }, + { + "alias": "Response code (GET) Payment", + "colorMode": "cell", + "colors": [ + "rgba(245, 54, 54, 0.9)", + "rgba(237, 129, 40, 0.89)", + "#7eb26d" + ], + "dateFormat": "YYYY-MM-DD HH:mm:ss", + "decimals": 2, + "mappingType": 1, + "pattern": "Payment", + "thresholds": [ + "0", + "200" + ], + "type": "string", + "unit": "short", + "valueMaps": [] + }, + { + "alias": "", + "colorMode": null, + "colors": [ + "rgba(245, 54, 54, 0.9)", + "rgba(237, 129, 40, 0.89)", + "rgba(50, 172, 45, 0.97)" + ], + "decimals": 2, + "pattern": "/.*/", + "thresholds": [], + "type": "number", + "unit": "short" + } + ], + "targets": [ + { + "alias": "Payment", + "groupBy": [ + { + "params": [ + "10s" + ], + "type": "time" + } + ], + "measurement": "http_response", + "orderByTime": "ASC", + "policy": "default", + "refId": "A", + "resultFormat": "time_series", + "select": [ + [ + { + "params": [ + "http_response_code" + ], + "type": "field" + }, + { + "params": [], + "type": "mean" + } + ] + ], + "tags": [ + { + "key": "server", + "operator": "=", + "value": "http://sockshop:18081/health" + }, + { + "condition": "AND", + "key": "method", + "operator": "=", + "value": "GET" + } + ] + } + ], + "title": "Microservice Availability (Component 1)", + "transform": "timeseries_to_columns", + "transparent": false, + "type": "table" + }, + { + "columns": [], + "datasource": "decideh2020adapt", + "description": "", + "fontSize": "100%", + "gridPos": { + "h": 6, + "w": 10, + "x": 10, + "y": 0 + }, + "hideTimeOverride": false, + "id": 8, + "interval": "10s", + "links": [], + "pageSize": 10, + "repeat": null, + "scroll": true, + "showHeader": true, + "sort": { + "col": 1, + "desc": true + }, + "styles": [ + { + "alias": "Time stamp", + "dateFormat": "YYYY-MM-DD HH:mm:ss", + "link": false, + "pattern": "Time", + "type": "date" + }, + { + "alias": "Response code (GET) Users", + "colorMode": "cell", + "colors": [ + "rgba(245, 54, 54, 0.9)", + "rgba(237, 129, 40, 0.89)", + "#7eb26d" + ], + "dateFormat": "YYYY-MM-DD HH:mm:ss", + "decimals": 2, + "mappingType": 1, + "pattern": "Users", + "thresholds": [ + "0", + "200" + ], + "type": "string", + "unit": "short", + "valueMaps": [] + }, + { + "alias": "", + "colorMode": null, + "colors": [ + "rgba(245, 54, 54, 0.9)", + "rgba(237, 129, 40, 0.89)", + "rgba(50, 172, 45, 0.97)" + ], + "decimals": 2, + "pattern": "/.*/", + "thresholds": [], + "type": "number", + "unit": "short" + } + ], + "targets": [ + { + "alias": "Users", + "groupBy": [ + { + "params": [ + "10s" + ], + "type": "time" + } + ], + "measurement": "http_response", + "orderByTime": "ASC", + "policy": "default", + "refId": "A", + "resultFormat": "time_series", + "select": [ + [ + { + "params": [ + "http_response_code" + ], + "type": "field" + }, + { + "params": [], + "type": "mean" + } + ] + ], + "tags": [ + { + "key": "server", + "operator": "=", + "value": "http://sockshop:18082/customers" + }, + { + "condition": "AND", + "key": "method", + "operator": "=", + "value": "GET" + } + ] + } + ], + "title": "Microservice Availability (Component 2)", + "transform": "timeseries_to_columns", + "transparent": false, + "type": "table" + }, + { + "columns": [], + "datasource": "decideh2020adapt", + "description": "", + "fontSize": "100%", + "gridPos": { + "h": 6, + "w": 10, + "x": 0, + "y": 6 + }, + "hideTimeOverride": false, + "id": 6, + "interval": "10s", + "links": [], + "pageSize": 10, + "repeat": null, + "scroll": true, + "showHeader": true, + "sort": { + "col": 1, + "desc": true + }, + "styles": [ + { + "alias": "Time stamp", + "dateFormat": "YYYY-MM-DD HH:mm:ss", + "link": false, + "pattern": "Time", + "type": "date" + }, + { + "alias": "Response code (GET) Catalogue", + "colorMode": "cell", + "colors": [ + "rgba(245, 54, 54, 0.9)", + "rgba(237, 129, 40, 0.89)", + "#7eb26d" + ], + "dateFormat": "YYYY-MM-DD HH:mm:ss", + "decimals": 2, + "mappingType": 1, + "pattern": "Catalogue", + "thresholds": [ + "0", + "200" + ], + "type": "string", + "unit": "short", + "valueMaps": [] + }, + { + "alias": "", + "colorMode": null, + "colors": [ + "rgba(245, 54, 54, 0.9)", + "rgba(237, 129, 40, 0.89)", + "rgba(50, 172, 45, 0.97)" + ], + "decimals": 2, + "pattern": "/.*/", + "thresholds": [], + "type": "number", + "unit": "short" + } + ], + "targets": [ + { + "alias": "Catalogue", + "groupBy": [ + { + "params": [ + "10s" + ], + "type": "time" + } + ], + "measurement": "http_response", + "orderByTime": "ASC", + "policy": "default", + "refId": "A", + "resultFormat": "time_series", + "select": [ + [ + { + "params": [ + "http_response_code" + ], + "type": "field" + }, + { + "params": [], + "type": "mean" + } + ] + ], + "tags": [ + { + "key": "server", + "operator": "=", + "value": "http://sockshop:18083/catalogue" + }, + { + "condition": "AND", + "key": "method", + "operator": "=", + "value": "GET" + } + ] + } + ], + "title": "Microservice Availability (Component 3)", + "transform": "timeseries_to_columns", + "transparent": false, + "type": "table" + }, + { + "columns": [], + "datasource": "decideh2020adapt", + "description": "", + "fontSize": "100%", + "gridPos": { + "h": 6, + "w": 10, + "x": 10, + "y": 6 + }, + "hideTimeOverride": false, + "id": 4, + "interval": "10s", + "links": [], + "pageSize": 10, + "repeat": null, + "scroll": true, + "showHeader": true, + "sort": { + "col": 1, + "desc": true + }, + "styles": [ + { + "alias": "Time stamp", + "dateFormat": "YYYY-MM-DD HH:mm:ss", + "link": false, + "pattern": "Time", + "type": "date" + }, + { + "alias": "Response code (GET) Front-end", + "colorMode": "cell", + "colors": [ + "rgba(245, 54, 54, 0.9)", + "rgba(237, 129, 40, 0.89)", + "#7eb26d" + ], + "dateFormat": "YYYY-MM-DD HH:mm:ss", + "decimals": 2, + "mappingType": 1, + "pattern": "Front-end", + "thresholds": [ + "0", + "200" + ], + "type": "string", + "unit": "short", + "valueMaps": [] + }, + { + "alias": "", + "colorMode": null, + "colors": [ + "rgba(245, 54, 54, 0.9)", + "rgba(237, 129, 40, 0.89)", + "rgba(50, 172, 45, 0.97)" + ], + "decimals": 2, + "pattern": "/.*/", + "thresholds": [], + "type": "number", + "unit": "short" + } + ], + "targets": [ + { + "alias": "Front-end", + "groupBy": [ + { + "params": [ + "10s" + ], + "type": "time" + } + ], + "measurement": "http_response", + "orderByTime": "ASC", + "policy": "default", + "refId": "A", + "resultFormat": "time_series", + "select": [ + [ + { + "params": [ + "http_response_code" + ], + "type": "field" + }, + { + "params": [], + "type": "mean" + } + ] + ], + "tags": [ + { + "key": "server", + "operator": "=", + "value": "http://sockshop:8079" + }, + { + "condition": "AND", + "key": "method", + "operator": "=", + "value": "GET" + } + ] + } + ], + "title": "Microservice Availability (Component 4)", + "transform": "timeseries_to_columns", + "transparent": false, + "type": "table" + } + ], + "schemaVersion": 16, + "style": "dark", + "tags": [], + "templating": { + "list": [] + }, + "time": { + "from": "now-6h", + "to": "now" + }, + "timepicker": { + "refresh_intervals": [ + "5s", + "10s", + "30s", + "1m", + "5m", + "15m", + "30m", + "1h", + "2h", + "1d" + ], + "time_options": [ + "5m", + "15m", + "1h", + "6h", + "12h", + "24h", + "2d", + "7d", + "30d" + ] + }, + "timezone": "", + "title": "Multi Cloud Application availability", + "uid": "RV8r6X-mz", + "version": 1 +} \ No newline at end of file diff --git a/ADAPT/Monitoring/eu.decideh2020.int.adapt.monitoring.grafana.server.src.dvp/src/main/docker/config/dashboards/Performance metrics for cloud offerings20180705.json b/ADAPT/Monitoring/eu.decideh2020.int.adapt.monitoring.grafana.server.src.dvp/src/main/docker/config/dashboards/Performance metrics for cloud offerings20180705.json deleted file mode 100644 index 0083f844d301c4ee630ca56d62b48d8a05a83f64..0000000000000000000000000000000000000000 --- a/ADAPT/Monitoring/eu.decideh2020.int.adapt.monitoring.grafana.server.src.dvp/src/main/docker/config/dashboards/Performance metrics for cloud offerings20180705.json +++ /dev/null @@ -1,593 +0,0 @@ -{ - "__inputs": [ - { - "name": "DS_DECIDEH2020ADAPT", - "label": "decideh2020adapt", - "description": "", - "type": "datasource", - "pluginId": "influxdb", - "pluginName": "InfluxDB" - } - ], - "__requires": [ - { - "type": "grafana", - "id": "grafana", - "name": "Grafana", - "version": "5.1.3" - }, - { - "type": "panel", - "id": "graph", - "name": "Graph", - "version": "5.0.0" - }, - { - "type": "datasource", - "id": "influxdb", - "name": "InfluxDB", - "version": "5.0.0" - }, - { - "type": "panel", - "id": "text", - "name": "Text", - "version": "5.0.0" - } - ], - "annotations": { - "list": [ - { - "builtIn": 1, - "datasource": "-- Grafana --", - "enable": true, - "hide": true, - "iconColor": "rgba(0, 211, 255, 1)", - "name": "Annotations & Alerts", - "type": "dashboard" - } - ] - }, - "editable": true, - "gnetId": null, - "graphTooltip": 0, - "id": null, - "links": [], - "panels": [ - { - "content": "# This Dashboard monitors the performance of the different cloud offerings (VM and DDBB) where the components in the multi-cloud application are deployed.\n\n", - "description": "", - "gridPos": { - "h": 5, - "w": 24, - "x": 0, - "y": 0 - }, - "id": 3, - "links": [], - "mode": "markdown", - "title": "Performance Metric for Cloud Offerings", - "type": "text" - }, - { - "aliasColors": {}, - "bars": false, - "dashLength": 10, - "dashes": false, - "datasource": "decideh2020adapt", - "fill": 1, - "gridPos": { - "h": 9, - "w": 24, - "x": 0, - "y": 5 - }, - "id": 7, - "legend": { - "alignAsTable": true, - "avg": true, - "current": false, - "max": true, - "min": true, - "rightSide": true, - "show": true, - "total": false, - "values": true - }, - "lines": true, - "linewidth": 1, - "links": [], - "nullPointMode": "null", - "percentage": false, - "pointradius": 5, - "points": false, - "renderer": "flot", - "seriesOverrides": [], - "spaceLength": 10, - "stack": false, - "steppedLine": false, - "targets": [ - { - "alias": "Host response time", - "groupBy": [ - { - "params": [ - "10s" - ], - "type": "time" - }, - { - "params": [ - "linear" - ], - "type": "fill" - } - ], - "measurement": "ping", - "orderByTime": "ASC", - "policy": "default", - "refId": "A", - "resultFormat": "time_series", - "select": [ - [ - { - "params": [ - "average_response_ms" - ], - "type": "field" - }, - { - "params": [], - "type": "mean" - } - ] - ], - "tags": [ - { - "key": "url", - "operator": "=", - "value": "sockshop" - } - ] - } - ], - "thresholds": [], - "timeFrom": null, - "timeShift": null, - "title": "Virtual Machine response time", - "tooltip": { - "shared": true, - "sort": 0, - "value_type": "individual" - }, - "type": "graph", - "xaxis": { - "buckets": null, - "mode": "time", - "name": null, - "show": true, - "values": [] - }, - "yaxes": [ - { - "format": "s", - "label": "Response Time", - "logBase": 1, - "max": null, - "min": null, - "show": true - }, - { - "format": "short", - "label": null, - "logBase": 1, - "max": null, - "min": null, - "show": true - } - ], - "yaxis": { - "align": false, - "alignLevel": null - } - }, - { - "aliasColors": {}, - "bars": false, - "dashLength": 10, - "dashes": false, - "datasource": "decideh2020adapt", - "description": "This panels show the number of transactions per second (Inserts, Deletes and Update) for the MongoDB .", - "fill": 1, - "gridPos": { - "h": 7, - "w": 24, - "x": 0, - "y": 14 - }, - "id": 1, - "legend": { - "alignAsTable": true, - "avg": true, - "current": false, - "max": true, - "min": true, - "rightSide": true, - "show": true, - "total": false, - "values": true - }, - "lines": true, - "linewidth": 1, - "links": [], - "nullPointMode": "null", - "percentage": false, - "pointradius": 5, - "points": false, - "renderer": "flot", - "seriesOverrides": [], - "spaceLength": 10, - "stack": false, - "steppedLine": false, - "targets": [ - { - "alias": "Inserts per second", - "dsType": "influxdb", - "groupBy": [ - { - "params": [ - "auto" - ], - "type": "time" - }, - { - "params": [ - "linear" - ], - "type": "fill" - } - ], - "measurement": "mongodb", - "orderByTime": "ASC", - "policy": "default", - "refId": "A", - "resultFormat": "time_series", - "select": [ - [ - { - "params": [ - "inserts_per_sec" - ], - "type": "field" - }, - { - "params": [], - "type": "mean" - } - ] - ], - "tags": [] - }, - { - "alias": "Deletes per second", - "dsType": "influxdb", - "groupBy": [ - { - "params": [ - "auto" - ], - "type": "time" - }, - { - "params": [ - "linear" - ], - "type": "fill" - } - ], - "measurement": "mongodb", - "orderByTime": "ASC", - "policy": "default", - "refId": "B", - "resultFormat": "time_series", - "select": [ - [ - { - "params": [ - "deletes_per_sec" - ], - "type": "field" - }, - { - "params": [], - "type": "mean" - } - ] - ], - "tags": [] - }, - { - "alias": "Updates per second", - "groupBy": [ - { - "params": [ - "auto" - ], - "type": "time" - }, - { - "params": [ - "linear" - ], - "type": "fill" - } - ], - "measurement": "mongodb", - "orderByTime": "ASC", - "policy": "default", - "refId": "C", - "resultFormat": "time_series", - "select": [ - [ - { - "params": [ - "updates_per_sec" - ], - "type": "field" - }, - { - "params": [], - "type": "mean" - } - ] - ], - "tags": [] - } - ], - "thresholds": [], - "timeFrom": null, - "timeShift": null, - "title": "Performance metrics for Mongo DB", - "tooltip": { - "shared": true, - "sort": 0, - "value_type": "individual" - }, - "transparent": false, - "type": "graph", - "xaxis": { - "buckets": null, - "mode": "time", - "name": null, - "show": true, - "values": [] - }, - "yaxes": [ - { - "format": "ops", - "label": "Operations per second", - "logBase": 1, - "max": null, - "min": null, - "show": true - }, - { - "format": "short", - "label": null, - "logBase": 1, - "max": null, - "min": null, - "show": true - } - ], - "yaxis": { - "align": false, - "alignLevel": null - } - }, - { - "aliasColors": {}, - "bars": false, - "dashLength": 10, - "dashes": false, - "datasource": "decideh2020adapt", - "fill": 1, - "gridPos": { - "h": 7, - "w": 24, - "x": 0, - "y": 21 - }, - "id": 5, - "legend": { - "alignAsTable": true, - "avg": true, - "current": false, - "max": true, - "min": true, - "rightSide": true, - "show": true, - "total": false, - "values": true - }, - "lines": true, - "linewidth": 1, - "links": [], - "nullPointMode": "null", - "percentage": false, - "pointradius": 5, - "points": false, - "renderer": "flot", - "seriesOverrides": [], - "spaceLength": 10, - "stack": false, - "steppedLine": false, - "targets": [ - { - "alias": "Bytes received", - "groupBy": [ - { - "params": [ - "$__interval" - ], - "type": "time" - }, - { - "params": [ - "linear" - ], - "type": "fill" - } - ], - "measurement": "mysql", - "orderByTime": "ASC", - "policy": "default", - "refId": "A", - "resultFormat": "time_series", - "select": [ - [ - { - "params": [ - "bytes_received" - ], - "type": "field" - }, - { - "params": [], - "type": "mean" - } - ] - ], - "tags": [ - { - "key": "server", - "operator": "=", - "value": "sockshop:3308" - } - ] - }, - { - "alias": "Bytes sent", - "groupBy": [ - { - "params": [ - "$__interval" - ], - "type": "time" - }, - { - "params": [ - "linear" - ], - "type": "fill" - } - ], - "measurement": "mysql", - "orderByTime": "ASC", - "policy": "default", - "refId": "B", - "resultFormat": "time_series", - "select": [ - [ - { - "params": [ - "bytes_sent" - ], - "type": "field" - }, - { - "params": [], - "type": "mean" - } - ] - ], - "tags": [ - { - "key": "server", - "operator": "=", - "value": "sockshop:3308" - } - ] - } - ], - "thresholds": [], - "timeFrom": null, - "timeShift": null, - "title": "Performance metrics for MySQL DB", - "tooltip": { - "shared": true, - "sort": 0, - "value_type": "individual" - }, - "type": "graph", - "xaxis": { - "buckets": null, - "mode": "time", - "name": null, - "show": true, - "values": [] - }, - "yaxes": [ - { - "format": "deckbytes", - "label": "Bytes received/sent", - "logBase": 1, - "max": null, - "min": null, - "show": true - }, - { - "format": "short", - "label": null, - "logBase": 1, - "max": null, - "min": null, - "show": true - } - ], - "yaxis": { - "align": false, - "alignLevel": null - } - } - ], - "schemaVersion": 16, - "style": "dark", - "tags": [], - "templating": { - "list": [] - }, - "time": { - "from": "now-30m", - "to": "now" - }, - "timepicker": { - "refresh_intervals": [ - "5s", - "10s", - "30s", - "1m", - "5m", - "15m", - "30m", - "1h", - "2h", - "1d" - ], - "time_options": [ - "5m", - "15m", - "1h", - "6h", - "12h", - "24h", - "2d", - "7d", - "30d" - ] - }, - "timezone": "browser", - "title": "Performance metrics for cloud offerings", - "uid": "E2yd9wnmz", - "version": 1 -} \ No newline at end of file diff --git a/ADAPT/Monitoring/eu.decideh2020.int.adapt.monitoring.management.server.src.dvp/src/main/docker/Dockerfile b/ADAPT/Monitoring/eu.decideh2020.int.adapt.monitoring.management.server.src.dvp/src/main/docker/Dockerfile index 66cb9ff2d770a941b45c3c6dad99b23f76cc93e0..f47ab8f376d2425cb16b662ed40cc955cb1c9821 100644 --- a/ADAPT/Monitoring/eu.decideh2020.int.adapt.monitoring.management.server.src.dvp/src/main/docker/Dockerfile +++ b/ADAPT/Monitoring/eu.decideh2020.int.adapt.monitoring.management.server.src.dvp/src/main/docker/Dockerfile @@ -5,7 +5,10 @@ FROM maven:3.5.3-jdk-8 as builder #COPY .m2 /root/.m2 # ARG GIT_CREDENTIALS -ARG APPMANAGER_VERSION +ARG APPMANAGER_VERSION=53dd49053bd12c83c27e1258a94de4d0ac2d7400 +ARG MCSLA_CORE_VERSION=5bf5d112d4e5c8b09e401cd757f123386b6db53d +ARG TELEGRAF_CONFIGPARSER_VERSION=159ab4b500263be55dfa719815a68c3a20edb2fa + COPY downloadsources.sh /downloadsources.sh COPY maveninstall.sh /maveninstall.sh @@ -14,6 +17,6 @@ RUN chmod +x /downloadsources.sh && \ chmod +x /maveninstall.sh && \ sh ./maveninstall.sh -WORKDIR /WP4/Adapt_monitoring/eu.decideh2020.adapt.monitoring.server +WORKDIR /ADAPT/monitoring/eu.decideh2020.adapt.monitoring.server CMD ["mvn","jetty:run","-Dmaven.test.skip=true"] #cd target/*.war /ROOT.war \ No newline at end of file diff --git a/ADAPT/Monitoring/eu.decideh2020.int.adapt.monitoring.management.server.src.dvp/src/main/docker/downloadsources.sh b/ADAPT/Monitoring/eu.decideh2020.int.adapt.monitoring.management.server.src.dvp/src/main/docker/downloadsources.sh index 7d9355e7b0bdc757b03a47f2f4520a1ea8464a97..8789488c2834685f5269520957441fad9db67aa0 100644 --- a/ADAPT/Monitoring/eu.decideh2020.int.adapt.monitoring.management.server.src.dvp/src/main/docker/downloadsources.sh +++ b/ADAPT/Monitoring/eu.decideh2020.int.adapt.monitoring.management.server.src.dvp/src/main/docker/downloadsources.sh @@ -1,6 +1,16 @@ cd / -git clone https://$GIT_CREDENTIALS@git.code.tecnalia.com/decide/AppController.git +git clone https://$GIT_CREDENTIALS@git.code.tecnalia.com/DECIDE_Public/DECIDE_Components.git AppController cd /AppController git checkout $APPMANAGER_VERSION cd / -git clone https://$GIT_CREDENTIALS@git.code.tecnalia.com/decide/WP4.git +git clone https://$GIT_CREDENTIALS@git.code.tecnalia.com/DECIDE_Public/DECIDE_Components.git mcsla-core +cd /mcsla-core +git checkout $MCSLA_CORE_VERSION +cd / +git clone https://$GIT_CREDENTIALS@git.code.tecnalia.com/DECIDE_Public/DECIDE_Components.git WP5 +cd /WP5 +git checkout $TELEGRAF_CONFIGPARSER_VERSION +cd / +git clone https://$GIT_CREDENTIALS@git.code.tecnalia.com/DECIDE_Public/DECIDE_Components.git WP4 +cd /WP4 +git checkout $WP4_VERSION diff --git a/ADAPT/Monitoring/eu.decideh2020.int.adapt.monitoring.management.server.src.dvp/src/main/docker/maveninstall.sh b/ADAPT/Monitoring/eu.decideh2020.int.adapt.monitoring.management.server.src.dvp/src/main/docker/maveninstall.sh index 92970b55b52f550747157aefb2f7828fe0e9b2dd..66f4b7b3df72c79fe536ad450ce7d09450c7eb17 100644 --- a/ADAPT/Monitoring/eu.decideh2020.int.adapt.monitoring.management.server.src.dvp/src/main/docker/maveninstall.sh +++ b/ADAPT/Monitoring/eu.decideh2020.int.adapt.monitoring.management.server.src.dvp/src/main/docker/maveninstall.sh @@ -1,4 +1,8 @@ cd /AppController mvn install -Dmaven.test.skip=true +cd /mcsla-core +mvn install -Dmaven.test.skip=true +cd /WP5/Telegraf_ConfigParser +mvn install -Dmaven.test.skip=true cd /WP4/Adapt_monitoring/eu.decideh2020.adapt.monitoring.server mvn install -Dmaven.test.skip=true diff --git a/ADAPT/Monitoring/eu.decideh2020.int.adapt.monitoring.vagrant.server.src.dvp/src/main/vagrant/Vagrantfile b/ADAPT/Monitoring/eu.decideh2020.int.adapt.monitoring.vagrant.server.src.dvp/src/main/vagrant/Vagrantfile index 3ee91daa17bb4c7d343793d9b012c0f1e9313cfa..2fddd15f6b5506637099ca51a6154e9bd7f3676c 100644 --- a/ADAPT/Monitoring/eu.decideh2020.int.adapt.monitoring.vagrant.server.src.dvp/src/main/vagrant/Vagrantfile +++ b/ADAPT/Monitoring/eu.decideh2020.int.adapt.monitoring.vagrant.server.src.dvp/src/main/vagrant/Vagrantfile @@ -1,5 +1,3 @@ -#http://ricostacruz.com/cheatsheets/vagrantfile.html - credentials_home = ENV['CREDENTIALS_HOME'] start_monitoring = ENV['START_MONITORING'] start_optimus = ENV['START_OPTIMUS'] @@ -84,6 +82,9 @@ Vagrant.configure("2") do |config| config.vm.synced_folder "../../../../../../WP5/ACSmI_discovery/eu.decideh2020.int.acsmi.backend.services.testcors.server.src.dvp/src/main/docker","/docker.acsmi.backend.services.testcors.server" config.vm.synced_folder "../../../../../../WP5", "/WP5" config.vm.synced_folder "../../../../../../../swagger-codegen", "/swagger-codegen" + config.vm.synced_folder "../../../../../../WP5/ACSmI_monitoring/eu.decideh2020.int.acsmi.monitoring.management.server.src.dvp/src/main/docker", "/docker.acsmi.monitoring.server" + config.vm.synced_folder "../../../../../../WP5/ACSmI_monitoring/eu.decideh2020.int.acsmi.monitoring.influxdb.server.src.dvp/src/main/docker", "/docker.acsmi.influxdb.server" + config.vm.synced_folder "../../../../../../WP5/ACSmI_monitoring/eu.decideh2020.int.acsmi.monitoring.telegraf.server.src.dvp/src/main/docker", "/docker.acsmi.telegraf.server" end config.vm.provider "virtualbox" do |vb| @@ -104,6 +105,8 @@ Vagrant.configure("2") do |config| config.vm.network :forwarded_port, guest: 3306, host: 3306 config.vm.network :forwarded_port, guest: 12080, host: 12080 config.vm.network :forwarded_port, guest: 13080, host: 13080 + config.vm.network :forwarded_port, guest: 14080, host: 14080 + config.vm.network :forwarded_port, guest: 14086, host: 14086 end # Provisionar Shell para las variables de entorno @@ -120,7 +123,11 @@ Vagrant.configure("2") do |config| echo '{"bip": "172.18.0.1/24","fixed-cidr": "172.18.0.0/24"}' > /etc/docker/daemon.json #echo '{"default-gateway": "172.18.0.1","graph": "/docker"}' > /etc/docker/daemon.json SHELL - + + config.vm.provision "shell", name: "dockerContainerCleaning", inline: <<-SHELL + docker rm $(docker ps -a -q) -f > /dev/null 2>&1 || true + SHELL + config.vm.provision "docker" do |d| if start_monitoring == 'Y' d.build_image "/docker.grafana.server", args: "-t tecnalia/eu.decideh2020.adapt.monitoring.grafana.server" @@ -129,7 +136,7 @@ Vagrant.configure("2") do |config| d.run "tecnalia/eu.decideh2020.adapt.monitoring.grafana.server", args: "-d -p 3000:3000 --restart=always -e 'GF_SERVER_ROOT_URL=http://grafana.esilab.org' -e 'GF_SECURITY_ADMIN_PASSWORD=admin' --name eu.decideh2020.adapt.monitoring.grafana.server --add-host influxdb:172.18.0.1 --add-host sockshop:172.26.252.81" d.build_image "/docker.influxdb.server", args: "-t tecnalia/eu.decideh2020.adapt.monitoring.influxdb.server" d.run "tecnalia/eu.decideh2020.adapt.monitoring.influxdb.server", args: "-d -p 8086:8086 --restart=always -e INFLUXDB_DB='decideh2020adapt' --name eu.decideh2020.adapt.monitoring.influxdb.server" - d.build_image "/docker.monitoring.server", args: "-t tecnalia/eu.decideh2020.adapt.monitoring.management.server --build-arg GIT_CREDENTIALS=$CREDENTIALS_GIT --build-arg APPMANAGER_VERSION=7de6f86cbc701ea55db3083a023a12876682a856" + d.build_image "/docker.monitoring.server", args: "-t tecnalia/eu.decideh2020.adapt.monitoring.management.server --build-arg GIT_CREDENTIALS=$CREDENTIALS_GIT " d.run "tecnalia/eu.decideh2020.adapt.monitoring.management.server", args: "-d -p 10080:8080 --restart=always --name eu.decideh2020.adapt.monitoring.management.server" d.build_image "/docker.telegraf.server", args: "-t tecnalia/eu.decideh2020.adapt.monitoring.telegraf.server" #d.run "tecnalia/eu.decideh2020.adapt.monitoring.telegraf.server", args: "-d --restart=always --name eu.decideh2020.adapt.monitoring.telegraf.server --add-host influxdb:172.18.0.1 --add-host sockshop:172.26.252.81" @@ -152,6 +159,12 @@ Vagrant.configure("2") do |config| d.run "tecnalia/eu.decideh2020.acsmi.backend.services.server.test.00", args: "-d --name eu.decideh2020.acsmi.backend.services.server.test.00 --restart=no --env MYSQL_DB_USER=root --env MYSQL_DB_NAME=acsmi_backend_services_server --env MYSQL_DB_HOST=172.18.0.1" d.build_image "/docker.acsmi.backend.services.testcors.server", args: "-t tecnalia/eu.decideh2020.acsmi.backend.services.testcors.server --build-arg GIT_CREDENTIALS=$CREDENTIALS_GIT" d.run "tecnalia/eu.decideh2020.acsmi.backend.services.testcors.server", args: "-d -p 13080:80 --restart=always --name eu.decideh2020.acsmi.backend.services.testcors.server " + d.build_image "/docker.acsmi.monitoring.server", args: "-t tecnalia/eu.decideh2020.acsmi.monitoring.management.server --build-arg GIT_CREDENTIALS=$CREDENTIALS_GIT " + d.run "tecnalia/eu.decideh2020.acsmi.monitoring.management.server", args: "-d -p 14080:8080 --restart=always --name eu.decideh2020.acsmi.monitoring.management.server" + d.build_image "/docker.acsmi.influxdb.server", args: "-t tecnalia/eu.decideh2020.acsmi.monitoring.influxdb.server" + d.run "tecnalia/eu.decideh2020.acsmi.monitoring.influxdb.server", args: "-d -p 14086:8086 --restart=always -e INFLUXDB_DB='decideh2020acsmi' --name eu.decideh2020.acsmi.monitoring.influxdb.server" + d.build_image "/docker.acsmi.telegraf.server", args: "-t tecnalia/eu.decideh2020.acsmi.monitoring.telegraf.server" + d.run "tecnalia/eu.decideh2020.acsmi.monitoring.telegraf.server", args: "-d --restart=always --name eu.decideh2020.acsmi.monitoring.telegraf.server --add-host influxdb:172.18.0.1 --add-host sockshop:172.26.252.81" end end if start_jhipster_acsmi == 'Y' diff --git a/ADAPT/Monitoring/eu.decideh2020.violationhandler.client/.project b/ADAPT/Monitoring/eu.decideh2020.violationhandler.client/.project new file mode 100644 index 0000000000000000000000000000000000000000..2b95855165688abcb7cdaa4f213ada001d5ebece --- /dev/null +++ b/ADAPT/Monitoring/eu.decideh2020.violationhandler.client/.project @@ -0,0 +1,23 @@ +<?xml version="1.0" encoding="UTF-8"?> +<projectDescription> + <name>eu.decideh2020.violationhandler.client</name> + <comment></comment> + <projects> + </projects> + <buildSpec> + <buildCommand> + <name>org.eclipse.jdt.core.javabuilder</name> + <arguments> + </arguments> + </buildCommand> + <buildCommand> + <name>org.eclipse.m2e.core.maven2Builder</name> + <arguments> + </arguments> + </buildCommand> + </buildSpec> + <natures> + <nature>org.eclipse.jdt.core.javanature</nature> + <nature>org.eclipse.m2e.core.maven2Nature</nature> + </natures> +</projectDescription> diff --git a/ADAPT/Monitoring/eu.decideh2020.violationhandler.client/.swagger-codegen-ignore b/ADAPT/Monitoring/eu.decideh2020.violationhandler.client/.swagger-codegen-ignore new file mode 100644 index 0000000000000000000000000000000000000000..c5fa491b4c557bf997d5dd21797de782545dc9e5 --- /dev/null +++ b/ADAPT/Monitoring/eu.decideh2020.violationhandler.client/.swagger-codegen-ignore @@ -0,0 +1,23 @@ +# Swagger Codegen Ignore +# Generated by swagger-codegen https://github.com/swagger-api/swagger-codegen + +# Use this file to prevent files from being overwritten by the generator. +# The patterns follow closely to .gitignore or .dockerignore. + +# As an example, the C# client generator defines ApiClient.cs. +# You can make changes and tell Swagger Codgen to ignore just this file by uncommenting the following line: +#ApiClient.cs + +# You can match any string of characters against a directory, file or extension with a single asterisk (*): +#foo/*/qux +# The above matches foo/bar/qux and foo/baz/qux, but not foo/bar/baz/qux + +# You can recursively match patterns against a directory, file or extension with a double asterisk (**): +#foo/**/qux +# This matches foo/bar/qux, foo/baz/qux, and foo/bar/baz/qux + +# You can also negate patterns with an exclamation (!). +# For example, you can ignore all files in a docs folder with the file extension .md: +#docs/*.md +# Then explicitly reverse the ignore rule for a single file: +#!docs/README.md diff --git a/ADAPT/Monitoring/eu.decideh2020.violationhandler.client/.swagger-codegen/VERSION b/ADAPT/Monitoring/eu.decideh2020.violationhandler.client/.swagger-codegen/VERSION new file mode 100644 index 0000000000000000000000000000000000000000..a6254504e40175d135cea7feb34ad31fa0d0bca3 --- /dev/null +++ b/ADAPT/Monitoring/eu.decideh2020.violationhandler.client/.swagger-codegen/VERSION @@ -0,0 +1 @@ +2.3.1 \ No newline at end of file diff --git a/ADAPT/Monitoring/eu.decideh2020.violationhandler.client/pom.xml b/ADAPT/Monitoring/eu.decideh2020.violationhandler.client/pom.xml new file mode 100644 index 0000000000000000000000000000000000000000..8a68ce97f1fd1531c8e396f366086e870aed27ec --- /dev/null +++ b/ADAPT/Monitoring/eu.decideh2020.violationhandler.client/pom.xml @@ -0,0 +1,175 @@ +<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> + <modelVersion>4.0.0</modelVersion> + <groupId>eu.decideh2020</groupId> + <artifactId>violationhandler.client</artifactId> + <packaging>jar</packaging> + <name>eu.decideh2020.vh.client</name> + <description>This is the API documentation for Violation Handler service of DECIDE h2020 european project</description> + <version>1.0.0</version> + <build> + <sourceDirectory>src/main/java</sourceDirectory> + <plugins> + <plugin> + <artifactId>maven-failsafe-plugin</artifactId> + <version>2.6</version> + <executions> + <execution> + <goals> + <goal>integration-test</goal> + <goal>verify</goal> + </goals> + </execution> + </executions> + </plugin> + <!--plugin> + <groupId>org.eclipse.jetty</groupId> + <artifactId>jetty-maven-plugin</artifactId> + <version>${jetty-version}</version> + <configuration> + <webApp> + <contextPath>/</contextPath> + </webApp> + <webAppSourceDirectory>target/${project.artifactId}-${project.version}</webAppSourceDirectory> + <stopPort>8079</stopPort> + <stopKey>stopit</stopKey> + <httpConnector> + <port></port> + <idleTimeout>60000</idleTimeout> + </httpConnector> + </configuration> + <executions> + <execution> + <id>start-jetty</id> + <phase>pre-integration-test</phase> + <goals> + <goal>start</goal> + </goals> + <configuration> + <scanIntervalSeconds>0</scanIntervalSeconds> + <daemon>true</daemon> + </configuration> + </execution> + <execution> + <id>stop-jetty</id> + <phase>post-integration-test</phase> + <goals> + <goal>stop</goal> + </goals> + </execution> + </executions> + </plugin--> + <plugin> + <groupId>org.codehaus.mojo</groupId> + <artifactId>build-helper-maven-plugin</artifactId> + <version>1.9.1</version> + <executions> + <execution> + <id>add-source</id> + <phase>generate-sources</phase> + <goals> + <goal>add-source</goal> + </goals> + <configuration> + <sources> + <source>src/gen/java</source> + </sources> + </configuration> + </execution> + </executions> + </plugin> + </plugins> + </build> + <dependencies> + <dependency> + <groupId>io.swagger</groupId> + <artifactId>swagger-jaxrs</artifactId> + <scope>compile</scope> + <version>${swagger-core-version}</version> + </dependency> + <dependency> + <groupId>ch.qos.logback</groupId> + <artifactId>logback-classic</artifactId> + <version>${logback-version}</version> + <scope>compile</scope> + </dependency> + <dependency> + <groupId>ch.qos.logback</groupId> + <artifactId>logback-core</artifactId> + <version>${logback-version}</version> + <scope>compile</scope> + </dependency> + <dependency> + <groupId>junit</groupId> + <artifactId>junit</artifactId> + <version>${junit-version}</version> + <scope>test</scope> + </dependency> + <!-- CXF Client --> + <dependency> + <groupId>org.apache.cxf</groupId> + <artifactId>cxf-rt-rs-client</artifactId> + <version>${cxf-version}</version> + <scope>test</scope> + </dependency> + + <!-- CXF server --> + <dependency> + <groupId>org.apache.cxf</groupId> + <artifactId>cxf-rt-frontend-jaxrs</artifactId> + <version>${cxf-version}</version> + <scope>compile</scope> + </dependency> + <dependency> + <groupId>org.apache.cxf</groupId> + <artifactId>cxf-rt-rs-service-description</artifactId> + <version>${cxf-version}</version> + <scope>compile</scope> + </dependency> + <dependency> + <groupId>org.apache.cxf</groupId> + <artifactId>cxf-rt-ws-policy</artifactId> + <version>${cxf-version}</version> + <scope>compile</scope> + </dependency> + <dependency> + <groupId>org.apache.cxf</groupId> + <artifactId>cxf-rt-wsdl</artifactId> + <version>${cxf-version}</version> + <scope>compile</scope> + </dependency> + <dependency> + <groupId>com.fasterxml.jackson.jaxrs</groupId> + <artifactId>jackson-jaxrs-json-provider</artifactId> + <version>${jackson-jaxrs-version}</version> + <scope>compile</scope> + </dependency> + <dependency> + <groupId>com.fasterxml.jackson.datatype</groupId> + <artifactId>jackson-datatype-joda</artifactId> + <version>${jackson-jaxrs-version}</version> + <scope>compile</scope> + </dependency> + </dependencies> + <repositories> + <repository> + <id>sonatype-snapshots</id> + <url>https://oss.sonatype.org/content/repositories/snapshots</url> + <snapshots> + <enabled>true</enabled> + </snapshots> + </repository> + </repositories> + <properties> + <java.version>1.7</java.version> + <maven.compiler.source>${java.version}</maven.compiler.source> + <maven.compiler.target>${java.version}</maven.compiler.target> + <swagger-core-version>1.5.15</swagger-core-version> + <jetty-version>9.2.9.v20150224</jetty-version> + <junit-version>4.12</junit-version> + <logback-version>1.1.7</logback-version> + <servlet-api-version>2.5</servlet-api-version> + <cxf-version>3.1.11</cxf-version> + <jackson-jaxrs-version>2.8.9</jackson-jaxrs-version> + <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> + </properties> +</project> diff --git a/ADAPT/Monitoring/eu.decideh2020.violationhandler.client/src/gen/java/eu/decideh2020/violationhandler/client/api/TestApi.java b/ADAPT/Monitoring/eu.decideh2020.violationhandler.client/src/gen/java/eu/decideh2020/violationhandler/client/api/TestApi.java new file mode 100644 index 0000000000000000000000000000000000000000..db9e45eda0c7456c88a21c12538506106a284318 --- /dev/null +++ b/ADAPT/Monitoring/eu.decideh2020.violationhandler.client/src/gen/java/eu/decideh2020/violationhandler/client/api/TestApi.java @@ -0,0 +1,43 @@ +package eu.decideh2020.violationhandler.client.api; + +import java.io.InputStream; +import java.io.OutputStream; +import java.util.List; +import java.util.Map; +import javax.ws.rs.*; +import javax.ws.rs.core.Response; +import javax.ws.rs.core.MediaType; +import org.apache.cxf.jaxrs.ext.multipart.*; + +import eu.decideh2020.violationhandler.client.model.ModelApiResponse; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import io.swagger.annotations.ApiResponses; +import io.swagger.annotations.ApiResponse; +import io.swagger.jaxrs.PATCH; + +/** + * Violation Handler + * + * <p>This is the API documentation for Violation Handler service of DECIDE h2020 european project + * + */ +@Path("/") +@Api(value = "/", description = "") +public interface TestApi { + + /** + * Test the Hello World API service + * + * Test the Hello World API service + * + */ + @GET + @Path("/hello") + @Produces({ "application/xml", "application/json" }) + @ApiOperation(value = "Test the Hello World API service", tags={ }) + @ApiResponses(value = { + @ApiResponse(code = 200, message = "successful operation", response = ModelApiResponse.class) }) + public ModelApiResponse hello(); +} + diff --git a/ADAPT/Monitoring/eu.decideh2020.violationhandler.client/src/gen/java/eu/decideh2020/violationhandler/client/api/ViolationsApi.java b/ADAPT/Monitoring/eu.decideh2020.violationhandler.client/src/gen/java/eu/decideh2020/violationhandler/client/api/ViolationsApi.java new file mode 100644 index 0000000000000000000000000000000000000000..021ec8c0d95795db38583f1c06d9ee83402f5ee3 --- /dev/null +++ b/ADAPT/Monitoring/eu.decideh2020.violationhandler.client/src/gen/java/eu/decideh2020/violationhandler/client/api/ViolationsApi.java @@ -0,0 +1,101 @@ +package eu.decideh2020.violationhandler.client.api; + +import eu.decideh2020.violationhandler.client.model.Violation; + +import java.io.InputStream; +import java.io.OutputStream; +import java.util.List; +import java.util.Map; +import javax.ws.rs.*; +import javax.ws.rs.core.Response; +import javax.ws.rs.core.MediaType; +import org.apache.cxf.jaxrs.ext.multipart.*; + +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import io.swagger.annotations.ApiResponses; +import io.swagger.annotations.ApiResponse; +import io.swagger.jaxrs.PATCH; + +/** + * Violation Handler + * + * <p>This is the API documentation for Violation Handler service of DECIDE h2020 european project + * + */ +@Path("/") +@Api(value = "/", description = "") +public interface ViolationsApi { + + /** + * Get all the violations that exist in the handler + * + * Get all the violations that exist in the handler + * + */ + @GET + @Path("/violation/getAllViolations") + @Produces({ "application/xml", "application/json" }) + @ApiOperation(value = "Get all the violations that exist in the handler", tags={ }) + @ApiResponses(value = { + @ApiResponse(code = 200, message = "successful operation", response = Violation.class, responseContainer = "array") }) + public List<Violation> getAllViolations(); + + /** + * Get violation from id + * + * Get violation from id + * + */ + @GET + @Path("/violation/{violationId}") + @Produces({ "application/xml", "application/json" }) + @ApiOperation(value = "Get violation from id", tags={ }) + @ApiResponses(value = { + @ApiResponse(code = 200, message = "successful operation", response = Violation.class), + @ApiResponse(code = 400, message = "Invalid agent_id value", response = void.class) }) + public Violation getViolationById(@PathParam("violationId") String violationId); + + /** + * Get all violations for given application description URI + * + * Get all violations for given application description URI + * + */ + @GET + @Path("/violation/getViolationsByServiceId") + @Produces({ "application/xml", "application/json" }) + @ApiOperation(value = "Get all violations for given application description URI", tags={ }) + @ApiResponses(value = { + @ApiResponse(code = 200, message = "successful operation", response = Violation.class, responseContainer = "array") }) + public List<Violation> getViolationsByServiceId(@QueryParam("id")Integer id); + + /** + * Get all violations for given application description URI + * + * Get all violations for given application description URI + * + */ + @GET + @Path("/violation/getViolationsByUri") + @Produces({ "application/xml", "application/json" }) + @ApiOperation(value = "Get all violations for given application description URI", tags={ }) + @ApiResponses(value = { + @ApiResponse(code = 200, message = "successful operation", response = Violation.class, responseContainer = "array") }) + public List<Violation> getViolationsByUri(@QueryParam("uri")String uri); + + /** + * Report a new violation + * + * Report a new violation in the system + * + */ + @POST + @Path("/violation") + @Produces({ "application/xml", "application/json" }) + @ApiOperation(value = "Report a new violation", tags={ }) + @ApiResponses(value = { + @ApiResponse(code = 200, message = "successful operation", response = Violation.class) }) + public Violation reportViolation(Violation violation); +} + diff --git a/ADAPT/Monitoring/eu.decideh2020.violationhandler.client/src/gen/java/eu/decideh2020/violationhandler/client/model/ModelApiResponse.java b/ADAPT/Monitoring/eu.decideh2020.violationhandler.client/src/gen/java/eu/decideh2020/violationhandler/client/model/ModelApiResponse.java new file mode 100644 index 0000000000000000000000000000000000000000..2de70dfd374bfd9942969500c627e0a5485df7fa --- /dev/null +++ b/ADAPT/Monitoring/eu.decideh2020.violationhandler.client/src/gen/java/eu/decideh2020/violationhandler/client/model/ModelApiResponse.java @@ -0,0 +1,102 @@ +package eu.decideh2020.violationhandler.client.model; + + +import io.swagger.annotations.ApiModelProperty; +import javax.xml.bind.annotation.XmlElement; +import javax.xml.bind.annotation.XmlRootElement; +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlType; +import javax.xml.bind.annotation.XmlEnum; +import javax.xml.bind.annotation.XmlEnumValue; +import com.fasterxml.jackson.annotation.JsonProperty; + +public class ModelApiResponse { + + @ApiModelProperty(value = "") + private Integer code = null; + + @ApiModelProperty(value = "") + private String type = null; + + @ApiModelProperty(value = "") + private String message = null; + /** + * Get code + * @return code + **/ + @JsonProperty("code") + public Integer getCode() { + return code; + } + + public void setCode(Integer code) { + this.code = code; + } + + public ModelApiResponse code(Integer code) { + this.code = code; + return this; + } + + /** + * Get type + * @return type + **/ + @JsonProperty("type") + public String getType() { + return type; + } + + public void setType(String type) { + this.type = type; + } + + public ModelApiResponse type(String type) { + this.type = type; + return this; + } + + /** + * Get message + * @return message + **/ + @JsonProperty("message") + public String getMessage() { + return message; + } + + public void setMessage(String message) { + this.message = message; + } + + public ModelApiResponse message(String message) { + this.message = message; + return this; + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ModelApiResponse {\n"); + + sb.append(" code: ").append(toIndentedString(code)).append("\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" message: ").append(toIndentedString(message)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private static String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} + diff --git a/ADAPT/Monitoring/eu.decideh2020.violationhandler.client/src/gen/java/eu/decideh2020/violationhandler/client/model/Violation.java b/ADAPT/Monitoring/eu.decideh2020.violationhandler.client/src/gen/java/eu/decideh2020/violationhandler/client/model/Violation.java new file mode 100644 index 0000000000000000000000000000000000000000..e67a428758b65a86426171b9866a10f37ae8916c --- /dev/null +++ b/ADAPT/Monitoring/eu.decideh2020.violationhandler.client/src/gen/java/eu/decideh2020/violationhandler/client/model/Violation.java @@ -0,0 +1,208 @@ +package eu.decideh2020.violationhandler.client.model; + + +import io.swagger.annotations.ApiModelProperty; +import javax.xml.bind.annotation.XmlElement; +import javax.xml.bind.annotation.XmlRootElement; +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlType; +import javax.xml.bind.annotation.XmlEnum; +import javax.xml.bind.annotation.XmlEnumValue; +import com.fasterxml.jackson.annotation.JsonProperty; + +public class Violation { + + @ApiModelProperty(value = "") + private Long id = null; + + @ApiModelProperty(value = "Uri of the application description location") + /** + * Uri of the application description location + **/ + private String appDescUri = null; + + @ApiModelProperty(value = "Id of the serice where violation occurs") + /** + * Id of the serice where violation occurs + **/ + private String serviceId = null; + + @ApiModelProperty(value = "Affected NFR name") + /** + * Affected NFR name + **/ + private String nfr = null; + + @ApiModelProperty(value = "Status of the violation") + /** + * Status of the violation + **/ + private String status = null; + + @ApiModelProperty(value = "Violation source type, SLA (0) or CSP (1)") + /** + * Violation source type, SLA (0) or CSP (1) + **/ + private Integer type = null; + + @ApiModelProperty(value = "Timestamp with the violation monitoring time") + /** + * Timestamp with the violation monitoring time + **/ + private Long timestamp = null; + /** + * Get id + * @return id + **/ + @JsonProperty("id") + public Long getId() { + return id; + } + + public void setId(Long id) { + this.id = id; + } + + public Violation id(Long id) { + this.id = id; + return this; + } + + /** + * Uri of the application description location + * @return appDescUri + **/ + @JsonProperty("app_desc_uri") + public String getAppDescUri() { + return appDescUri; + } + + public void setAppDescUri(String appDescUri) { + this.appDescUri = appDescUri; + } + + public Violation appDescUri(String appDescUri) { + this.appDescUri = appDescUri; + return this; + } + + /** + * Id of the serice where violation occurs + * @return serviceId + **/ + @JsonProperty("service_id") + public String getServiceId() { + return serviceId; + } + + public void setServiceId(String serviceId) { + this.serviceId = serviceId; + } + + public Violation serviceId(String serviceId) { + this.serviceId = serviceId; + return this; + } + + /** + * Affected NFR name + * @return nfr + **/ + @JsonProperty("nfr") + public String getNfr() { + return nfr; + } + + public void setNfr(String nfr) { + this.nfr = nfr; + } + + public Violation nfr(String nfr) { + this.nfr = nfr; + return this; + } + + /** + * Status of the violation + * @return status + **/ + @JsonProperty("status") + public String getStatus() { + return status; + } + + public void setStatus(String status) { + this.status = status; + } + + public Violation status(String status) { + this.status = status; + return this; + } + + /** + * Violation source type, SLA (0) or CSP (1) + * @return type + **/ + @JsonProperty("type") + public Integer getType() { + return type; + } + + public void setType(Integer type) { + this.type = type; + } + + public Violation type(Integer type) { + this.type = type; + return this; + } + + /** + * Timestamp with the violation monitoring time + * @return timestamp + **/ + @JsonProperty("timestamp") + public Long getTimestamp() { + return timestamp; + } + + public void setTimestamp(Long timestamp) { + this.timestamp = timestamp; + } + + public Violation timestamp(Long timestamp) { + this.timestamp = timestamp; + return this; + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class Violation {\n"); + + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" appDescUri: ").append(toIndentedString(appDescUri)).append("\n"); + sb.append(" serviceId: ").append(toIndentedString(serviceId)).append("\n"); + sb.append(" nfr: ").append(toIndentedString(nfr)).append("\n"); + sb.append(" status: ").append(toIndentedString(status)).append("\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" timestamp: ").append(toIndentedString(timestamp)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private static String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} +