refs #1806 add new directory resources to save all grafana configuration exported. Adds new scripts export/import grafana configurations and setup grafana token. Updates oglog script installation to import saved dashboards in repo
parent
7a295580eb
commit
e7fa49ffd1
|
@ -0,0 +1,3 @@
|
|||
OGLOG_IP=192.168.2.4
|
||||
OGCORE_IP=192.168.2.1
|
||||
OPENSEARCH_INITIAL_ADMIN_PASSWORD=CorrectHorse_BatteryStaple1
|
|
@ -0,0 +1,148 @@
|
|||
[
|
||||
{
|
||||
"id": 1,
|
||||
"uid": "fehoe93yzz20wf",
|
||||
"orgID": 1,
|
||||
"folderUID": "eehoe7oh9bs3kd",
|
||||
"ruleGroup": "grupo-cada-1m",
|
||||
"title": "Subred alta ocupación",
|
||||
"condition": "C",
|
||||
"data": [
|
||||
{
|
||||
"refId": "A",
|
||||
"queryType": "",
|
||||
"relativeTimeRange": {
|
||||
"from": 600,
|
||||
"to": 0
|
||||
},
|
||||
"datasourceUid": "dea978mh1bncwf",
|
||||
"model": {
|
||||
"dataset": "mysql",
|
||||
"datasource": {
|
||||
"type": "mysql",
|
||||
"uid": "dea978mh1bncwf"
|
||||
},
|
||||
"editorMode": "code",
|
||||
"format": "table",
|
||||
"hide": false,
|
||||
"intervalMs": 1000,
|
||||
"maxDataPoints": 43200,
|
||||
"rawQuery": true,
|
||||
"rawSql": "SELECT\n s.name AS metric,\n ROUND(100 * COUNT(c.id) / (POW(2, 32 - BIT_COUNT(INET_ATON(s.netmask))) - 2), 2) AS usage_percentage\nFROM subnet s\nLEFT JOIN client c ON c.subnet_id = s.id\nGROUP BY s.id, s.name, s.netmask\nHAVING usage_percentage >= 80;\n",
|
||||
"refId": "A",
|
||||
"sql": {
|
||||
"columns": [
|
||||
{
|
||||
"parameters": [],
|
||||
"type": "function"
|
||||
}
|
||||
],
|
||||
"groupBy": [
|
||||
{
|
||||
"property": {
|
||||
"type": "string"
|
||||
},
|
||||
"type": "groupBy"
|
||||
}
|
||||
],
|
||||
"limit": 50
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"refId": "B",
|
||||
"queryType": "",
|
||||
"relativeTimeRange": {
|
||||
"from": 0,
|
||||
"to": 0
|
||||
},
|
||||
"datasourceUid": "__expr__",
|
||||
"model": {
|
||||
"conditions": [
|
||||
{
|
||||
"evaluator": {
|
||||
"params": [],
|
||||
"type": "gt"
|
||||
},
|
||||
"operator": {
|
||||
"type": "and"
|
||||
},
|
||||
"query": {
|
||||
"params": [
|
||||
"B"
|
||||
]
|
||||
},
|
||||
"reducer": {
|
||||
"params": [],
|
||||
"type": "last"
|
||||
},
|
||||
"type": "query"
|
||||
}
|
||||
],
|
||||
"datasource": {
|
||||
"type": "__expr__",
|
||||
"uid": "__expr__"
|
||||
},
|
||||
"expression": "A",
|
||||
"intervalMs": 1000,
|
||||
"maxDataPoints": 43200,
|
||||
"reducer": "last",
|
||||
"refId": "B",
|
||||
"type": "reduce"
|
||||
}
|
||||
},
|
||||
{
|
||||
"refId": "C",
|
||||
"queryType": "",
|
||||
"relativeTimeRange": {
|
||||
"from": 0,
|
||||
"to": 0
|
||||
},
|
||||
"datasourceUid": "__expr__",
|
||||
"model": {
|
||||
"conditions": [
|
||||
{
|
||||
"evaluator": {
|
||||
"params": [
|
||||
80
|
||||
],
|
||||
"type": "gt"
|
||||
},
|
||||
"operator": {
|
||||
"type": "and"
|
||||
},
|
||||
"query": {
|
||||
"params": [
|
||||
"C"
|
||||
]
|
||||
},
|
||||
"reducer": {
|
||||
"params": [],
|
||||
"type": "last"
|
||||
},
|
||||
"type": "query"
|
||||
}
|
||||
],
|
||||
"datasource": {
|
||||
"type": "__expr__",
|
||||
"uid": "__expr__"
|
||||
},
|
||||
"expression": "A",
|
||||
"intervalMs": 1000,
|
||||
"maxDataPoints": 43200,
|
||||
"refId": "C",
|
||||
"type": "threshold"
|
||||
}
|
||||
}
|
||||
],
|
||||
"updated": "2025-04-02T07:36:00Z",
|
||||
"noDataState": "NoData",
|
||||
"execErrState": "Error",
|
||||
"for": "1m",
|
||||
"isPaused": false,
|
||||
"notification_settings": {
|
||||
"receiver": "grafana-default-email"
|
||||
},
|
||||
"record": null
|
||||
}
|
||||
]
|
|
@ -0,0 +1,7 @@
|
|||
{
|
||||
"extra": null,
|
||||
"message": "Expired API key",
|
||||
"messageId": "api-key.expired",
|
||||
"statusCode": 401,
|
||||
"traceID": ""
|
||||
}
|
|
@ -0,0 +1,485 @@
|
|||
{
|
||||
"meta": {
|
||||
"type": "db",
|
||||
"canSave": true,
|
||||
"canEdit": true,
|
||||
"canAdmin": true,
|
||||
"canStar": true,
|
||||
"canDelete": true,
|
||||
"slug": "estado-actual-de-los-clientes",
|
||||
"url": "/d/eeaki78ey6fwgf/estado-actual-de-los-clientes",
|
||||
"expires": "0001-01-01T00:00:00Z",
|
||||
"created": "2025-01-20T14:28:07Z",
|
||||
"updated": "2025-04-14T18:45:57Z",
|
||||
"updatedBy": "Anonymous",
|
||||
"createdBy": "admin",
|
||||
"version": 10,
|
||||
"hasAcl": false,
|
||||
"isFolder": false,
|
||||
"folderId": 0,
|
||||
"folderUid": "",
|
||||
"folderTitle": "General",
|
||||
"folderUrl": "",
|
||||
"provisioned": false,
|
||||
"provisionedExternalId": "",
|
||||
"annotationsPermissions": {
|
||||
"dashboard": {
|
||||
"canAdd": true,
|
||||
"canEdit": true,
|
||||
"canDelete": true
|
||||
},
|
||||
"organization": {
|
||||
"canAdd": true,
|
||||
"canEdit": true,
|
||||
"canDelete": true
|
||||
}
|
||||
}
|
||||
},
|
||||
"dashboard": {
|
||||
"annotations": {
|
||||
"list": [
|
||||
{
|
||||
"builtIn": 1,
|
||||
"datasource": {
|
||||
"type": "grafana",
|
||||
"uid": "-- Grafana --"
|
||||
},
|
||||
"enable": true,
|
||||
"hide": true,
|
||||
"iconColor": "rgba(0, 211, 255, 1)",
|
||||
"name": "Annotations & Alerts",
|
||||
"type": "dashboard"
|
||||
}
|
||||
]
|
||||
},
|
||||
"editable": true,
|
||||
"fiscalYearStartMonth": 0,
|
||||
"graphTooltip": 0,
|
||||
"id": 2,
|
||||
"links": [],
|
||||
"panels": [
|
||||
{
|
||||
"datasource": {
|
||||
"type": "mysql",
|
||||
"uid": "dea978mh1bncwf"
|
||||
},
|
||||
"fieldConfig": {
|
||||
"defaults": {
|
||||
"color": {
|
||||
"mode": "palette-classic"
|
||||
},
|
||||
"custom": {
|
||||
"hideFrom": {
|
||||
"legend": false,
|
||||
"tooltip": false,
|
||||
"viz": false
|
||||
}
|
||||
},
|
||||
"mappings": []
|
||||
},
|
||||
"overrides": []
|
||||
},
|
||||
"gridPos": {
|
||||
"h": 8,
|
||||
"w": 24,
|
||||
"x": 0,
|
||||
"y": 0
|
||||
},
|
||||
"id": 3,
|
||||
"maxPerRow": 8,
|
||||
"options": {
|
||||
"displayLabels": [],
|
||||
"legend": {
|
||||
"displayMode": "list",
|
||||
"placement": "bottom",
|
||||
"showLegend": true
|
||||
},
|
||||
"pieType": "pie",
|
||||
"reduceOptions": {
|
||||
"calcs": [
|
||||
"lastNotNull"
|
||||
],
|
||||
"fields": "/^total$/",
|
||||
"values": true
|
||||
},
|
||||
"tooltip": {
|
||||
"mode": "single",
|
||||
"sort": "none"
|
||||
}
|
||||
},
|
||||
"pluginVersion": "11.4.0",
|
||||
"repeat": "organizational_unit",
|
||||
"repeatDirection": "h",
|
||||
"targets": [
|
||||
{
|
||||
"dataset": "mysql",
|
||||
"datasource": {
|
||||
"type": "mysql",
|
||||
"uid": "dea978mh1bncwf"
|
||||
},
|
||||
"editorMode": "code",
|
||||
"format": "table",
|
||||
"rawQuery": true,
|
||||
"rawSql": "WITH RECURSIVE recursive_units AS (\n SELECT id, name FROM organizational_unit WHERE name IN (${organizational_unit:sqlstring})\n UNION ALL\n SELECT ou.id, ou.name\n FROM organizational_unit ou\n JOIN recursive_units ru ON ou.parent_id = ru.id\n)\n\nSELECT \n ru.name AS organizational_unit,\n client.status,\n COUNT(*) AS total\nFROM \n client\nJOIN \n organizational_unit ou ON client.organizational_unit_id = ou.id\nJOIN \n recursive_units ru ON ou.id = ru.id\nGROUP BY \n ru.name, client.status\n",
|
||||
"refId": "A",
|
||||
"sql": {
|
||||
"columns": [
|
||||
{
|
||||
"parameters": [],
|
||||
"type": "function"
|
||||
}
|
||||
],
|
||||
"groupBy": [
|
||||
{
|
||||
"property": {
|
||||
"type": "string"
|
||||
},
|
||||
"type": "groupBy"
|
||||
}
|
||||
],
|
||||
"limit": 50
|
||||
}
|
||||
}
|
||||
],
|
||||
"title": "Estado de ordenadores: ${organizational_unit}",
|
||||
"transformations": [
|
||||
{
|
||||
"id": "filterFieldsByName",
|
||||
"options": {
|
||||
"include": {
|
||||
"names": [
|
||||
"total",
|
||||
"organizational_unit",
|
||||
"status"
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
],
|
||||
"type": "piechart"
|
||||
},
|
||||
{
|
||||
"datasource": {
|
||||
"type": "mysql",
|
||||
"uid": "dea978mh1bncwf"
|
||||
},
|
||||
"fieldConfig": {
|
||||
"defaults": {
|
||||
"color": {
|
||||
"mode": "palette-classic"
|
||||
},
|
||||
"custom": {
|
||||
"axisBorderShow": false,
|
||||
"axisCenteredZero": false,
|
||||
"axisColorMode": "text",
|
||||
"axisLabel": "",
|
||||
"axisPlacement": "auto",
|
||||
"fillOpacity": 80,
|
||||
"gradientMode": "none",
|
||||
"hideFrom": {
|
||||
"legend": false,
|
||||
"tooltip": false,
|
||||
"viz": false
|
||||
},
|
||||
"lineWidth": 1,
|
||||
"scaleDistribution": {
|
||||
"type": "linear"
|
||||
},
|
||||
"thresholdsStyle": {
|
||||
"mode": "off"
|
||||
}
|
||||
},
|
||||
"mappings": [],
|
||||
"thresholds": {
|
||||
"mode": "absolute",
|
||||
"steps": [
|
||||
{
|
||||
"color": "green",
|
||||
"value": null
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
"overrides": [
|
||||
{
|
||||
"matcher": {
|
||||
"id": "byName",
|
||||
"options": "status_og_live"
|
||||
},
|
||||
"properties": [
|
||||
{
|
||||
"id": "color",
|
||||
"value": {
|
||||
"fixedColor": "red",
|
||||
"mode": "fixed"
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"matcher": {
|
||||
"id": "byName",
|
||||
"options": "status_off"
|
||||
},
|
||||
"properties": [
|
||||
{
|
||||
"id": "color",
|
||||
"value": {
|
||||
"fixedColor": "super-light-blue",
|
||||
"mode": "fixed"
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"matcher": {
|
||||
"id": "byName",
|
||||
"options": "status_windows"
|
||||
},
|
||||
"properties": [
|
||||
{
|
||||
"id": "color",
|
||||
"value": {
|
||||
"fixedColor": "light-purple",
|
||||
"mode": "fixed"
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
"gridPos": {
|
||||
"h": 8,
|
||||
"w": 12,
|
||||
"x": 0,
|
||||
"y": 8
|
||||
},
|
||||
"id": 2,
|
||||
"options": {
|
||||
"barRadius": 0,
|
||||
"barWidth": 0.97,
|
||||
"fullHighlight": false,
|
||||
"groupWidth": 0.7,
|
||||
"legend": {
|
||||
"calcs": [],
|
||||
"displayMode": "list",
|
||||
"placement": "bottom",
|
||||
"showLegend": true
|
||||
},
|
||||
"orientation": "auto",
|
||||
"showValue": "auto",
|
||||
"stacking": "normal",
|
||||
"tooltip": {
|
||||
"mode": "single",
|
||||
"sort": "none"
|
||||
},
|
||||
"xField": "organizational_unit",
|
||||
"xTickLabelRotation": 0,
|
||||
"xTickLabelSpacing": 0
|
||||
},
|
||||
"pluginVersion": "11.4.0",
|
||||
"targets": [
|
||||
{
|
||||
"dataset": "mysql",
|
||||
"datasource": {
|
||||
"type": "mysql",
|
||||
"uid": "dea978mh1bncwf"
|
||||
},
|
||||
"editorMode": "code",
|
||||
"format": "table",
|
||||
"rawQuery": true,
|
||||
"rawSql": "SELECT \n organizational_unit.name AS organizational_unit,\n SUM(CASE WHEN client.status = 'off' THEN 1 ELSE 0 END) AS status_off,\n SUM(CASE WHEN client.status = 'windows' THEN 1 ELSE 0 END) AS status_windows,\n SUM(CASE WHEN client.status = 'linux' THEN 1 ELSE 0 END) AS status_linux,\n SUM(CASE WHEN client.status = 'og-live' THEN 1 ELSE 0 END) AS status_og_live\nFROM \n client\nJOIN \n organizational_unit ON client.organizational_unit_id = organizational_unit.id\nGROUP BY \n organizational_unit.name\nORDER BY \n organizational_unit.name;\n",
|
||||
"refId": "A",
|
||||
"sql": {
|
||||
"columns": [
|
||||
{
|
||||
"parameters": [],
|
||||
"type": "function"
|
||||
}
|
||||
],
|
||||
"groupBy": [
|
||||
{
|
||||
"property": {
|
||||
"type": "string"
|
||||
},
|
||||
"type": "groupBy"
|
||||
}
|
||||
],
|
||||
"limit": 50
|
||||
}
|
||||
}
|
||||
],
|
||||
"title": "Estado de equipos por unidad organizativa",
|
||||
"type": "barchart"
|
||||
},
|
||||
{
|
||||
"datasource": {
|
||||
"type": "mysql",
|
||||
"uid": "dea978mh1bncwf"
|
||||
},
|
||||
"fieldConfig": {
|
||||
"defaults": {
|
||||
"color": {
|
||||
"mode": "palette-classic"
|
||||
},
|
||||
"custom": {
|
||||
"axisBorderShow": false,
|
||||
"axisCenteredZero": false,
|
||||
"axisColorMode": "text",
|
||||
"axisLabel": "",
|
||||
"axisPlacement": "auto",
|
||||
"fillOpacity": 80,
|
||||
"gradientMode": "none",
|
||||
"hideFrom": {
|
||||
"legend": false,
|
||||
"tooltip": false,
|
||||
"viz": false
|
||||
},
|
||||
"lineWidth": 1,
|
||||
"scaleDistribution": {
|
||||
"type": "linear"
|
||||
},
|
||||
"thresholdsStyle": {
|
||||
"mode": "off"
|
||||
}
|
||||
},
|
||||
"mappings": [
|
||||
{
|
||||
"options": {
|
||||
"linux": {
|
||||
"color": "purple",
|
||||
"index": 1
|
||||
},
|
||||
"off": {
|
||||
"color": "super-light-blue",
|
||||
"index": 0
|
||||
},
|
||||
"og-live": {
|
||||
"color": "yellow",
|
||||
"index": 2
|
||||
},
|
||||
"windows": {
|
||||
"color": "blue",
|
||||
"index": 3
|
||||
}
|
||||
},
|
||||
"type": "value"
|
||||
}
|
||||
],
|
||||
"thresholds": {
|
||||
"mode": "absolute",
|
||||
"steps": [
|
||||
{
|
||||
"color": "green",
|
||||
"value": null
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
"overrides": []
|
||||
},
|
||||
"gridPos": {
|
||||
"h": 8,
|
||||
"w": 12,
|
||||
"x": 0,
|
||||
"y": 16
|
||||
},
|
||||
"id": 1,
|
||||
"options": {
|
||||
"barRadius": 0,
|
||||
"barWidth": 0.97,
|
||||
"colorByField": "status",
|
||||
"fullHighlight": false,
|
||||
"groupWidth": 0.7,
|
||||
"legend": {
|
||||
"calcs": [],
|
||||
"displayMode": "list",
|
||||
"placement": "bottom",
|
||||
"showLegend": true
|
||||
},
|
||||
"orientation": "auto",
|
||||
"showValue": "auto",
|
||||
"stacking": "none",
|
||||
"tooltip": {
|
||||
"mode": "single",
|
||||
"sort": "none"
|
||||
},
|
||||
"xTickLabelRotation": 0,
|
||||
"xTickLabelSpacing": 0
|
||||
},
|
||||
"pluginVersion": "11.4.0",
|
||||
"targets": [
|
||||
{
|
||||
"dataset": "mysql",
|
||||
"datasource": {
|
||||
"type": "mysql",
|
||||
"uid": "dea978mh1bncwf"
|
||||
},
|
||||
"editorMode": "code",
|
||||
"format": "table",
|
||||
"rawQuery": true,
|
||||
"rawSql": "SELECT status, COUNT(*) AS count\nFROM client\nGROUP BY status;\n",
|
||||
"refId": "A",
|
||||
"sql": {
|
||||
"columns": [
|
||||
{
|
||||
"parameters": [],
|
||||
"type": "function"
|
||||
}
|
||||
],
|
||||
"groupBy": [
|
||||
{
|
||||
"property": {
|
||||
"type": "string"
|
||||
},
|
||||
"type": "groupBy"
|
||||
}
|
||||
],
|
||||
"limit": 50
|
||||
}
|
||||
}
|
||||
],
|
||||
"title": "Panel Title",
|
||||
"type": "barchart"
|
||||
}
|
||||
],
|
||||
"preload": false,
|
||||
"schemaVersion": 40,
|
||||
"tags": [],
|
||||
"templating": {
|
||||
"list": [
|
||||
{
|
||||
"current": {
|
||||
"text": [
|
||||
"ARQ (Despacho)"
|
||||
],
|
||||
"value": [
|
||||
"ARQ (Despacho)"
|
||||
]
|
||||
},
|
||||
"datasource": {
|
||||
"type": "mysql",
|
||||
"uid": "dea978mh1bncwf"
|
||||
},
|
||||
"definition": "SELECT DISTINCT name FROM organizational_unit ORDER BY name",
|
||||
"description": "",
|
||||
"includeAll": true,
|
||||
"label": "Unidad Organizativa",
|
||||
"multi": true,
|
||||
"name": "organizational_unit",
|
||||
"options": [],
|
||||
"query": "SELECT DISTINCT name FROM organizational_unit ORDER BY name",
|
||||
"refresh": 1,
|
||||
"regex": "",
|
||||
"type": "query"
|
||||
}
|
||||
]
|
||||
},
|
||||
"timepicker": {},
|
||||
"timezone": "browser",
|
||||
"title": "Estado actual de los clientes",
|
||||
"uid": "eeaki78ey6fwgf",
|
||||
"version": 10,
|
||||
"weekStart": ""
|
||||
}
|
||||
}
|
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,189 @@
|
|||
{
|
||||
"meta": {
|
||||
"type": "db",
|
||||
"canSave": true,
|
||||
"canEdit": true,
|
||||
"canAdmin": true,
|
||||
"canStar": true,
|
||||
"canDelete": true,
|
||||
"slug": "peticiones-nginx",
|
||||
"url": "/d/aeho5mwznhzb4d/peticiones-nginx",
|
||||
"expires": "0001-01-01T00:00:00Z",
|
||||
"created": "2025-04-02T05:59:24Z",
|
||||
"updated": "2025-04-14T18:45:57Z",
|
||||
"updatedBy": "Anonymous",
|
||||
"createdBy": "admin",
|
||||
"version": 3,
|
||||
"hasAcl": false,
|
||||
"isFolder": false,
|
||||
"folderId": 0,
|
||||
"folderUid": "",
|
||||
"folderTitle": "General",
|
||||
"folderUrl": "",
|
||||
"provisioned": false,
|
||||
"provisionedExternalId": "",
|
||||
"annotationsPermissions": {
|
||||
"dashboard": {
|
||||
"canAdd": true,
|
||||
"canEdit": true,
|
||||
"canDelete": true
|
||||
},
|
||||
"organization": {
|
||||
"canAdd": true,
|
||||
"canEdit": true,
|
||||
"canDelete": true
|
||||
}
|
||||
}
|
||||
},
|
||||
"dashboard": {
|
||||
"annotations": {
|
||||
"list": [
|
||||
{
|
||||
"builtIn": 1,
|
||||
"datasource": {
|
||||
"type": "grafana",
|
||||
"uid": "-- Grafana --"
|
||||
},
|
||||
"enable": true,
|
||||
"hide": true,
|
||||
"iconColor": "rgba(0, 211, 255, 1)",
|
||||
"name": "Annotations & Alerts",
|
||||
"type": "dashboard"
|
||||
}
|
||||
]
|
||||
},
|
||||
"editable": true,
|
||||
"fiscalYearStartMonth": 0,
|
||||
"graphTooltip": 0,
|
||||
"id": 4,
|
||||
"links": [],
|
||||
"panels": [
|
||||
{
|
||||
"datasource": {
|
||||
"type": "grafana-opensearch-datasource",
|
||||
"uid": "cehm2sg07ozcwc"
|
||||
},
|
||||
"fieldConfig": {
|
||||
"defaults": {
|
||||
"color": {
|
||||
"mode": "palette-classic"
|
||||
},
|
||||
"custom": {
|
||||
"axisBorderShow": false,
|
||||
"axisCenteredZero": false,
|
||||
"axisColorMode": "text",
|
||||
"axisLabel": "",
|
||||
"axisPlacement": "auto",
|
||||
"barAlignment": 0,
|
||||
"barWidthFactor": 0.6,
|
||||
"drawStyle": "line",
|
||||
"fillOpacity": 0,
|
||||
"gradientMode": "none",
|
||||
"hideFrom": {
|
||||
"legend": false,
|
||||
"tooltip": false,
|
||||
"viz": false
|
||||
},
|
||||
"insertNulls": false,
|
||||
"lineInterpolation": "linear",
|
||||
"lineWidth": 1,
|
||||
"pointSize": 5,
|
||||
"scaleDistribution": {
|
||||
"type": "linear"
|
||||
},
|
||||
"showPoints": "auto",
|
||||
"spanNulls": false,
|
||||
"stacking": {
|
||||
"group": "A",
|
||||
"mode": "none"
|
||||
},
|
||||
"thresholdsStyle": {
|
||||
"mode": "off"
|
||||
}
|
||||
},
|
||||
"mappings": [],
|
||||
"thresholds": {
|
||||
"mode": "absolute",
|
||||
"steps": [
|
||||
{
|
||||
"color": "green",
|
||||
"value": null
|
||||
},
|
||||
{
|
||||
"color": "red",
|
||||
"value": 80
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
"overrides": []
|
||||
},
|
||||
"gridPos": {
|
||||
"h": 8,
|
||||
"w": 12,
|
||||
"x": 0,
|
||||
"y": 0
|
||||
},
|
||||
"id": 1,
|
||||
"options": {
|
||||
"legend": {
|
||||
"calcs": [],
|
||||
"displayMode": "list",
|
||||
"placement": "bottom",
|
||||
"showLegend": true
|
||||
},
|
||||
"tooltip": {
|
||||
"mode": "single",
|
||||
"sort": "none"
|
||||
}
|
||||
},
|
||||
"pluginVersion": "11.4.0",
|
||||
"targets": [
|
||||
{
|
||||
"alias": "",
|
||||
"bucketAggs": [
|
||||
{
|
||||
"field": "@timestamp",
|
||||
"id": "2",
|
||||
"settings": {
|
||||
"interval": "auto"
|
||||
},
|
||||
"type": "date_histogram"
|
||||
}
|
||||
],
|
||||
"datasource": {
|
||||
"type": "grafana-opensearch-datasource",
|
||||
"uid": "cehm2sg07ozcwc"
|
||||
},
|
||||
"format": "table",
|
||||
"luceneQueryType": "Metric",
|
||||
"metrics": [
|
||||
{
|
||||
"id": "1",
|
||||
"type": "count"
|
||||
}
|
||||
],
|
||||
"query": "container.name: \"ogcore-nginx\"",
|
||||
"queryType": "lucene",
|
||||
"refId": "A",
|
||||
"timeField": "@timestamp"
|
||||
}
|
||||
],
|
||||
"title": "Numero de peticiones nginx",
|
||||
"type": "timeseries"
|
||||
}
|
||||
],
|
||||
"preload": false,
|
||||
"schemaVersion": 40,
|
||||
"tags": [],
|
||||
"templating": {
|
||||
"list": []
|
||||
},
|
||||
"timepicker": {},
|
||||
"timezone": "browser",
|
||||
"title": "Peticiones nginx",
|
||||
"uid": "aeho5mwznhzb4d",
|
||||
"version": 3,
|
||||
"weekStart": ""
|
||||
}
|
||||
}
|
|
@ -0,0 +1,470 @@
|
|||
{
|
||||
"meta": {
|
||||
"type": "db",
|
||||
"canSave": true,
|
||||
"canEdit": true,
|
||||
"canAdmin": true,
|
||||
"canStar": true,
|
||||
"canDelete": true,
|
||||
"slug": "traceo-y-comandos",
|
||||
"url": "/d/cehkmg691ogsge/traceo-y-comandos",
|
||||
"expires": "0001-01-01T00:00:00Z",
|
||||
"created": "2025-04-01T06:13:37Z",
|
||||
"updated": "2025-04-14T18:45:57Z",
|
||||
"updatedBy": "Anonymous",
|
||||
"createdBy": "admin",
|
||||
"version": 13,
|
||||
"hasAcl": false,
|
||||
"isFolder": false,
|
||||
"folderId": 0,
|
||||
"folderUid": "",
|
||||
"folderTitle": "General",
|
||||
"folderUrl": "",
|
||||
"provisioned": false,
|
||||
"provisionedExternalId": "",
|
||||
"annotationsPermissions": {
|
||||
"dashboard": {
|
||||
"canAdd": true,
|
||||
"canEdit": true,
|
||||
"canDelete": true
|
||||
},
|
||||
"organization": {
|
||||
"canAdd": true,
|
||||
"canEdit": true,
|
||||
"canDelete": true
|
||||
}
|
||||
}
|
||||
},
|
||||
"dashboard": {
|
||||
"annotations": {
|
||||
"list": [
|
||||
{
|
||||
"builtIn": 1,
|
||||
"datasource": {
|
||||
"type": "grafana",
|
||||
"uid": "-- Grafana --"
|
||||
},
|
||||
"enable": true,
|
||||
"hide": true,
|
||||
"iconColor": "rgba(0, 211, 255, 1)",
|
||||
"name": "Annotations & Alerts",
|
||||
"type": "dashboard"
|
||||
}
|
||||
]
|
||||
},
|
||||
"editable": true,
|
||||
"fiscalYearStartMonth": 0,
|
||||
"graphTooltip": 0,
|
||||
"id": 3,
|
||||
"links": [],
|
||||
"panels": [
|
||||
{
|
||||
"datasource": {
|
||||
"type": "mysql",
|
||||
"uid": "dea978mh1bncwf"
|
||||
},
|
||||
"fieldConfig": {
|
||||
"defaults": {
|
||||
"color": {
|
||||
"fixedColor": "red",
|
||||
"mode": "fixed"
|
||||
},
|
||||
"custom": {
|
||||
"axisBorderShow": false,
|
||||
"axisCenteredZero": false,
|
||||
"axisColorMode": "text",
|
||||
"axisLabel": "",
|
||||
"axisPlacement": "auto",
|
||||
"fillOpacity": 80,
|
||||
"gradientMode": "none",
|
||||
"hideFrom": {
|
||||
"legend": false,
|
||||
"tooltip": false,
|
||||
"viz": false
|
||||
},
|
||||
"lineWidth": 1,
|
||||
"scaleDistribution": {
|
||||
"type": "linear"
|
||||
},
|
||||
"thresholdsStyle": {
|
||||
"mode": "off"
|
||||
}
|
||||
},
|
||||
"mappings": [],
|
||||
"thresholds": {
|
||||
"mode": "absolute",
|
||||
"steps": [
|
||||
{
|
||||
"color": "green",
|
||||
"value": null
|
||||
},
|
||||
{
|
||||
"color": "red",
|
||||
"value": 80
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
"overrides": [
|
||||
{
|
||||
"matcher": {
|
||||
"id": "byName",
|
||||
"options": "in_progress"
|
||||
},
|
||||
"properties": [
|
||||
{
|
||||
"id": "color",
|
||||
"value": {
|
||||
"mode": "palette-classic"
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"matcher": {
|
||||
"id": "byName",
|
||||
"options": "success"
|
||||
},
|
||||
"properties": [
|
||||
{
|
||||
"id": "color",
|
||||
"value": {
|
||||
"fixedColor": "green",
|
||||
"mode": "fixed"
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
"gridPos": {
|
||||
"h": 7,
|
||||
"w": 24,
|
||||
"x": 0,
|
||||
"y": 0
|
||||
},
|
||||
"id": 3,
|
||||
"options": {
|
||||
"barRadius": 0,
|
||||
"barWidth": 0.94,
|
||||
"colorByField": "status",
|
||||
"fullHighlight": false,
|
||||
"groupWidth": 0.7,
|
||||
"legend": {
|
||||
"calcs": [],
|
||||
"displayMode": "list",
|
||||
"placement": "bottom",
|
||||
"showLegend": true
|
||||
},
|
||||
"orientation": "auto",
|
||||
"showValue": "auto",
|
||||
"stacking": "none",
|
||||
"tooltip": {
|
||||
"mode": "single",
|
||||
"sort": "none"
|
||||
},
|
||||
"xTickLabelRotation": 0,
|
||||
"xTickLabelSpacing": 0
|
||||
},
|
||||
"pluginVersion": "11.4.0",
|
||||
"repeat": "organizational_unit",
|
||||
"repeatDirection": "h",
|
||||
"targets": [
|
||||
{
|
||||
"dataset": "mysql",
|
||||
"datasource": {
|
||||
"type": "mysql",
|
||||
"uid": "dea978mh1bncwf"
|
||||
},
|
||||
"editorMode": "code",
|
||||
"format": "table",
|
||||
"rawQuery": true,
|
||||
"rawSql": "SELECT \n ou.name AS organizational_unit,\n SUM(CASE WHEN trace.status = 'failed' THEN 1 ELSE 0 END) AS failed,\n SUM(CASE WHEN trace.status = 'in-progress' THEN 1 ELSE 0 END) AS in_progress,\n SUM(CASE WHEN trace.status = 'success' THEN 1 ELSE 0 END) AS success\nFROM trace\nJOIN client ON trace.client_id = client.id\nJOIN organizational_unit ou ON client.organizational_unit_id = ou.id\nWHERE ou.name IN (${organizational_unit:sqlstring})\nGROUP BY ou.name\nORDER BY ou.name;\n",
|
||||
"refId": "A",
|
||||
"sql": {
|
||||
"columns": [
|
||||
{
|
||||
"parameters": [],
|
||||
"type": "function"
|
||||
}
|
||||
],
|
||||
"groupBy": [
|
||||
{
|
||||
"property": {
|
||||
"type": "string"
|
||||
},
|
||||
"type": "groupBy"
|
||||
}
|
||||
],
|
||||
"limit": 50
|
||||
}
|
||||
}
|
||||
],
|
||||
"title": "Estado de comandos: ${organizational_unit}",
|
||||
"type": "barchart"
|
||||
},
|
||||
{
|
||||
"datasource": {
|
||||
"type": "mysql",
|
||||
"uid": "dea978mh1bncwf"
|
||||
},
|
||||
"fieldConfig": {
|
||||
"defaults": {
|
||||
"color": {
|
||||
"mode": "thresholds"
|
||||
},
|
||||
"custom": {
|
||||
"axisBorderShow": false,
|
||||
"axisCenteredZero": false,
|
||||
"axisColorMode": "text",
|
||||
"axisLabel": "",
|
||||
"axisPlacement": "auto",
|
||||
"fillOpacity": 80,
|
||||
"gradientMode": "none",
|
||||
"hideFrom": {
|
||||
"legend": false,
|
||||
"tooltip": false,
|
||||
"viz": false
|
||||
},
|
||||
"lineWidth": 1,
|
||||
"scaleDistribution": {
|
||||
"type": "linear"
|
||||
},
|
||||
"thresholdsStyle": {
|
||||
"mode": "off"
|
||||
}
|
||||
},
|
||||
"mappings": [],
|
||||
"thresholds": {
|
||||
"mode": "absolute",
|
||||
"steps": [
|
||||
{
|
||||
"color": "green",
|
||||
"value": null
|
||||
},
|
||||
{
|
||||
"color": "red",
|
||||
"value": 80
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
"overrides": []
|
||||
},
|
||||
"gridPos": {
|
||||
"h": 8,
|
||||
"w": 12,
|
||||
"x": 0,
|
||||
"y": 7
|
||||
},
|
||||
"id": 2,
|
||||
"options": {
|
||||
"barRadius": 0,
|
||||
"barWidth": 0.97,
|
||||
"fullHighlight": false,
|
||||
"groupWidth": 0.7,
|
||||
"legend": {
|
||||
"calcs": [],
|
||||
"displayMode": "list",
|
||||
"placement": "bottom",
|
||||
"showLegend": true
|
||||
},
|
||||
"orientation": "auto",
|
||||
"showValue": "auto",
|
||||
"stacking": "none",
|
||||
"tooltip": {
|
||||
"mode": "single",
|
||||
"sort": "none"
|
||||
},
|
||||
"xTickLabelRotation": 0,
|
||||
"xTickLabelSpacing": 0
|
||||
},
|
||||
"pluginVersion": "11.4.0",
|
||||
"targets": [
|
||||
{
|
||||
"dataset": "mysql",
|
||||
"datasource": {
|
||||
"type": "mysql",
|
||||
"uid": "dea978mh1bncwf"
|
||||
},
|
||||
"editorMode": "code",
|
||||
"format": "table",
|
||||
"rawQuery": true,
|
||||
"rawSql": "SELECT \n command,\n ROUND(AVG(TIMESTAMPDIFF(SECOND, executed_at, finished_at))) AS avg_seconds\nFROM trace\nWHERE finished_at IS NOT NULL\nGROUP BY command\nORDER BY avg_seconds DESC;\n",
|
||||
"refId": "A",
|
||||
"sql": {
|
||||
"columns": [
|
||||
{
|
||||
"parameters": [],
|
||||
"type": "function"
|
||||
}
|
||||
],
|
||||
"groupBy": [
|
||||
{
|
||||
"property": {
|
||||
"type": "string"
|
||||
},
|
||||
"type": "groupBy"
|
||||
}
|
||||
],
|
||||
"limit": 50
|
||||
}
|
||||
}
|
||||
],
|
||||
"title": "Tiempo de media en segundos de la duración de los comandos",
|
||||
"type": "barchart"
|
||||
},
|
||||
{
|
||||
"datasource": {
|
||||
"type": "mysql",
|
||||
"uid": "dea978mh1bncwf"
|
||||
},
|
||||
"fieldConfig": {
|
||||
"defaults": {
|
||||
"color": {
|
||||
"fixedColor": "light-red",
|
||||
"mode": "fixed"
|
||||
},
|
||||
"custom": {
|
||||
"axisBorderShow": false,
|
||||
"axisCenteredZero": false,
|
||||
"axisColorMode": "text",
|
||||
"axisLabel": "",
|
||||
"axisPlacement": "auto",
|
||||
"fillOpacity": 80,
|
||||
"gradientMode": "none",
|
||||
"hideFrom": {
|
||||
"legend": false,
|
||||
"tooltip": false,
|
||||
"viz": false
|
||||
},
|
||||
"lineWidth": 1,
|
||||
"scaleDistribution": {
|
||||
"type": "linear"
|
||||
},
|
||||
"thresholdsStyle": {
|
||||
"mode": "off"
|
||||
}
|
||||
},
|
||||
"mappings": [],
|
||||
"min": 0,
|
||||
"thresholds": {
|
||||
"mode": "absolute",
|
||||
"steps": [
|
||||
{
|
||||
"color": "green",
|
||||
"value": null
|
||||
},
|
||||
{
|
||||
"color": "red",
|
||||
"value": 80
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
"overrides": []
|
||||
},
|
||||
"gridPos": {
|
||||
"h": 8,
|
||||
"w": 12,
|
||||
"x": 12,
|
||||
"y": 7
|
||||
},
|
||||
"id": 4,
|
||||
"options": {
|
||||
"barRadius": 0,
|
||||
"barWidth": 0.97,
|
||||
"fullHighlight": false,
|
||||
"groupWidth": 0.7,
|
||||
"legend": {
|
||||
"calcs": [],
|
||||
"displayMode": "list",
|
||||
"placement": "bottom",
|
||||
"showLegend": true
|
||||
},
|
||||
"orientation": "auto",
|
||||
"showValue": "auto",
|
||||
"stacking": "none",
|
||||
"tooltip": {
|
||||
"mode": "single",
|
||||
"sort": "none"
|
||||
},
|
||||
"xTickLabelRotation": 0,
|
||||
"xTickLabelSpacing": 0
|
||||
},
|
||||
"pluginVersion": "11.4.0",
|
||||
"targets": [
|
||||
{
|
||||
"dataset": "mysql",
|
||||
"datasource": {
|
||||
"type": "mysql",
|
||||
"uid": "dea978mh1bncwf"
|
||||
},
|
||||
"editorMode": "code",
|
||||
"format": "table",
|
||||
"rawQuery": true,
|
||||
"rawSql": "SELECT \n command,\n COUNT(*) AS total_failed\nFROM trace\nWHERE status = 'failed'\nGROUP BY command\nORDER BY total_failed DESC;\n",
|
||||
"refId": "A",
|
||||
"sql": {
|
||||
"columns": [
|
||||
{
|
||||
"parameters": [],
|
||||
"type": "function"
|
||||
}
|
||||
],
|
||||
"groupBy": [
|
||||
{
|
||||
"property": {
|
||||
"type": "string"
|
||||
},
|
||||
"type": "groupBy"
|
||||
}
|
||||
],
|
||||
"limit": 50
|
||||
}
|
||||
}
|
||||
],
|
||||
"title": "Número de errores por tipo de comando",
|
||||
"type": "barchart"
|
||||
}
|
||||
],
|
||||
"preload": false,
|
||||
"schemaVersion": 40,
|
||||
"tags": [],
|
||||
"templating": {
|
||||
"list": [
|
||||
{
|
||||
"current": {
|
||||
"text": [
|
||||
"PCs internos"
|
||||
],
|
||||
"value": [
|
||||
"PCs internos"
|
||||
]
|
||||
},
|
||||
"datasource": {
|
||||
"type": "mysql",
|
||||
"uid": "dea978mh1bncwf"
|
||||
},
|
||||
"definition": "SELECT DISTINCT name FROM organizational_unit ORDER BY name",
|
||||
"description": "SELECT DISTINCT name FROM organizational_unit ORDER BY name",
|
||||
"includeAll": true,
|
||||
"label": "Unidad Organizativa",
|
||||
"multi": true,
|
||||
"name": "organizational_unit",
|
||||
"options": [],
|
||||
"query": "SELECT DISTINCT name FROM organizational_unit ORDER BY name",
|
||||
"refresh": 1,
|
||||
"regex": "",
|
||||
"type": "query"
|
||||
}
|
||||
]
|
||||
},
|
||||
"timepicker": {},
|
||||
"timezone": "browser",
|
||||
"title": "Traceo y comandos",
|
||||
"uid": "cehkmg691ogsge",
|
||||
"version": 13,
|
||||
"weekStart": ""
|
||||
}
|
||||
}
|
|
@ -0,0 +1,248 @@
|
|||
{
|
||||
"meta": {
|
||||
"type": "db",
|
||||
"canSave": true,
|
||||
"canEdit": true,
|
||||
"canAdmin": true,
|
||||
"canStar": true,
|
||||
"canDelete": true,
|
||||
"slug": "uso-de-ips-de-subred",
|
||||
"url": "/d/eehoawvwyk6iof/uso-de-ips-de-subred",
|
||||
"expires": "0001-01-01T00:00:00Z",
|
||||
"created": "2025-04-02T06:58:34Z",
|
||||
"updated": "2025-04-14T18:45:57Z",
|
||||
"updatedBy": "Anonymous",
|
||||
"createdBy": "admin",
|
||||
"version": 3,
|
||||
"hasAcl": false,
|
||||
"isFolder": false,
|
||||
"folderId": 0,
|
||||
"folderUid": "",
|
||||
"folderTitle": "General",
|
||||
"folderUrl": "",
|
||||
"provisioned": false,
|
||||
"provisionedExternalId": "",
|
||||
"annotationsPermissions": {
|
||||
"dashboard": {
|
||||
"canAdd": true,
|
||||
"canEdit": true,
|
||||
"canDelete": true
|
||||
},
|
||||
"organization": {
|
||||
"canAdd": true,
|
||||
"canEdit": true,
|
||||
"canDelete": true
|
||||
}
|
||||
}
|
||||
},
|
||||
"dashboard": {
|
||||
"annotations": {
|
||||
"list": [
|
||||
{
|
||||
"builtIn": 1,
|
||||
"datasource": {
|
||||
"type": "grafana",
|
||||
"uid": "-- Grafana --"
|
||||
},
|
||||
"enable": true,
|
||||
"hide": true,
|
||||
"iconColor": "rgba(0, 211, 255, 1)",
|
||||
"name": "Annotations & Alerts",
|
||||
"type": "dashboard"
|
||||
}
|
||||
]
|
||||
},
|
||||
"editable": true,
|
||||
"fiscalYearStartMonth": 0,
|
||||
"graphTooltip": 0,
|
||||
"id": 5,
|
||||
"links": [],
|
||||
"panels": [
|
||||
{
|
||||
"datasource": {
|
||||
"type": "mysql",
|
||||
"uid": "dea978mh1bncwf"
|
||||
},
|
||||
"fieldConfig": {
|
||||
"defaults": {
|
||||
"color": {
|
||||
"mode": "thresholds"
|
||||
},
|
||||
"custom": {
|
||||
"axisBorderShow": false,
|
||||
"axisCenteredZero": false,
|
||||
"axisColorMode": "text",
|
||||
"axisLabel": "",
|
||||
"axisPlacement": "auto",
|
||||
"fillOpacity": 80,
|
||||
"gradientMode": "none",
|
||||
"hideFrom": {
|
||||
"legend": false,
|
||||
"tooltip": false,
|
||||
"viz": false
|
||||
},
|
||||
"lineWidth": 1,
|
||||
"scaleDistribution": {
|
||||
"type": "linear"
|
||||
},
|
||||
"thresholdsStyle": {
|
||||
"mode": "off"
|
||||
}
|
||||
},
|
||||
"decimals": 1,
|
||||
"fieldMinMax": false,
|
||||
"mappings": [],
|
||||
"max": 100,
|
||||
"min": 1,
|
||||
"thresholds": {
|
||||
"mode": "absolute",
|
||||
"steps": [
|
||||
{
|
||||
"color": "green",
|
||||
"value": null
|
||||
},
|
||||
{
|
||||
"color": "red",
|
||||
"value": 80
|
||||
}
|
||||
]
|
||||
},
|
||||
"unit": "percent"
|
||||
},
|
||||
"overrides": [
|
||||
{
|
||||
"matcher": {
|
||||
"id": "byName",
|
||||
"options": "usage_percentage"
|
||||
},
|
||||
"properties": [
|
||||
{
|
||||
"id": "custom.hideFrom",
|
||||
"value": {
|
||||
"legend": false,
|
||||
"tooltip": false,
|
||||
"viz": false
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"matcher": {
|
||||
"id": "byName",
|
||||
"options": "max_ips"
|
||||
},
|
||||
"properties": [
|
||||
{
|
||||
"id": "custom.hideFrom",
|
||||
"value": {
|
||||
"legend": false,
|
||||
"tooltip": false,
|
||||
"viz": true
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": "unit",
|
||||
"value": "none"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"matcher": {
|
||||
"id": "byName",
|
||||
"options": "assigned_clients"
|
||||
},
|
||||
"properties": [
|
||||
{
|
||||
"id": "unit",
|
||||
"value": "none"
|
||||
},
|
||||
{
|
||||
"id": "custom.hideFrom",
|
||||
"value": {
|
||||
"legend": false,
|
||||
"tooltip": false,
|
||||
"viz": true
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
"gridPos": {
|
||||
"h": 8,
|
||||
"w": 12,
|
||||
"x": 0,
|
||||
"y": 0
|
||||
},
|
||||
"id": 1,
|
||||
"options": {
|
||||
"barRadius": 0,
|
||||
"barWidth": 0.97,
|
||||
"fullHighlight": false,
|
||||
"groupWidth": 0.7,
|
||||
"legend": {
|
||||
"calcs": [],
|
||||
"displayMode": "list",
|
||||
"placement": "bottom",
|
||||
"showLegend": true
|
||||
},
|
||||
"orientation": "auto",
|
||||
"showValue": "auto",
|
||||
"stacking": "none",
|
||||
"tooltip": {
|
||||
"mode": "multi",
|
||||
"sort": "none"
|
||||
},
|
||||
"xTickLabelRotation": 0,
|
||||
"xTickLabelSpacing": 0
|
||||
},
|
||||
"pluginVersion": "11.4.0",
|
||||
"targets": [
|
||||
{
|
||||
"dataset": "mysql",
|
||||
"datasource": {
|
||||
"type": "mysql",
|
||||
"uid": "dea978mh1bncwf"
|
||||
},
|
||||
"editorMode": "code",
|
||||
"format": "table",
|
||||
"rawQuery": true,
|
||||
"rawSql": "SELECT\n s.name AS metric, -- Esto Grafana lo usa como \"etiqueta\" por subred\n COUNT(c.id) AS assigned_clients,\n POW(2, 32 - BIT_COUNT(INET_ATON(s.netmask))) - 2 AS max_ips,\n ROUND(100 * COUNT(c.id) / (POW(2, 32 - BIT_COUNT(INET_ATON(s.netmask))) - 2), 2) AS usage_percentage\nFROM subnet s\nLEFT JOIN client c ON c.subnet_id = s.id\nGROUP BY s.id, s.name, s.netmask\nORDER BY usage_percentage DESC;\n",
|
||||
"refId": "A",
|
||||
"sql": {
|
||||
"columns": [
|
||||
{
|
||||
"parameters": [],
|
||||
"type": "function"
|
||||
}
|
||||
],
|
||||
"groupBy": [
|
||||
{
|
||||
"property": {
|
||||
"type": "string"
|
||||
},
|
||||
"type": "groupBy"
|
||||
}
|
||||
],
|
||||
"limit": 50
|
||||
}
|
||||
}
|
||||
],
|
||||
"title": "Panel Title",
|
||||
"type": "barchart"
|
||||
}
|
||||
],
|
||||
"preload": false,
|
||||
"schemaVersion": 40,
|
||||
"tags": [],
|
||||
"templating": {
|
||||
"list": []
|
||||
},
|
||||
"timepicker": {},
|
||||
"timezone": "browser",
|
||||
"title": "Uso de IPs de subred",
|
||||
"uid": "eehoawvwyk6iof",
|
||||
"version": 3,
|
||||
"weekStart": ""
|
||||
}
|
||||
}
|
|
@ -0,0 +1,7 @@
|
|||
{
|
||||
"extra": null,
|
||||
"message": "Expired API key",
|
||||
"messageId": "api-key.expired",
|
||||
"statusCode": 401,
|
||||
"traceID": ""
|
||||
}
|
|
@ -0,0 +1,75 @@
|
|||
[
|
||||
{
|
||||
"id": 3,
|
||||
"uid": "cehm2sg07ozcwc",
|
||||
"orgId": 1,
|
||||
"name": "grafana-opensearch-datasource",
|
||||
"type": "grafana-opensearch-datasource",
|
||||
"typeName": "OpenSearch",
|
||||
"typeLogoUrl": "public/plugins/grafana-opensearch-datasource/img/logo.svg",
|
||||
"access": "proxy",
|
||||
"url": "https://oglog-os.mytld:9200",
|
||||
"user": "",
|
||||
"database": "",
|
||||
"basicAuth": true,
|
||||
"isDefault": false,
|
||||
"jsonData": {
|
||||
"database": "journalbeat-*",
|
||||
"flavor": "opensearch",
|
||||
"logLevelField": "",
|
||||
"logMessageField": "",
|
||||
"maxConcurrentShardRequests": 5,
|
||||
"pplEnabled": true,
|
||||
"serverName": "oglog-os.mytld",
|
||||
"serverless": false,
|
||||
"timeField": "@timestamp",
|
||||
"tlsAuth": true,
|
||||
"tlsAuthWithCACert": false,
|
||||
"tlsSkipVerify": true,
|
||||
"version": "1.0.0",
|
||||
"versionLabel": "OpenSearch (compatibility mode)"
|
||||
},
|
||||
"readOnly": false
|
||||
},
|
||||
{
|
||||
"id": 2,
|
||||
"uid": "dea978mh1bncwf",
|
||||
"orgId": 1,
|
||||
"name": "mysql",
|
||||
"type": "mysql",
|
||||
"typeName": "MySQL",
|
||||
"typeLogoUrl": "public/app/plugins/datasource/mysql/img/mysql_logo.svg",
|
||||
"access": "proxy",
|
||||
"url": "__OGCORE_IP__:3336",
|
||||
"user": "root",
|
||||
"database": "",
|
||||
"basicAuth": false,
|
||||
"isDefault": false,
|
||||
"jsonData": {
|
||||
"connMaxLifetime": 14400,
|
||||
"database": "ogcore",
|
||||
"maxIdleConns": 100,
|
||||
"maxIdleConnsAuto": true,
|
||||
"maxOpenConns": 100,
|
||||
"tlsSkipVerify": false
|
||||
},
|
||||
"readOnly": false
|
||||
},
|
||||
{
|
||||
"id": 1,
|
||||
"uid": "PBFA97CFB590B2093",
|
||||
"orgId": 1,
|
||||
"name": "Prometheus",
|
||||
"type": "prometheus",
|
||||
"typeName": "Prometheus",
|
||||
"typeLogoUrl": "public/app/plugins/datasource/prometheus/img/prometheus_logo.svg",
|
||||
"access": "proxy",
|
||||
"url": "https://oglog-prom.mytld:9090",
|
||||
"user": "",
|
||||
"database": "",
|
||||
"basicAuth": false,
|
||||
"isDefault": true,
|
||||
"jsonData": {},
|
||||
"readOnly": true
|
||||
}
|
||||
]
|
|
@ -0,0 +1,45 @@
|
|||
#!/bin/bash
|
||||
|
||||
# Variables
|
||||
GRAFANA_URL="https://oglog-graf.mytld:3000"
|
||||
EXPORT_DIR="../etc/grafana/resources"
|
||||
TOKEN_FILE="./grafana_token.txt"
|
||||
# Comprobar que el token existe
|
||||
if [ ! -f "$TOKEN_FILE" ]; then
|
||||
echo "Error: No se encontró el archivo $TOKEN_FILE con el token de Grafana."
|
||||
echo "Ejecuta primero setup_grafana_token.sh"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
API_TOKEN=$(cat "$TOKEN_FILE")
|
||||
|
||||
# Crear directorios
|
||||
mkdir -p "$EXPORT_DIR/dashboards"
|
||||
mkdir -p "$EXPORT_DIR/datasources"
|
||||
mkdir -p "$EXPORT_DIR/alerts"
|
||||
|
||||
# Exportar todos los dashboards
|
||||
echo "Exportando dashboards..."
|
||||
curl -s -H "Authorization: Bearer $API_TOKEN" "$GRAFANA_URL/api/search?query=&type=dash-db" | jq -c '.[]' |
|
||||
while read -r dashboard; do
|
||||
uid=$(echo "$dashboard" | jq -r '.uid')
|
||||
title=$(echo "$dashboard" | jq -r '.title' | tr ' /' '_' | tr -d '"')
|
||||
|
||||
curl -s -H "Authorization: Bearer $API_TOKEN" "$GRAFANA_URL/api/dashboards/uid/$uid" \
|
||||
| jq '.' > "$EXPORT_DIR/dashboards/${title}.json"
|
||||
|
||||
echo "Exportado: $title"
|
||||
done
|
||||
|
||||
# Exportar datasources
|
||||
echo "Exportando datasources..."
|
||||
curl -s -H "Authorization: Bearer $API_TOKEN" "$GRAFANA_URL/api/datasources" \
|
||||
| jq '.' > "$EXPORT_DIR/datasources/datasources.json"
|
||||
|
||||
# Exportar alertas (si usas alert rules v2)
|
||||
echo "Exportando alert rules..."
|
||||
curl -s -H "Authorization: Bearer $API_TOKEN" "$GRAFANA_URL/api/v1/provisioning/alert-rules" \
|
||||
| jq '.' > "$EXPORT_DIR/alerts/alert-rules.json"
|
||||
|
||||
echo "Exportación completada en: $EXPORT_DIR"
|
||||
|
|
@ -0,0 +1,52 @@
|
|||
#!/bin/bash
|
||||
|
||||
# Variables
|
||||
GRAFANA_URL="https://oglog-graf.mytld:3000"
|
||||
RESOURCE_DIR="../etc/grafana/resources"
|
||||
TOKEN_FILE="./grafana_token.txt"
|
||||
# Comprobar que el token existe
|
||||
if [ ! -f "$TOKEN_FILE" ]; then
|
||||
echo "Error: No se encontró el archivo $TOKEN_FILE con el token de Grafana."
|
||||
echo "Ejecuta primero setup_grafana_token.sh"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
API_TOKEN=$(cat "$TOKEN_FILE")
|
||||
|
||||
# Importar datasources
|
||||
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" \
|
||||
-H "Authorization: Bearer $API_TOKEN" \
|
||||
-H "Content-Type: application/json" \
|
||||
-d "$datasource" > /dev/null
|
||||
done
|
||||
echo "Datasources importados."
|
||||
fi
|
||||
|
||||
# Importar dashboards
|
||||
echo "Importando dashboards..."
|
||||
for f in "$RESOURCE_DIR/dashboards"/*.json; do
|
||||
echo "Importando $(basename "$f")"
|
||||
curl -s -X POST "$GRAFANA_URL/api/dashboards/db" \
|
||||
-H "Authorization: Bearer $API_TOKEN" \
|
||||
-H "Content-Type: application/json" \
|
||||
--data-binary "@$f" > /dev/null
|
||||
done
|
||||
echo "Dashboards importados."
|
||||
|
||||
# Importar alertas
|
||||
if [ -f "$RESOURCE_DIR/alerts/alert-rules.json" ]; then
|
||||
echo "Importando alert rules..."
|
||||
jq -c '.[]' "$RESOURCE_DIR/alerts/alert-rules.json" | while read -r alert; do
|
||||
curl -s -X POST "$GRAFANA_URL/api/v1/provisioning/alert-rules" \
|
||||
-H "Authorization: Bearer $API_TOKEN" \
|
||||
-H "Content-Type: application/json" \
|
||||
-d "$alert" > /dev/null
|
||||
done
|
||||
echo "Alertas importadas."
|
||||
fi
|
||||
|
||||
echo "Importación completa."
|
||||
|
|
@ -32,15 +32,29 @@ if ! mountpoint -q "$LOCAL_MOUNT"; then
|
|||
mount -t nfs "$NFS_SERVER:$NFS_PATH" "$LOCAL_MOUNT"
|
||||
fi
|
||||
|
||||
# Comprobar variables de entorno requeridas
|
||||
required_env_vars=("IP_MAQUINA" "OPENSEARCH_INITIAL_ADMIN_PASSWORD")
|
||||
for var in "${required_env_vars[@]}"; do
|
||||
# Cargar variables desde el archivo .env
|
||||
ENV_FILE="../.env"
|
||||
|
||||
if [ ! -f "$ENV_FILE" ]; then
|
||||
echo "ERROR: No se encontró el archivo .env"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
export $(grep -v '^#' "$ENV_FILE" | xargs)
|
||||
|
||||
# Comprobar variables requeridas
|
||||
required_vars=("OGLOG_IP" "OGCORE_IP" "OPENSEARCH_INITIAL_ADMIN_PASSWORD")
|
||||
for var in "${required_vars[@]}"; do
|
||||
if [[ -z "${!var}" ]]; then
|
||||
log "ERROR: La variable de entorno $var debe estar definida."
|
||||
echo "ERROR: La variable de entorno $var debe estar definida en el archivo .env."
|
||||
exit 1
|
||||
fi
|
||||
done
|
||||
|
||||
# Ejemplo de uso
|
||||
echo "OGLOG se instalará en: $OGLOG_IP"
|
||||
echo "Base de datos OGCORE en: $OGCORE_IP"
|
||||
|
||||
# Validar la contraseña
|
||||
if [[ ${#OPENSEARCH_INITIAL_ADMIN_PASSWORD} -lt 12 || \
|
||||
! "$OPENSEARCH_INITIAL_ADMIN_PASSWORD" =~ [A-Z] || \
|
||||
|
@ -52,12 +66,12 @@ fi
|
|||
|
||||
# Actualizar /etc/hosts
|
||||
cat >> /etc/hosts <<EOF
|
||||
$IP_MAQUINA oglog-os.mytld
|
||||
$IP_MAQUINA oglog-osdb.mytld
|
||||
$IP_MAQUINA oglog-jb.mytld
|
||||
$IP_MAQUINA oglog-jrem.mytld
|
||||
$IP_MAQUINA oglog-prom.mytld
|
||||
$IP_MAQUINA oglog-graf.mytld
|
||||
$OGLOG_IP oglog-os.mytld
|
||||
$OGLOG_IP oglog-osdb.mytld
|
||||
$OGLOG_IP oglog-jb.mytld
|
||||
$OGLOG_IP oglog-jrem.mytld
|
||||
$OGLOG_IP oglog-prom.mytld
|
||||
$OGLOG_IP oglog-graf.mytld
|
||||
EOF
|
||||
|
||||
# Instalación de paquetes necesarios
|
||||
|
@ -175,6 +189,20 @@ done
|
|||
log "Verificación final de servicios:"
|
||||
systemctl is-active journalbeat filebeat opensearch opensearch-dashboards prometheus grafana-server
|
||||
|
||||
# Crear token y configurar Grafana
|
||||
log "Creando token para Grafana..."
|
||||
while IFS= read -r line; do
|
||||
log "$line"
|
||||
done < <(./script/setup_grafana_token.sh)
|
||||
|
||||
sed -i "s/__OGCORE_IP__/${OGCORE_IP}/g" ../etc/grafana/resources/datasources/datasources.json
|
||||
|
||||
log "Importando configuracion en Grafana..."
|
||||
while IFS= read -r line; do
|
||||
log "$line"
|
||||
done < <(./script/import_grafana.sh)
|
||||
|
||||
|
||||
DURATION=$SECONDS
|
||||
|
||||
log "Tiempo total: $((DURATION / 60)) minutos y $((DURATION % 60)) segundos"
|
|
@ -0,0 +1,57 @@
|
|||
#!/bin/bash
|
||||
|
||||
# Variables
|
||||
GRAFANA_URL="https://oglog-graf.mytld:3000"
|
||||
GRAFANA_USER="admin"
|
||||
GRAFANA_PASS="admin"
|
||||
CERT="/etc/grafana/oglog-graf.mytld.crt.pem"
|
||||
KEY="/etc/grafana/oglog-graf.mytld.key.pem"
|
||||
SA_NAME="dashboard-exporter"
|
||||
TOKEN_NAME="dashboard-export-token"
|
||||
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 \
|
||||
"$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 \
|
||||
-H "Content-Type: application/json" \
|
||||
-d '{ "name": "'"$SA_NAME"'", "role": "Admin" }' \
|
||||
"$GRAFANA_URL/api/serviceaccounts" | jq -r '.id')
|
||||
echo "Service Account creado con ID: $SA_ID"
|
||||
else
|
||||
echo "Service Account ya existe con ID: $SA_ID"
|
||||
fi
|
||||
|
||||
# 3. Verificamos si el fichero con el token existe
|
||||
if [ -f "$TOKEN_FILE" ]; then
|
||||
echo "El token ya fue generado y está guardado en $TOKEN_FILE."
|
||||
echo "Para forzar su regeneración, borra el archivo manualmente."
|
||||
else
|
||||
echo "Buscando token existente con nombre $TOKEN_NAME..."
|
||||
|
||||
TOKEN_ID=$(curl -s --cert "$CERT" --key "$KEY" -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 \
|
||||
"$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 \
|
||||
-H "Content-Type: application/json" \
|
||||
-d '{ "name": "'"$TOKEN_NAME"'", "secondsToLive": '"$TOKEN_TTL"' }' \
|
||||
"$GRAFANA_URL/api/serviceaccounts/$SA_ID/tokens" | jq -r '.key')
|
||||
|
||||
echo "$TOKEN" > "$TOKEN_FILE"
|
||||
echo "Token guardado en $TOKEN_FILE"
|
||||
fi
|
||||
|
Loading…
Reference in New Issue