mcp-instana 0.1.0__py3-none-any.whl → 0.1.1__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.
- mcp_instana-0.1.1.dist-info/METADATA +908 -0
- mcp_instana-0.1.1.dist-info/RECORD +30 -0
- {mcp_instana-0.1.0.dist-info → mcp_instana-0.1.1.dist-info}/WHEEL +1 -1
- mcp_instana-0.1.1.dist-info/entry_points.txt +4 -0
- mcp_instana-0.1.0.dist-info/LICENSE → mcp_instana-0.1.1.dist-info/licenses/LICENSE.md +3 -3
- src/application/__init__.py +1 -0
- src/{client/application_alert_config_mcp_tools.py → application/application_alert_config.py} +251 -273
- src/application/application_analyze.py +415 -0
- src/application/application_catalog.py +153 -0
- src/{client/application_metrics_mcp_tools.py → application/application_metrics.py} +107 -129
- src/{client/application_resources_mcp_tools.py → application/application_resources.py} +128 -150
- src/application/application_settings.py +1135 -0
- src/application/application_topology.py +107 -0
- src/core/__init__.py +1 -0
- src/core/server.py +436 -0
- src/core/utils.py +213 -0
- src/event/__init__.py +1 -0
- src/{client/events_mcp_tools.py → event/events_tools.py} +128 -136
- src/infrastructure/__init__.py +1 -0
- src/{client/infrastructure_analyze_mcp_tools.py → infrastructure/infrastructure_analyze.py} +200 -203
- src/{client/infrastructure_catalog_mcp_tools.py → infrastructure/infrastructure_catalog.py} +194 -264
- src/infrastructure/infrastructure_metrics.py +167 -0
- src/{client/infrastructure_resources_mcp_tools.py → infrastructure/infrastructure_resources.py} +192 -223
- src/{client/infrastructure_topology_mcp_tools.py → infrastructure/infrastructure_topology.py} +105 -106
- src/log/__init__.py +1 -0
- src/log/log_alert_configuration.py +331 -0
- src/prompts/mcp_prompts.py +900 -0
- src/prompts/prompt_loader.py +29 -0
- src/prompts/prompt_registry.json +21 -0
- mcp_instana-0.1.0.dist-info/METADATA +0 -649
- mcp_instana-0.1.0.dist-info/RECORD +0 -19
- mcp_instana-0.1.0.dist-info/entry_points.txt +0 -3
- src/client/What is the sum of queue depth for all q +0 -55
- src/client/instana_client_base.py +0 -93
- src/client/log_alert_configuration_mcp_tools.py +0 -316
- src/client/show the top 5 services with the highest +0 -28
- src/mcp_server.py +0 -343
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
src/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
2
|
-
src/client/What is the sum of queue depth for all q,sha256=Ya_mffnaM8lWf5S54GObgeelp-iPtPGaU5eknT94x64,5564
|
|
3
|
-
src/client/application_alert_config_mcp_tools.py,sha256=OwAE7JXD-Nf2TWy5Y9XoIZPXqcZK0j-Xy4DA57BxlEM,31316
|
|
4
|
-
src/client/application_metrics_mcp_tools.py,sha256=rKPOZ12rHBtCqJUr8E5URM5_DOnb1yeGtkYRE2dvICc,16294
|
|
5
|
-
src/client/application_resources_mcp_tools.py,sha256=lJe1JL70sS0FOvB2RMiRU_Y9F2QX_GRQVNgWeWWBq1U,19076
|
|
6
|
-
src/client/events_mcp_tools.py,sha256=U9Ltkavjflz7LWaItODZYDeSrtUycwgYXVWDLLxmH5Y,26663
|
|
7
|
-
src/client/infrastructure_analyze_mcp_tools.py,sha256=EbpKCOh3P36iClyb2p3qyg5xiJR2EKyHtXxElGGjMgs,30326
|
|
8
|
-
src/client/infrastructure_catalog_mcp_tools.py,sha256=rwokyguCa_5pGDue_aNhobBlNTcvQO99QyXbP__K3uU,31502
|
|
9
|
-
src/client/infrastructure_resources_mcp_tools.py,sha256=TWjUE9PaSPotUuMWzUllbFkBO3b-XbiFo680pq8LirA,30735
|
|
10
|
-
src/client/infrastructure_topology_mcp_tools.py,sha256=_lc9H6JbJO3qOG64jFtfdm6sFfaEsUCEheCMlw1n1kw,15334
|
|
11
|
-
src/client/instana_client_base.py,sha256=Grc8rLq0ZA7pbhczZfH6NNsKS3KAyhVXThDUXkGC5dc,3620
|
|
12
|
-
src/client/log_alert_configuration_mcp_tools.py,sha256=R1v_pEMKCNryHynLovcNh-z4OBmZRIwGxe3x8vg29Jo,13267
|
|
13
|
-
src/client/show the top 5 services with the highest,sha256=lKQ2ULcBtP1K4DxZYrzfySgA-5cTy5Ng0eiDV9raYZM,3433
|
|
14
|
-
src/mcp_server.py,sha256=qFfTTULjxzNk4Ryii3QQK6FivRlX_5wDC3yvtxVYB3I,13497
|
|
15
|
-
mcp_instana-0.1.0.dist-info/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
|
|
16
|
-
mcp_instana-0.1.0.dist-info/METADATA,sha256=UWfRyf5JuMdyIoNEhTUO0y75IzdHX_AmWUuu6nJStxA,25907
|
|
17
|
-
mcp_instana-0.1.0.dist-info/WHEEL,sha256=b4K_helf-jlQoXBBETfwnf4B04YC67LOev0jo4fX5m8,88
|
|
18
|
-
mcp_instana-0.1.0.dist-info/entry_points.txt,sha256=Ct-3wKWErkkx8mXN3_ZmdyUx9qap9hYoWv2dfAAFu00,51
|
|
19
|
-
mcp_instana-0.1.0.dist-info/RECORD,,
|
|
@@ -1,55 +0,0 @@
|
|
|
1
|
-
What is the sum of queue depth for all queues in the cluster with name ABC?
|
|
2
|
-
Show top 3 queues with highest queue depth for last 60 minutes group by queue name.
|
|
3
|
-
Show me the mean of queue depth for all the IBM MQ Queues where the queue name contains QL, grouped by the queue manager name.
|
|
4
|
-
What is the rate of messages in and messages out for queue XYZ running in IBM MQ for the last 1 hour?
|
|
5
|
-
what is the sum of messages sent and received by IBM MQ Queue Manager QQQ for the past 24 hours, grouped by queue name?
|
|
6
|
-
show me queueFullPercentage for queue with queue name XYZ?
|
|
7
|
-
show me percentage that the queue has reached its maximum depth for queue with queue name XYZ?
|
|
8
|
-
Show me the sum of messages received by MQ Queue with queue manager name matching XYZ and queue name matching ABC.
|
|
9
|
-
Show me open Input count of IBM MQ Queues with queue name=XYZ ordered in DESC.
|
|
10
|
-
Show total sum of queueDepth and the average queueFullPercentage for all MQ queues in namespace XYZ group by queue name.
|
|
11
|
-
What is the count of pods for deployments labeled as environment=envABC in the namespace nameXYZ?
|
|
12
|
-
What is the required CPU of deployment ABC running in kubernetes namespace XYZ for the last 30 minutes?
|
|
13
|
-
Show me the available to desired replica ratio of kubernetes deployments with label component my-comp.
|
|
14
|
-
Show top 2 deployments with high required memory in namespace ABC group by deployment.
|
|
15
|
-
Show me the number of available and desired replicas for all deployment with label component=compXYZ.
|
|
16
|
-
Show top 3 deployments with high memory limits in namespace XYZ group by deployment in the last 1 hour.
|
|
17
|
-
what is the sum of aggregated cpu requests for kubernetes deployment APP-1 in namespace NAMESPACE-1 for last 2 hours?
|
|
18
|
-
What is the average available to desired replica ratio for the deployment label service XYZ that runs inside kubernetes namespace ABC over the last 24 hours?
|
|
19
|
-
Show me the average of desired replicas for all deployments with the label "app" set to "my-app".
|
|
20
|
-
Show me the availableToDesiredReplicaRatio of kubernetesDeployment with deployment name=mydeployment and order by availableToDesiredReplicaRatio in descending order.
|
|
21
|
-
What is the average memory limit for pods in the namespace ABC?
|
|
22
|
-
What is the maximum memory limit for all pods with label name=serviceXYZ in kubernetes namespace ABC sorted by memory limit in descending order?
|
|
23
|
-
Show top 5 pods with high cpu requests for container in namespace nameABC group by pod in the last 2 hours.
|
|
24
|
-
Show me the number of restarts of pods with label name XYZ in kubernetes namespace ABC.
|
|
25
|
-
What is the average amount of memory requested by Kubernetes Pods with label name=ABC during the past hour?
|
|
26
|
-
show me the number of containers for pods with label node_name XYZ, group by the pod name.
|
|
27
|
-
In the last 60 minutes, how many times did the kubernetes pod with the label matching app=ABC restart?
|
|
28
|
-
What is the average cpu requests of the pods with label app=appABC group by the node they are running on?
|
|
29
|
-
List cpu requests grouped by kubernetesPods with label app=myApp, order by cpuRequests in descending order, aggregating metrics by cpuRequests by sum.
|
|
30
|
-
Show me the cpuRequests for all kubernetes pods with the label "app" set to "appABC" for the last hour, grouped by pod name in ascending order.
|
|
31
|
-
How many queries were executed on the db2 database named ABC?
|
|
32
|
-
Show total number of failed queries to db2 database with host name ABC.
|
|
33
|
-
Show top 3 databases with high number of queries in namespace XYZ.
|
|
34
|
-
What is the average lock wait time for db2 database with name DB1 in the last hour?
|
|
35
|
-
What is the sum of total request time for all workloads in the db2 database named my-db?
|
|
36
|
-
What is the maximum number of connections to db2 name=mydb?
|
|
37
|
-
What is the total wait time by the db2Database with name=mydb, order by totalWaitTime in descending order, and group by host name on the last 1 hour?
|
|
38
|
-
Show me the average number of rows returned by each database in the last hour.
|
|
39
|
-
Show top 5 databases with highest number of queries in the last 24 hours
|
|
40
|
-
How many rollbacks occurred in the database name XYZ in the last hour?
|
|
41
|
-
Show me the number of runnable threads of JVM running inside appserver container of kubernetes deployment label component my-comp and kubernetes namespace ABC, grouped by the name of kubernetes pod.
|
|
42
|
-
Show me the total number of threads in a blocked state for the last 1 hour.
|
|
43
|
-
What is the average percentage of used memory of the Java application running on kubernetes namespace ABC over the last day.
|
|
44
|
-
How many runnable threads are there in the JVM instance running on the host named ABC?
|
|
45
|
-
what is the average memory usage of jvm running in cluster ABC for each deployment label zone?
|
|
46
|
-
what is the average memory.used for jvm in namespace ABC for last 1 hour, grouped by host name and sorted by memory.used in descending order?
|
|
47
|
-
What is the memory used by the JVM running on host ABC and having process ID 1234?
|
|
48
|
-
Show me the number of runnable threads and the number of waiting threads for all Java applications with tag kubernetes.namespace.name=XYZ value.
|
|
49
|
-
Get the total number of runnable threads, new threads, and threads in timed-waiting for all JVMs running on namespace XYZ.
|
|
50
|
-
Show memory free for jvm runtime platform with tag jvm.version=XYZ.
|
|
51
|
-
|
|
52
|
-
we want to know the memory used and no of blocked threads per metrics available for entity JVM runtime platform for last 1 hour in Instana.
|
|
53
|
-
|
|
54
|
-
We want to see the complete infrastructure topology from Instana in order to know how all monitored entities are connected and get a comprehensive view of infrastructure's relationships and dependencies . can you help us getting the details .
|
|
55
|
-
|
|
@@ -1,93 +0,0 @@
|
|
|
1
|
-
"""
|
|
2
|
-
Base Instana API Client Module
|
|
3
|
-
|
|
4
|
-
This module provides the base client for interacting with the Instana API.
|
|
5
|
-
"""
|
|
6
|
-
|
|
7
|
-
import sys
|
|
8
|
-
import requests
|
|
9
|
-
from typing import Dict, Any, AsyncIterator
|
|
10
|
-
from contextlib import asynccontextmanager
|
|
11
|
-
|
|
12
|
-
# Registry to store all tools
|
|
13
|
-
MCP_TOOLS = {}
|
|
14
|
-
|
|
15
|
-
def register_as_tool(func):
|
|
16
|
-
"""Decorator to register a method as an MCP tool."""
|
|
17
|
-
MCP_TOOLS[func.__name__] = func
|
|
18
|
-
return func
|
|
19
|
-
|
|
20
|
-
class BaseInstanaClient:
|
|
21
|
-
"""Base client for Instana API with common functionality."""
|
|
22
|
-
|
|
23
|
-
def __init__(self, read_token: str, base_url: str):
|
|
24
|
-
self.read_token = read_token
|
|
25
|
-
self.base_url = base_url
|
|
26
|
-
|
|
27
|
-
def get_headers(self):
|
|
28
|
-
"""Get standard headers for Instana API requests."""
|
|
29
|
-
return {
|
|
30
|
-
"Authorization": f"apiToken {self.read_token}",
|
|
31
|
-
"Content-Type": "application/json",
|
|
32
|
-
"Accept": "application/json"
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
async def make_request(self, endpoint: str, params: Dict[str, Any] = None, method: str = "GET", json: Dict[str, Any] = None) -> Dict[str, Any]:
|
|
36
|
-
"""Make a request to the Instana API."""
|
|
37
|
-
url = f"{self.base_url}/{endpoint.lstrip('/')}"
|
|
38
|
-
headers = self.get_headers()
|
|
39
|
-
|
|
40
|
-
try:
|
|
41
|
-
if method.upper() == "GET":
|
|
42
|
-
response = requests.get(url, headers=headers, params=params, verify=False)
|
|
43
|
-
elif method.upper() == "POST":
|
|
44
|
-
# Use the json parameter if provided, otherwise use params
|
|
45
|
-
data_to_send = json if json is not None else params
|
|
46
|
-
response = requests.post(url, headers=headers, json=data_to_send, verify=False)
|
|
47
|
-
elif method.upper() == "PUT":
|
|
48
|
-
data_to_send = json if json is not None else params
|
|
49
|
-
response = requests.put(url, headers=headers, json=data_to_send, verify=False)
|
|
50
|
-
elif method.upper() == "DELETE":
|
|
51
|
-
response = requests.delete(url, headers=headers, params=params, verify=False)
|
|
52
|
-
else:
|
|
53
|
-
return {"error": f"Unsupported HTTP method: {method}"}
|
|
54
|
-
|
|
55
|
-
response.raise_for_status()
|
|
56
|
-
return response.json()
|
|
57
|
-
except requests.exceptions.HTTPError as err:
|
|
58
|
-
print(f"HTTP Error: {err}", file=sys.stderr)
|
|
59
|
-
return {"error": f"HTTP Error: {err}"}
|
|
60
|
-
except requests.exceptions.RequestException as err:
|
|
61
|
-
print(f"Error: {err}", file=sys.stderr)
|
|
62
|
-
return {"error": f"Error: {err}"}
|
|
63
|
-
except Exception as e:
|
|
64
|
-
print(f"Unexpected error: {str(e)}", file=sys.stderr)
|
|
65
|
-
return {"error": f"Unexpected error: {str(e)}"}
|
|
66
|
-
|
|
67
|
-
@asynccontextmanager
|
|
68
|
-
async def instana_api_token(read_token: str, base_url: str) -> AsyncIterator[Dict[str, BaseInstanaClient]]:
|
|
69
|
-
"""
|
|
70
|
-
Context manager for creating and managing Instana API clients.
|
|
71
|
-
Returns a dictionary of client instances for different API groups.
|
|
72
|
-
"""
|
|
73
|
-
# Import here to avoid circular imports
|
|
74
|
-
from .infrastructure_mcp_tools import InfrastructureMCPTools
|
|
75
|
-
from .application_mcp_tools import ApplicationClient
|
|
76
|
-
|
|
77
|
-
# Create the standard clients
|
|
78
|
-
infra_client = InfrastructureMCPTools(read_token=read_token, base_url=base_url)
|
|
79
|
-
app_client = ApplicationClient(read_token=read_token, base_url=base_url)
|
|
80
|
-
|
|
81
|
-
# Initialize clients dictionary
|
|
82
|
-
clients = {
|
|
83
|
-
"infrastructure": infra_client,
|
|
84
|
-
"application": app_client,
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
try:
|
|
88
|
-
yield clients
|
|
89
|
-
except Exception as e:
|
|
90
|
-
print(f"Error in Instana API client: {e}", file=sys.stderr)
|
|
91
|
-
finally:
|
|
92
|
-
# Clean up resources if needed
|
|
93
|
-
pass
|
|
@@ -1,316 +0,0 @@
|
|
|
1
|
-
"""
|
|
2
|
-
Log Alert Configuration MCP Tools Module
|
|
3
|
-
|
|
4
|
-
This module provides log alert configuration-specific MCP tools for Instana monitoring.
|
|
5
|
-
"""
|
|
6
|
-
|
|
7
|
-
import sys
|
|
8
|
-
import traceback
|
|
9
|
-
from typing import Dict, Any, List, Optional
|
|
10
|
-
from datetime import datetime
|
|
11
|
-
|
|
12
|
-
# Import the necessary classes from the SDK
|
|
13
|
-
try:
|
|
14
|
-
from instana_client.api.log_alert_configuration_api import LogAlertConfigurationApi
|
|
15
|
-
from instana_client.api_client import ApiClient
|
|
16
|
-
from instana_client.configuration import Configuration
|
|
17
|
-
from instana_client.models.log_alert_config import LogAlertConfig
|
|
18
|
-
except ImportError as e:
|
|
19
|
-
traceback.print_exc(file=sys.stderr)
|
|
20
|
-
raise
|
|
21
|
-
|
|
22
|
-
from .instana_client_base import BaseInstanaClient, register_as_tool
|
|
23
|
-
|
|
24
|
-
# Helper function for debug printing
|
|
25
|
-
def debug_print(*args, **kwargs):
|
|
26
|
-
"""Print debug information to stderr instead of stdout"""
|
|
27
|
-
print(*args, file=sys.stderr, **kwargs)
|
|
28
|
-
|
|
29
|
-
class LogAlertConfigurationMCPTools(BaseInstanaClient):
|
|
30
|
-
"""Tools for log alert configuration in Instana MCP."""
|
|
31
|
-
|
|
32
|
-
def __init__(self, read_token: str, base_url: str):
|
|
33
|
-
"""Initialize the Log Alert Configuration MCP tools client."""
|
|
34
|
-
super().__init__(read_token=read_token, base_url=base_url)
|
|
35
|
-
|
|
36
|
-
try:
|
|
37
|
-
debug_print(f"Initializing LogAlertConfigurationMCPTools with base_url={base_url}")
|
|
38
|
-
|
|
39
|
-
# Configure the API client with the correct base URL and authentication
|
|
40
|
-
configuration = Configuration()
|
|
41
|
-
configuration.host = base_url
|
|
42
|
-
configuration.api_key['ApiKeyAuth'] = read_token
|
|
43
|
-
configuration.api_key_prefix['ApiKeyAuth'] = 'apiToken'
|
|
44
|
-
|
|
45
|
-
# Create an API client with this configuration
|
|
46
|
-
api_client = ApiClient(configuration=configuration)
|
|
47
|
-
|
|
48
|
-
# Initialize the Instana SDK's LogAlertConfigurationApi with our configured client
|
|
49
|
-
self.log_alert_api = LogAlertConfigurationApi(api_client=api_client)
|
|
50
|
-
debug_print(f"Initialized LogAlertConfigurationApi with host: {configuration.host}")
|
|
51
|
-
except Exception as e:
|
|
52
|
-
debug_print(f"Error initializing LogAlertConfigurationApi: {e}")
|
|
53
|
-
traceback.print_exc(file=sys.stderr)
|
|
54
|
-
raise
|
|
55
|
-
|
|
56
|
-
@register_as_tool
|
|
57
|
-
async def create_log_alert_config(self, config: Dict[str, Any], ctx=None) -> Dict[str, Any]:
|
|
58
|
-
"""
|
|
59
|
-
Create a new log alert configuration.
|
|
60
|
-
|
|
61
|
-
Args:
|
|
62
|
-
config: Dictionary containing the log alert configuration
|
|
63
|
-
Required fields:
|
|
64
|
-
- name: Name of the alert
|
|
65
|
-
- query: Log query string
|
|
66
|
-
- threshold: Threshold value for the alert
|
|
67
|
-
- timeThreshold: Time threshold in milliseconds
|
|
68
|
-
- rule: Rule configuration
|
|
69
|
-
ctx: The MCP context (optional)
|
|
70
|
-
|
|
71
|
-
Returns:
|
|
72
|
-
Dictionary containing the created log alert configuration or error information
|
|
73
|
-
"""
|
|
74
|
-
try:
|
|
75
|
-
debug_print(f"create_log_alert_config called with config={config}")
|
|
76
|
-
|
|
77
|
-
# Convert dictionary to LogAlertConfig model
|
|
78
|
-
log_alert_config = LogAlertConfig(**config)
|
|
79
|
-
|
|
80
|
-
# Call the API
|
|
81
|
-
result = self.log_alert_api.create_log_alert_config(log_alert_config=log_alert_config)
|
|
82
|
-
|
|
83
|
-
debug_print(f"Result from create_log_alert_config: {result}")
|
|
84
|
-
return self._convert_to_dict(result)
|
|
85
|
-
except Exception as e:
|
|
86
|
-
debug_print(f"Error in create_log_alert_config: {e}")
|
|
87
|
-
import traceback
|
|
88
|
-
traceback.print_exc(file=sys.stderr)
|
|
89
|
-
return {"error": f"Failed to create log alert configuration: {str(e)}"}
|
|
90
|
-
|
|
91
|
-
@register_as_tool
|
|
92
|
-
async def delete_log_alert_config(self, id: str, ctx=None) -> Dict[str, Any]:
|
|
93
|
-
"""
|
|
94
|
-
Delete a log alert configuration.
|
|
95
|
-
|
|
96
|
-
Args:
|
|
97
|
-
id: ID of the log alert configuration to delete
|
|
98
|
-
ctx: The MCP context (optional)
|
|
99
|
-
|
|
100
|
-
Returns:
|
|
101
|
-
Dictionary containing the result of the deletion operation or error information
|
|
102
|
-
"""
|
|
103
|
-
try:
|
|
104
|
-
debug_print(f"delete_log_alert_config called with id={id}")
|
|
105
|
-
|
|
106
|
-
self.log_alert_api.delete_log_alert_config(id=id)
|
|
107
|
-
|
|
108
|
-
debug_print(f"Successfully deleted log alert configuration with ID {id}")
|
|
109
|
-
return {"success": True, "message": f"Log alert configuration with ID {id} deleted successfully"}
|
|
110
|
-
except Exception as e:
|
|
111
|
-
debug_print(f"Error in delete_log_alert_config: {e}")
|
|
112
|
-
import traceback
|
|
113
|
-
traceback.print_exc(file=sys.stderr)
|
|
114
|
-
return {"error": f"Failed to delete log alert configuration: {str(e)}"}
|
|
115
|
-
|
|
116
|
-
@register_as_tool
|
|
117
|
-
async def disable_log_alert_config(self, id: str, ctx=None) -> Dict[str, Any]:
|
|
118
|
-
"""
|
|
119
|
-
Disable a log alert configuration.
|
|
120
|
-
|
|
121
|
-
Args:
|
|
122
|
-
id: ID of the log alert configuration to disable
|
|
123
|
-
ctx: The MCP context (optional)
|
|
124
|
-
|
|
125
|
-
Returns:
|
|
126
|
-
Dictionary containing the result of the disable operation or error information
|
|
127
|
-
"""
|
|
128
|
-
try:
|
|
129
|
-
debug_print(f"disable_log_alert_config called with id={id}")
|
|
130
|
-
|
|
131
|
-
self.log_alert_api.disable_log_alert_config(id=id)
|
|
132
|
-
|
|
133
|
-
debug_print(f"Successfully disabled log alert configuration with ID {id}")
|
|
134
|
-
return {"success": True, "message": f"Log alert configuration with ID {id} disabled successfully"}
|
|
135
|
-
except Exception as e:
|
|
136
|
-
debug_print(f"Error in disable_log_alert_config: {e}")
|
|
137
|
-
import traceback
|
|
138
|
-
traceback.print_exc(file=sys.stderr)
|
|
139
|
-
return {"error": f"Failed to disable log alert configuration: {str(e)}"}
|
|
140
|
-
|
|
141
|
-
@register_as_tool
|
|
142
|
-
async def enable_log_alert_config(self, id: str, ctx=None) -> Dict[str, Any]:
|
|
143
|
-
"""
|
|
144
|
-
Enable a log alert configuration.
|
|
145
|
-
|
|
146
|
-
Args:
|
|
147
|
-
id: ID of the log alert configuration to enable
|
|
148
|
-
ctx: The MCP context (optional)
|
|
149
|
-
|
|
150
|
-
Returns:
|
|
151
|
-
Dictionary containing the result of the enable operation or error information
|
|
152
|
-
"""
|
|
153
|
-
try:
|
|
154
|
-
debug_print(f"enable_log_alert_config called with id={id}")
|
|
155
|
-
|
|
156
|
-
self.log_alert_api.enable_log_alert_config(id=id)
|
|
157
|
-
|
|
158
|
-
debug_print(f"Successfully enabled log alert configuration with ID {id}")
|
|
159
|
-
return {"success": True, "message": f"Log alert configuration with ID {id} enabled successfully"}
|
|
160
|
-
except Exception as e:
|
|
161
|
-
debug_print(f"Error in enable_log_alert_config: {e}")
|
|
162
|
-
import traceback
|
|
163
|
-
traceback.print_exc(file=sys.stderr)
|
|
164
|
-
return {"error": f"Failed to enable log alert configuration: {str(e)}"}
|
|
165
|
-
|
|
166
|
-
@register_as_tool
|
|
167
|
-
async def find_active_log_alert_configs(self, alert_ids: Optional[List[str]] = None, ctx=None) -> Dict[str, Any]:
|
|
168
|
-
"""
|
|
169
|
-
Get all active log alert configurations.
|
|
170
|
-
|
|
171
|
-
Args:
|
|
172
|
-
alert_ids: Optional list of alert IDs to filter by
|
|
173
|
-
ctx: The MCP context (optional)
|
|
174
|
-
|
|
175
|
-
Returns:
|
|
176
|
-
Dictionary containing active log alert configurations or error information
|
|
177
|
-
"""
|
|
178
|
-
try:
|
|
179
|
-
debug_print(f"find_active_log_alert_configs called with alert_ids={alert_ids}")
|
|
180
|
-
|
|
181
|
-
result = self.log_alert_api.find_active_log_alert_configs(alert_ids=alert_ids)
|
|
182
|
-
|
|
183
|
-
debug_print(f"Result from find_active_log_alert_configs: {result}")
|
|
184
|
-
return {"configs": [self._convert_to_dict(config) for config in result]}
|
|
185
|
-
except Exception as e:
|
|
186
|
-
debug_print(f"Error in find_active_log_alert_configs: {e}")
|
|
187
|
-
import traceback
|
|
188
|
-
traceback.print_exc(file=sys.stderr)
|
|
189
|
-
return {"error": f"Failed to find active log alert configurations: {str(e)}"}
|
|
190
|
-
|
|
191
|
-
@register_as_tool
|
|
192
|
-
async def find_log_alert_config(self, id: str, valid_on: Optional[int] = None, ctx=None) -> Dict[str, Any]:
|
|
193
|
-
"""
|
|
194
|
-
Get a specific log alert configuration by ID.
|
|
195
|
-
|
|
196
|
-
Args:
|
|
197
|
-
id: ID of the log alert configuration to retrieve
|
|
198
|
-
valid_on: Optional timestamp to get the configuration valid at that time
|
|
199
|
-
ctx: The MCP context (optional)
|
|
200
|
-
|
|
201
|
-
Returns:
|
|
202
|
-
Dictionary containing the log alert configuration or error information
|
|
203
|
-
"""
|
|
204
|
-
try:
|
|
205
|
-
debug_print(f"find_log_alert_config called with id={id}, valid_on={valid_on}")
|
|
206
|
-
|
|
207
|
-
result = self.log_alert_api.find_log_alert_config(id=id, valid_on=valid_on)
|
|
208
|
-
|
|
209
|
-
debug_print(f"Result from find_log_alert_config: {result}")
|
|
210
|
-
return self._convert_to_dict(result)
|
|
211
|
-
except Exception as e:
|
|
212
|
-
debug_print(f"Error in find_log_alert_config: {e}")
|
|
213
|
-
import traceback
|
|
214
|
-
traceback.print_exc(file=sys.stderr)
|
|
215
|
-
return {"error": f"Failed to find log alert configuration: {str(e)}"}
|
|
216
|
-
|
|
217
|
-
@register_as_tool
|
|
218
|
-
async def find_log_alert_config_versions(self, id: str, ctx=None) -> Dict[str, Any]:
|
|
219
|
-
"""
|
|
220
|
-
Get all versions of a log alert configuration.
|
|
221
|
-
|
|
222
|
-
Args:
|
|
223
|
-
id: ID of the log alert configuration to get versions for
|
|
224
|
-
ctx: The MCP context (optional)
|
|
225
|
-
|
|
226
|
-
Returns:
|
|
227
|
-
Dictionary containing versions of the log alert configuration or error information
|
|
228
|
-
"""
|
|
229
|
-
try:
|
|
230
|
-
debug_print(f"find_log_alert_config_versions called with id={id}")
|
|
231
|
-
|
|
232
|
-
result = self.log_alert_api.find_log_alert_config_versions(id=id)
|
|
233
|
-
|
|
234
|
-
debug_print(f"Result from find_log_alert_config_versions: {result}")
|
|
235
|
-
return {"versions": [self._convert_to_dict(version) for version in result]}
|
|
236
|
-
except Exception as e:
|
|
237
|
-
debug_print(f"Error in find_log_alert_config_versions: {e}")
|
|
238
|
-
import traceback
|
|
239
|
-
traceback.print_exc(file=sys.stderr)
|
|
240
|
-
return {"error": f"Failed to find log alert configuration versions: {str(e)}"}
|
|
241
|
-
|
|
242
|
-
@register_as_tool
|
|
243
|
-
async def restore_log_alert_config(self, id: str, created: int, ctx=None) -> Dict[str, Any]:
|
|
244
|
-
"""
|
|
245
|
-
Restore a log alert configuration to a previous version.
|
|
246
|
-
|
|
247
|
-
Args:
|
|
248
|
-
id: ID of the log alert configuration to restore
|
|
249
|
-
created: Timestamp of the version to restore
|
|
250
|
-
ctx: The MCP context (optional)
|
|
251
|
-
|
|
252
|
-
Returns:
|
|
253
|
-
Dictionary containing the result of the restore operation or error information
|
|
254
|
-
"""
|
|
255
|
-
try:
|
|
256
|
-
debug_print(f"restore_log_alert_config called with id={id}, created={created}")
|
|
257
|
-
|
|
258
|
-
self.log_alert_api.restore_log_alert_config(id=id, created=created)
|
|
259
|
-
|
|
260
|
-
debug_print(f"Successfully restored log alert configuration with ID {id}")
|
|
261
|
-
return {
|
|
262
|
-
"success": True,
|
|
263
|
-
"message": f"Log alert configuration with ID {id} restored to version from {datetime.fromtimestamp(created/1000).isoformat()}"
|
|
264
|
-
}
|
|
265
|
-
except Exception as e:
|
|
266
|
-
debug_print(f"Error in restore_log_alert_config: {e}")
|
|
267
|
-
import traceback
|
|
268
|
-
traceback.print_exc(file=sys.stderr)
|
|
269
|
-
return {"error": f"Failed to restore log alert configuration: {str(e)}"}
|
|
270
|
-
|
|
271
|
-
@register_as_tool
|
|
272
|
-
async def update_log_alert_config(self, id: str, config: Dict[str, Any], ctx=None) -> Dict[str, Any]:
|
|
273
|
-
"""
|
|
274
|
-
Update a log alert configuration.
|
|
275
|
-
|
|
276
|
-
Args:
|
|
277
|
-
id: ID of the log alert configuration to update
|
|
278
|
-
config: Dictionary containing the updated log alert configuration
|
|
279
|
-
ctx: The MCP context (optional)
|
|
280
|
-
|
|
281
|
-
Returns:
|
|
282
|
-
Dictionary containing the updated log alert configuration or error information
|
|
283
|
-
"""
|
|
284
|
-
try:
|
|
285
|
-
debug_print(f"update_log_alert_config called with id={id}, config={config}")
|
|
286
|
-
|
|
287
|
-
# Convert dictionary to LogAlertConfig model
|
|
288
|
-
log_alert_config = LogAlertConfig(**config)
|
|
289
|
-
|
|
290
|
-
# Call the API
|
|
291
|
-
result = self.log_alert_api.update_log_alert_config(id=id, log_alert_config=log_alert_config)
|
|
292
|
-
|
|
293
|
-
debug_print(f"Result from update_log_alert_config: {result}")
|
|
294
|
-
return self._convert_to_dict(result)
|
|
295
|
-
except Exception as e:
|
|
296
|
-
debug_print(f"Error in update_log_alert_config: {e}")
|
|
297
|
-
import traceback
|
|
298
|
-
traceback.print_exc(file=sys.stderr)
|
|
299
|
-
return {"error": f"Failed to update log alert configuration: {str(e)}"}
|
|
300
|
-
|
|
301
|
-
def _convert_to_dict(self, obj: Any) -> Dict[str, Any]:
|
|
302
|
-
"""
|
|
303
|
-
Convert an object to a dictionary.
|
|
304
|
-
|
|
305
|
-
Args:
|
|
306
|
-
obj: Object to convert
|
|
307
|
-
|
|
308
|
-
Returns:
|
|
309
|
-
Dictionary representation of the object
|
|
310
|
-
"""
|
|
311
|
-
if hasattr(obj, "to_dict"):
|
|
312
|
-
return obj.to_dict()
|
|
313
|
-
elif hasattr(obj, "__dict__"):
|
|
314
|
-
return obj.__dict__
|
|
315
|
-
else:
|
|
316
|
-
return obj
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
show the top 5 services with the highest number of calls to cassandra cluster ABC_CLUST
|
|
2
|
-
What is the total latency in milliseconds for HTTP calls from the service named MyService to the host named myhost in the last hour?
|
|
3
|
-
What is the sum of latency in the last 1 hour for database calls from the service named MyService to the host named myhost sorted by latency in descending order?
|
|
4
|
-
Show me the average response time of HTTP requests to the APPXYZ application in the last 10 minutes, group result by call name, and order result by average response time in ascending order.
|
|
5
|
-
show the average latency of all HTTP calls from service XYZ
|
|
6
|
-
show the average latency of HTTP calls from service XYZ to service ABC, grouped by the call name
|
|
7
|
-
What is the rate of calls in the last 5 minutes for HTTP calls from the service named MyService to the host named myhost grouped by destination host?
|
|
8
|
-
show the average latency of HTTP calls to the service named 'my_service'
|
|
9
|
-
show the average latency for all HTTP calls from service XYZ to service ABC
|
|
10
|
-
show the number of calls and errors from service XYZ to service ABC, grouped by the destination server
|
|
11
|
-
What is the number of calls in the last 2 hours for HTTP calls from the service named MyService to the host named myhost grouped by the call type and sorted by the number of calls in descending order?
|
|
12
|
-
Show me the total number of calls, errors, and the response time for HTTP calls from the APPXYZ application in the last 2 hours, group result by call name, and order result by response time in ascending order.
|
|
13
|
-
show the mean latency and number of calls from service XYZ to service ABC, grouped by the HTTP method
|
|
14
|
-
What is the rate of errors per minute for database calls from the service named MyService to the host named myhost in the last hour?
|
|
15
|
-
show the number of errors from service XYZ to service ABC, grouped by the HTTP method and ordered by errors
|
|
16
|
-
What is the max latency in the last 1 hour for database calls to the host named myhost of the service named MyService?
|
|
17
|
-
What are the sum of errors for HTTP calls from the service named MyService to the service named MyOtherService in the last 5 minutes?
|
|
18
|
-
What is the average latency in the last 1 hour for database calls to the host named myhost of the service named MyService, ordered by the latency in descending order?
|
|
19
|
-
Show me the number of failed HTTP requests between applications appXYZ and appABC in the last hour, group result by error messages, and order result by number of errors in descending order.
|
|
20
|
-
How many HTTP calls were made by the service named MyService to the host named myhost in the last 2 hours?
|
|
21
|
-
What is the average response time of PCFindInventoryIVSyncService calls handled by apiserver service of oms-pcity-prod-1 application?
|
|
22
|
-
Show top erroneous calls handled by 'Robot Shop - EP' application since yesterday
|
|
23
|
-
Show performance overview of all http calls in the past 2 hours group by call name
|
|
24
|
-
What is the average response time of promo HTTP calls handled by Kubernetes cluster demo-us-cluster?
|
|
25
|
-
What is the average response time of readiness calls, handled by service app of application zone in last 1 day?
|
|
26
|
-
Show count of erroneous HTTP calls by call.tag.Errorcode handled by AdService application.
|
|
27
|
-
Show top erroneous calls handled by AdService service since last 10 minutes.
|
|
28
|
-
Show performance overview of outbound http calls from kubernetes cluster kub8-names to AC-test1 application order by calls
|