Dashboards
Dashboards let you save and organize views of your infrastructure for quick access and sharing.
Overview
Dashboards provide:
- Saved queries - Store frequently used MQL queries
- Custom views - Organize information relevant to your workflow
- Team sharing - Share dashboards with colleagues
- Quick access - One-click access to important metrics
Creating Dashboards
Via UI
- Navigate to Dashboards in the Inventory menu
- Click Create Dashboard
- Enter a name and optional description
- Add panels with queries or visualizations
Dashboard Structure
Dashboard: Production Overview
├── Panel: Resource Summary
│ └── Query: SELECT type, COUNT(*) ...
├── Panel: Recent Changes
│ └── Query: SELECT * FROM transactions ...
└── Panel: Untagged Resources
└── Query: SELECT * FROM instances WHERE tags IS NULL
Panel Types
Query Panel
Display results of an MQL query:
SELECT r.type, count(*) as count
FROM resources r
GROUP BY r.type
ORDER BY r.type
LIMIT 10
Summary Panel
Show aggregate metrics:
- Total resources
- Resources by workspace
- Change counts
Graph Panel
Embed dependency graph views:
- Filtered by type or module
- Focused on specific resources
Example Dashboards
Infrastructure Overview
┌─────────────────────────────────────────────────────────┐
│ Infrastructure Overview │
├─────────────────────────────┬───────────────────────────┤
│ Total Resources: 1,234 │ States: 15 │
│ Workspaces: 3 │ Last Update: 2 min ago │
├─────────────────────────────┴───────────────────────────┤
│ Resources by Type │
│ ┌────────────────────────────────────────────────────┐ │
│ │ aws_instance ████████████████████ 234 │ │
│ │ aws_security_group ██████████████ 156 │ │
│ │ aws_iam_role ████████████ 123 │ │
│ │ aws_s3_bucket █████████ 89 │ │
│ └────────────────────────────────────────────────────┘ │
├─────────────────────────────────────────────────────────┤
│ Recent Changes │
│ • 10:30 - user@company.com - networking/prod │
│ • 10:15 - ci@company.com - kubernetes/staging │
│ • 09:45 - user@company.com - database/prod │
└─────────────────────────────────────────────────────────┘
Security Dashboard
┌─────────────────────────────────────────────────────────┐
│ Security Dashboard │
├─────────────────────────────────────────────────────────┤
│ Query: Security Groups with Open Access │
│ SELECT address, attributes->>'name' │
│ FROM instances │
│ WHERE type = 'aws_security_group' │
│ AND attributes::text LIKE '%0.0.0.0/0%' │
├─────────────────────────────────────────────────────────┤
│ Query: IAM Roles with Admin Access │
│ SELECT address, attributes->>'name' │
│ FROM instances │
│ WHERE type = 'aws_iam_role' │
│ AND attributes::text LIKE '%AdministratorAccess%' │
├─────────────────────────────────────────────────────────┤
│ Query: Public S3 Buckets │
│ SELECT address FROM instances │
│ WHERE type = 'aws_s3_bucket_public_access_block' │
│ AND attributes->>'block_public_acls' = 'false' │
└─────────────────────────────────────────────────────────┘
Cost Analysis Dashboard
┌─────────────────────────────────────────────────────────┐
│ Cost Analysis │
├─────────────────────────────────────────────────────────┤
│ EC2 Instance Types │
│ SELECT attributes->>'instance_type' as type, │
│ COUNT(*) as count │
│ FROM instances │
│ WHERE type = 'aws_instance' │
│ GROUP BY attributes->>'instance_type' │
├─────────────────────────────────────────────────────────┤
│ RDS Instance Classes │
│ SELECT attributes->>'instance_class' as class, │
│ COUNT(*) as count │
│ FROM instances │
│ WHERE type = 'aws_db_instance' │
│ GROUP BY attributes->>'instance_class' │
└─────────────────────────────────────────────────────────┘
Useful Queries
Resource Inventory
-- All resources by type
SELECT r.type, count(*) as count
FROM resources r
GROUP BY r.type
ORDER BY r.type
-- Resources by workspace
SELECT s.workspace, count(*) as resources
FROM instances i
JOIN states s ON i.state_id = s.id
GROUP BY s.workspace
ORDER BY s.workspace
Compliance
-- Resources without tags
SELECT address, type
FROM instances
WHERE type LIKE 'aws_%'
AND (attributes->'tags' IS NULL
OR attributes->>'tags' = '{}')
-- Resources missing required tag
SELECT address, type
FROM instances
WHERE type LIKE 'aws_%'
AND attributes->'tags'->>'Environment' IS NULL
Security
-- Security groups with broad ingress
SELECT address, attributes->>'name' as name
FROM instances
WHERE type = 'aws_security_group'
AND attributes::text LIKE '%0.0.0.0/0%'
-- IAM users (should be minimized)
SELECT address
FROM instances
WHERE type = 'aws_iam_user'
Change Tracking
-- States changed recently (via transaction data)
SELECT name, workspace, created_at
FROM states
ORDER BY created_at DESC
LIMIT 10
Sharing Dashboards
URL Sharing
Each dashboard has a unique URL that can be shared with team members who have access to Stategraph.
Export
Export dashboard configuration for backup or sharing:
- Open dashboard settings
- Click Export
- Save the JSON configuration
Import
Import a dashboard from JSON:
- Navigate to Dashboards
- Click Import
- Paste or upload the JSON configuration
Best Practices
- Name clearly - Use descriptive names that indicate purpose
- Group related queries - Keep related information together
- Add descriptions - Document what each panel shows
- Use time filters - Add date ranges where relevant
- Review regularly - Update dashboards as infrastructure evolves
Tips
Query Performance
- Use LIMIT for large result sets
- Filter early in queries
- Avoid SELECT * when possible
Organization
- Create dashboards per team or function
- Separate operational and security dashboards
- Archive outdated dashboards
Maintenance
- Review queries after major changes
- Update dashboards when adding new resource types
- Remove obsolete panels
Next Steps
- Query Language - MQL syntax
- API Reference - Programmatic access
- Insights - Analysis tools