From b0d7a299fe30bc3e1456e8646f9bfc18571d431d Mon Sep 17 00:00:00 2001 From: Nicolas Arenas Date: Wed, 30 Jul 2025 13:25:40 +0200 Subject: [PATCH] Elimina archivos del controls de versiones --- .../oglog/dh_installchangelogs.dch.trimmed | 6 - debian/changelog | 2 +- debian/files | 2 - debian/oglog/DEBIAN/md5sums | 27 - debian/oglog/DEBIAN/postrm | 8 - .../opengnsys/oglog/etc/grafana/grafana.ini | 33 - .../provisioning/datasources/prometheus.yaml | 8 - .../oglog/etc/opensearch/pipelines.json | 605 ------------------ .../usr/share/doc/oglog/changelog.Debian.gz | Bin 181 -> 0 bytes debian/patches/series | 1 + script/import_grafana.sh | 4 +- script/setup_grafana_token.sh | 13 +- 12 files changed, 11 insertions(+), 698 deletions(-) delete mode 100644 debian/.debhelper/generated/oglog/dh_installchangelogs.dch.trimmed delete mode 100644 debian/files delete mode 100644 debian/oglog/DEBIAN/md5sums delete mode 100755 debian/oglog/DEBIAN/postrm delete mode 100644 debian/oglog/opt/opengnsys/oglog/etc/grafana/grafana.ini delete mode 100644 debian/oglog/opt/opengnsys/oglog/etc/grafana/provisioning/datasources/prometheus.yaml delete mode 100644 debian/oglog/opt/opengnsys/oglog/etc/opensearch/pipelines.json delete mode 100644 debian/oglog/usr/share/doc/oglog/changelog.Debian.gz diff --git a/debian/.debhelper/generated/oglog/dh_installchangelogs.dch.trimmed b/debian/.debhelper/generated/oglog/dh_installchangelogs.dch.trimmed deleted file mode 100644 index 80e6cbf..0000000 --- a/debian/.debhelper/generated/oglog/dh_installchangelogs.dch.trimmed +++ /dev/null @@ -1,6 +0,0 @@ -oglog (0.0.1-1) UNRELEASED; urgency=low - - * Initial release. Closes: #nnnn - - - -- Nicolas Arenas Mon, 07 Jul 2025 11:17:41 +0000 diff --git a/debian/changelog b/debian/changelog index 80e6cbf..ec78b13 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,4 +1,4 @@ -oglog (0.0.1-1) UNRELEASED; urgency=low +oglog (0.0.1-2) UNRELEASED; urgency=low * Initial release. Closes: #nnnn diff --git a/debian/files b/debian/files deleted file mode 100644 index 25c6086..0000000 --- a/debian/files +++ /dev/null @@ -1,2 +0,0 @@ -oglog_0.0.1-1_amd64.buildinfo unknown optional -oglog_0.0.1-1_amd64.deb unknown optional diff --git a/debian/oglog/DEBIAN/md5sums b/debian/oglog/DEBIAN/md5sums deleted file mode 100644 index a872b6a..0000000 --- a/debian/oglog/DEBIAN/md5sums +++ /dev/null @@ -1,27 +0,0 @@ -b21eb22a15f70b9f4effb9c861a151ac opt/opengnsys/oglog/etc/filebeat/filebeat.yml -a1bca00a415f8e6ad671c9fc0e5aa599 opt/opengnsys/oglog/etc/grafana/dashboards/1860.json -fe48324bff332d3008b7ea20ef347c86 opt/opengnsys/oglog/etc/grafana/grafana.ini -5f30e6a73714660772795757730672a0 opt/opengnsys/oglog/etc/grafana/provisioning/alerting/alerts.yaml -6f792b6660385b5205bb88ec72017ff5 opt/opengnsys/oglog/etc/grafana/provisioning/alerting/contactpoint.yaml -e3e158174e4b0c887e3ebf8ab3270998 opt/opengnsys/oglog/etc/grafana/provisioning/dashboards/dashboard.yaml -210879070a80d49bc39325365568cfc2 opt/opengnsys/oglog/etc/grafana/provisioning/datasources/opensearch.yaml -c88702f9f323cb1c5769528af963d926 opt/opengnsys/oglog/etc/grafana/provisioning/datasources/prometheus.yaml -c9948ab4dcf48d6f964b7f5cb5a71b6e opt/opengnsys/oglog/etc/grafana/resources/alerts/alert-rules.json -c74acaaf45ab0129421e574020850d4d opt/opengnsys/oglog/etc/grafana/resources/dashboards/.json -61a25398ebaac88dc31463dcaaed53fc opt/opengnsys/oglog/etc/grafana/resources/dashboards/Estado_actual_de_los_clientes.json -111a7056ca200c19c3dfdc831462c7aa opt/opengnsys/oglog/etc/grafana/resources/dashboards/Node_Exporter_Full.json -83a8a06018e829535d16d477d8c0c1ad opt/opengnsys/oglog/etc/grafana/resources/dashboards/Peticiones_nginx.json -f683ca4a448cc6379d6f7ea0be4905d5 opt/opengnsys/oglog/etc/grafana/resources/dashboards/Traceo_y_comandos.json -d2b04ad33afe5f7817693c09fd028f58 opt/opengnsys/oglog/etc/grafana/resources/dashboards/Uso_de_IPs_de_subred.json -c74acaaf45ab0129421e574020850d4d opt/opengnsys/oglog/etc/grafana/resources/dashboards/null.json -b331b2d52722185ffe696134f2f21574 opt/opengnsys/oglog/etc/grafana/resources/datasources/datasources.json -bb9d630a4043ca40a02fc7d151def533 opt/opengnsys/oglog/etc/journalbeat/journalbeat.yml -6dfcc99992924abe469b3c37a5721a35 opt/opengnsys/oglog/etc/opensearch-dashboards/opensearch_dashboards.yml -f910f0079cac0a6c878001aa8d931cb6 opt/opengnsys/oglog/etc/opensearch-dashboards/saved_searches.ndjson -8265cff9992dbf2c247146a948ddc07b opt/opengnsys/oglog/etc/opensearch/opensearch.yml -9accc84d9ccdaf5dd7bb60ca69301bf1 opt/opengnsys/oglog/etc/opensearch/pipelines.json -91005de9a7933fc879fee2f8602a966e opt/opengnsys/oglog/etc/prometheus/prometheus.yml -b782a19c68d9f34cb55f907eba24bf97 opt/opengnsys/oglog/etc/prometheus/web-config.yml -8be54476ab923c429c20607c575a8878 usr/share/doc/oglog/README.Debian -91bbdf3919c8302a03cba3b728f55bc0 usr/share/doc/oglog/changelog.Debian.gz -26470036a67b744fed35f11a0c96fd2f usr/share/doc/oglog/copyright diff --git a/debian/oglog/DEBIAN/postrm b/debian/oglog/DEBIAN/postrm deleted file mode 100755 index 3e9fde0..0000000 --- a/debian/oglog/DEBIAN/postrm +++ /dev/null @@ -1,8 +0,0 @@ -#!/bin/sh -set -e -# Automatically added by dh_installdebconf/13.14.1ubuntu5 -if [ "$1" = purge ] && [ -e /usr/share/debconf/confmodule ]; then - . /usr/share/debconf/confmodule - db_purge -fi -# End automatically added section diff --git a/debian/oglog/opt/opengnsys/oglog/etc/grafana/grafana.ini b/debian/oglog/opt/opengnsys/oglog/etc/grafana/grafana.ini deleted file mode 100644 index 15cd8c0..0000000 --- a/debian/oglog/opt/opengnsys/oglog/etc/grafana/grafana.ini +++ /dev/null @@ -1,33 +0,0 @@ -[server] -protocol = https -cert_file = /opt/opengnsys/oglog/etc/certs/server.crt -cert_key = /opt/opengnsys/oglog/etc/certs/server.key -http_port = 3030 - - -[analytics] -reporting_enabled = false -check_for_updates = false -check_for_plugin_updates = false - -[database] -type = sqlite3 -path = /var/lib/grafana/grafana.db - -[auth] -disable_login_form = false - -#################################### SMTP / Emailing ########################## -[smtp] -enabled = true -host = smtp.qindel.es:465 -user = lgromero@qindel.com -password = *** -;cert_file = -;key_file = -skip_verify = true -from_address = lgromero@qindel.com -from_name = Grafana - -[emails] -welcome_email_on_sign_up = false diff --git a/debian/oglog/opt/opengnsys/oglog/etc/grafana/provisioning/datasources/prometheus.yaml b/debian/oglog/opt/opengnsys/oglog/etc/grafana/provisioning/datasources/prometheus.yaml deleted file mode 100644 index 9f7e2cc..0000000 --- a/debian/oglog/opt/opengnsys/oglog/etc/grafana/provisioning/datasources/prometheus.yaml +++ /dev/null @@ -1,8 +0,0 @@ -apiVersion: 1 -datasources: - - name: Prometheus - type: prometheus - access: proxy - url: https://${OGLOG_SERVER}:9090 - isDefault: true - diff --git a/debian/oglog/opt/opengnsys/oglog/etc/opensearch/pipelines.json b/debian/oglog/opt/opengnsys/oglog/etc/opensearch/pipelines.json deleted file mode 100644 index 9060c22..0000000 --- a/debian/oglog/opt/opengnsys/oglog/etc/opensearch/pipelines.json +++ /dev/null @@ -1,605 +0,0 @@ -{ - "filter_ogdhcp_pipeline" : { - "description" : "Parse logs to extract http_code and desc, while preserving original message", - "processors" : [ - { - "script" : { - "if" : "ctx.syslog?.identifier != 'ogdhcp'", - "source" : "\n ctx.debug = 'Skipped: identifier is ' + (ctx.syslog?.identifier ?: 'undefined');\n ctx.pipeline_stop = true; // Stops further processing but retains the document\n " - } - }, - { - "set" : { - "field" : "debug", - "value" : "Processed: identifier is ogdhcp" - } - }, - { - "script" : { - "source" : "\n ctx.processed_message = ctx.message;\n " - } - }, - { - "gsub" : { - "field" : "processed_message", - "pattern" : "^app\\.[A-Z]+: ", - "replacement" : "", - "ignore_failure" : true - } - }, - { - "gsub" : { - "field" : "processed_message", - "pattern" : "^request\\.INFO: Matched route \".*?\"\\. ", - "replacement" : "", - "ignore_failure" : true - } - }, - { - "json" : { - "field" : "processed_message", - "target_field" : "parsed_message", - "ignore_failure" : true - } - }, - { - "set" : { - "field" : "route", - "value" : "{{parsed_message.route}}", - "ignore_empty_value" : true, - "if" : "ctx.parsed_message?.route != null" - } - }, - { - "set" : { - "field" : "route_parameters", - "value" : "{{parsed_message.route_parameters}}", - "ignore_empty_value" : true, - "if" : "ctx.parsed_message?.route_parameters != null" - } - }, - { - "set" : { - "field" : "request_uri", - "value" : "{{parsed_message.request_uri}}", - "ignore_empty_value" : true, - "if" : "ctx.parsed_message?.request_uri != null" - } - }, - { - "set" : { - "field" : "method", - "value" : "{{parsed_message.method}}", - "ignore_empty_value" : true, - "if" : "ctx.parsed_message?.method != null" - } - }, - { - "set" : { - "field" : "http_code", - "value" : "{{parsed_message.http_code}}", - "ignore_empty_value" : true - } - }, - { - "set" : { - "field" : "description", - "value" : "{{parsed_message.desc}}", - "ignore_empty_value" : true - } - } - ] - }, - "master_pipeline" : { - "description" : "Master pipeline to route logs based on syslog.identifier", - "processors" : [ - { - "pipeline" : { - "name" : "filter_tftp_pipeline", - "if" : "ctx.syslog?.identifier == 'in.tftpd'" - } - }, - { - "pipeline" : { - "name" : "filter_ogboot_pipeline", - "if" : "ctx.syslog?.identifier == 'ogboot'" - } - }, - { - "pipeline" : { - "name" : "filter_ogdhcp_pipeline", - "if" : "ctx.syslog?.identifier == 'ogdhcp'" - } - }, - { - "pipeline" : { - "name" : "kea_dhcp_pipeline", - "if" : "ctx.syslog?.identifier == 'kea-dhcp4'" - } - }, - { - "pipeline" : { - "name" : "ogrepo_pipeline", - "if" : "ctx.syslog?.identifier == 'ogrepo-api'" - } - }, - { - "pipeline" : { - "name" : "docker_logs_pipeline", - "if" : "ctx.syslog?.identifier == 'docker'" - } - }, - { - "json": { - "field": "message", - "target_field": "parsed_message", - "ignore_failure": true, - "if": "ctx.syslog?.identifier == 'ogcore'" - } - }, - { - "set" : { - "field" : "debug", - "value" : "No matching pipeline, skipping further processing.", - "if" : "ctx.syslog?.identifier != 'in.tftpd' && ctx.syslog?.identifier != 'ogboot' && ctx.syslog?.identifier != 'kea-dhcp4' && ctx.syslog?.identifier != 'ogrepo-api' && ctx.syslog?.identifier != 'docker'" - } - } - ] - }, - "json_parse_pipeline" : { - "description" : "Parse JSON payload from logs", - "processors" : [ - { - "json" : { - "field" : "message", - "target_field" : "parsed_json", - "ignore_failure" : true - } - } - ] - }, - "docker_logs_pipeline" : { - "description" : "Parse Docker logs and route based on container name", - "processors" : [ - { - "grok" : { - "field" : "message", - "patterns" : [ - "%{DATA:container.name}\\s*\\|%{GREEDYDATA:log_details}" - ], - "ignore_failure" : true - } - }, - { - "pipeline" : { - "name" : "parse_nginx_logs", - "if" : "ctx.container?.name == 'ogcore-nginx'", - "ignore_failure" : true - } - }, - { - "json" : { - "field" : "log_details", - "target_field" : "parsed_json", - "ignore_failure" : true - } - } - ] - }, - "json_parse_with_replacement_debug" : { - "description" : "Debug replacement of single quotes with double quotes and parse JSON", - "processors" : [ - { - "script" : { - "source" : "\n ctx.message = ctx.message.replace(\"'\", \"\\\"\");\n " - } - }, - { - "set" : { - "field" : "debug_message", - "value" : "{{ message }}" - } - }, - { - "json" : { - "field" : "message", - "target_field" : "parsed_json", - "ignore_failure" : true - } - } - ] - }, - "ogrepo_parse_pipeline" : { - "description" : "Parse ogRepo logs for detailed JSON information", - "processors" : [ - { - "grok" : { - "field" : "message", - "patterns" : [ - "%{TIMESTAMP_ISO8601:timestamp} %{DATA:hostname} %{DATA:service}\\[%{NUMBER:pid}\\]: %{GREEDYDATA:json_payload}" - ], - "ignore_failure" : true - } - }, - { - "json" : { - "field" : "json_payload", - "target_field" : "parsed_json", - "ignore_failure" : true - } - }, - { - "rename" : { - "field" : "parsed_json.component", - "target_field" : "component", - "ignore_failure" : true - } - }, - { - "rename" : { - "field" : "parsed_json.severity", - "target_field" : "severity", - "ignore_failure" : true - } - }, - { - "rename" : { - "field" : "parsed_json.http_code", - "target_field" : "http_code", - "ignore_failure" : true - } - }, - { - "rename" : { - "field" : "parsed_json.operation", - "target_field" : "operation", - "ignore_failure" : true - } - }, - { - "rename" : { - "field" : "parsed_json.desc", - "target_field" : "description", - "ignore_failure" : true - } - } - ] - }, - "kea_dhcp_pipeline" : { - "description" : "Parse logs from kea-dhcp4 to extract key fields", - "processors" : [ - { - "grok" : { - "field" : "message", - "patterns" : [ - "%{TIMESTAMP_ISO8601:timestamp} %{LOGLEVEL:level} \\[%{DATA:service}/%{NUMBER:pid}\\.%{DATA:thread_id}\\] %{DATA:event_type} \\[hwtype=%{NUMBER:hw_type} %{MAC:mac_address}\\](?:, cid=\\[%{DATA:cid}\\])?, tid=%{DATA:transaction_id}: (?:lease %{IP:ip_address} %{GREEDYDATA:event_details})?" - ], - "ignore_failure" : true - } - }, - { - "set" : { - "field" : "service", - "value" : "kea-dhcp4", - "ignore_failure" : true - } - } - ] - }, - "kea_dhcp_filebeat_pipeline" : { - "description" : "Parse Kea DHCP logs from Filebeat", - "processors" : [ - { - "grok" : { - "field" : "message", - "patterns" : [ - "%{TIMESTAMP_ISO8601:timestamp} %{LOGLEVEL:level} \\[%{DATA:service}/%{NUMBER:pid}\\.%{DATA:thread_id}\\] %{DATA:event_type} \\[hwtype=%{NUMBER:hw_type} %{MAC:mac_address}\\](?:, cid=\\[%{DATA:cid}\\])?, tid=%{DATA:transaction_id}: (?:lease %{IP:ip_address} %{GREEDYDATA:event_details})?" - ], - "ignore_failure" : true - } - }, - { - "set" : { - "field" : "service", - "value" : "kea-dhcp4", - "ignore_failure" : true - } - }, - { - "date" : { - "field" : "timestamp", - "formats" : [ - "yyyy-MM-dd HH:mm:ss.SSS" - ], - "target_field" : "@timestamp", - "ignore_failure" : true - } - } - ] - }, - "filter_ogboot_pipeline" : { - "description" : "Parse logs to extract http_code and desc, while preserving original message", - "processors" : [ - { - "script" : { - "if" : "ctx.syslog?.identifier != 'ogboot'", - "source" : "\n ctx.debug = 'Skipped: identifier is ' + (ctx.syslog?.identifier ?: 'undefined');\n ctx.pipeline_stop = true; // Stops further processing but retains the document\n " - } - }, - { - "set" : { - "field" : "debug", - "value" : "Processed: identifier is ogboot" - } - }, - { - "script" : { - "source" : "\n ctx.processed_message = ctx.message;\n " - } - }, - { - "gsub" : { - "field" : "processed_message", - "pattern" : "^app\\.[A-Z]+: ", - "replacement" : "", - "ignore_failure" : true - } - }, - { - "gsub" : { - "field" : "processed_message", - "pattern" : "^request\\.INFO: Matched route \".*?\"\\. ", - "replacement" : "", - "ignore_failure" : true - } - }, - { - "json" : { - "field" : "processed_message", - "target_field" : "parsed_message", - "ignore_failure" : true - } - }, - { - "set" : { - "field" : "route", - "value" : "{{parsed_message.route}}", - "ignore_empty_value" : true, - "if" : "ctx.parsed_message?.route != null" - } - }, - { - "set" : { - "field" : "route_parameters", - "value" : "{{parsed_message.route_parameters}}", - "ignore_empty_value" : true, - "if" : "ctx.parsed_message?.route_parameters != null" - } - }, - { - "set" : { - "field" : "request_uri", - "value" : "{{parsed_message.request_uri}}", - "ignore_empty_value" : true, - "if" : "ctx.parsed_message?.request_uri != null" - } - }, - { - "set" : { - "field" : "method", - "value" : "{{parsed_message.method}}", - "ignore_empty_value" : true, - "if" : "ctx.parsed_message?.method != null" - } - }, - { - "set" : { - "field" : "http_code", - "value" : "{{parsed_message.http_code}}", - "ignore_empty_value" : true - } - }, - { - "set" : { - "field" : "description", - "value" : "{{parsed_message.desc}}", - "ignore_empty_value" : true - } - } - ] - }, - "ogrepo_pipeline" : { - "description" : "Pipeline to parse ogRepo logs", - "processors" : [ - { - "set" : { - "field" : "debug_message", - "value" : "{{message}}" - } - }, - { - "script" : { - "source" : "\n if (ctx.message != null) {\n ctx.message = ctx.message.replace(\"'\", \"\\\"\")\n }\n " - } - }, - { - "json" : { - "field" : "message", - "target_field" : "parsed_json", - "ignore_failure" : true - } - }, - { - "remove" : { - "field" : "message", - "ignore_failure" : true - } - } - ] - }, - "parse_nginx_logs" : { - "description" : "Parse logs from Nginx in the 'main' log format with debug information", - "processors" : [ - { - "set" : { - "field" : "debug", - "value" : "Entered parse_nginx_logs pipeline", - "ignore_failure" : true - } - }, - { - "gsub" : { - "field" : "log_details", - "pattern" : "^\\s+", - "replacement" : "", - "ignore_failure" : true - } - }, - { - "grok" : { - "field" : "log_details", - "patterns" : [ - "%{IP:client_ip} %{GREEDYDATA:rest}" - ], - "ignore_failure" : true - } - }, - { - "grok" : { - "field" : "rest", - "patterns" : [ - "- %{DATA:remote_user} \\[%{HTTPDATE:timestamp}\\] %{GREEDYDATA:rest_after_timestamp}" - ], - "ignore_failure" : true - } - }, - { - "grok" : { - "field" : "rest_after_timestamp", - "patterns" : [ - "\"%{WORD:method} %{DATA:request_path} HTTP/%{NUMBER:http_version}\" %{NUMBER:status} %{NUMBER:body_bytes} %{GREEDYDATA:rest_referer}" - ], - "ignore_failure" : true - } - }, - { - "grok" : { - "field" : "rest_referer", - "patterns" : [ - "\"%{DATA:referer}\" \"%{GREEDYDATA:nginx_user_agent}\"" - ], - "ignore_failure" : true - } - }, - { - "date" : { - "field" : "timestamp", - "formats" : [ - "dd/MMM/yyyy:HH:mm:ss Z" - ], - "target_field" : "@timestamp", - "ignore_failure" : true - } - }, - { - "remove" : { - "field" : [ - "rest" - ], - "ignore_missing" : true - } - } - ] - }, - "kea_dhcp_parse_pipeline" : { - "description" : "Parse Kea DHCP logs for detailed information", - "processors" : [ - { - "grok" : { - "field" : "message", - "patterns" : [ - "%{TIMESTAMP_ISO8601:timestamp} +%{LOGLEVEL:log_level} \\[%{DATA:source}/%{NUMBER:pid}.%{NUMBER:thread_id}\\] %{WORD:message_id} \\[%{DATA:hwtype}\\], cid=%{DATA:cid}, tid=%{DATA:tid}: lease %{IP:lease} has been allocated for %{NUMBER:lease_duration} seconds" - ], - "ignore_failure" : true - } - }, - { - "set" : { - "field" : "service", - "value" : "kea-dhcp4", - "ignore_failure" : true - } - } - ] - }, - "json_parse_with_replacement" : { - "description" : "Replace single quotes with double quotes and parse JSON", - "processors" : [ - { - "script" : { - "source" : "\n ctx.message = ctx.message.replace(\"'\", \"\\\"\");\n " - } - }, - { - "json" : { - "field" : "message", - "target_field" : "parsed_json" - } - } - ] - }, - "tftp_parse_pipeline" : { - "description" : "Parse logs from in.tftpd to extract filename and client IP", - "processors" : [ - { - "grok" : { - "field" : "message", - "patterns" : [ - "RRQ from %{HOSTNAME:client_ip} filename %{GREEDYDATA:filename}" - ], - "ignore_failure" : true - } - }, - { - "set" : { - "field" : "service", - "value" : "tftpd", - "ignore_failure" : true - } - } - ] - }, - "filter_tftp_pipeline" : { - "description" : "Parse logs from in.tftpd to extract filename and client IP", - "processors" : [ - { - "grok" : { - "field" : "message", - "patterns" : [ - "RRQ from %{HOSTNAME:client_ip} filename %{GREEDYDATA:filename}" - ], - "ignore_failure" : true - } - }, - { - "set" : { - "field" : "service_name", - "value" : "tftpd", - "ignore_failure" : true - } - } - ] - }, - "copy-message-pipeline" : { - "description" : "Pipeline que copia el campo message a message_raw", - "processors" : [ - { - "set" : { - "field" : "message_raw", - "value" : "{{message}}" - } - } - ] - } -} - diff --git a/debian/oglog/usr/share/doc/oglog/changelog.Debian.gz b/debian/oglog/usr/share/doc/oglog/changelog.Debian.gz deleted file mode 100644 index 548a9637f6179d6e34e340059b9e234c55ab17d3..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 181 zcmV;m080NKiwFP!00002109UX3c@fHMfd%R3vQfRlA;K8K+!HLD&p_~wLWVg=3&wx z{d=QlbI;;%xz=2xD-w~&SoUx|obp}1I_H}yysgPp?OgLGihw=}qZ(CeSkhEFO0d@K z$Yto5KuCbu&!8NdC*kI682`GF1wYWTwhML3IN;GinjrNhdS2{SY0UzTrW?xd57 jUkhN*W(YCC)@!699Ye}YPO_22Km?*M=TiwZzyJUMDZNv| diff --git a/debian/patches/series b/debian/patches/series index 4a97dfa..64324f8 100644 --- a/debian/patches/series +++ b/debian/patches/series @@ -1 +1,2 @@ # You must remove unused comment lines for the released package. +patch001 diff --git a/script/import_grafana.sh b/script/import_grafana.sh index d81c802..18eb9dd 100755 --- a/script/import_grafana.sh +++ b/script/import_grafana.sh @@ -18,7 +18,7 @@ API_TOKEN=$(cat "$TOKEN_FILE") if [ -f "$RESOURCE_DIR/datasources/datasources.json" ]; then echo "Importando datasources..." jq -c '.[]' "$RESOURCE_DIR/datasources/datasources.json" | while read -r datasource; do - curl -s -X POST "$GRAFANA_URL/api/datasources" \ + curl -k -X POST "$GRAFANA_URL/api/datasources" \ -H "Authorization: Bearer $API_TOKEN" \ -H "Content-Type: application/json" \ -d "$datasource" > /dev/null @@ -32,7 +32,7 @@ for f in "$RESOURCE_DIR/dashboards"/*.json; do echo "Importando $(basename "$f")" jq 'del(.dashboard.id) | {dashboard: .dashboard, overwrite: true}' "$f" | \ - curl -s -X POST "$GRAFANA_URL/api/dashboards/db" \ + curl -k -X POST "$GRAFANA_URL/api/dashboards/db" \ -H "Authorization: Bearer $API_TOKEN" \ -H "Content-Type: application/json" \ --data-binary @- diff --git a/script/setup_grafana_token.sh b/script/setup_grafana_token.sh index dd4986b..ebe16a9 100755 --- a/script/setup_grafana_token.sh +++ b/script/setup_grafana_token.sh @@ -1,10 +1,11 @@ #!/bin/bash +set -x # Variables #GRAFANA_URL="https://oglog-graf.mytld:3000" GRAFANA_URL=$1 GRAFANA_USER="admin" -GRAFANA_PASS="admin" +GRAFANA_PASS="qindel" #CERT="/etc/grafana/oglog-graf.mytld.crt.pem" CERT=$2 #KEY="/etc/grafana/oglog-graf.mytld.key.pem" @@ -15,14 +16,14 @@ TOKEN_TTL=3600 TOKEN_FILE="./grafana_token.txt" # 1. Buscar si ya existe el Service Account -SA_ID=$(curl -s --cert "$CERT" --key "$KEY" -u $GRAFANA_USER:$GRAFANA_PASS \ +SA_ID=$(curl -k -u $GRAFANA_USER:$GRAFANA_PASS \ "$GRAFANA_URL/api/serviceaccounts/search" \ | jq -r '.serviceAccounts[] | select(.name=="'"$SA_NAME"'") | .id') # 2. Crear si no existe if [ -z "$SA_ID" ]; then echo "Creando Service Account: $SA_NAME" - SA_ID=$(curl -s --cert "$CERT" --key "$KEY" -u $GRAFANA_USER:$GRAFANA_PASS \ + SA_ID=$(curl -k -u $GRAFANA_USER:$GRAFANA_PASS \ -H "Content-Type: application/json" \ -d '{ "name": "'"$SA_NAME"'", "role": "Admin" }' \ "$GRAFANA_URL/api/serviceaccounts" | jq -r '.id') @@ -38,18 +39,18 @@ if [ -f "$TOKEN_FILE" ]; then else echo "Buscando token existente con nombre $TOKEN_NAME..." - TOKEN_ID=$(curl -s --cert "$CERT" --key "$KEY" -u $GRAFANA_USER:$GRAFANA_PASS \ + TOKEN_ID=$(curl -k -u $GRAFANA_USER:$GRAFANA_PASS \ "$GRAFANA_URL/api/serviceaccounts/$SA_ID/tokens" \ | jq -r '.[] | select(.name=="'"$TOKEN_NAME"'") | .id') if [ -n "$TOKEN_ID" ]; then echo "Borrando token anterior con ID $TOKEN_ID..." - curl -s -X DELETE --cert "$CERT" --key "$KEY" -u $GRAFANA_USER:$GRAFANA_PASS \ + curl -k -X DELETE -u $GRAFANA_USER:$GRAFANA_PASS \ "$GRAFANA_URL/api/serviceaccounts/$SA_ID/tokens/$TOKEN_ID" > /dev/null fi echo "Creando nuevo token..." - TOKEN=$(curl -s --cert "$CERT" --key "$KEY" -u $GRAFANA_USER:$GRAFANA_PASS \ + TOKEN=$(curl -k -u $GRAFANA_USER:$GRAFANA_PASS \ -H "Content-Type: application/json" \ -d '{ "name": "'"$TOKEN_NAME"'", "secondsToLive": '"$TOKEN_TTL"' }' \ "$GRAFANA_URL/api/serviceaccounts/$SA_ID/tokens" | jq -r '.key')