Debian Codegraph @

rust-interface/examples/amdsmi_exporter/README.md

raw
1 # AMDSMI Exporter
2
3 The `AMDSMI Exporter` is a tool that exports AMD SMI metrics and runs an HTTP server to serve these metrics. It provides options to list supported GPUs and metrics' information, as well as to export metrics with optional filtering using whitelist and blacklist. This enables fine-grained control over which metrics are included or excluded.
4
5 ## Features
6
7 - List supported GPUs and detailed metrics information.
8 - Export AMD SMI metrics and serve them via an HTTP server.
9 - Filter metrics using whitelist and blacklist.
10 - Filter metrics by GPU BDF or ID.
11
12 ## Usage
13
14 ### List Supported GPUs and Metrics
15
16 To list the supported GPUs and metrics' information, use the `list` subcommand:
17
18 ```sh
19 amdsmi_exporter list
20 ```
21
22 ### Export Metrics and Run HTTP Server
23
24 To export AMD SMI metrics and run the HTTP server, use the `metric` subcommand:
25
26 ```sh
27 amdsmi_exporter metric [OPTIONS]
28 ```
29
30 #### Options
31
32 - `-p, --port <PORT>`: Sets the port to listen on (default: 9898).
33 - `-g, --gpu <GPU>`: Sets the GPU BDF or the zero-based index of the socket ID and processor ID for export.
34 Example:
35 - `--gpu 0000:03:00.0`
36 - `--gpu 0.0`
37 - `-w, --whitelist <METRIC>`: Comma-separated list of metric field names to include.
38 - `-b, --blacklist <METRIC>`: Comma-separated list of metric field names to exclude.
39
40 ### Examples
41
42 #### List Supported GPUs and Metrics
43
44 ```sh
45 amdsmi_exporter list
46 ```
47
48 #### Export Metrics and Run HTTP Server on Port 8080 for a Specific GPU
49
50 ```sh
51 amdsmi_exporter metric --port 8080 --gpu 0000:03:00.0
52 ```
53
54 #### Export Metrics with Whitelist Filter
55
56 ```sh
57 amdsmi_exporter metric --whitelist AMDSMI_FI_GFX_ACTIVITY,AMDSMI_FI_UMC_ACTIVITY
58 ```
59
60 #### Export Metrics with Blacklist Filter
61
62 ```sh
63 amdsmi_exporter metric --blacklist AMDSMI_FI_GFX_VOLTAGE,AMDSMI_FI_SOC_VOLTAGE
64 ```
65
66 ### Set Up Prometheus Docker Server to Connect to This Client Exporter
67
68 To set up a Prometheus Docker server to connect to this client exporter, follow these steps:
69
70 1. **Create a Prometheus Configuration File**
71
72 Create a file named prometheus.yml with the following content:
73
74 ```yaml
75 global:
76 scrape_interval: 15s
77
78 scrape_configs:
79 - job_name: 'amdsmi_exporter'
80 static_configs:
81 - targets: ['localhost:9898']
82 ```
83
84 Replace `localhost:9898` with the appropriate address and port if you are running the exporter on a different host or port.
85
86 2. **Run Prometheus Docker Container**
87
88 Run the Prometheus Docker container with the configuration file:
89
90 ```sh
91 docker run -d --name=prometheus -p 9090:9090 -v $(pwd)/prometheus.yml:/etc/prometheus/prometheus.yml prom/prometheus
92 ```
93
94 3. **Access Prometheus Web Interface**
95
96 Open your web browser and go to `http://localhost:9090` to access the Prometheus web interface. You should see the `amdsmi_exporter` job listed under the "Targets" section.