-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* update dependencies * update dependencies * update dependencies * actian integration * fix certifi * actian pipeline
- Loading branch information
1 parent
65c18bc
commit ab9999b
Showing
38 changed files
with
2,703 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -12,3 +12,4 @@ version.py | |
sdc-data*/ | ||
containers/streamsets/python-libs/ | ||
agent/backup-data/ | ||
/agent/actian_config/actian-client/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
FROM tiangolo/uwsgi-nginx-flask:python3.10 | ||
|
||
WORKDIR /usr/src/app | ||
|
||
COPY . . | ||
ADD .bashrc /root/.bashrc | ||
COPY ./custom_entrypoint.sh / | ||
COPY supervisord.conf /etc/supervisor/supervisord.conf | ||
COPY nginx.conf /etc/nginx/nginx.conf | ||
COPY uwsgi-nginx-entrypoint.sh /uwsgi-nginx-entrypoint.sh | ||
COPY uwsgi.ini /etc/uwsgi/uwsgi.ini | ||
RUN chmod +x /custom_entrypoint.sh /uwsgi-nginx-entrypoint.sh | ||
|
||
ENV STREAMSETS_USERNAME="admin" STREAMSETS_PASSWORD="admin" STREAMSETS_URL="http://localhost:18630" \ | ||
LOG_FILE_PATH="/var/log/agent/agent.log" ANODOT_API_URL="https://api.anodot.com" ENV_PROD='true' \ | ||
GIT_SHA1=local-build VALIDATION_ENABLED="true" FLASK_APP="/usr/src/app/src/agent/api/main.py" FLASK_DEBUG=1 \ | ||
prometheus_multiproc_dir="/opt/metrics" | ||
|
||
# actian dependencies | ||
RUN apt-get update && apt-get install sudo | ||
COPY ./actian_config/actian-client /tmp/actian-client | ||
RUN /tmp/actian-client/client_install.sh -express | ||
COPY ./actian_config/odbcinst.ini /etc/odbcinst.ini | ||
ENV II_ODBC_WCHAR_SIZE=2 II_SYSTEM="/opt/Actian/Actian_Client" \ | ||
LD_LIBRARY_PATH=/lib:/usr/lib:/opt/Actian/Actian_Client/ingres/lib:/opt/Actian/Actian_Client/ingres/lib/lp32 | ||
|
||
RUN ./install_requirements.sh | ||
RUN python setup.py develop | ||
|
||
RUN groupadd -g 10001 agent && useradd -r -u 10001 -g agent agent | ||
RUN mkdir /var/log/agent /opt/metrics | ||
|
||
ENTRYPOINT ["/custom_entrypoint.sh"] | ||
CMD flask run --host=0.0.0.0 --port=8080 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
services: | ||
dc: | ||
platform: linux/amd64 | ||
build: | ||
context: ../../containers/streamsets | ||
ports: | ||
- "18630:18630" | ||
restart: on-failure | ||
volumes: | ||
- ./sdc-data:/data | ||
- ./sdc-conf:/etc/sdc_conf | ||
|
||
agent: | ||
platform: linux/amd64 | ||
build: | ||
context: .. | ||
dockerfile: Dockerfile.actian.local | ||
restart: always | ||
environment: | ||
STREAMSETS_USERNAME: 'admin' | ||
STREAMSETS_PASSWORD: 'admin' | ||
STREAMSETS_URL: 'http://dc:18630' | ||
ENV_PROD: 'false' | ||
AGENT_DB_HOST: 'db' | ||
AGENT_DB_USER: 'agent' | ||
AGENT_DB_PASSWORD: 'agent' | ||
GIT_SHA1: 'local' | ||
AGENT_URL: 'http://anodot-agent' | ||
PGPASSWORD: 'agent' | ||
TLS_VERSION: '1.1' | ||
LOG_LEVEL: 'DEBUG' | ||
depends_on: | ||
- dc | ||
- db | ||
volumes: | ||
- ../backup-data:/usr/src/app/backup-data | ||
- ../output:/output | ||
- ../:/usr/src/app | ||
ports: | ||
- "80:80" | ||
|
||
db: | ||
image: postgres:15 | ||
restart: always | ||
environment: | ||
POSTGRES_USER: agent | ||
POSTGRES_PASSWORD: agent | ||
POSTGRES_DB: agent | ||
ports: | ||
- "5432:5432" | ||
volumes: | ||
- db-data:/var/lib/postgresql/data | ||
|
||
|
||
volumes: | ||
agent-data: | ||
db-data: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
[ODBC] | ||
Trace = yes | ||
TraceFile = /tmp/odbctrace.log | ||
|
||
[ODBC Drivers] | ||
Ingres=Installed | ||
|
||
[Ingres] | ||
Driver=/opt/Actian/Actian_Client/ingres/lib/libiiodbcdriver.1.so |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
from .actian import actian | ||
from .cacti import cacti | ||
from .observium import observium | ||
from .snmp import snmp | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
from flask import jsonify, Blueprint, request | ||
from agent import pipeline, data_extractor | ||
from agent.api.routes import needs_pipeline | ||
|
||
actian = Blueprint('actian_source', __name__) | ||
|
||
|
||
@actian.route('/data_extractors/actian/<pipeline_id>', methods=['GET']) | ||
@needs_pipeline | ||
def read(pipeline_id: str): | ||
pipeline_ = pipeline.repository.get_by_id(pipeline_id) | ||
offset = request.args.get('offset') | ||
if not offset: | ||
return jsonify('No offset provided'), 400 | ||
metrics = data_extractor.actian.extract_metrics(pipeline_, int(offset)) | ||
return jsonify(metrics) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,3 +3,4 @@ | |
from . import snmp | ||
from . import topology | ||
from . import rrd | ||
from . import actian |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
from .actian import extract_metrics |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
import pyodbc | ||
from agent import source | ||
from agent.pipeline import Pipeline | ||
from agent.modules import logger | ||
|
||
logger_ = logger.get_logger(__name__) | ||
|
||
|
||
def extract_metrics(pipeline_: Pipeline, offset: int) -> list: | ||
cnx = pyodbc.connect(pipeline_.source.config[source.ActianSource.CONNECTION_STRING]) | ||
cursor = cnx.cursor() | ||
timestamp_to_unix = f'UNIX_TIMESTAMP({pipeline_.timestamp_path})' | ||
timestamp_condition = f'{timestamp_to_unix} >= {offset} AND {timestamp_to_unix} < {offset} + {pipeline_.interval}' | ||
query = pipeline_.query.replace('{TIMESTAMP_CONDITION}', timestamp_condition) | ||
logger_.info(f'Executing query: {query}') | ||
cursor.execute(query) | ||
rows = cursor.fetchall() | ||
column_names = [c[0] for c in cursor.description] | ||
return [{c: row.__getattribute__(c) for c in column_names} for row in rows] | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.