mirror of
https://github.com/simstudioai/sim.git
synced 2026-09-24 15:45:35 +08:00
feat(grafana): validate integration and add folder, health, and contact-point tools (#5082)
* feat(grafana): validate integration and add folder, health, and contact-point tools - Require alert-rule title/ruleGroup/data in the block (create would 400 without them) - Trim UID path params across dashboard and alert-rule tools to avoid copy-paste 404s - Use Grafana brand color for the block background - Surface previously-unsettable list params (limit, starred, annotation type) - Add get/update/delete folder, check data source health, get health, and create contact point tools - Strip non-TSDoc comments; regenerate docs and integrations.json * fix(grafana): scope block param remaps per operation to prevent cross-operation leaks
This commit is contained in:
@@ -2936,12 +2936,11 @@ export function ClickHouseIcon(props: SVGProps<SVGSVGElement>) {
|
||||
|
||||
export function MicrosoftIcon(props: SVGProps<SVGSVGElement>) {
|
||||
return (
|
||||
<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 23 23' {...props}>
|
||||
<path fill='#f3f3f3' d='M0 0h23v23H0z' />
|
||||
<path fill='#f35325' d='M1 1h10v10H1z' />
|
||||
<path fill='#81bc06' d='M12 1h10v10H12z' />
|
||||
<path fill='#05a6f0' d='M1 12h10v10H1z' />
|
||||
<path fill='#ffba08' d='M12 12h10v10H12z' />
|
||||
<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 109 109' {...props}>
|
||||
<polygon fill='#F1511B' points='51.9,51.9 0,51.9 0,0 51.9,0' />
|
||||
<polygon fill='#80CC28' points='109.3,51.9 57.3,51.9 57.3,0 109.3,0' />
|
||||
<polygon fill='#00ADEF' points='51.9,109.3 0,109.3 0,57.4 51.9,57.4' />
|
||||
<polygon fill='#FBBC09' points='109.3,109.3 57.3,109.3 57.3,57.4 109.3,57.4' />
|
||||
</svg>
|
||||
)
|
||||
}
|
||||
|
||||
@@ -7,7 +7,7 @@ import { BlockInfoCard } from "@/components/ui/block-info-card"
|
||||
|
||||
<BlockInfoCard
|
||||
type="grafana"
|
||||
color="#FFFFFF"
|
||||
color="#F46800"
|
||||
/>
|
||||
|
||||
{/* MANUAL-CONTENT-START:intro */}
|
||||
@@ -401,6 +401,34 @@ List all alert notification contact points
|
||||
| ↳ `disableResolveMessage` | boolean | Whether resolve messages are disabled |
|
||||
| ↳ `provenance` | string | Provisioning source \(empty if API-managed\) |
|
||||
|
||||
### `grafana_create_contact_point`
|
||||
|
||||
Create a notification contact point (e.g., Slack, email, PagerDuty)
|
||||
|
||||
#### Input
|
||||
|
||||
| Parameter | Type | Required | Description |
|
||||
| --------- | ---- | -------- | ----------- |
|
||||
| `apiKey` | string | Yes | Grafana Service Account Token |
|
||||
| `baseUrl` | string | Yes | Grafana instance URL \(e.g., https://your-grafana.com\) |
|
||||
| `organizationId` | string | No | Organization ID for multi-org Grafana instances \(e.g., 1, 2\) |
|
||||
| `name` | string | Yes | Name of the contact point \(groups receivers shown in the UI\) |
|
||||
| `type` | string | Yes | Receiver type \(e.g., slack, email, pagerduty, webhook\) |
|
||||
| `settings` | string | Yes | JSON object of type-specific settings \(e.g., \{"addresses":"a@b.com"\} for email, \{"url":"..."\} for slack\) |
|
||||
| `disableResolveMessage` | boolean | No | Do not send a notification when the alert resolves |
|
||||
| `disableProvenance` | boolean | No | Set X-Disable-Provenance header so the contact point remains editable in the UI |
|
||||
|
||||
#### Output
|
||||
|
||||
| Parameter | Type | Description |
|
||||
| --------- | ---- | ----------- |
|
||||
| `uid` | string | UID of the created contact point |
|
||||
| `name` | string | Name of the contact point |
|
||||
| `type` | string | Receiver type |
|
||||
| `settings` | json | Type-specific settings |
|
||||
| `disableResolveMessage` | boolean | Whether resolve notifications are suppressed |
|
||||
| `provenance` | string | Provisioning source \(empty if API-managed\) |
|
||||
|
||||
### `grafana_create_annotation`
|
||||
|
||||
Create an annotation on a dashboard or as a global annotation
|
||||
@@ -584,6 +612,26 @@ Get a data source by its ID or UID
|
||||
| `version` | number | Data source version |
|
||||
| `readOnly` | boolean | Whether the data source is read-only |
|
||||
|
||||
### `grafana_check_data_source_health`
|
||||
|
||||
Test connectivity to a data source by its UID
|
||||
|
||||
#### Input
|
||||
|
||||
| Parameter | Type | Required | Description |
|
||||
| --------- | ---- | -------- | ----------- |
|
||||
| `apiKey` | string | Yes | Grafana Service Account Token |
|
||||
| `baseUrl` | string | Yes | Grafana instance URL \(e.g., https://your-grafana.com\) |
|
||||
| `organizationId` | string | No | Organization ID for multi-org Grafana instances \(e.g., 1, 2\) |
|
||||
| `dataSourceUid` | string | Yes | The UID of the data source to health-check \(e.g., P1234AB5678\) |
|
||||
|
||||
#### Output
|
||||
|
||||
| Parameter | Type | Description |
|
||||
| --------- | ---- | ----------- |
|
||||
| `status` | string | Health status of the data source \(e.g., OK\) |
|
||||
| `message` | string | Detailed health message from the data source |
|
||||
|
||||
### `grafana_list_folders`
|
||||
|
||||
List all folders in Grafana
|
||||
@@ -655,4 +703,112 @@ Create a new folder in Grafana
|
||||
| `updated` | string | Timestamp when the folder was last updated |
|
||||
| `version` | number | Version number of the folder |
|
||||
|
||||
### `grafana_get_folder`
|
||||
|
||||
Get a folder by its UID
|
||||
|
||||
#### Input
|
||||
|
||||
| Parameter | Type | Required | Description |
|
||||
| --------- | ---- | -------- | ----------- |
|
||||
| `apiKey` | string | Yes | Grafana Service Account Token |
|
||||
| `baseUrl` | string | Yes | Grafana instance URL \(e.g., https://your-grafana.com\) |
|
||||
| `organizationId` | string | No | Organization ID for multi-org Grafana instances \(e.g., 1, 2\) |
|
||||
| `folderUid` | string | Yes | The UID of the folder to retrieve \(e.g., folder-abc123\) |
|
||||
|
||||
#### Output
|
||||
|
||||
| Parameter | Type | Description |
|
||||
| --------- | ---- | ----------- |
|
||||
| `id` | number | The numeric ID of the folder |
|
||||
| `uid` | string | The UID of the folder |
|
||||
| `title` | string | The title of the folder |
|
||||
| `url` | string | The URL path to the folder |
|
||||
| `parentUid` | string | Parent folder UID \(nested folders only\) |
|
||||
| `parents` | array | Ancestor folder hierarchy \(nested folders only\) |
|
||||
| `hasAcl` | boolean | Whether the folder has custom ACL permissions |
|
||||
| `canSave` | boolean | Whether the current user can save the folder |
|
||||
| `canEdit` | boolean | Whether the current user can edit the folder |
|
||||
| `canAdmin` | boolean | Whether the current user has admin rights on the folder |
|
||||
| `createdBy` | string | Username of who created the folder |
|
||||
| `created` | string | Timestamp when the folder was created |
|
||||
| `updatedBy` | string | Username of who last updated the folder |
|
||||
| `updated` | string | Timestamp when the folder was last updated |
|
||||
| `version` | number | Version number of the folder |
|
||||
|
||||
### `grafana_update_folder`
|
||||
|
||||
Update (rename) a folder. Fetches the current folder and merges your changes.
|
||||
|
||||
#### Input
|
||||
|
||||
| Parameter | Type | Required | Description |
|
||||
| --------- | ---- | -------- | ----------- |
|
||||
| `apiKey` | string | Yes | Grafana Service Account Token |
|
||||
| `baseUrl` | string | Yes | Grafana instance URL \(e.g., https://your-grafana.com\) |
|
||||
| `organizationId` | string | No | Organization ID for multi-org Grafana instances \(e.g., 1, 2\) |
|
||||
| `folderUid` | string | Yes | The UID of the folder to update \(e.g., folder-abc123\) |
|
||||
| `title` | string | Yes | New title for the folder |
|
||||
|
||||
#### Output
|
||||
|
||||
| Parameter | Type | Description |
|
||||
| --------- | ---- | ----------- |
|
||||
| `id` | number | The numeric ID of the folder |
|
||||
| `uid` | string | The UID of the folder |
|
||||
| `title` | string | The updated title of the folder |
|
||||
| `url` | string | The URL path to the folder |
|
||||
| `parentUid` | string | Parent folder UID \(nested folders only\) |
|
||||
| `parents` | array | Ancestor folder hierarchy \(nested folders only\) |
|
||||
| `hasAcl` | boolean | Whether the folder has custom ACL permissions |
|
||||
| `canSave` | boolean | Whether the current user can save the folder |
|
||||
| `canEdit` | boolean | Whether the current user can edit the folder |
|
||||
| `canAdmin` | boolean | Whether the current user has admin rights on the folder |
|
||||
| `createdBy` | string | Username of who created the folder |
|
||||
| `created` | string | Timestamp when the folder was created |
|
||||
| `updatedBy` | string | Username of who last updated the folder |
|
||||
| `updated` | string | Timestamp when the folder was last updated |
|
||||
| `version` | number | Version number of the folder |
|
||||
|
||||
### `grafana_delete_folder`
|
||||
|
||||
Delete a folder by its UID
|
||||
|
||||
#### Input
|
||||
|
||||
| Parameter | Type | Required | Description |
|
||||
| --------- | ---- | -------- | ----------- |
|
||||
| `apiKey` | string | Yes | Grafana Service Account Token |
|
||||
| `baseUrl` | string | Yes | Grafana instance URL \(e.g., https://your-grafana.com\) |
|
||||
| `organizationId` | string | No | Organization ID for multi-org Grafana instances \(e.g., 1, 2\) |
|
||||
| `folderUid` | string | Yes | The UID of the folder to delete \(e.g., folder-abc123\) |
|
||||
| `forceDeleteRules` | boolean | No | Delete any alert rules stored in the folder along with it \(default false\) |
|
||||
|
||||
#### Output
|
||||
|
||||
| Parameter | Type | Description |
|
||||
| --------- | ---- | ----------- |
|
||||
| `uid` | string | The UID of the deleted folder |
|
||||
| `message` | string | Confirmation message |
|
||||
|
||||
### `grafana_get_health`
|
||||
|
||||
Check the health of the Grafana instance (version, database status)
|
||||
|
||||
#### Input
|
||||
|
||||
| Parameter | Type | Required | Description |
|
||||
| --------- | ---- | -------- | ----------- |
|
||||
| `apiKey` | string | Yes | Grafana Service Account Token |
|
||||
| `baseUrl` | string | Yes | Grafana instance URL \(e.g., https://your-grafana.com\) |
|
||||
| `organizationId` | string | No | Organization ID for multi-org Grafana instances \(e.g., 1, 2\) |
|
||||
|
||||
#### Output
|
||||
|
||||
| Parameter | Type | Description |
|
||||
| --------- | ---- | ----------- |
|
||||
| `commit` | string | Git commit hash of the running Grafana build |
|
||||
| `database` | string | Database health status \(e.g., ok\) |
|
||||
| `version` | string | Grafana version |
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user