Loading manifests/monitoringservice.yaml +45 −34 Original line number Diff line number Diff line Loading @@ -13,13 +13,14 @@ # limitations under the License. apiVersion: apps/v1 kind: Deployment kind: StatefulSet metadata: name: monitoringservice name: monitoringdb spec: selector: matchLabels: app: monitoringservice serviceName: "monitoringservice" replicas: 1 template: metadata: Loading @@ -32,35 +33,47 @@ spec: - name: metricsdb image: questdb/questdb ports: - containerPort: 9000 - containerPort: 9009 - containerPort: 9003 - name: http containerPort: 9000 protocol: TCP - name: influxdb containerPort: 9009 protocol: TCP env: - name: QDB_CAIRO_COMMIT_LAG value: "1000" - name: QDB_CAIRO_MAX_UNCOMMITTED_ROWS value: "100000" readinessProbe: exec: command: ["curl", "-XGET", "localhost:9000"] livenessProbe: exec: command: ["curl", "-XGET", "localhost:9003/metrics"] resources: requests: cpu: 250m memory: 512Mi limits: cpu: 700m memory: 1024Mi --- apiVersion: apps/v1 kind: Deployment metadata: name: monitoringserver spec: selector: matchLabels: app: monitoringservice replicas: 1 template: metadata: labels: app: monitoringservice spec: terminationGracePeriodSeconds: 5 restartPolicy: Always containers: - name: server image: registry.gitlab.com/teraflow-h2020/controller/monitoring:latest imagePullPolicy: Always ports: - containerPort: 7070 - name: grpc containerPort: 7070 protocol: TCP env: - name: LOG_LEVEL value: "INFO" - name: METRICSDB_HOSTNAME value: "localhost" value: "monitoringservice" - name: METRICSDB_ILP_PORT value: "9009" - name: METRICSDB_REST_PORT Loading @@ -68,19 +81,13 @@ spec: - name: METRICSDB_TABLE value: "monitoring" readinessProbe: exec: command: ["/bin/grpc_health_probe", "-addr=:7070"] grpc: port: 7070 initialDelaySeconds: 5 livenessProbe: exec: command: ["/bin/grpc_health_probe", "-addr=:7070"] resources: requests: cpu: 250m memory: 512Mi limits: cpu: 700m memory: 1024Mi grpc: port: 7070 initialDelaySeconds: 10 --- apiVersion: v1 kind: Service Loading @@ -95,7 +102,11 @@ spec: protocol: TCP port: 7070 targetPort: 7070 - name: questdb - name: http protocol: TCP port: 9000 targetPort: 9000 - name: influxdb protocol: TCP port: 9009 targetPort: 9009 No newline at end of file src/monitoring/service/MetricsDBTools.py +16 −13 Original line number Diff line number Diff line Loading @@ -17,12 +17,15 @@ import socket import requests import json import sys import logging LOGGER = logging.getLogger(__name__) class MetricsDB(): def __init__(self, host, ilp_port, rest_port, table): self.socket=socket.socket(socket.AF_INET, socket.SOCK_STREAM) self.host=host self.ilp_port=ilp_port self.ilp_port=int(ilp_port) self.rest_port=rest_port self.table=table Loading @@ -47,6 +50,6 @@ class MetricsDB(): try: response = requests.get(url, params=query_params) json_response = json.loads(response.text) print(json_response) LOGGER.info(json_response) except requests.exceptions.RequestException as e: print(f'Error: {e}', file=sys.stderr) LOGGER.info(f'Error: {e}', file=sys.stderr) src/monitoring/service/MonitoringServiceServicerImpl.py +1 −0 Original line number Diff line number Diff line Loading @@ -59,6 +59,7 @@ class MonitoringServiceServicerImpl(MonitoringServiceServicer): # Set metrics_db client self.metrics_db = MetricsDBTools.MetricsDB(METRICSDB_HOSTNAME,METRICSDB_ILP_PORT,METRICSDB_REST_PORT,METRICSDB_TABLE) LOGGER.info('MetricsDB initialized') # SetKpi (SetKpiRequest) returns (KpiId) {} def SetKpi( Loading Loading
manifests/monitoringservice.yaml +45 −34 Original line number Diff line number Diff line Loading @@ -13,13 +13,14 @@ # limitations under the License. apiVersion: apps/v1 kind: Deployment kind: StatefulSet metadata: name: monitoringservice name: monitoringdb spec: selector: matchLabels: app: monitoringservice serviceName: "monitoringservice" replicas: 1 template: metadata: Loading @@ -32,35 +33,47 @@ spec: - name: metricsdb image: questdb/questdb ports: - containerPort: 9000 - containerPort: 9009 - containerPort: 9003 - name: http containerPort: 9000 protocol: TCP - name: influxdb containerPort: 9009 protocol: TCP env: - name: QDB_CAIRO_COMMIT_LAG value: "1000" - name: QDB_CAIRO_MAX_UNCOMMITTED_ROWS value: "100000" readinessProbe: exec: command: ["curl", "-XGET", "localhost:9000"] livenessProbe: exec: command: ["curl", "-XGET", "localhost:9003/metrics"] resources: requests: cpu: 250m memory: 512Mi limits: cpu: 700m memory: 1024Mi --- apiVersion: apps/v1 kind: Deployment metadata: name: monitoringserver spec: selector: matchLabels: app: monitoringservice replicas: 1 template: metadata: labels: app: monitoringservice spec: terminationGracePeriodSeconds: 5 restartPolicy: Always containers: - name: server image: registry.gitlab.com/teraflow-h2020/controller/monitoring:latest imagePullPolicy: Always ports: - containerPort: 7070 - name: grpc containerPort: 7070 protocol: TCP env: - name: LOG_LEVEL value: "INFO" - name: METRICSDB_HOSTNAME value: "localhost" value: "monitoringservice" - name: METRICSDB_ILP_PORT value: "9009" - name: METRICSDB_REST_PORT Loading @@ -68,19 +81,13 @@ spec: - name: METRICSDB_TABLE value: "monitoring" readinessProbe: exec: command: ["/bin/grpc_health_probe", "-addr=:7070"] grpc: port: 7070 initialDelaySeconds: 5 livenessProbe: exec: command: ["/bin/grpc_health_probe", "-addr=:7070"] resources: requests: cpu: 250m memory: 512Mi limits: cpu: 700m memory: 1024Mi grpc: port: 7070 initialDelaySeconds: 10 --- apiVersion: v1 kind: Service Loading @@ -95,7 +102,11 @@ spec: protocol: TCP port: 7070 targetPort: 7070 - name: questdb - name: http protocol: TCP port: 9000 targetPort: 9000 - name: influxdb protocol: TCP port: 9009 targetPort: 9009 No newline at end of file
src/monitoring/service/MetricsDBTools.py +16 −13 Original line number Diff line number Diff line Loading @@ -17,12 +17,15 @@ import socket import requests import json import sys import logging LOGGER = logging.getLogger(__name__) class MetricsDB(): def __init__(self, host, ilp_port, rest_port, table): self.socket=socket.socket(socket.AF_INET, socket.SOCK_STREAM) self.host=host self.ilp_port=ilp_port self.ilp_port=int(ilp_port) self.rest_port=rest_port self.table=table Loading @@ -47,6 +50,6 @@ class MetricsDB(): try: response = requests.get(url, params=query_params) json_response = json.loads(response.text) print(json_response) LOGGER.info(json_response) except requests.exceptions.RequestException as e: print(f'Error: {e}', file=sys.stderr) LOGGER.info(f'Error: {e}', file=sys.stderr)
src/monitoring/service/MonitoringServiceServicerImpl.py +1 −0 Original line number Diff line number Diff line Loading @@ -59,6 +59,7 @@ class MonitoringServiceServicerImpl(MonitoringServiceServicer): # Set metrics_db client self.metrics_db = MetricsDBTools.MetricsDB(METRICSDB_HOSTNAME,METRICSDB_ILP_PORT,METRICSDB_REST_PORT,METRICSDB_TABLE) LOGGER.info('MetricsDB initialized') # SetKpi (SetKpiRequest) returns (KpiId) {} def SetKpi( Loading