holmesgpt 0.13.2__py3-none-any.whl → 0.18.4__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 (188) hide show
  1. holmes/__init__.py +3 -5
  2. holmes/clients/robusta_client.py +20 -6
  3. holmes/common/env_vars.py +58 -3
  4. holmes/common/openshift.py +1 -1
  5. holmes/config.py +123 -148
  6. holmes/core/conversations.py +71 -15
  7. holmes/core/feedback.py +191 -0
  8. holmes/core/investigation.py +31 -39
  9. holmes/core/investigation_structured_output.py +3 -3
  10. holmes/core/issue.py +1 -1
  11. holmes/core/llm.py +508 -88
  12. holmes/core/models.py +108 -4
  13. holmes/core/openai_formatting.py +14 -1
  14. holmes/core/prompt.py +48 -3
  15. holmes/core/runbooks.py +1 -0
  16. holmes/core/safeguards.py +8 -6
  17. holmes/core/supabase_dal.py +295 -100
  18. holmes/core/tool_calling_llm.py +489 -428
  19. holmes/core/tools.py +325 -56
  20. holmes/core/tools_utils/token_counting.py +21 -0
  21. holmes/core/tools_utils/tool_context_window_limiter.py +40 -0
  22. holmes/core/tools_utils/tool_executor.py +0 -13
  23. holmes/core/tools_utils/toolset_utils.py +1 -0
  24. holmes/core/toolset_manager.py +191 -5
  25. holmes/core/tracing.py +19 -3
  26. holmes/core/transformers/__init__.py +23 -0
  27. holmes/core/transformers/base.py +63 -0
  28. holmes/core/transformers/llm_summarize.py +175 -0
  29. holmes/core/transformers/registry.py +123 -0
  30. holmes/core/transformers/transformer.py +32 -0
  31. holmes/core/truncation/compaction.py +94 -0
  32. holmes/core/truncation/dal_truncation_utils.py +23 -0
  33. holmes/core/truncation/input_context_window_limiter.py +219 -0
  34. holmes/interactive.py +228 -31
  35. holmes/main.py +23 -40
  36. holmes/plugins/interfaces.py +2 -1
  37. holmes/plugins/prompts/__init__.py +2 -1
  38. holmes/plugins/prompts/_fetch_logs.jinja2 +31 -6
  39. holmes/plugins/prompts/_general_instructions.jinja2 +1 -2
  40. holmes/plugins/prompts/_runbook_instructions.jinja2 +24 -12
  41. holmes/plugins/prompts/base_user_prompt.jinja2 +7 -0
  42. holmes/plugins/prompts/conversation_history_compaction.jinja2 +89 -0
  43. holmes/plugins/prompts/generic_ask.jinja2 +0 -4
  44. holmes/plugins/prompts/generic_ask_conversation.jinja2 +0 -1
  45. holmes/plugins/prompts/generic_ask_for_issue_conversation.jinja2 +0 -1
  46. holmes/plugins/prompts/generic_investigation.jinja2 +0 -1
  47. holmes/plugins/prompts/investigation_procedure.jinja2 +50 -1
  48. holmes/plugins/prompts/kubernetes_workload_ask.jinja2 +0 -1
  49. holmes/plugins/prompts/kubernetes_workload_chat.jinja2 +0 -1
  50. holmes/plugins/runbooks/__init__.py +145 -17
  51. holmes/plugins/runbooks/catalog.json +2 -0
  52. holmes/plugins/sources/github/__init__.py +4 -2
  53. holmes/plugins/sources/prometheus/models.py +1 -0
  54. holmes/plugins/toolsets/__init__.py +44 -27
  55. holmes/plugins/toolsets/aks-node-health.yaml +46 -0
  56. holmes/plugins/toolsets/aks.yaml +64 -0
  57. holmes/plugins/toolsets/atlas_mongodb/mongodb_atlas.py +38 -47
  58. holmes/plugins/toolsets/azure_sql/apis/alert_monitoring_api.py +3 -2
  59. holmes/plugins/toolsets/azure_sql/apis/azure_sql_api.py +2 -1
  60. holmes/plugins/toolsets/azure_sql/apis/connection_failure_api.py +3 -2
  61. holmes/plugins/toolsets/azure_sql/apis/connection_monitoring_api.py +3 -1
  62. holmes/plugins/toolsets/azure_sql/apis/storage_analysis_api.py +3 -1
  63. holmes/plugins/toolsets/azure_sql/azure_sql_toolset.py +12 -13
  64. holmes/plugins/toolsets/azure_sql/tools/analyze_connection_failures.py +15 -12
  65. holmes/plugins/toolsets/azure_sql/tools/analyze_database_connections.py +15 -12
  66. holmes/plugins/toolsets/azure_sql/tools/analyze_database_health_status.py +11 -11
  67. holmes/plugins/toolsets/azure_sql/tools/analyze_database_performance.py +11 -9
  68. holmes/plugins/toolsets/azure_sql/tools/analyze_database_storage.py +15 -12
  69. holmes/plugins/toolsets/azure_sql/tools/get_active_alerts.py +15 -15
  70. holmes/plugins/toolsets/azure_sql/tools/get_slow_queries.py +11 -8
  71. holmes/plugins/toolsets/azure_sql/tools/get_top_cpu_queries.py +11 -8
  72. holmes/plugins/toolsets/azure_sql/tools/get_top_data_io_queries.py +11 -8
  73. holmes/plugins/toolsets/azure_sql/tools/get_top_log_io_queries.py +11 -8
  74. holmes/plugins/toolsets/azure_sql/utils.py +0 -32
  75. holmes/plugins/toolsets/bash/argocd/__init__.py +3 -3
  76. holmes/plugins/toolsets/bash/aws/__init__.py +4 -4
  77. holmes/plugins/toolsets/bash/azure/__init__.py +4 -4
  78. holmes/plugins/toolsets/bash/bash_toolset.py +11 -15
  79. holmes/plugins/toolsets/bash/common/bash.py +23 -13
  80. holmes/plugins/toolsets/bash/common/bash_command.py +1 -1
  81. holmes/plugins/toolsets/bash/common/stringify.py +1 -1
  82. holmes/plugins/toolsets/bash/kubectl/__init__.py +2 -1
  83. holmes/plugins/toolsets/bash/kubectl/constants.py +0 -1
  84. holmes/plugins/toolsets/bash/kubectl/kubectl_get.py +3 -4
  85. holmes/plugins/toolsets/bash/parse_command.py +12 -13
  86. holmes/plugins/toolsets/cilium.yaml +284 -0
  87. holmes/plugins/toolsets/connectivity_check.py +124 -0
  88. holmes/plugins/toolsets/coralogix/api.py +132 -119
  89. holmes/plugins/toolsets/coralogix/coralogix.jinja2 +14 -0
  90. holmes/plugins/toolsets/coralogix/toolset_coralogix.py +219 -0
  91. holmes/plugins/toolsets/coralogix/utils.py +15 -79
  92. holmes/plugins/toolsets/datadog/datadog_api.py +525 -26
  93. holmes/plugins/toolsets/datadog/datadog_logs_instructions.jinja2 +55 -11
  94. holmes/plugins/toolsets/datadog/datadog_metrics_instructions.jinja2 +3 -3
  95. holmes/plugins/toolsets/datadog/datadog_models.py +59 -0
  96. holmes/plugins/toolsets/datadog/datadog_url_utils.py +213 -0
  97. holmes/plugins/toolsets/datadog/instructions_datadog_traces.jinja2 +165 -28
  98. holmes/plugins/toolsets/datadog/toolset_datadog_general.py +417 -241
  99. holmes/plugins/toolsets/datadog/toolset_datadog_logs.py +234 -214
  100. holmes/plugins/toolsets/datadog/toolset_datadog_metrics.py +167 -79
  101. holmes/plugins/toolsets/datadog/toolset_datadog_traces.py +374 -363
  102. holmes/plugins/toolsets/elasticsearch/__init__.py +6 -0
  103. holmes/plugins/toolsets/elasticsearch/elasticsearch.py +834 -0
  104. holmes/plugins/toolsets/elasticsearch/opensearch_ppl_query_docs.jinja2 +1616 -0
  105. holmes/plugins/toolsets/elasticsearch/opensearch_query_assist.py +78 -0
  106. holmes/plugins/toolsets/elasticsearch/opensearch_query_assist_instructions.jinja2 +223 -0
  107. holmes/plugins/toolsets/git.py +54 -50
  108. holmes/plugins/toolsets/grafana/base_grafana_toolset.py +16 -4
  109. holmes/plugins/toolsets/grafana/common.py +13 -29
  110. holmes/plugins/toolsets/grafana/grafana_tempo_api.py +455 -0
  111. holmes/plugins/toolsets/grafana/loki/instructions.jinja2 +25 -0
  112. holmes/plugins/toolsets/grafana/loki/toolset_grafana_loki.py +191 -0
  113. holmes/plugins/toolsets/grafana/loki_api.py +4 -0
  114. holmes/plugins/toolsets/grafana/toolset_grafana.py +293 -89
  115. holmes/plugins/toolsets/grafana/toolset_grafana_dashboard.jinja2 +49 -0
  116. holmes/plugins/toolsets/grafana/toolset_grafana_tempo.jinja2 +246 -11
  117. holmes/plugins/toolsets/grafana/toolset_grafana_tempo.py +820 -292
  118. holmes/plugins/toolsets/grafana/trace_parser.py +4 -3
  119. holmes/plugins/toolsets/internet/internet.py +15 -16
  120. holmes/plugins/toolsets/internet/notion.py +9 -11
  121. holmes/plugins/toolsets/investigator/core_investigation.py +44 -36
  122. holmes/plugins/toolsets/investigator/model.py +3 -1
  123. holmes/plugins/toolsets/json_filter_mixin.py +134 -0
  124. holmes/plugins/toolsets/kafka.py +36 -42
  125. holmes/plugins/toolsets/kubernetes.yaml +317 -113
  126. holmes/plugins/toolsets/kubernetes_logs.py +9 -9
  127. holmes/plugins/toolsets/kubernetes_logs.yaml +32 -0
  128. holmes/plugins/toolsets/logging_utils/logging_api.py +94 -8
  129. holmes/plugins/toolsets/mcp/toolset_mcp.py +218 -64
  130. holmes/plugins/toolsets/newrelic/new_relic_api.py +165 -0
  131. holmes/plugins/toolsets/newrelic/newrelic.jinja2 +65 -0
  132. holmes/plugins/toolsets/newrelic/newrelic.py +320 -0
  133. holmes/plugins/toolsets/openshift.yaml +283 -0
  134. holmes/plugins/toolsets/prometheus/prometheus.py +1202 -421
  135. holmes/plugins/toolsets/prometheus/prometheus_instructions.jinja2 +54 -5
  136. holmes/plugins/toolsets/prometheus/utils.py +28 -0
  137. holmes/plugins/toolsets/rabbitmq/api.py +23 -4
  138. holmes/plugins/toolsets/rabbitmq/toolset_rabbitmq.py +13 -14
  139. holmes/plugins/toolsets/robusta/robusta.py +239 -68
  140. holmes/plugins/toolsets/robusta/robusta_instructions.jinja2 +26 -9
  141. holmes/plugins/toolsets/runbook/runbook_fetcher.py +157 -27
  142. holmes/plugins/toolsets/service_discovery.py +1 -1
  143. holmes/plugins/toolsets/servicenow_tables/instructions.jinja2 +83 -0
  144. holmes/plugins/toolsets/servicenow_tables/servicenow_tables.py +426 -0
  145. holmes/plugins/toolsets/utils.py +88 -0
  146. holmes/utils/config_utils.py +91 -0
  147. holmes/utils/connection_utils.py +31 -0
  148. holmes/utils/console/result.py +10 -0
  149. holmes/utils/default_toolset_installation_guide.jinja2 +1 -22
  150. holmes/utils/env.py +7 -0
  151. holmes/utils/file_utils.py +2 -1
  152. holmes/utils/global_instructions.py +60 -11
  153. holmes/utils/holmes_status.py +6 -4
  154. holmes/utils/holmes_sync_toolsets.py +0 -2
  155. holmes/utils/krr_utils.py +188 -0
  156. holmes/utils/log.py +15 -0
  157. holmes/utils/markdown_utils.py +2 -3
  158. holmes/utils/memory_limit.py +58 -0
  159. holmes/utils/sentry_helper.py +64 -0
  160. holmes/utils/stream.py +69 -8
  161. holmes/utils/tags.py +4 -3
  162. holmes/version.py +37 -15
  163. holmesgpt-0.18.4.dist-info/LICENSE +178 -0
  164. {holmesgpt-0.13.2.dist-info → holmesgpt-0.18.4.dist-info}/METADATA +35 -31
  165. holmesgpt-0.18.4.dist-info/RECORD +258 -0
  166. holmes/core/performance_timing.py +0 -72
  167. holmes/plugins/toolsets/aws.yaml +0 -80
  168. holmes/plugins/toolsets/coralogix/toolset_coralogix_logs.py +0 -112
  169. holmes/plugins/toolsets/datadog/datadog_traces_formatter.py +0 -310
  170. holmes/plugins/toolsets/datadog/toolset_datadog_rds.py +0 -739
  171. holmes/plugins/toolsets/grafana/grafana_api.py +0 -42
  172. holmes/plugins/toolsets/grafana/tempo_api.py +0 -124
  173. holmes/plugins/toolsets/grafana/toolset_grafana_loki.py +0 -110
  174. holmes/plugins/toolsets/newrelic.py +0 -231
  175. holmes/plugins/toolsets/opensearch/opensearch.py +0 -257
  176. holmes/plugins/toolsets/opensearch/opensearch_logs.py +0 -161
  177. holmes/plugins/toolsets/opensearch/opensearch_traces.py +0 -218
  178. holmes/plugins/toolsets/opensearch/opensearch_traces_instructions.jinja2 +0 -12
  179. holmes/plugins/toolsets/opensearch/opensearch_utils.py +0 -166
  180. holmes/plugins/toolsets/servicenow/install.md +0 -37
  181. holmes/plugins/toolsets/servicenow/instructions.jinja2 +0 -3
  182. holmes/plugins/toolsets/servicenow/servicenow.py +0 -219
  183. holmes/utils/keygen_utils.py +0 -6
  184. holmesgpt-0.13.2.dist-info/LICENSE.txt +0 -21
  185. holmesgpt-0.13.2.dist-info/RECORD +0 -234
  186. /holmes/plugins/toolsets/{opensearch → newrelic}/__init__.py +0 -0
  187. {holmesgpt-0.13.2.dist-info → holmesgpt-0.18.4.dist-info}/WHEEL +0 -0
  188. {holmesgpt-0.13.2.dist-info → holmesgpt-0.18.4.dist-info}/entry_points.txt +0 -0
@@ -3,28 +3,27 @@ import logging
3
3
  import shlex
4
4
  from typing import Any, Optional
5
5
 
6
- from holmes.plugins.toolsets.bash.common.bash_command import BashCommand
7
- from holmes.plugins.toolsets.bash.common.config import BashExecutorConfig
8
- from holmes.plugins.toolsets.bash.kubectl import KubectlCommand
6
+ from holmes.plugins.toolsets.bash.argocd import ArgocdCommand
9
7
  from holmes.plugins.toolsets.bash.aws import AWSCommand
10
8
  from holmes.plugins.toolsets.bash.azure import AzureCommand
11
- from holmes.plugins.toolsets.bash.argocd import ArgocdCommand
9
+ from holmes.plugins.toolsets.bash.common.bash_command import BashCommand
10
+ from holmes.plugins.toolsets.bash.common.config import BashExecutorConfig
12
11
  from holmes.plugins.toolsets.bash.docker import DockerCommand
13
12
  from holmes.plugins.toolsets.bash.helm import HelmCommand
14
-
15
- # Utilities imports - all now use Command classes
16
- from holmes.plugins.toolsets.bash.utilities.wc import WCCommand
13
+ from holmes.plugins.toolsets.bash.kubectl import KubectlCommand
14
+ from holmes.plugins.toolsets.bash.utilities.base64_util import Base64Command
17
15
  from holmes.plugins.toolsets.bash.utilities.cut import CutCommand
18
- from holmes.plugins.toolsets.bash.utilities.sort import SortCommand
19
- from holmes.plugins.toolsets.bash.utilities.uniq import UniqCommand
16
+ from holmes.plugins.toolsets.bash.utilities.grep import GrepCommand
20
17
  from holmes.plugins.toolsets.bash.utilities.head import HeadCommand
21
- from holmes.plugins.toolsets.bash.utilities.tail import TailCommand
22
- from holmes.plugins.toolsets.bash.utilities.tr import TrCommand
23
- from holmes.plugins.toolsets.bash.utilities.base64_util import Base64Command
24
18
  from holmes.plugins.toolsets.bash.utilities.jq import JqCommand
25
19
  from holmes.plugins.toolsets.bash.utilities.sed import SedCommand
26
- from holmes.plugins.toolsets.bash.utilities.grep import GrepCommand
20
+ from holmes.plugins.toolsets.bash.utilities.sort import SortCommand
21
+ from holmes.plugins.toolsets.bash.utilities.tail import TailCommand
22
+ from holmes.plugins.toolsets.bash.utilities.tr import TrCommand
23
+ from holmes.plugins.toolsets.bash.utilities.uniq import UniqCommand
27
24
 
25
+ # Utilities imports - all now use Command classes
26
+ from holmes.plugins.toolsets.bash.utilities.wc import WCCommand
28
27
 
29
28
  # All commands now use BashCommand classes
30
29
  AVAILABLE_COMMANDS: list[BashCommand] = [
@@ -0,0 +1,284 @@
1
+ toolsets:
2
+ cilium/core:
3
+ description: "Cilium CNI and Hubble network observability tools for troubleshooting network connectivity and security"
4
+ docs_url: "https://robusta-dev.github.io/holmesgpt/data-sources/builtin-toolsets/cilium/"
5
+ icon_url: "https://cilium.io/static/logo-dark-text.png"
6
+ llm_instructions: |
7
+ You have access to comprehensive Cilium and Hubble tools for debugging Kubernetes networking and security.
8
+ Use these tools to investigate:
9
+ - Network connectivity issues between pods/services
10
+ - Network policy violations
11
+ - Load balancing problems
12
+ - Network flows and traffic patterns
13
+ - Cilium component health and status
14
+
15
+ ALWAYS follow these troubleshooting steps:
16
+ 1. Check Cilium agent status and health, and attempt to remediate if broken.
17
+ 2. Use Hubble to observe network flows and identify blocked or dropped traffic
18
+ 3. Check network policies if traffic is being denied
19
+ 4. Examine Cilium endpoints and services for configuration issues
20
+ 5. Analyze BPF maps and load balancer state if needed
21
+ 6. Run connectivity tests ONLY as a last resort (they take 5+ minutes)
22
+
23
+ {% if tool_names|list|length > 0 %}
24
+ The following Cilium commands are available: {{ ", ".join(tool_names) }}
25
+ {% endif %}
26
+
27
+ ALWAYS provide specific actionable solutions based on the observed data rather than generic troubleshooting advice.
28
+ tags:
29
+ - cli
30
+ prerequisites:
31
+ - command: "cilium status"
32
+ config:
33
+ timeout: 300 # Default timeout in seconds - connectivity tests can take 5+ minutes to complete
34
+
35
+ tools:
36
+ # Cilium Status and Health
37
+ - name: "cilium_status"
38
+ description: "Display overall Cilium agent status and health"
39
+ command: "cilium status"
40
+
41
+ - name: "cilium_status_verbose"
42
+ description: "Display detailed Cilium agent status with verbose output"
43
+ command: "cilium status --verbose"
44
+
45
+ - name: "cilium_version"
46
+ description: "Show Cilium version information"
47
+ command: "cilium version"
48
+
49
+ - name: "cilium_config"
50
+ description: "Display current Cilium configuration"
51
+ command: "cilium config view"
52
+
53
+ # Connectivity Testing
54
+ - name: "cilium_connectivity_test"
55
+ description: "Run comprehensive connectivity tests to validate network functionality (SLOW: 5+ minutes - use as last resort)"
56
+ command: "timeout {{ config.timeout | default(600) }} cilium connectivity test --test-concurrency 1"
57
+
58
+ - name: "cilium_connectivity_test_namespace"
59
+ description: "Run connectivity tests in a specific namespace (SLOW: 5+ minutes - use as last resort)"
60
+ command: "timeout {{ config.timeout | default(600) }} cilium connectivity test --test-namespace {{ namespace }}"
61
+ args:
62
+ - name: "namespace"
63
+ type: "string"
64
+ description: "Kubernetes namespace to run connectivity tests in"
65
+
66
+ # Cluster and Node Information
67
+ - name: "cilium_clustermesh_status"
68
+ description: "Display cluster mesh status for multi-cluster networking"
69
+ command: "cilium clustermesh status"
70
+
71
+ # Features and Configuration
72
+ - name: "cilium_features_status"
73
+ description: "Report which features are enabled in Cilium agents"
74
+ command: "cilium features status"
75
+
76
+ # BGP Control Plane
77
+ - name: "cilium_bgp_peers"
78
+ description: "List BGP peers for nodes running Cilium (requires BGP enabled)"
79
+ command: "cilium bgp peers || echo 'BGP not enabled or not properly configured'"
80
+
81
+ - name: "cilium_bgp_routes"
82
+ description: "List BGP routes for nodes running Cilium (requires BGP enabled)"
83
+ command: "cilium bgp routes || echo 'BGP not enabled or not properly configured'"
84
+
85
+ # Encryption (requires Cilium 1.18+)
86
+ - name: "cilium_encryption_status"
87
+ description: "Show encryption status and configuration (requires Cilium 1.18+)"
88
+ command: "cilium encryption status || echo 'Encryption status not supported in this Cilium version'"
89
+
90
+ # System Diagnostics
91
+ - name: "cilium_sysdump"
92
+ description: "Collect system information for troubleshooting Cilium issues"
93
+ command: "cilium sysdump --output-filename cilium-sysdump-$(date +%Y%m%d-%H%M%S).zip"
94
+
95
+ # Installation and Upgrade
96
+ - name: "cilium_install_status"
97
+ description: "Check Cilium installation status in the cluster"
98
+ command: "cilium status --wait"
99
+
100
+ - name: "cilium_context"
101
+ description: "Display the current Kubernetes context configuration"
102
+ command: "cilium context"
103
+
104
+ # Multicast (only works if multicast is enabled)
105
+ - name: "cilium_multicast_groups"
106
+ description: "List multicast groups and their members (requires multicast enabled)"
107
+ command: "cilium multicast list group || echo 'Multicast not enabled in this cluster'"
108
+
109
+ hubble/observability:
110
+ description: "Hubble network observability tools for monitoring and troubleshooting network flows"
111
+ docs_url: "https://robusta-dev.github.io/holmesgpt/data-sources/builtin-toolsets/cilium/#hubble"
112
+ icon_url: "https://raw.githubusercontent.com/cilium/hubble/main/Documentation/images/hubble_logo.png"
113
+ llm_instructions: |
114
+ Use Hubble to observe and analyze network traffic flows in your Kubernetes cluster.
115
+
116
+ IMPORTANT: Hubble commands require a running Hubble server (hubble-relay) to be accessible.
117
+ If Hubble server is not available, these commands will fail with connection errors.
118
+ Use 'cilium hubble enable' to enable Hubble if needed.
119
+
120
+ Hubble provides deep visibility into:
121
+ - HTTP/gRPC/DNS traffic flows
122
+ - Network policy drops and allows
123
+ - Service-to-service communication patterns
124
+ - Security events and anomalies
125
+ - Cilium agent events and debug information
126
+
127
+ When troubleshooting with Hubble:
128
+ 1. Start with broad flow observations to understand traffic patterns
129
+ 2. Filter by specific pods, namespaces, or protocols as needed
130
+ 3. Look for dropped flows to identify policy issues
131
+ 4. Check DNS resolution problems
132
+ 5. Analyze L7 protocols for application-level issues
133
+ 6. Use policy verdicts to understand network policy behavior
134
+
135
+ Use time windows and limits to focus on recent events during incident investigation.
136
+ Note: Some advanced features like agent-events and debug-events may not be available in all Hubble versions.
137
+ tags:
138
+ - cli
139
+ prerequisites:
140
+ - command: "hubble version"
141
+ - command: "hubble status"
142
+ config:
143
+ timeout: 300 # Default timeout in seconds for potentially long-running commands
144
+
145
+ tools:
146
+ # Flow Observation
147
+ - name: "hubble_observe"
148
+ description: "Observe network flows in real-time (last 100 flows)"
149
+ command: "hubble observe --last 1000"
150
+ transformers:
151
+ - name: llm_summarize
152
+ config:
153
+ input_threshold: 1000
154
+ prompt: |
155
+ Summarize this hubble observe output focusing on
156
+ - Notable traffic patterns.
157
+ - Traffic drops of any kind, source, destingation, protocol, etc.
158
+ - Errors that might indicate network issues.
159
+
160
+ - name: "hubble_observe_namespace"
161
+ description: "Observe flows for a specific namespace"
162
+ command: "hubble observe --namespace {{ namespace }} --last 100"
163
+ args:
164
+ - name: "namespace"
165
+ type: "string"
166
+ description: "Kubernetes namespace to observe flows for"
167
+
168
+ - name: "hubble_observe_pod"
169
+ description: "Observe flows to/from a specific pod (format: namespace/pod-name)"
170
+ command: "hubble observe --pod {{ pod_name }} --last 100"
171
+ args:
172
+ - name: "pod_name"
173
+ type: "string"
174
+ description: "Pod name in format namespace/pod-name or just pod-name (defaults to 'default' namespace)"
175
+
176
+ - name: "hubble_observe_since"
177
+ description: "Observe flows since a specific time (e.g., '5m', '1h', '2023-01-01T10:00:00Z')"
178
+ command: "timeout {{ config.timeout | default(30) }} hubble observe --since {{ time_duration }}"
179
+ args:
180
+ - name: "time_duration"
181
+ type: "string"
182
+ description: "Time duration or timestamp (e.g., '5m', '1h', '2023-01-01T10:00:00Z')"
183
+
184
+ # Protocol-Specific Observation
185
+ - name: "hubble_observe_http"
186
+ description: "Observe HTTP traffic flows"
187
+ command: "hubble observe --protocol http --last 100"
188
+
189
+ - name: "hubble_observe_dns"
190
+ description: "Observe DNS queries and responses"
191
+ command: "hubble observe --protocol dns --last 100"
192
+
193
+ - name: "hubble_observe_grpc"
194
+ description: "Observe gRPC traffic flows"
195
+ command: "hubble observe --protocol grpc --last 100"
196
+
197
+ # Traffic Analysis
198
+ - name: "hubble_observe_drops"
199
+ description: "Show only dropped network flows (policy denials, etc.)"
200
+ command: "hubble observe --verdict DROPPED --last 100"
201
+
202
+ - name: "hubble_observe_forwarded"
203
+ description: "Show flows that were successfully forwarded"
204
+ command: "hubble observe --verdict FORWARDED --last 100"
205
+
206
+ - name: "hubble_observe_service"
207
+ description: "Observe flows to/from a specific service (format: namespace/service-name)"
208
+ command: "hubble observe --service {{ service_name }} --last 100"
209
+ args:
210
+ - name: "service_name"
211
+ type: "string"
212
+ description: "Service name in format namespace/service-name or just service-name (defaults to 'default' namespace)"
213
+
214
+ - name: "hubble_observe_port"
215
+ description: "Observe flows on a specific port"
216
+ command: "hubble observe --port {{ port }} --last 100"
217
+ args:
218
+ - name: "port"
219
+ type: "integer"
220
+ description: "Port number to filter flows by (e.g., 8080, 443)"
221
+
222
+ # Flow Filtering and Analysis
223
+ - name: "hubble_observe_from_pod"
224
+ description: "Observe flows originating from a specific pod (format: namespace/pod-name)"
225
+ command: "hubble observe --from-pod {{ namespace }}/{{ pod_name }} --last 100"
226
+ args:
227
+ - name: "namespace"
228
+ type: "string"
229
+ description: "Kubernetes namespace where the source pod is located"
230
+ - name: "pod_name"
231
+ type: "string"
232
+ description: "Name of the source pod"
233
+
234
+ - name: "hubble_observe_to_pod"
235
+ description: "Observe flows destined to a specific pod (format: namespace/pod-name)"
236
+ command: "hubble observe --to-pod {{ namespace }}/{{ pod_name }} --last 100"
237
+ args:
238
+ - name: "namespace"
239
+ type: "string"
240
+ description: "Kubernetes namespace where the destination pod is located"
241
+ - name: "pod_name"
242
+ type: "string"
243
+ description: "Name of the destination pod"
244
+
245
+ - name: "hubble_observe_between_namespaces"
246
+ description: "Observe flows between two specific namespaces"
247
+ command: "hubble observe --from-namespace {{ src_namespace }} --to-namespace {{ dst_namespace }} --last 100"
248
+ args:
249
+ - name: "src_namespace"
250
+ type: "string"
251
+ description: "Source namespace to filter flows from"
252
+ - name: "dst_namespace"
253
+ type: "string"
254
+ description: "Destination namespace to filter flows to"
255
+
256
+ - name: "hubble_observe_json"
257
+ description: "Output flow observations in JSON format for detailed analysis"
258
+ command: "hubble observe --output json --last 100"
259
+
260
+ # Status and Metrics
261
+ - name: "hubble_status"
262
+ description: "Display Hubble server status and configuration"
263
+ command: "hubble status"
264
+
265
+ - name: "hubble_list_nodes"
266
+ description: "List nodes available for flow observation"
267
+ command: "hubble list nodes"
268
+
269
+ - name: "hubble_observe_flows_summary"
270
+ description: "Get a summary of recent network flows with basic statistics"
271
+ command: "hubble observe --last 100 --output compact"
272
+
273
+ # Security and Policy Analysis
274
+ - name: "hubble_observe_security_events"
275
+ description: "Observe security-related network events and policy violations"
276
+ command: "hubble observe --verdict DROPPED --last 100"
277
+
278
+ - name: "hubble_observe_policy_verdicts"
279
+ description: "Show policy verdict events (allows and denies)"
280
+ command: "hubble observe --type policy-verdict --last 100"
281
+
282
+ - name: "hubble_observe_l7_traffic"
283
+ description: "Show L7 (application-layer) traffic flows"
284
+ command: "hubble observe --type l7 --last 100"
@@ -0,0 +1,124 @@
1
+ import socket
2
+ from typing import Any, Dict, Literal
3
+
4
+ from holmes.core.tools import (
5
+ StructuredToolResult,
6
+ StructuredToolResultStatus,
7
+ Tool,
8
+ ToolInvokeContext,
9
+ ToolParameter,
10
+ Toolset,
11
+ ToolsetTag,
12
+ )
13
+ from holmes.plugins.toolsets.utils import toolset_name_for_one_liner
14
+
15
+ BROWSER_LIKE_UA = (
16
+ "Mozilla/5.0 (Windows NT 10.0; Win64; x64) "
17
+ "AppleWebKit/537.36 (KHTML, like Gecko) "
18
+ "Chrome/120.0.0.0 Safari/537.36"
19
+ )
20
+
21
+ UserAgentMode = Literal["none", "browser"]
22
+
23
+
24
+ def tcp_check(host: str, port: int, timeout: float) -> Dict[str, Any]:
25
+ if not (1 <= port <= 65535):
26
+ return {
27
+ "ok": False,
28
+ "error": "invalid port (must be 1-65535)",
29
+ }
30
+
31
+ try:
32
+ with socket.create_connection((host, port), timeout=timeout):
33
+ return {
34
+ "ok": True,
35
+ }
36
+ except (OSError, socket.timeout) as e:
37
+ return {
38
+ "ok": False,
39
+ "error": str(e),
40
+ }
41
+
42
+
43
+ class TcpCheckTool(Tool):
44
+ toolset: "ConnectivityCheckToolset" = None # type: ignore
45
+
46
+ def __init__(self, toolset: "ConnectivityCheckToolset"):
47
+ super().__init__(
48
+ name="tcp_check",
49
+ description="Check if a TCP socket can be opened to a host and port.",
50
+ parameters={
51
+ "host": ToolParameter(
52
+ description="The hostname or IP address to connect to",
53
+ type="string",
54
+ required=True,
55
+ ),
56
+ "port": ToolParameter(
57
+ description="The port to connect to",
58
+ type="integer",
59
+ required=True,
60
+ ),
61
+ "timeout": ToolParameter(
62
+ description="Timeout in seconds (default: 3.0)",
63
+ type="number",
64
+ required=False,
65
+ ),
66
+ },
67
+ )
68
+ self.toolset = toolset
69
+
70
+ def _invoke(self, params: dict, context: ToolInvokeContext) -> StructuredToolResult:
71
+ host = params.get("host")
72
+ port = params.get("port")
73
+ if host is None:
74
+ return StructuredToolResult(
75
+ status=StructuredToolResultStatus.ERROR,
76
+ data={"error": "host parameter is required"},
77
+ params=params,
78
+ )
79
+ if port is None:
80
+ return StructuredToolResult(
81
+ status=StructuredToolResultStatus.ERROR,
82
+ data={"error": "port parameter is required"},
83
+ params=params,
84
+ )
85
+
86
+ result = tcp_check(
87
+ host=host,
88
+ port=int(port),
89
+ timeout=float(params.get("timeout", 3.0)),
90
+ )
91
+ return StructuredToolResult(
92
+ status=StructuredToolResultStatus.SUCCESS,
93
+ data=result,
94
+ params=params,
95
+ )
96
+
97
+ def get_parameterized_one_liner(self, params) -> str:
98
+ host = params.get("host", "<missing host>")
99
+ port = params.get("port", "<missing port>")
100
+ return (
101
+ f"{toolset_name_for_one_liner(self.toolset.name)}: "
102
+ f"TCP check {host}:{port}"
103
+ )
104
+
105
+
106
+ class ConnectivityCheckToolset(Toolset):
107
+ def __init__(self):
108
+ super().__init__(
109
+ name="connectivity_check",
110
+ description="Check TCP connectivity to endpoints",
111
+ icon_url="https://platform.robusta.dev/demos/internet-access.svg",
112
+ tools=[
113
+ TcpCheckTool(self),
114
+ ],
115
+ tags=[
116
+ ToolsetTag.CORE,
117
+ ],
118
+ is_default=True,
119
+ enabled=True,
120
+ docs_url="https://holmesgpt.dev/data-sources/builtin-toolsets/connectivity-check/",
121
+ )
122
+
123
+ def get_example_config(self) -> Dict[str, Any]:
124
+ return {}