Skip to content

Commit 3b74831

Browse files
authored
Merge pull request #15 from Inkedstinct/7_doc/nld_proofread
7_doc/nld proofread
2 parents ee25e5d + e7dffa0 commit 3b74831

25 files changed

+3549
-464
lines changed

README.md

+20
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,23 @@
22
PowerAPI website use [MKDocs](https://www.mkdocs.org/).
33

44
You can push your changes on `master` branch to deploy them on the website.
5+
6+
## Local development
7+
8+
When redacting changes for this documentation, you may want to visualize the
9+
output the way it will be presented in the final website once compiled.
10+
11+
One way to do so is to:
12+
13+
1. Install the necessary packages : mkdocs, mkdocs-material, mkdocs-material-extensions
14+
This can be done with: `pip install mkdocs mkdocs-material mkdocs-material-extensions`
15+
16+
2. Have a local copy of this repository (taking care of *checkout-ing* the right ref)
17+
18+
3. From the CLI, have this particular repository as PWD
19+
20+
4. Use mkdocs in order to serve locally (default on http://localhost:8000)
21+
This can be done with: `mkdocs serve -o`
22+
23+
5. Check the URL it serves to, targets will be rebuild on modifications in the
24+
current directory or in any nested elements (use -W to add paths to be considered for hot reloading)

docs/assets/images/reference/sensors/PowerAPI_HWPCSensorOverview.drawio

+99
Large diffs are not rendered by default.

docs/assets/images/reference/sensors/PowerAPI_HWPCSensorOverview.drawio.svg

+4
Loading

docs/getting_started.md

+72-37
Original file line numberDiff line numberDiff line change
@@ -1,57 +1,92 @@
11
# Getting started
22

3-
If you want to monitor the energy consumption of your process we have some
4-
ready-to-use tools
3+
In this tutorial, we will guide you through the first steps to get started with PowerAPI.
4+
The objective is to get a quick view of the capabilities of PowerAPI, by monitoring a process and getting a quick glimpse at the energy consumption.
5+
A few things are required before we start:
56

6-
???+ info "Source and Destination"
7-
In order to use any Formula, you need to run a Source and a Destination. The former is used by a Sensor to store metrics. The later allows the Formula to make available the estimations. For starting, you can use [MongoDB](https://hub.docker.com/_/mongo) as Source and [InfluxDB:2.X](https://hub.docker.com/_/influxdb) as Destination by installing them as Docker containers.
8-
For more details about Sources and Destinations please check this [section](reference/database/sources_destinations.md).
7+
- A compatible processor (you can see the compatible CPU architecture [here](./reference/sensors/hwpc-sensor.md#)), and you can look on the following pages to find your CPU architecture:
8+
* For [Intel Processor](https://en.wikipedia.org/wiki/List_of_Intel_processors)
9+
* For [Intel Xeon Processor](https://en.wikipedia.org/wiki/List_of_Intel_Xeon_processors)
10+
* For [AMD Processor](https://en.wikipedia.org/wiki/Table_of_AMD_processors)
11+
- A python installation ready
12+
- Docker & Docker-Compose ready (refer to [this official documentation](https://docs.docker.com/engine/install/) and the [post-install steps](https://docs.docker.com/engine/install/linux-postinstall/) if needed !)
13+
- Root access
14+
- Optional : [Git](https://git-scm.com/book/en/v2/Getting-Started-Installing-Git) to proceed by cloning the repository
915

16+
## Which components to get a complete stack
1017

11-
<!---
12-
## **RAPL Formula**
18+
If you wish to get started as soon as possible, the archive below will allow you to deploy the following elements:
1319

14-
!!! note ""
15-
for monitoring the energy consumption of your device
20+
1. A MongoDB instance to store the [Sensor](./reference/sensors/hwpc-sensor.md)
21+
Reports
1622

17-
RAPL Formula is made for tracking the energy consumption of your machine.
18-
To install RAPL Formula on a baremetal server or a PC run [the following
19-
script](script/rapl_install.sh) in a Terminal.
23+
3. An [HWPC-Sensor](./reference/sensors/hwpc-sensor.md) that outputs its
24+
[HWPC Reports](./reference/reports/reports.md#hwpc-reports) in a MongoDB Database,
25+
within the HWPC Report Collection
2026

21-
The script explains what it will do and then pauses before it does it.
27+
4. A [SmartWatts](./reference/formulas/smartwatts.md) that streams the
28+
[HWPC Reports](./reference/reports/reports.md#hwpc-reports) from the MongoDB
29+
Database Collection, processes it and outputs its
30+
[Power Reports](./reference/reports/reports.md#power-reports) as CSV files for a
31+
quick glimpse
2232

23-
Please notice that you need a **Linux distribution** in order to use the HWPC Sensor installed by the script as
24-
well as a **comptible Intel** (Sandy Bridge and newer) or **AMD Processor** (Zen). **Power/ARM/RISCV are not supported** architectures. HWPC Sensor will **not work on a Virtual Machine**. However, you can install the Formula by hand in a Virtual Machine if need it.
25-
-->
33+
## Preparation
2634

27-
## **SmartWatts Formula**
35+
You can either download the archive by cloning the repository or using wget.
2836

29-
!!! note ""
30-
for monitoring the power consumption of your process
37+
=== "git"
38+
```sh
39+
git clone https://github.com/powerapi-ng/powerapi-ng.github.io.git
40+
cd powerapi-ng.github.io/docs/script/getting-started
41+
```
3142

32-
Smartwatts is made for tracking the power consumption of processes on a
33-
machine.
34-
To install Smartwatts on a baremetal server or a PC run [the following
35-
script](script/smartwatts_install.sh) in a Terminal. Please notice that you will need [pip](https://pip.pypa.io/en/stable/installation/) or [docker](https://docs.docker.com/engine/install/) in order to use the Formula.
43+
=== "wget"
44+
```
45+
wget -c https://raw.githubusercontent.com/powerapi-ng/powerapi-ng.github.io/refs/heads/master/docs/script/getting_started.tar.gz -O - | tar -xz
46+
cd getting_started
47+
```
3648

37-
The script explains what it will do and then pauses before it does it.
49+
At this stage, you will have all the essential files to begin. Let's go through each element in detail.
50+
### Archive content
3851

39-
Please notice that you need a **Linux distribution** in order to use the HWPC Sensor installed by the script as
40-
well as a **comptible Intel** (Sandy Bridge and newer) or **AMD Processor** (Zen). You also need [docker](https://docs.docker.com/engine/install/). **Power/ARM/RISCV are not supported** architectures. HWPC Sensor will **not work on a Virtual Machine**. However, you can install the Formula by hand in a Virtual Machine if need it.
52+
```sh
53+
getting_started/
54+
|--csv/
55+
|--formula/
56+
|----smartwatts-mongodb-csv.json
57+
|--sensor/
58+
|----hwpc-mongodb.json
59+
|--start.sh
60+
|--start.py
61+
|--stop.sh
62+
|--pretty_print.py
63+
|--docker-compose.yaml
64+
|--.env
65+
```
4166

67+
#### HWPC-Sensor and SmartWatts Configuration
4268

69+
As described in the [HWPC-Sensor Documentation](./reference/sensors/hwpc-sensor.md#global-parameters) and in the [SmartWatts Documentation](./reference/formulas/smartwatts.md#global-parameters),
70+
several parameters can be set, both globally and for specific Groups monitored for the sensor or the formula.
4371

44-
#### CGroups
45-
If you need to monitor a process or a group of process via SmartWatts by using HWPC Sensor **version 1.2 or older**, you can follow this [tutorial](reference/cgroup/cgroup.md). Please notice that **cgroup V1** is required **only** for HWPC Sensor **version 1.2 or older**. If you need to enable this `cgroup` version please follow this [tutorial](reference/cgroup/cgroup_v1_activation.md).
72+
The provided docker-compose.yaml file uses configuration files and the **.env** to set those parameters.
73+
You can find examples of both those configuration files in the archive under the **formula** and **sensor** directories.
4674

47-
<!---
48-
## **Jouleit**
4975

50-
!!! note ""
51-
for mesuring the energy consumption of a program
76+
## Turn the key
5277

53-
Jouleit is made for tracking the energy consumption of a program.
54-
Jouleit need `gawk` to run.
55-
You can get the script from the [github repository](https://github.com/powerapi-ng/jouleit)
56-
Start jouleit by using `./jouleit.sh cmd`.
57-
-->
78+
Once all set, you shall be able to initiate the stack with:
79+
80+
```sh
81+
python3 start.py
82+
```
83+
84+
After the 2 minutes of monitoring, you will be able to see the result inside the **csv** directory.
85+
If you have trouble understanding the output, you can read the [Power Report documentation](./reference/reports/reports.md#power-reports).
86+
87+
!!! info "Quick results overview"
88+
Only in the context of this testing archive, after the monitoring, you can use the following command to get a pretty print of the result directly inside the terminal.
89+
90+
```sh
91+
python3 pretty_print.py
92+
```

docs/reference/database/sources_destinations.md

+23-19
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,23 @@
1-
# Sources and Destinations
1+
# Storage Options
22

3-
A PowerAPI Formula uses Sources and Destinations in order to retrieve metrics and store estimations.
3+
Different storage options are available to serve different purpose both for [Sensors](../overview.md#Sensor) and [Formulas](../overview.md#Formula).
44

5-
For each Source/Destination the parameters to specify are different. For each one of them,
6-
its parameters are specified in following sections.
5+
Storage is needed to save reports produced by each components.
6+
- Sensors store their usage reports
7+
- Formulas retrieve usage reports and store energy consumption reports
8+
- Visualization tools or individuals need to access reports for analysis
79

810
## Summary
9-
| Name | Source | Destination | CLI `input`/`ouput` parameter value | JSON `type` tag parameter value |
10-
| ------------- | ----- | ------------- | ------------- | ------------------------------------ |
11-
| MongoDB | Yes | Yes | mongodb | mongodb |
12-
| InfluxDB2 | No | Yes | influxdb2 | influxdb2 |
13-
| CSV | Yes | Yes | csv | csv |
14-
| Socket | Yes | No | socket | socket |
15-
| File Database | Yes | Yes | filedb | filedb |
16-
| Prometheus | No | Yes | prometheus | prometheus |
11+
12+
The following table defines the existing storage options for Sensors usage reports :
13+
14+
| Name | CLI `ouput` parameter value | JSON `type` tag parameter value|
15+
| ------------ | --------------------------------------| -------------------------------------------|
16+
| MongoDB | mongodb | mongodb |
17+
| CSV | csv | csv |
18+
| Socket | socket | socket |
19+
| File Database | filedb | filedb |
20+
1721

1822
## MongoDB
1923

@@ -30,7 +34,7 @@ The list of accepted parameters are:
3034
|`db` (`database` for `HWPCSensor`) | string | `d` (`D` for `HWPCSensor`) | N/A | Yes | The name of your database |
3135
|`collection` | string | `c` (`C` for `HWPCSensor`) | N/A | Yes | The name of the collection inside `db` |
3236
|`name` | string | `n` | `"puller_mongodb"` (Source), `pusher_mongodb` (Destination)| No | The related puller/pusher name. This parameter is not used by `HWPCSensor` |
33-
|`model` | string | `m` | `"HWPCReport"` (Source), `PowerReport` (Destination) | No | The Report type stored by the database |
37+
|`model` | string | `m` | `"HWPC Report"` (Source), `Power Report` (Destination) | No | The Report type stored by the database |
3438

3539
### JSON File Excerpt
3640

@@ -64,7 +68,7 @@ The list of accepted parameters are:
6468
|`org` | string | `g` | N/A | Yes | The name of the organization associated to the bucket |
6569
|`tags` | string | `t` | N/A | No | List of metadata keys of the report separated by `,` that will be kept. `sensor` and `target` are always kept as report metadata |
6670
|`name` | string | `n` | `"pusher_influxdb2"` | No | The related pusher name |
67-
|`model` | string | `m` | `"PowerReport"` | No | The Report type stored by the database |
71+
|`model` | string | `m` | `"Power Report"` | No | The Report type stored by the database |
6872

6973

7074
InfluxDB2 can only be used as a Destination.
@@ -75,7 +79,7 @@ Below you find an example of configuration excerpt for this kind of Destination.
7579

7680
```json
7781
{
78-
"model": "PowerReport",
82+
"model": "Power Report",
7983
"type": "influxdb2",
8084
"uri": "http://127.0.0.1",
8185
"port": 8086,
@@ -100,7 +104,7 @@ The list of accepted parameters are:
100104
|`files`(Source)| string | `f` | Empty list | No | The list of input CSV files with the format file1,file2,file3... |
101105
|`directory` (Destination and `HWPCSensor`)| string |`d` (`U` for `HWPCSensor`) | Current directory | No |The directory where output CSV files will be written |
102106
|`name` | string | `n` | `"puller_csv"` (Source), `"pusher_csv"` (Destination)| No | The related puller/pusher name. This parameter is not used by `HWPCSensor` |
103-
|`model` | string | `m` | `"HWPCReport"` (Source), `"PowerReport"` (Destination) | No | The Report type stored in CSV files. This parameter is not used by `HWPCSensor` |
107+
|`model` | string | `m` | `"HWPC Report"` (Source), `"Power Report"` (Destination) | No | The Report type stored in CSV files. This parameter is not used by `HWPCSensor` |
104108

105109
### JSON File Excerpt
106110

@@ -128,7 +132,7 @@ The list of accepted parameters are:
128132
|`port` | int | `P` | N/A | Yes | The port of communication |
129133
|`uri`/ `host` | int | `U` | N/A | Yes | The IP address of the machine running the socket |
130134
|`name` | string | `n` | `"puller_socket"`| No | The related puller name |
131-
|`model` | string | `m` | `"HWPCReport"` | No | The Report type managed by the socket |
135+
|`model` | string | `m` | `"HWPC Report"` | No | The Report type managed by the socket |
132136

133137

134138
### JSON File Excerpt
@@ -158,7 +162,7 @@ The list of accepted parameters are:
158162
| ------------- | ----- | ------------- | -------------| ---------- | ------------------------------------ |
159163
|`filename` | int | `f` | N/A | Yes | The name of the file |
160164
|`name` | string | `n` | `"pusher_filedb"` | No | The related pusher name |
161-
|`model` | string | `m` | `"HWPCReport"` (Source) `"PowerReport"` (Destination)| No | The Report type stored in the file |
165+
|`model` | string | `m` | `"HWPC Report"` (Source) `"Power Report"` (Destination)| No | The Report type stored in the file |
162166

163167
### JSON File Excerpt
164168

@@ -188,7 +192,7 @@ The list of accepted parameters are:
188192
|`metric-name` | string | `M` | N/A | Yes | The exposed metric name |
189193
|`metric-description` | string | `d` | `"energy consumption"` | No | The exposed metric description |
190194
|`name` | string | `n` | `"pusher_prom"` | No | The related pusher name |
191-
|`model` | string | `m` | `"PowerReport"` | No | The Report type exposed by Prometheus |
195+
|`model` | string | `m` | `"Power Report"` | No | The Report type exposed by Prometheus |
192196

193197

194198
Prometheus can only be used as a Destination that monitors reports but they will be not stored by this service.

docs/reference/formulas/configuration_files.md

+3-6
Original file line numberDiff line numberDiff line change
@@ -11,14 +11,11 @@ The table below shows basic parameters.
1111
| `verbose` | `bool` (flag) | `v` |`NOTSET` | Verbose or quiet mode |
1212
| `stream` | `bool` (flag) | `s` |`False` | Real time or post-mortem mode |
1313
| `sensor-report-sampling-interval` | `int` | N/A | `1000` | The time in milliseconds between two reports (`stream` = `True`) |
14-
| `input` | `string` (Source) | N/A | N/A | Source used as input. More information about Sources and their related parameters can be found [here](../database/sources_destinations.md)|
15-
| `output` | `string` (Destination)| N/A | N/A | Destination used as output. More information about Destinations and their related parameters can be found [here](../database/sources_destinations.md)|
14+
| `input` | `string` | N/A | N/A | SmartWatts input, shall match an existing Sensor output and contain HPWCReports. See [here](./smartwatts.md#smartwatts-inputs) |
15+
| `output` | `string` | N/A | N/A | SmartWatts output to store Power Report. See [here](./smartwatts.md#smartwatts-outputs) |
1616
| `pre-processor` | `string` | N/A | N/A | Pre-Processor to modify reports generated by a sensor. More information about Processors and their related parameters can be found [here](../processors/processors.md) |
1717
| `post-processor` | `string` | N/A | N/A | Post-Processor to modify reports generated by a formula. More information about Processors and their related parameters can be found [here](../processors/processors.md) |
1818

19-
???+ tip "Sources and Destinations' values"
20-
- Sources: `mongodb`, `csv`, `socket`, `filedb`
21-
- Destinations: `mongodb`, `influxedb`, `influxedb2`, `csv`, `socket`, `filedb`, `prom`
2219

2320
???+ tip "Processors' values"
2421
- Pre-Processors: `k8s`, `libvirt`
@@ -52,5 +49,5 @@ PowerAPI Formulas use `json` files. These files follow the next template:
5249
$formula_parameters
5350
}
5451
```
55-
???+ info "Sources and Destinations' `json` tags"
52+
???+ info "input and output' `json` tags"
5653
More information related to `json` tags for each Source/Destination can be found [here](../database/sources_destinations.md)

0 commit comments

Comments
 (0)