Commit 3ee498db authored by Sergio Gonzalez Diaz's avatar Sergio Gonzalez Diaz
Browse files

test influx

parent d109d6e3
Loading
Loading
Loading
Loading
+6 −6
Original line number Diff line number Diff line
@@ -27,12 +27,12 @@ spec:
          value: "teraflow"
        - name: INFLUXDB_HTTP_AUTH_ENABLED
          value: "True"
        # readinessProbe:
        #   exec:
        #     command: ["curl", "-XGET", "localhost:8086/health"]
        # livenessProbe:
        #   exec:
        #     command: ["curl", "-XGET", "localhost:8086/health"]
        readinessProbe:
          exec:
            command: ["curl", "-XGET", "localhost:8086/health"]
        livenessProbe:
          exec:
            command: ["curl", "-XGET", "localhost:8086/health"]
        resources:
          requests:
            cpu: 250m
+4 −2
Original line number Diff line number Diff line
@@ -39,9 +39,11 @@ build influx:
    # # - kubectl get all
    # - curl -XGET "10.97.74.29:8086/health" 
    # # - kubectl delete -f "manifests/influx.yaml"
    - pip install influxdb
    - cd ./src/monitoring/service
    - python3 test_influx.py
    - docker build -t "test-influx" ./
    - docker run --name test-influx --rm test-influx
    - docker stop test-influx
    - docker rmi test-influx

# test if the Docker image can be pulled from the gitlab registry
# test monitoring pull:
+6 −0
Original line number Diff line number Diff line
FROM python:3-slim

RUN pip install --upgrade pip 
RUN pip install influxdb
RUN pip install datetime
ENTRYPOINT ["python3", "test_influx.py"]
 No newline at end of file
+2 −2
Original line number Diff line number Diff line
from influx_tools import *
from influxdb import InfluxDBClient
from datetime import datetime

influx = Influx('10.97.74.29', 8086, 'teraflow', 'teraflow', 'monitoring')
influx = InfluxDBClient('10.97.74.29', 8086, 'teraflow', 'teraflow', 'monitoring')
influx.write_KPI(datetime.now(),1,1,101,1000)
results = influx.client.query('select * from samples;')
print(results.raw)
 No newline at end of file