Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Create Documentation Scaffolding #461

Merged
merged 6 commits into from
Dec 20, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
42 changes: 42 additions & 0 deletions .github/workflows/deploy-docs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
name: deploy-gh-pages

on:
push:
branches:
- main
workflow_dispatch:
permissions:
contents: write
pages: write
id-token: write

jobs:
build:
runs-on: ubuntu-20.04
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
steps:
- uses: actions/checkout@v4
- name: Setup mdBook
uses: jontze/action-mdbook@v3
with:
token: ${{ secrets.GITHUB_TOKEN }}
use-mermaid: true
- run: mdbook build
- name: Upload artifact
uses: actions/upload-pages-artifact@v3
with:
path: './book'

deploy:
needs: build
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
runs-on: ubuntu-latest
steps:
- name: Setup Pages
uses: actions/configure-pages@v5
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v4
1 change: 1 addition & 0 deletions docs/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
book
25 changes: 25 additions & 0 deletions docs/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# Wazuh Agent Technical Documentation

This folder contains the technical documentation for the Wazuh Agent. The documentation is organized into the following guides:

- **Development Guide**: Instructions for building, testing, and packaging the agent.
- **Reference Manual**: Detailed information on the agent’s architecture, configuration, and usage.
- **Diagnostic Guide**: Steps to diagnose errors and resolve common issues.

## Requirements

To work with this documentation, you need **mdBook** installed. For installation instructions, refer to the [mdBook documentation](https://rust-lang.github.io/mdBook/).

## Usage

- To build the documentation, run:
```bash
./build.sh
```
The output will be generated in the `book` directory.

- To serve the documentation locally for preview, run:
```bash
./server.sh
```
The documentation will be available at [http://127.0.0.1:3000](http://127.0.0.1:3000).
45 changes: 45 additions & 0 deletions docs/SUMMARY.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
# Summary

- [Introduction](README.md)

# Development Documentation

- [Introduction](dev/README.md)
- [Setup Environment](dev/setup.md)
- [Build Packages](dev/build-packages.md)
- [Build Image](dev/build-image.md)
- [Build from Sources](dev/build-sources.md)
- [Run from Sources](dev/run-agent.md)
- [Run Tests](dev/run-tests.md)

# Reference Manual

- [Introduction](ref/README.md)
- [Description](ref/description.md)
- [Architecture](ref/architecture.md)
- [Compatibility](ref/compatibility.md)
- [Getting Started](ref/getting-started/README.md)
- [Requirements](ref/getting-started/requirements.md)
- [Packages](ref/getting-started/packages.md)
- [Installation](ref/getting-started/installation.md)
- [Configuration](ref/configuration.md)
- [Modules](ref/modules/README.md)
- [File Integrity monitoring](ref/modules/fim/README.md)
- [Architecture](ref/modules/fim/architecture.md)
- [API Reference](ref/modules/fim/api-reference.md)
- [Inventory](ref/modules/inventory/README.md)
- [Architecture](ref/modules/inventory/architecture.md)
- [API Reference](ref/modules/inventory/api-reference.md)
- [Logcollector](ref/modules/logcollector/README.md)
- [Architecture](ref/modules/logcollector/architecture.md)
- [API Reference](ref/modules/logcollector/api-reference.md)
- [Upgrade](ref/upgrade.md)
- [Uninstall](ref/uninstall.md)
- [Back Up and Restore](ref/backup-restore.md)
- [Security](ref/security.md)
- [Performance](ref/performance.md)
- [Glossary](ref/glossary.md)

# Diagnostic Documentation

- [Diagnostic Guide](diag/diagnostic.md)
6 changes: 6 additions & 0 deletions docs/book.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
[book]
authors = ["Vikman Fernandez-Castro"]
language = "en"
multilingual = false
src = "."
title = "Wazuh Agent Documentation"
3 changes: 3 additions & 0 deletions docs/build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#! /bin/sh

mdbook build
Empty file added docs/dev/README.md
Empty file.
1 change: 1 addition & 0 deletions docs/dev/build-image.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# Build a Container Image
1 change: 1 addition & 0 deletions docs/dev/build-packages.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# Build Packages
3 changes: 3 additions & 0 deletions docs/dev/build-sources.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Build from Sources

## Build Scripts / Makefiles
1 change: 1 addition & 0 deletions docs/dev/run-agent.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# Run from Sources
1 change: 1 addition & 0 deletions docs/dev/run-tests.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# Run Tests
4 changes: 4 additions & 0 deletions docs/dev/setup.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# Set up the Development Environment

## Set up the Toolchain
## Set up Editor / Debugger
165 changes: 165 additions & 0 deletions docs/diag/diagnostic.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,165 @@
# Diagnostic Guide

1. **Agent version and service status**
2. **Configuration files**
3. **Logs**
4. **System resource usage**

### Agent Version and Status

#### Linux

```
/usr/share/wazuh-agent/bin/wazuh-agent -v
```
```
systemctl status wazuh-agent
```

#### macOS

```
/Library/Application Support/wazuh-agent/bin/wazuh-agent -v
```

#### Windows

```
"C:\\Program Files\\wazuh-agent\\wazuh-agent.exe" -v
```
```
Get-Service -Name wazuh-agent
```

### Configuration Files

#### Linux

To gather the configuration file, locate the following file:

- /etc/wazuh-agent/wazuh-agent.yml

Copy this filee for analysis.

#### macOS

To gather the configuration file, locate the following file:

- /Library/Application Support/wazuh-agent/etc/wazuh-agent.yml

Copy this filee for analysis.

#### Windows

To gather the configuration file, locate the following file:

- C:\\ProgramData\\wazuh-agent\\etc\\wazuh.yml

Copy this filee for analysis.

### Logs

#### Linux

Use `journald` or `systemctl status wazuh-agent` to capture logs related to `wazuh-agent`.

```bash
journalctl -u wazuh-agent.service
```

#### macOS

Use the Unified Logging System (ULS) to extract logs related to `wazuh-agent`.

```bash
log show --predicate 'process == "wazuh-agent"' --info
```

#### Windows

Use the Event Viewer to search for logs related to `wazuh-agent`.

### System Resources

#### Linux & macOS

Collect system resource usage data to understand the agent's performance impact. Fill in the table below with the relevant data:

| Daemon | CPU usage | RAM usage | Disk usage | Network usage |
|----------------------|-----------|-----------|------------|-----------------------------|
| (Global) | | | | (Connections to port 27000) |
| `wazuh-agent` | | | | |

#### Steps to collect system resource data

1. **CPU and RAM usage:**
- Use the `top` or `htop` command to monitor CPU and RAM usage for `wazuh-agent`.
2. **Disk usage:**
- Use the `df -h` command to check the disk usage of the file system where Wazuh is installed.
- Use the `du -h` command to check the disk usage of the Wazuh agent installation (usually _/usr/share/wazuh-agent_).
3. **Network usage:**
- Use the `netstat` or `ss` command to monitor connections to ports 1514 and 1515.
- Alternatively, use tools like `iftop` or `nload` to measure real-time network usage.

##### Example commands

1. **CPU and RAM usage:**
```bash
top -p $(pgrep -d',' wazuh-agent)
top -p $(pgrep -d',' wazuh-modulesd)
```
2. **Disk usage:**
```bash
df -h /usr/share/wazuh-agent
df -h /var/lib/wazuh-agent
```
3. **Network usage:**
```bash
netstat -an | grep ':1514\|:1515'
```

#### Windows

Collect system resource usage data to understand the agent's performance impact. Fill in the table below with the relevant data:

| Daemon | CPU usage | RAM usage | Disk usage | Network usage |
|-------------------|-----------|-----------|------------|-----------------------------------|
| `wazuh-agent.exe` | | | | |

#### Steps to collect system resource data

1. **CPU and RAM usage:**
- Use the Task Manager or the `tasklist` command to monitor CPU and RAM usage for `wazuh-agent.exe`.
2. **Disk usage:**
- Use the `dir` command to check the disk usage of the directory where Wazuh is installed.
- Alternatively, use the Disk Management tool or the `Get-PSDrive` PowerShell cmdlet.
3. **Network usage:**
- Use the `netstat` command to monitor connections to ports 1514 and 1515.
- Alternatively, use tools like Resource Monitor or PowerShell cmdlets such as `Get-NetTCPConnection`.

##### Example commands

1. **CPU and RAM usage:**
- Open Task Manager, go to the "Details" tab, and find `wazuh-agent.exe`.
- Or use the command prompt:
```cmd
tasklist /fi "imagename eq wazuh-agent.exe"
```
2. **Disk usage:**
- Command prompt:
```cmd
dir "C:\\Program Files\\wazuh-agent" /s
```
- PowerShell:
```powershell
Get-PSDrive -PSProvider FileSystem
```
3. **Network usage:**
- Command prompt:
```cmd
netstat -an | findstr ":1514" | findstr ":1515"
```
- PowerShell:
```powershell
Get-NetTCPConnection -LocalPort 1514,1515
```
Empty file added docs/ref/README.md
Empty file.
1 change: 1 addition & 0 deletions docs/ref/architecture.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# Architecture
1 change: 1 addition & 0 deletions docs/ref/backup-restore.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# Back Up and Restore
1 change: 1 addition & 0 deletions docs/ref/compatibility.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# Compatibility
1 change: 1 addition & 0 deletions docs/ref/configuration.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# Configuration
1 change: 1 addition & 0 deletions docs/ref/description.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# Description
1 change: 1 addition & 0 deletions docs/ref/getting-started/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# Getting Started
1 change: 1 addition & 0 deletions docs/ref/getting-started/installation.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# Installation
1 change: 1 addition & 0 deletions docs/ref/getting-started/packages.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# Packages
1 change: 1 addition & 0 deletions docs/ref/getting-started/requirements.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# Requirements
1 change: 1 addition & 0 deletions docs/ref/glossary.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# Glossary
1 change: 1 addition & 0 deletions docs/ref/modules/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# Modules
1 change: 1 addition & 0 deletions docs/ref/modules/fim/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# File Integrity monitoring
1 change: 1 addition & 0 deletions docs/ref/modules/fim/api-reference.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# API Reference
1 change: 1 addition & 0 deletions docs/ref/modules/fim/architecture.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# Architecture
1 change: 1 addition & 0 deletions docs/ref/modules/inventory/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# Inventory
1 change: 1 addition & 0 deletions docs/ref/modules/inventory/api-reference.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# API Reference
1 change: 1 addition & 0 deletions docs/ref/modules/inventory/architecture.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# Architecture
1 change: 1 addition & 0 deletions docs/ref/modules/logcollector/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# Logcollector
1 change: 1 addition & 0 deletions docs/ref/modules/logcollector/api-reference.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# API Reference
1 change: 1 addition & 0 deletions docs/ref/modules/logcollector/architecture.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# Architecture
1 change: 1 addition & 0 deletions docs/ref/performance.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# Performance
1 change: 1 addition & 0 deletions docs/ref/security.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# Security
1 change: 1 addition & 0 deletions docs/ref/uninstall.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# Uninstall
1 change: 1 addition & 0 deletions docs/ref/upgrade.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# Upgrade
3 changes: 3 additions & 0 deletions docs/server.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#! /bin/sh

mdbook serve
Loading