Skip to content

Commit fa81056

Browse files
authored
⭐️ add documentation for cnquery (#6412)
* ⭐️ add documentation for cnquery * 🧹 update spellcheck
1 parent 65e0469 commit fa81056

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

57 files changed

+5188
-5
lines changed

.github/actions/spelling/expect.txt

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ Clusterwide
2222
cmek
2323
cpe
2424
cryptokey
25+
cyclonedx
2526
CUSTOMERID
2627
customresources
2728
datapath
@@ -37,6 +38,8 @@ eip
3738
ekm
3839
elbv
3940
exo
41+
frontmatter
42+
fumadocs
4043
gcfs
4144
gcs
4245
geomatchstatement
@@ -66,6 +69,7 @@ lfs
6669
Lightbox
6770
liveanalytics
6871
loggingservice
72+
lsp
6973
manageddevice
7074
managedrulegroupstatement
7175
managedzone
@@ -108,6 +112,9 @@ rtsp
108112
rulegroup
109113
rulegroupreferencestatement
110114
saas
115+
sbom
116+
SECRETID
117+
SECRETVALUE
111118
Sas
112119
scim
113120
scm
@@ -132,6 +139,7 @@ toplevel
132139
tpu
133140
udid
134141
usb
142+
VAULTNAME
135143
vdcs
136144
virtualmachine
137145
Vtpm
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -369,7 +369,7 @@ When debugging `cnquery`, you can monitor and profile memory and CPU usage using
369369

370370
You should start seeing data in Grafana!
371371

372-
![Grafana_dashboard](images/Grafana-dashboard.png)
372+
![Grafana_dashboard](.github/images/Grafana-dashboard.png)
373373

374374
## Contribute changes
375375

README.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
# cnquery
22

3-
![cnquery light-mode logo](docs/images/cnquery-light.svg#gh-light-mode-only)
4-
![cnquery dark-mode logo](docs/images/cnquery-dark.svg#gh-dark-mode-only)
3+
![cnquery light-mode logo](.github/images/cnquery-light.svg#gh-light-mode-only)
4+
![cnquery dark-mode logo](.github/images/cnquery-dark.svg#gh-dark-mode-only)
55

66
**Open source, cloud-native asset inventory and discovery**
77

88
cnquery is a cloud-native tool for querying your entire infrastructure. Built upon Mondoo's security data fabric, it answers thousands of questions about your infrastructure and integrates with over 850 resources across cloud accounts, Kubernetes, containers, services, VMs, APIs, and more.
99

10-
![cnquery run example](docs/images/cnquery-run.gif)
10+
![cnquery run example](.github/images/cnquery-run.gif)
1111

1212
Here are a few more examples:
1313

@@ -112,7 +112,7 @@ cnquery scan -f examples/example-os.mql.yaml
112112

113113
Like all other commands, you can specify different providers like `k8s`, `aws`, `docker`, and many more. Run `--help` to see the full list of supported providers.
114114

115-
![cnquery scan example](docs/images/cnquery-scan.gif)
115+
![cnquery scan example](.github/images/cnquery-scan.gif)
116116

117117
These files can also contain multiple query packs for many different target systems.
118118

docs/CONTRIBUTING.md

Lines changed: 91 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,91 @@
1+
# Contributing to cnquery Documentation
2+
3+
This folder contains the user-facing documentation for cnquery. The content is synced to the [Mondoo docs site](https://mondoo.com/docs/cnquery/).
4+
5+
## How the sync works
6+
7+
The cnquery docs live in this open source repo but are published on mondoo.com/docs. A GitHub Action in the docs repo syncs the content:
8+
9+
1. **Source**: This folder (`cnquery/docs/`)
10+
2. **Destination**: `docs/content/cnquery/` in the private docs repo
11+
3. **Trigger**: Daily at 6 AM UTC or manual dispatch
12+
13+
### What gets synced
14+
15+
- All `.mdx` files (documentation content)
16+
- CLI reference files in `cli/` folder (auto-generated)
17+
18+
### What stays in the docs repo only
19+
20+
- `meta.json` files (fumadocs navigation configuration)
21+
- Images in `public/img/cnquery/`
22+
23+
The sync workflow backs up and restores `meta.json` files to preserve navigation structure.
24+
25+
## Writing documentation
26+
27+
### File format
28+
29+
- Use `.mdx` extension for all documentation files
30+
- CLI reference files in `cli/` use `.md` (auto-generated)
31+
32+
### Frontmatter
33+
34+
Each file needs frontmatter with at least:
35+
36+
```yaml
37+
---
38+
title: Page Title
39+
sidebar_label: Short Label
40+
displayed_sidebar: cnquery
41+
description: Brief description for SEO
42+
image: /img/cnquery/mondoo-feature.jpg
43+
---
44+
```
45+
46+
### Images
47+
48+
Images are stored in the docs repo at `public/img/cnquery/`. Reference them with absolute paths:
49+
50+
```markdown
51+
![Alt text](/img/cnquery/folder/image.png)
52+
```
53+
54+
Available image folders:
55+
- `/img/cnquery/` - Featured images, banners
56+
- `/img/cnquery/github/` - GitHub app setup screenshots
57+
- `/img/cnquery/gw/` - Google Workspace screenshots
58+
- `/img/cnquery/m365/` - Microsoft 365 screenshots
59+
60+
### Links
61+
62+
Use absolute paths for links:
63+
```markdown
64+
[MQL Reference](/mql/resources/)
65+
[Other cnquery page](/cnquery/cnquery-about/)
66+
```
67+
68+
## Adding new images
69+
70+
If you need new images:
71+
72+
1. Add the image to the docs repo at `public/img/cnquery/`
73+
2. Reference it in your markdown with the absolute path
74+
3. The image will be available after the docs repo change is merged
75+
76+
## Folder structure
77+
78+
```
79+
docs/
80+
├── cli/ # Auto-generated CLI reference (do not edit)
81+
├── cloud/ # Cloud provider docs (AWS, Azure, GCP, etc.)
82+
│ ├── aws/
83+
│ ├── k8s/
84+
│ └── ...
85+
├── os/ # Operating system docs
86+
├── saas/ # SaaS integration docs (GitHub, M365, etc.)
87+
├── index.mdx # cnquery docs home page
88+
├── cnquery-about.mdx # What is cnquery
89+
├── providers.mdx # Provider installation
90+
└── CONTRIBUTING.md # This file
91+
```

docs/README.md

Lines changed: 114 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,114 @@
1+
---
2+
title: Get Started with cnquery
3+
id: cnquery-get-started
4+
sidebar_label: Get Started with cnquery
5+
displayed_sidebar: cnquery
6+
sidebar_position: 2
7+
description: cnquery is Mondoo's open source, cloud-native tool that answers every question about your infrastructure. Install, and get up and running with cnquery.
8+
image: /img/cnquery/mondoo-feature.jpg
9+
---
10+
11+
Welcome to cnquery, an open source project created by [Mondoo](https://mondoo.com)!
12+
13+
-> [Learn about cnquery](/cnquery/cnquery-about)
14+
15+
## Download and install cnquery​
16+
17+
Install cnquery with our installation script:
18+
19+
### Linux and macOS
20+
21+
```bash
22+
bash -c "$(curl -sSL https://install.mondoo.com/sh)"
23+
```
24+
25+
(You can read the [Linux/macOS installation script](https://install.mondoo.com/sh).)
26+
27+
### Windows
28+
29+
```powershell
30+
Set-ExecutionPolicy Unrestricted -Scope Process -Force;
31+
[System.Net.ServicePointManager]::SecurityProtocol = [System.Net.ServicePointManager]::SecurityProtocol -bor 3072;
32+
iex ((New-Object System.Net.WebClient).DownloadString('https://install.mondoo.com/ps1/cnquery'));
33+
Install-Mondoo -Product cnquery;
34+
```
35+
36+
(You can read the [Windows installation script](https://install.mondoo.com/ps1/cnquery).)
37+
38+
### Install manually
39+
40+
Manual installation packages are available on [GitHub releases](https://github.com/mondoohq/cnquery/releases/latest).
41+
42+
<Callout>
43+
If you install cnquery on machines that can't download and install updates (because they're air-gapped or don't give cnquery write access), you must install cnquery providers. To learn more, read [Manage cnquery Providers](/cnquery/providers/).
44+
</Callout>
45+
## Run queries in the cnquery shell​
46+
47+
The easiest way to discover cnquery's capabilities is to use the interactive shell, which has auto-complete to guide you:
48+
49+
```bash
50+
cnquery shell
51+
```
52+
53+
Once inside the shell, you can enter MQL queries. For example, this query returns the name of the current machine and the platform it's running:
54+
55+
```bash
56+
asset { name title }
57+
```
58+
59+
### Get help in the cnquery shell​
60+
61+
To see what information cnquery can retrieve, use the `help` command. These are some examples of how the help can guide you:
62+
63+
| This command... | Describes the queryable resources for... |
64+
| ---------------------- | ---------------------------------------- |
65+
| `help` | All of cnquery |
66+
| `help k8s` | Kubernetes |
67+
| `help k8s.statefulset` | Kubernetes Cluster StatefulSets |
68+
| `help azure` | Azure |
69+
| `help terraform` | Terraform |
70+
71+
### Exit the cnquery shell​
72+
73+
To exit cnquery shell, either press `Ctrl + D` or type `exit`.
74+
75+
## Run queries in your own shell​
76+
77+
To run standalone queries in your shell, use the cnquery run command:
78+
79+
```bash
80+
cnquery run TARGET -c "QUERY"
81+
```
82+
83+
| For... | Substitute... |
84+
| -------- | ----------------------------------------------------------------------- |
85+
| `TARGET` | The asset to query, such as `local` or a transport to a remote machine. |
86+
| `QUERY` | The MQL query that specifies the information you want. |
87+
88+
For example, this command runs a query against your local system. It lists the services installed and whether each service is running:
89+
90+
```bash
91+
cnquery run local -c "services.list { name running }"
92+
```
93+
94+
For a list of supported targets, use the help command:
95+
96+
```bash
97+
cnquery help run
98+
```
99+
100+
## Explore your infrastructure in Mondoo Platform​
101+
102+
To more easily explore your infrastructure, sign up for a Mondoo Platform account. Mondoo's web-based console allows you to navigate, search, and inspect all of your assets.
103+
104+
To get started, [contact Mondoo](https://mondoo.com/contact).
105+
106+
To learn about Mondoo Platform, read the [Mondoo Platform docs](../platform/home) or visit [mondoo.com](https://mondoo.com).
107+
108+
## Learn more​
109+
110+
- To explore cnquery commands, read [CLI Reference](/cnquery/cli/cnquery).
111+
- To explore the capabilities of the MQL language, read the [MQL docs](/mql/resources).
112+
- To learn what technologies cnquery integrates with, read [Supported Query Targets](/cnquery/cnquery-supported).
113+
114+
---

0 commit comments

Comments
 (0)