2020## Define elements to monitor
2121
2222PowerAPI being a monitoring tool for energy consumption, we will need to define
23- the necessary elements to monitor. An example is also given if you do not already
24- have a process you wish to monitor.
23+ the necessary elements to monitor.
24+ In the testing archive, we will be able to see the consumption of the docker container by the default.
25+ But if we want to monitor a specific process, we can use the Linux abstraction of [ cGroups] ( https://www.redhat.com/sysadmin/cgroups-part-one ) .
2526
2627### Create a cGroup
2728
28- We need a subset of running processes to be monitored. For this, we use the
29- Linux abstraction of [ cGroups] ( https://www.redhat.com/sysadmin/cgroups-part-one ) .
30-
3129In order to create a cGroup, the following command can be used from CLI :
3230
3331``` sh
@@ -87,19 +85,22 @@ wget "https://github.com/powerapi-ng/powerapi-ng.github.io/tree/master/examples/
8785unzip powerapi-stack.zip && cd powerapi-stack
8886```
8987
90- From this archive, you will have all the necessary files to get started, let us break down each elements .
88+ From this archive, you will have all the necessary files to get started, let us break down each element .
9189
9290### Archive content
9391
9492``` sh
95- | powerapi-stack/
96- | --docker-compose.yaml
97- | --configs.d/
98- | ----hwpc-sensor-config.json
99- | ----smartwatts-config.json
93+ | getting_started/
94+ | --csv/
95+ | --fomula/
96+ | ----smartwatts-mongodb-csv.json
97+ | --sensor/
98+ | ----hwpc-mongodb.json
99+ | --start.sh
100100| --start.py
101- | --reports.d/
102- | ----powerreports.csv
101+ | --pretty_print.py
102+ | --docker-compose.yaml
103+ | --.env
103104```
104105
105106#### HWPC-Sensor Configuration
@@ -112,24 +113,41 @@ An example configuration file for HWPC-Sensor is given below and available in th
112113``` json title="powerapi-stack/hwpc-sensor-config.json"
113114
114115{
115- "verbose" : false ,
116- "frequency" : 1000 ,
117- "name" : " hwpc-sensor" ,
118- "cgroup_basepath" : " /sys/fs/cgroup/perf_event" ,
119- "system" : {
120- "type" : " MONITOR_ALL_CPU_PER_SOCKET" ,
121- "events" : [" RAPL_ENERGY_PKG" , " RAPL_ENERGY_DRAM" ]
122- },
123- "container" : {
124- "type" : " MONITOR_ALL_CPU_PER_SOCKET" ,
125- "events" : [" RAPL_ENERGY_PKG" , " RAPL_ENERGY_DRAM" ]
126- },
127- "output" : {
128- "type" : " mongodb" ,
129- "uri" : " mongodb://mongodb:27017" ,
130- "db" : " powerapi" ,
131- "collection" : " HWPCReports"
132- }
116+ "name" : " sensor" ,
117+ "verbose" : true ,
118+ "frequency" : 1000 ,
119+ "cgroup_basepath" : " /sys/fs/cgroup/" ,
120+ "output" : {
121+ "type" : " mongodb" ,
122+ "uri" : " mongodb://mongodb:27017" ,
123+ "database" : " db_sensor" ,
124+ "collection" : " prep"
125+ },
126+ "system" : {
127+ "rapl" : {
128+ "events" : [
129+ " RAPL_ENERGY_PKG"
130+ ],
131+ "monitoring_type" : " MONITOR_ONE_CPU_PER_SOCKET"
132+ },
133+ "msr" : {
134+ "events" : [
135+ " TSC" ,
136+ " APERF" ,
137+ " MPERF"
138+ ]
139+ }
140+ },
141+ "container" : {
142+ "core" : {
143+ "events" : [
144+ " CPU_CLK_THREAD_UNHALTED:REF_P" ,
145+ " CPU_CLK_THREAD_UNHALTED:THREAD_P" ,
146+ " LLC_MISSES" ,
147+ " INSTRUCTIONS_RETIRED"
148+ ]
149+ }
150+ }
133151}
134152```
135153
@@ -142,29 +160,32 @@ An example configuration file for SmartWatts is given below and available in the
142160
143161``` json title="powerapi-stack/smartwatts-config.json"
144162{
145- "verbose" : true ,
146- "stream" : true ,
147- "input" : {
148- "puller" : {
149- "model" : " HWPCReport" ,
150- "type" : " mongodb" ,
151- "uri" : " mongodb://127.0.0.1" ,
152- "db" : " powerapi" ,
153- "collection" : " HWPCReports"
154- }
155- },
156- "output" : {
157- "pusher_power" : {
158- "type" : " csv" ,
159- "directory" : " reports.d" ,
160- "files" : " powerreports.csv"
161- }
162- },
163- "cpu-base-freq" : 1900 ,
164- "cpu-error-threshold" : 2.0 ,
165- "disable-dram-formula" : true ,
166- "sensor-reports-frequency" : 1000
167- }
163+ "verbose" : false ,
164+ "stream" : true ,
165+ "input" : {
166+ "puller_mongodb" : {
167+ "model" : " HWPCReport" ,
168+ "type" : " mongodb" ,
169+ "name" : " puller_mongodb" ,
170+ "uri" : " mongodb://mongodb:27017" ,
171+ "db" : " db_sensor" ,
172+ "collection" : " prep"
173+ }
174+ },
175+ "output" : {
176+ "pusher_csv" : {
177+ "model" : " PowerReport" ,
178+ "type" : " csv" ,
179+ "name" : " pusher_csv" ,
180+ "directory" : " /tmp/csv"
181+ }
182+ },
183+ "cpu-base-freq" : 1900 ,
184+ "cpu-error-threshold" : 2.0 ,
185+ "disable-dram-formula" : true ,
186+ "sensor-reports-frequency" : 1000
187+ }
188+
168189```
169190
170191## Turn the key
0 commit comments