LogstashUI 0.5.5.dev0__py3-none-any.whl → 0.5.5.dev1__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (86) hide show
  1. API/connections_views.py +28 -8
  2. API/guides.py +4 -0
  3. API/mcp/dispatch.py +4 -0
  4. API/mcp/tools.py +22 -6
  5. API/mcp/views.py +4 -0
  6. API/simulation_detail.py +4 -0
  7. Common/ai/agent_builder.py +30 -36
  8. Common/elastic_utils.py +174 -37
  9. Documentation/content/CHANGELOG.md +28 -0
  10. Documentation/content/docs/logstashui/SNMP/configuration.md +1 -1
  11. Documentation/content/docs/logstashui/SNMP/deploying_changes.md +3 -1
  12. Documentation/content/docs/logstashui/SNMP/index.md +1 -2
  13. Documentation/content/docs/logstashui/SNMP/schema.md +60 -12
  14. Documentation/content/docs/logstashui/SNMP/testing.md +1 -1
  15. Documentation/content/docs/logstashui/SNMP/tsds_implementation.md +33 -0
  16. Documentation/content/docs/logstashui/configuration/host_mode.md +1 -2
  17. Documentation/content/docs/logstashui/configuration/index.md +1 -1
  18. Documentation/content/docs/logstashui/database/index.md +2 -4
  19. Documentation/content/docs/logstashui/mcp.md +9 -24
  20. Documentation/content/docs/logstashui/rest_api.md +31 -17
  21. Documentation/content/docs/logstashui/utilities/dissect_debugger.md +2 -2
  22. Documentation/content/docs/logstashui/utilities/grok_debugger.md +2 -5
  23. Documentation/content/docs/logstashui/utilities/index.md +5 -5
  24. Management/migrations/0005_settings_check_for_updates.py +22 -0
  25. Management/models.py +7 -0
  26. Management/templates/management_settings.html +135 -124
  27. Management/views.py +6 -3
  28. PipelineManager/connections_crud.py +42 -11
  29. PipelineManager/forms.py +141 -6
  30. PipelineManager/manager_views.py +83 -24
  31. PipelineManager/migrations/0034_connection_es_hosts_kibana_url.py +23 -0
  32. PipelineManager/migrations/0035_connection_es_hosts_backfill.py +58 -0
  33. PipelineManager/models.py +77 -4
  34. PipelineManager/static/js/connections_table.js +14 -2
  35. PipelineManager/templates/components/pipeline_manager/connection_modal.html +307 -136
  36. PipelineManager/templates/components/pipeline_manager/mcp_modal.html +8 -2
  37. PipelineManager/templates/pipeline_manager.html +22 -0
  38. SNMP/ai_template_generation.py +17 -10
  39. SNMP/data/authoring_instructions.md +7 -6
  40. SNMP/data/normalizers.json +79 -1
  41. SNMP/data/official_profiles/aruba_wireless_controller.json +40 -7
  42. SNMP/data/official_profiles/cisco_system_metrics.json +4 -5
  43. SNMP/data/official_profiles/dell_idrac_fans.json +2 -2
  44. SNMP/data/official_profiles/dell_idrac_memory.json +42 -5
  45. SNMP/data/official_profiles/dell_idrac_power_supply.json +47 -3
  46. SNMP/data/official_profiles/dell_idrac_raid_controller.json +44 -5
  47. SNMP/data/official_profiles/generic_host_system_metrics.json +129 -6
  48. SNMP/data/official_profiles/generic_interfaces.json +28 -0
  49. SNMP/data/official_profiles/generic_ucd_system_metrics.json +254 -14
  50. SNMP/data/official_profiles/isilon_performance.json +156 -38
  51. SNMP/data/official_profiles/isilon_protocols.json +20 -63
  52. SNMP/data/official_profiles/isilon_system.json +131 -38
  53. SNMP/data/schema.md +60 -12
  54. SNMP/data/schema_reference/snmp_field_schema.md +60 -14
  55. SNMP/data/snmp_template.json +320 -30
  56. SNMP/data/template_profile_context.md +11277 -1996
  57. SNMP/deploy_fingerprint.py +150 -0
  58. SNMP/migrations/0026_snmpdeploymentstate_deployed_fingerprint.py +21 -0
  59. SNMP/models.py +43 -11
  60. SNMP/overview.py +22 -7
  61. SNMP/snmp_crud.py +125 -94
  62. SNMP/snmp_normalizers.py +264 -85
  63. SNMP/snmp_pipeline_generator.py +238 -25
  64. SNMP/snmp_test.py +21 -1
  65. SNMP/static/js/ai_device_template_modal.js +50 -98
  66. SNMP/static/js/discovered_devices.js +3 -0
  67. SNMP/static/js/snmp_changes_indicator.js +2 -2
  68. SNMP/static/js/snmp_diff_modal.js +8 -2
  69. SNMP/templates/Networks.html +0 -8
  70. SNMP/templates/Onboarding.html +18 -19
  71. SNMP/templates/components/ai_generate_template_content.html +10 -14
  72. SNMP/views.py +32 -34
  73. Site/static/js/base.js +52 -7
  74. Site/templates/base.html +1 -1
  75. Site/views.py +23 -0
  76. {logstashui-0.5.5.dev0.dist-info → logstashui-0.5.5.dev1.dist-info}/METADATA +1 -1
  77. {logstashui-0.5.5.dev0.dist-info → logstashui-0.5.5.dev1.dist-info}/RECORD +82 -81
  78. theme/static/css/dist/styles.css +1 -1
  79. Documentation/content/docs/logstashui/configuration/logstashui.yml.md +0 -16
  80. Documentation/content/docs/logstashui/mcp_scenarios.md +0 -234
  81. SNMP/data/mib_reference/std_host_resources.json +0 -32
  82. SNMP/data/mib_reference/std_ucd_linux.json +0 -27
  83. {logstashui-0.5.5.dev0.dist-info → logstashui-0.5.5.dev1.dist-info}/WHEEL +0 -0
  84. {logstashui-0.5.5.dev0.dist-info → logstashui-0.5.5.dev1.dist-info}/entry_points.txt +0 -0
  85. {logstashui-0.5.5.dev0.dist-info → logstashui-0.5.5.dev1.dist-info}/licenses/LICENSE.txt +0 -0
  86. {logstashui-0.5.5.dev0.dist-info → logstashui-0.5.5.dev1.dist-info}/licenses/NOTICE.txt +0 -0
API/connections_views.py CHANGED
@@ -52,6 +52,8 @@ def _safe_connection_data(conn):
52
52
  'agent_id': conn.agent_id,
53
53
  'host': conn.host,
54
54
  'port': conn.port,
55
+ 'es_hosts': conn.get_es_hosts(),
56
+ 'kibana_url': conn.kibana_url,
55
57
  'username': conn.username,
56
58
  'cloud_id': conn.cloud_id,
57
59
  'cloud_url': conn.cloud_url,
@@ -93,7 +95,7 @@ def connection_list(request):
93
95
  def _list_connections(request):
94
96
  connections_qs = Connection.objects.values(
95
97
  'id', 'name', 'connection_type', 'agent_id',
96
- 'policy__policy_type', 'host', 'port', 'username',
98
+ 'policy__policy_type', 'host', 'port', 'es_hosts', 'kibana_url', 'username',
97
99
  'cloud_id', 'cloud_url', 'is_active',
98
100
  'last_check_in', 'created_at', 'updated_at',
99
101
  'desired_agent_version', 'restart_on_next_checkin',
@@ -103,6 +105,7 @@ def _list_connections(request):
103
105
 
104
106
  # Normalize datetime fields to ISO strings
105
107
  for c in connections:
108
+ c['es_hosts'] = Connection(cloud_id=c['cloud_id'], es_hosts=c['es_hosts']).get_es_hosts()
106
109
  for field in ('last_check_in', 'created_at', 'updated_at'):
107
110
  val = c.get(field)
108
111
  c[field] = val.isoformat() if val else None
@@ -130,7 +133,7 @@ def _create_connection(request):
130
133
 
131
134
  new_connection = form.save()
132
135
 
133
- success, message = manager_views.test_connectivity(new_connection.id)
136
+ success, message, warnings, reachable = manager_views.check_connectivity(new_connection.id)
134
137
  if not success:
135
138
  new_connection.delete()
136
139
  logger.error("API create connection: connectivity test failed — %s", message)
@@ -141,6 +144,8 @@ def _create_connection(request):
141
144
  'success': True,
142
145
  'connection_id': new_connection.id,
143
146
  'message': 'Connection created and tested successfully.',
147
+ 'warnings': warnings,
148
+ 'reachable': reachable,
144
149
  }, status=201)
145
150
 
146
151
 
@@ -196,14 +201,13 @@ def _connection_form_defaults(conn):
196
201
  else:
197
202
  auth_type = 'basic'
198
203
 
199
- return {
204
+ defaults = {
200
205
  'name': conn.name,
201
206
  'connection_type': conn.connection_type,
202
- 'host': conn.host or '',
203
- 'port': conn.port or '',
204
207
  'username': conn.username or '',
205
208
  'cloud_id': conn.cloud_id or '',
206
209
  'cloud_url': conn.cloud_url or '',
210
+ 'kibana_url': conn.kibana_url or '',
207
211
  # Checkbox: an omitted key would be read as False and silently flip an
208
212
  # existing connection to strict TLS verification on a partial PUT.
209
213
  'allow_self_signed_certs': conn.allow_self_signed_certs,
@@ -213,6 +217,12 @@ def _connection_form_defaults(conn):
213
217
  'auth_type': auth_type,
214
218
  # api_key / password deliberately omitted: empty string → keep existing
215
219
  }
220
+ if conn.connection_type == Connection.ConnectionType.CENTRALIZED:
221
+ defaults['es_hosts'] = conn.get_es_hosts()
222
+ else:
223
+ defaults['host'] = conn.host or ''
224
+ defaults['port'] = conn.port or ''
225
+ return defaults
216
226
 
217
227
 
218
228
  @api_require_admin
@@ -227,6 +237,12 @@ def _update_connection(request, connection_id):
227
237
  # The caller only needs to supply the fields they want to change; omitted
228
238
  # fields retain their current values.
229
239
  merged = _connection_form_defaults(conn)
240
+ if ('host' in data or 'port' in data) and 'es_hosts' not in data and 'es_hosts' in merged:
241
+ # Legacy single-node update: start from the stored first node (mirrored
242
+ # in host/port) and replace the node list with that one node.
243
+ merged.pop('es_hosts')
244
+ merged['host'] = conn.host or ''
245
+ merged['port'] = conn.port or ''
230
246
  merged.update(data)
231
247
 
232
248
  # Bug 1 fix (update path): check for name collision against other connections.
@@ -245,10 +261,12 @@ def _update_connection(request, connection_id):
245
261
 
246
262
  test_success = False
247
263
  test_message = ''
264
+ warnings = []
265
+ reachable = []
248
266
  try:
249
267
  with transaction.atomic():
250
268
  updated = form.save()
251
- test_success, test_message = manager_views.test_connectivity(updated.id)
269
+ test_success, test_message, warnings, reachable = manager_views.check_connectivity(updated.id)
252
270
  if not test_success:
253
271
  transaction.set_rollback(True)
254
272
  except Exception as exc:
@@ -264,6 +282,8 @@ def _update_connection(request, connection_id):
264
282
  'success': True,
265
283
  'connection_id': connection_id,
266
284
  'message': 'Connection updated and tested successfully.',
285
+ 'warnings': warnings,
286
+ 'reachable': reachable,
267
287
  })
268
288
 
269
289
 
@@ -305,8 +325,8 @@ def connection_test(request, connection_id):
305
325
  return JsonResponse({'success': False, 'error': 'Connection not found'}, status=404)
306
326
 
307
327
  logger.info("API: connectivity test for connection %s by %s", connection_id, request.user.username)
308
- success, message = manager_views.test_connectivity(connection_id)
328
+ success, message, warnings, reachable = manager_views.check_connectivity(connection_id)
309
329
 
310
330
  if success:
311
- return JsonResponse({'success': True, 'detail': message})
331
+ return JsonResponse({'success': True, 'detail': message, 'warnings': warnings, 'reachable': reachable})
312
332
  return JsonResponse({'success': False, 'error': str(message)}, status=422)
API/guides.py CHANGED
@@ -1,3 +1,7 @@
1
+ #Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
2
+ #or more contributor license agreements. Licensed under the Elastic License;
3
+ #you may not use this file except in compliance with the Elastic License.
4
+
1
5
  """Agent guides: short Markdown how-tos for working with LogstashUI.
2
6
 
3
7
  The text lives in ``docs/docs/logstashui/agent_guides/<topic>.md`` so it also
API/mcp/dispatch.py CHANGED
@@ -1,3 +1,7 @@
1
+ #Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
2
+ #or more contributor license agreements. Licensed under the Elastic License;
3
+ #you may not use this file except in compliance with the Elastic License.
4
+
1
5
  """Execute an MCP tool by calling its REST API view in-process.
2
6
 
3
7
  The caller's authenticated user and API token are carried onto a synthetic
API/mcp/tools.py CHANGED
@@ -1,3 +1,7 @@
1
+ #Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
2
+ #or more contributor license agreements. Licensed under the Elastic License;
3
+ #you may not use this file except in compliance with the Elastic License.
4
+
1
5
  """Declarative MCP tool registry mapped onto REST API routes.
2
6
 
3
7
  Each :class:`Tool` names the URL pattern and HTTP method it dispatches to;
@@ -273,11 +277,18 @@ _CONNECTION_FIELDS = {
273
277
  'connection_type': _str('Connection type.', ['CENTRALIZED', 'AGENT']),
274
278
  'connection_mode': _str('How to reach Elasticsearch.', ['url', 'cloud']),
275
279
  'auth_type': _str('Elasticsearch auth method: basic or api_key.'),
276
- 'host': _str('Elasticsearch URL without the port, e.g. https://es.example.com; put the '
277
- 'port in port.'),
280
+ 'es_hosts': _arr('URL mode: ordered Elasticsearch node URLs with ports, e.g. '
281
+ '["https://es1:9200", "https://es2:9200"]. At least one is required; all must '
282
+ 'share http or https. Replaces the stored list on update.',
283
+ {'type': 'string'}),
284
+ 'kibana_url': _str('Optional Kibana origin, e.g. https://kibana.example.com:5601. Needed for '
285
+ 'SNMP AI features on URL-mode connections; Cloud ID connections derive it '
286
+ 'when blank.'),
287
+ 'host': _str('Legacy single-node form of es_hosts: Elasticsearch URL without the port; put '
288
+ 'the port in port. Prefer es_hosts.'),
278
289
  'cloud_id': _str('Elastic Cloud ID.'),
279
290
  'cloud_url': _str('Full cluster URL for Cloud deployments.'),
280
- 'port': _int('9200 for URL mode, 443 for Cloud.'),
291
+ 'port': _int('Port for the legacy host field (443/80 by scheme when omitted).'),
281
292
  'username': _str('Basic-auth username.'),
282
293
  'password': _str('Basic-auth password. Omit on update to keep the stored value.'),
283
294
  'api_key': _str('Elasticsearch API key. Omit on update to keep the stored value.'),
@@ -534,19 +545,24 @@ TOOLS = [
534
545
  'nodes; policy_id is the policy they run, and SIMULATE-policy agents run simulations. '
535
546
  'Credentials are never returned.'),
536
547
  Tool('connections_create', 'connections', 'api-connections-list', 'POST',
537
- 'Create a connection. It is connectivity-tested first and rolled back on failure. Admin only.',
548
+ 'Create a connection. Each Elasticsearch node is tested; it is rolled back only when '
549
+ 'every node fails. Unreachable nodes or Kibana come back in warnings, nodes that '
550
+ 'answered in reachable. Admin only.',
538
551
  body=_CONNECTION_FIELDS, required=('name', 'connection_type'),
539
552
  hints={422: _CONNECTION_TEST_FAILED + ' Nothing was saved.'}),
540
553
  Tool('connections_get', 'connections', 'api-connections-detail', 'GET',
541
554
  'Get one connection by ID.', path_params={'connection_id': _int('Connection ID.')}),
542
555
  Tool('connections_update', 'connections', 'api-connections-detail', 'PUT',
543
- 'Update a connection; send only fields to change. Re-tested and rolled back on failure. Admin only.',
556
+ 'Update a connection; send only fields to change. Re-tested and rolled back only when '
557
+ 'every node fails; partial failures come back in warnings, nodes that answered in '
558
+ 'reachable. Admin only.',
544
559
  path_params={'connection_id': _int('Connection ID.')}, body=_CONNECTION_FIELDS,
545
560
  hints={422: _CONNECTION_TEST_FAILED + ' The update was rolled back.'}),
546
561
  Tool('connections_delete', 'connections', 'api-connections-detail', 'DELETE',
547
562
  'Delete a connection. Admin only.', path_params={'connection_id': _int('Connection ID.')}),
548
563
  Tool('connections_test', 'connections', 'api-connections-test', 'POST',
549
- 'Run a live connectivity check against a saved connection without changing it.',
564
+ 'Run a live connectivity check against each node of a saved connection without changing '
565
+ 'it. Unreachable nodes or Kibana come back in warnings, nodes that answered in reachable.',
550
566
  path_params={'connection_id': _int('Connection ID.')}, read_only=True,
551
567
  hints={404: 'Connection not found. Use connections_list to find the ID.',
552
568
  422: _CONNECTION_TEST_FAILED + ' Fix it with connections_update.'}),
API/mcp/views.py CHANGED
@@ -1,3 +1,7 @@
1
+ #Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
2
+ #or more contributor license agreements. Licensed under the Elastic License;
3
+ #you may not use this file except in compliance with the Elastic License.
4
+
1
5
  """Stateless MCP Streamable HTTP endpoint at ``/api/mcp``.
2
6
 
3
7
  Each POST carries one JSON-RPC message and gets one ``application/json``
API/simulation_detail.py CHANGED
@@ -1,3 +1,7 @@
1
+ #Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
2
+ #or more contributor license agreements. Licensed under the Elastic License;
3
+ #you may not use this file except in compliance with the Elastic License.
4
+
1
5
  """Shape raw simulation results to a chosen level of detail.
2
6
 
3
7
  A simulation run produces a step-0 copy of the input and a final event whose
@@ -11,8 +11,6 @@ Examples:
11
11
  from Common.ai.agent_builder import AgentBuilder, RESOURCE_TOOL, RESOURCE_SKILL, RESOURCE_AGENT
12
12
 
13
13
  builder = AgentBuilder(connection_id=42)
14
- # or, for URL-based connections:
15
- builder = AgentBuilder(connection_id=42, kibana_url_override="https://my-kibana:5601")
16
14
 
17
15
  results = builder.check_resources(
18
16
  tools=MY_TOOL_DEFINITIONS,
@@ -167,10 +165,9 @@ _PUT_STRIP_KEYS = {
167
165
  class AgentBuilder:
168
166
  """Client for the Elastic Agent Builder API.
169
167
 
170
- At least one of connection_id or kibana_url_override must be provided.
171
- The Kibana URL and auth credentials are derived from the Connection
172
- record, or from kibana_url_override after normalize_kibana_url
173
- (``.es.`` hosts become ``.kb.``, paths stripped).
168
+ The Kibana URL comes from the Connection's saved ``kibana_url`` or its
169
+ Cloud ID (see ``get_kibana_url``); auth credentials come from the same
170
+ record.
174
171
  """
175
172
 
176
173
  # Connect timeout is short so a wrong host (ES instead of Kibana) fails
@@ -181,33 +178,22 @@ class AgentBuilder:
181
178
  _PROBE_READ_TIMEOUT = 8
182
179
  _INVOKE_READ_TIMEOUT = 300
183
180
 
184
- def __init__(self, connection_id=None, kibana_url_override=None):
181
+ def __init__(self, connection_id):
185
182
  """Initialize an Agent Builder client.
186
183
 
187
184
  Args:
188
185
  connection_id: LogstashUI DB Connection pk. Kibana URL and auth
189
186
  credentials are derived automatically from the Connection record.
190
- kibana_url_override: Kibana origin after normalize_kibana_url
191
- (``.es.`` hosts become ``.kb.``, paths stripped). If omitted, the
192
- origin is derived from the Connection via get_kibana_url.
193
187
 
194
188
  Raises:
195
- ValueError: If neither connection_id nor kibana_url_override is given.
189
+ KibanaUrlMissing: The connection has no saved Kibana URL and no
190
+ Cloud ID.
196
191
  """
197
- from Common.elastic_utils import _get_creds, get_kibana_url, normalize_kibana_url
192
+ from Common.elastic_utils import _get_creds, get_kibana_url
198
193
 
199
- if connection_id is None and kibana_url_override is None:
200
- raise ValueError(
201
- "Supply at least connection_id or kibana_url_override"
202
- )
203
-
204
- self._creds, _conn = _get_creds(connection_id) if connection_id else ({}, None)
194
+ self._creds, _conn = _get_creds(connection_id)
205
195
  self._connection_id = connection_id
206
-
207
- raw_url = (kibana_url_override or '').strip()
208
- if not raw_url:
209
- raw_url = get_kibana_url(connection_id)
210
- self._kibana_url = normalize_kibana_url(raw_url).rstrip('/')
196
+ self._kibana_url = get_kibana_url(connection_id).rstrip('/')
211
197
  logger.info("AgentBuilder Kibana origin: %s", self._kibana_url)
212
198
 
213
199
  # Build reusable headers. Writes also need kbn-xsrf (added per-call).
@@ -221,9 +207,7 @@ class AgentBuilder:
221
207
  self._auth = self._creds.get('http_auth') # (username, password) or None
222
208
 
223
209
  self._session = requests.Session()
224
- # Honour the connection's TLS setting when one is bound; fall back to
225
- # strict verification when only kibana_url_override is given (no record).
226
- self._session.verify = (not _conn.allow_self_signed_certs) if _conn is not None else True
210
+ self._session.verify = not _conn.allow_self_signed_certs
227
211
  self._session.auth = self._auth
228
212
  self._session.headers.update(self._read_headers)
229
213
 
@@ -347,20 +331,30 @@ class AgentBuilder:
347
331
 
348
332
  @staticmethod
349
333
  def _normalize(resource_dict, resource_type):
350
- """Return a copy with write-only configuration keys removed for stable comparison.
351
-
352
- Kibana accepts certain keys (e.g. ``skill_ids``, ``tools``) inside the
353
- agent ``configuration`` object on write but does not include them in the
354
- GET response. Stripping them from both sides before comparison prevents
355
- permanent false "needs update" results.
334
+ """Return a copy of an agent with unstable ``configuration`` keys removed.
335
+
336
+ Two kinds of keys are dropped from both sides before comparison, so
337
+ neither causes a permanent false "needs update":
338
+
339
+ * Write-only keys (``skill_ids``, ``tools``) that some Kibana versions
340
+ omit from the GET response.
341
+ * Empty values (``None``, ``[]``, ``{}``, ``''``). Newer Kibana
342
+ versions return defaults for keys our definitions don't set, such
343
+ as ``subagent_ids: []``.
344
+
345
+ Examples:
346
+ >>> AgentBuilder._normalize(
347
+ ... {'configuration': {'instructions': 'x', 'subagent_ids': [], 'tools': []}},
348
+ ... RESOURCE_AGENT)
349
+ {'configuration': {'instructions': 'x'}}
356
350
  """
357
351
  if resource_type != RESOURCE_AGENT:
358
352
  return resource_dict
359
353
  result = dict(resource_dict)
360
- config = dict(result.get('configuration') or {})
361
- for k in AgentBuilder._AGENT_CONFIG_WRITE_ONLY_KEYS:
362
- config.pop(k, None)
363
- result['configuration'] = config
354
+ result['configuration'] = {
355
+ k: v for k, v in (result.get('configuration') or {}).items()
356
+ if k not in AgentBuilder._AGENT_CONFIG_WRITE_ONLY_KEYS and v not in (None, [], {}, '')
357
+ }
364
358
  return result
365
359
 
366
360
  @staticmethod
Common/elastic_utils.py CHANGED
@@ -32,6 +32,86 @@ def test_elastic_connectivity(elastic_connection):
32
32
  """
33
33
  return json.dumps(dict(elastic_connection.info()), indent=4)
34
34
 
35
+
36
+ def check_elastic_nodes(connection_id):
37
+ """Call ``info()`` on each Elasticsearch node of a connection separately.
38
+
39
+ A client built with several hosts succeeds when any one answers, which
40
+ would hide a mistyped node. Cloud ID connections are checked once.
41
+
42
+ Args:
43
+ connection_id: Primary key of a CENTRALIZED ``Connection``.
44
+
45
+ Returns:
46
+ List of ``(host, ok, detail)`` tuples in node order. ``host`` is None
47
+ for Cloud ID; ``detail`` is cluster-info JSON or the error text.
48
+
49
+ Examples:
50
+ >>> check_elastic_nodes(conn.pk) # doctest: +SKIP
51
+ [('https://es1:9200', True, '{...}'), ('https://es2:9200', False, 'Connection refused')]
52
+ """
53
+ creds, connection = _get_creds(connection_id)
54
+ hosts = creds.pop('hosts', None)
55
+ targets = [None] if 'cloud_id' in creds else (hosts or [])
56
+ results = []
57
+ for host in targets:
58
+ kwargs = dict(creds)
59
+ if host:
60
+ kwargs['hosts'] = [host]
61
+ client = None
62
+ try:
63
+ client = Elasticsearch(
64
+ **kwargs,
65
+ verify_certs=not connection.allow_self_signed_certs,
66
+ request_timeout=15,
67
+ max_retries=0,
68
+ )
69
+ results.append((host, True, test_elastic_connectivity(client)))
70
+ except Exception as e:
71
+ results.append((host, False, str(e)))
72
+ finally:
73
+ if client is not None:
74
+ client.close()
75
+ return results
76
+
77
+
78
+ def check_kibana_status(connection_id):
79
+ """Return a warning string when the saved Kibana URL is unreachable.
80
+
81
+ Only the saved ``kibana_url`` is checked; a Cloud ID-derived URL is not.
82
+
83
+ Args:
84
+ connection_id: Primary key of a CENTRALIZED ``Connection``.
85
+
86
+ Returns:
87
+ Warning text, or None when there is no saved URL or ``/api/status``
88
+ answers 200.
89
+ """
90
+ creds, connection = _get_creds(connection_id)
91
+ if not connection.kibana_url:
92
+ return None
93
+ kibana_url = normalize_kibana_url(connection.kibana_url).rstrip('/')
94
+ headers = {}
95
+ auth = None
96
+ if creds.get('api_key'):
97
+ headers['Authorization'] = f"ApiKey {creds['api_key']}"
98
+ elif 'http_auth' in creds:
99
+ auth = creds['http_auth']
100
+ try:
101
+ response = requests.get(
102
+ f"{kibana_url}/api/status",
103
+ headers=headers,
104
+ auth=auth,
105
+ verify=not connection.allow_self_signed_certs,
106
+ timeout=15,
107
+ )
108
+ except requests.RequestException as e:
109
+ return f"Kibana at {kibana_url} is unreachable: {e}"
110
+ if response.status_code != 200:
111
+ return f"Kibana at {kibana_url} returned HTTP {response.status_code} from /api/status."
112
+ return None
113
+
114
+
35
115
  def get_elastic_connections_from_list():
36
116
  """Build ES clients for every CENTRALIZED ``Connection`` row.
37
117
 
@@ -98,12 +178,7 @@ def _get_creds(connection_id):
98
178
  if connection.cloud_id:
99
179
  connection_data['cloud_id'] = connection.cloud_id
100
180
  else:
101
- # For CENTRALIZED connections, combine host and port fields
102
- # The frontend stores them separately, so we need to recombine them
103
- if connection.port:
104
- connection_data['hosts'] = f"{connection.host}:{connection.port}"
105
- else:
106
- connection_data['hosts'] = connection.host
181
+ connection_data['hosts'] = connection.get_es_hosts()
107
182
 
108
183
  if connection.api_key:
109
184
  connection_data['api_key'] = connection.get_api_key()
@@ -558,7 +633,13 @@ def check_index_template(connection_id, template_name, template_definition):
558
633
  Returns:
559
634
  Dict with ``status`` (``not_installed``, ``installed``,
560
635
  ``installed_but_outdated``, or ``error``), ``differences`` (field
561
- names), and ``error``.
636
+ names), and ``error``. Outdated results also carry
637
+ ``version_change``, or ``None`` when the versions match.
638
+
639
+ Example:
640
+ >>> check_index_template(1, 'metrics-snmp.polling', template)
641
+ {'status': 'installed_but_outdated', 'differences': ['_meta.version'],
642
+ 'version_change': {'installed': '1.7', 'available': '1.8'}, 'error': None}
562
643
  """
563
644
  try:
564
645
  current = get_index_template(connection_id, template_name)
@@ -582,14 +663,21 @@ def check_index_template(connection_id, template_name, template_definition):
582
663
  differences.append('data_stream')
583
664
 
584
665
  # Compare version string from _meta if the desired template declares one
666
+ version_change = None
585
667
  desired_version = template_definition.get('_meta', {}).get('version')
586
668
  if desired_version is not None:
587
669
  current_version = current.get('_meta', {}).get('version')
588
670
  if desired_version != current_version:
589
671
  differences.append('_meta.version')
672
+ version_change = {'installed': current_version, 'available': desired_version}
590
673
 
591
674
  if differences:
592
- return {'status': 'installed_but_outdated', 'differences': differences, 'error': None}
675
+ return {
676
+ 'status': 'installed_but_outdated',
677
+ 'differences': differences,
678
+ 'version_change': version_change,
679
+ 'error': None,
680
+ }
593
681
 
594
682
  return {'status': 'installed', 'differences': [], 'error': None}
595
683
 
@@ -842,11 +930,73 @@ def normalize_kibana_url(url):
842
930
  return urlunparse((scheme, netloc, '', '', '', ''))
843
931
 
844
932
 
933
+ KIBANA_URL_MISSING_MESSAGE = (
934
+ "This connection has no Kibana URL. Add one on the connection to use AI generation."
935
+ )
936
+
937
+
938
+ def connection_edit_url(connection_id, focus='kibana_url'):
939
+ """Return the Connections page link that opens one connection's edit form.
940
+
941
+ Args:
942
+ connection_id: Primary key of a CENTRALIZED ``Connection``.
943
+ focus: Form field to focus after the form opens.
944
+
945
+ Returns:
946
+ Relative URL string.
947
+
948
+ Examples:
949
+ >>> connection_edit_url(7)
950
+ '/ConnectionManager/?edit=7&focus=kibana_url'
951
+ """
952
+ return f"/ConnectionManager/?edit={connection_id}&focus={focus}"
953
+
954
+
955
+ class KibanaUrlMissing(ValueError):
956
+ """The connection has neither a saved Kibana URL nor a Cloud ID."""
957
+
958
+ def __init__(self, connection_id):
959
+ super().__init__(KIBANA_URL_MISSING_MESSAGE)
960
+ self.connection_id = connection_id
961
+ self.edit_url = connection_edit_url(connection_id)
962
+
963
+
964
+ def kibana_url_from_cloud_id(cloud_id):
965
+ """Decode the Kibana origin from an Elastic Cloud ID.
966
+
967
+ Args:
968
+ cloud_id: ``deployment-name:base64("domain$es_uuid$kibana_uuid")``.
969
+
970
+ Returns:
971
+ Kibana origin string, or ``None`` when the ID cannot be decoded.
972
+
973
+ Examples:
974
+ >>> import base64
975
+ >>> kibana_url_from_cloud_id("dep:" + base64.b64encode(b"us-east-1.aws.found.io$es1$kb1").decode())
976
+ 'https://kb1.us-east-1.aws.found.io'
977
+ """
978
+ import base64
979
+ import binascii
980
+
981
+ if not cloud_id or ':' not in cloud_id:
982
+ return None
983
+ try:
984
+ decoded = base64.b64decode(cloud_id.split(':', 1)[1]).decode('utf-8')
985
+ except (binascii.Error, UnicodeDecodeError, ValueError):
986
+ return None
987
+ parts = decoded.split('$')
988
+ if len(parts) < 2:
989
+ return None
990
+ domain = parts[0]
991
+ kibana_url = f"https://{parts[2]}.{domain}" if len(parts) > 2 else f"https://{domain}"
992
+ return normalize_kibana_url(kibana_url)
993
+
994
+
845
995
  def get_kibana_url(connection_id):
846
- """Derive a Kibana origin from a CENTRALIZED connection.
996
+ """Return the Kibana origin for a CENTRALIZED connection.
847
997
 
848
- Decodes ``cloud_id`` when present; otherwise rewrites the ES ``hosts``
849
- URL through ``normalize_kibana_url``.
998
+ Uses the saved ``kibana_url`` first, then decodes the Cloud ID. The URL
999
+ is never guessed from the Elasticsearch node hosts.
850
1000
 
851
1001
  Args:
852
1002
  connection_id: Primary key of a CENTRALIZED ``Connection``.
@@ -855,33 +1005,20 @@ def get_kibana_url(connection_id):
855
1005
  Kibana origin string.
856
1006
 
857
1007
  Raises:
858
- ValueError: If neither ``cloud_id`` nor ``hosts`` can produce a URL.
1008
+ KibanaUrlMissing: The connection has no saved Kibana URL and no
1009
+ decodable Cloud ID. ``edit_url`` links to the connection's form.
1010
+
1011
+ Examples:
1012
+ >>> get_kibana_url(conn.pk) # doctest: +SKIP
1013
+ 'https://kibana.example.com:5601'
859
1014
  """
860
- import base64
861
-
862
- creds, _ = _get_creds(connection_id)
863
-
864
- # Check if cloud_id is present
865
- if 'cloud_id' in creds:
866
- cloud_id = creds['cloud_id']
867
- # Format: "deployment-name:base64encodeddata"
868
- if ':' in cloud_id:
869
- encoded_part = cloud_id.split(':', 1)[1]
870
- decoded = base64.b64decode(encoded_part).decode('utf-8')
871
- # Format: "domain$es_uuid$kibana_uuid"
872
- parts = decoded.split('$')
873
- if len(parts) >= 2:
874
- domain = parts[0]
875
- # Construct Kibana URL
876
- kibana_url = f"https://{parts[2]}.{domain}" if len(parts) > 2 else f"https://{domain}"
877
- return normalize_kibana_url(kibana_url)
878
-
879
- # Check for hosts (URL-based connection)
880
- if 'hosts' in creds and creds['hosts']:
881
- es_url = creds['hosts'][0] if isinstance(creds['hosts'], list) else creds['hosts']
882
- return normalize_kibana_url(es_url)
883
-
884
- raise ValueError("Could not determine Kibana URL from connection")
1015
+ connection = ConnectionTable.objects.get(id=connection_id)
1016
+ if connection.kibana_url:
1017
+ return normalize_kibana_url(connection.kibana_url)
1018
+ from_cloud = kibana_url_from_cloud_id(connection.cloud_id)
1019
+ if from_cloud:
1020
+ return from_cloud
1021
+ raise KibanaUrlMissing(connection_id)
885
1022
 
886
1023
 
887
1024
  def create_kibana_dashboard(connection_id, dashboard_definition):
@@ -8,14 +8,32 @@
8
8
  - The embedded key is never sent to an enrolled agent.
9
9
  - **No more weak default compose secret.** `docker-compose.yml` no longer defaults `LOGSTASHUI_AGENT_CSR_SECRET` to `logstashui-compose-dev`. `bin/start_logstashui.sh`, `start_logstashui.bat` and `smoke_agent_modes.sh` generate `LOGSTASH_AGENT_API_KEY` and `LOGSTASHUI_AGENT_CSR_SECRET` once per install and keep them in `logstashui_data/.agent_api_key` and `.agent_csr_secret` (mode 600). An exported value takes precedence.
10
10
 
11
+ ### Added
12
+
13
+ - **SNMP devices on Kibana's Hosts page.** Devices polled with the official system profiles now appear on Kibana's Infrastructure Hosts and Inventory pages, with CPU, load, memory, disk usage, disk I/O and network RX/TX. Devices that report none of CPU, memory or load, such as UPSes and PDUs, stay off the Hosts page.
14
+ - Every field the SNMP index template shares with Elastic's System integration is now mapped exactly as Elastic maps it.
15
+ - New normalizers: `counter_delta`, table `sum` with `exclude_when`, and `share`. `multiply` gains `multiply_field` and `ratio` gains `difference_output_field`.
16
+
11
17
  ### Changed
12
18
 
19
+ - **SNMP field renames** (see the [SNMP Field Reference](/docs/docs/logstashui/SNMP/schema.md)):
20
+ - `system.cpu.num_cpus` is now `system.cpu.cores`.
21
+ - `system.memory.total`, `system.memory.actual.free` and `system.filesystem.total` are plain byte values instead of `.kb` / `.bytes` objects. Cisco and Aruba total memory in KB moved to `system.memory.actual.total.kb`.
22
+ - `system.load.*` now comes from `laLoadInt` × 0.01 and is a number. It used to be the `laLoad` string.
23
+ - `hrStorageTable` rows are split: disks go to `system.filesystem` and RAM, swap and other rows go to `system.storage`. Sizes are in bytes.
24
+ - **Isilon OneFS profiles rewritten against ISILON-MIB.** Cluster and node status, `/ifs` capacity, and CPU are now read from the correct OIDs. CPU is reported as a fraction (0–1) instead of per mil. New tables cover chassis, drives, drive performance, fans, temperature and power sensors, licenses, per-node CPU, and per-protocol statistics (`storage.protocol`). Dashboards built on the old Isilon fields need updating.
13
25
  - The Kubernetes examples add `LOGSTASH_AGENT_API_KEY` to `Secret/logstashui` and pass it to the embedded agent Deployment.
14
26
  - `bin/smoke_agent_modes.sh` Phase 1 now probes agent auth: no key and wrong key return `401`, the right key returns `200`, a traversal attempt on `/validate` returns `400`, and `/openapi.json` returns `404`. The offline phase also runs the agent's `tests/test_api_auth.py`.
15
27
 
16
28
  ### Upgrade notes
17
29
 
18
30
  - If you run `docker compose` directly instead of the start scripts, export the same `LOGSTASH_AGENT_API_KEY` and `LOGSTASHUI_AGENT_CSR_SECRET` for both services.
31
+ - **SNMP:** to pick up the new mappings and profiles:
32
+ 1. Run `logstashui manage sync_snmp_official_data --cleanup`.
33
+ 2. In the SNMP deploy dialog, install the updated index template on each connection and accept the **Rollover Required** prompt.
34
+ 3. Redeploy the SNMP pipelines for each network.
35
+ - **SNMP:** backing indices created before the upgrade keep the old mappings. Until they're gone, Kibana shows the load, memory and filesystem fields as conflicting types, and panels such as Normalized Load and Memory Free fail with "Field ... is of the wrong type". ES|QL queries across the data stream also silently drop those fields. Delete the old backing indices once you no longer need their history and their `index.time_series.end_time` has passed, then refresh the data view's field list. Reindexing old data into the data stream doesn't work, because TSDS rejects documents outside its current time window.
36
+ - **SNMP:** custom profiles copied from the official ones keep the old behavior. To match, poll `laLoadInt` (`1.3.6.1.4.1.2021.10.1.5.x`) × 0.01 instead of `laLoad`, and write the renamed fields above as plain byte values.
19
37
 
20
38
  ## [0.5.4] - Dissect and grok debuggers, system policies, SSL verification controls - 10/26/2026
21
39
 
@@ -335,6 +353,16 @@ This release is the next step after **0.4.x**: full SNMP network management, fir
335
353
  - Existing production agents on Default/Packaged **do not need to re-enroll**; restart after agent package upgrade.
336
354
  - Prefer enrolled **Simulate** agents for pipeline simulation; leave Packaged for production. Use **Managed** for multi-instance production trees on the same host.
337
355
  - See the roles guide for coexistence (isolated state/config per instance) and VERSION pins.
356
+ - `logstashui.yml` is no longer read. Move its settings to [environment variables](docs/docs/logstashui/configuration/environment.md). A commented sample env file ships in the wheel at `LogstashUI/packaging/logstashui.default`.
357
+
358
+ | Old YAML | Replacement |
359
+ |---|---|
360
+ | `no_auth.enabled` | `LOGSTASHUI_NO_AUTH` |
361
+ | `paths.data` / `paths.logs` | `LOGSTASHUI_DATA_DIR` / `LOGSTASHUI_LOGS_DIR` |
362
+ | `agent.ui_url` | `LOGSTASHUI_AGENT_UI_URL` (the value saved in Settings still wins) |
363
+ | `agent.include_ca_fingerprint` | `LOGSTASHUI_INCLUDE_CA_FINGERPRINT` |
364
+ | `simulation.mode` | Enrolled **Simulate** agents, plus `LOGSTASH_AGENT_URL` for the compose embedded agent |
365
+ | `simulation.logstash_agent.*` | `bin/start_logstashui.sh --legacy-host-agent` only |
338
366
 
339
367
 
340
368
  ## [0.5.0] - NMS release - 07/21/2026
@@ -51,7 +51,7 @@ A network is a monitoring zone. **Every network gets its own generated pipelines
51
51
  | **Name** | Unique friendly name. Used (sanitized) in pipeline names: `snmp-<network>-...` |
52
52
  | **Network range** | CIDR notation, e.g. `192.168.1.0/24`. Used by [discovery](/docs/docs/logstashui/SNMP/discovery.md) to know what to scan. |
53
53
  | **Deployment mode** | **Centralized Pipeline Management** (pipelines written to Elasticsearch) or **Logstash Agent** (pipelines pushed to an enrolled agent). See [Deploying Changes](/docs/docs/logstashui/SNMP/deploying_changes.md). |
54
- | **Connection** | The Elasticsearch connection (CPM mode) or Logstash Agent connection (agent mode) this network deploys to. |
54
+ | **Connection** | The Elasticsearch connection (CPM mode) or Logstash Agent connection (agent mode) this network deploys to. The generated Elasticsearch output lists every node URL on that connection, in the order you entered them. Logstash load-balances across them rather than failing over in order. |
55
55
  | **Credential mode** (CPM only) | **Manage Keystore Manually** (you add the credential entries to the Logstash keystore on the node yourself) or **Plaintext Credentials** (credentials embedded in the pipeline definition — convenient, but visible to anyone who can read pipelines in Elasticsearch). Not applicable in agent mode, where the agent manages the node's keystore and host configuration for you. |
56
56
  | **Polling interval** | How often devices are polled, in seconds (default 30). |
57
57
  | **Namespace** | Data stream namespace for this network's data (default `default`). Alternatively, enable **namespace from device template** to use the normalized template name as the namespace. |