Skip to content

Commit 7554ed7

Browse files
Copilotalvarolopez
andcommitted
doc: Update documentation and configuration for Prometheus extractor
Co-authored-by: alvarolopez <[email protected]>
1 parent 6938099 commit 7554ed7

File tree

3 files changed

+77
-10
lines changed

3 files changed

+77
-10
lines changed

caso/opts.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
import caso.extract.base
2222
import caso.extract.manager
2323
import caso.extract.openstack.nova
24+
import caso.extract.prometheus
2425
import caso.keystone_client
2526
import caso.manager
2627
import caso.messenger.logstash
@@ -43,5 +44,6 @@ def list_opts():
4344
("benchmark", caso.extract.openstack.nova.benchmark_opts),
4445
("keystone_auth", caso.keystone_client.opts),
4546
("logstash", caso.messenger.logstash.opts),
47+
("prometheus", caso.extract.prometheus.opts),
4648
("ssm", caso.messenger.ssm.opts),
4749
]

doc/source/configuration.rst

Lines changed: 28 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -121,8 +121,15 @@ config file (``/etc/caso/caso.conf.sample``) includes a description
121121
of every option. You should check at least the following options:
122122

123123
* ``extractor`` (default value: ``nova``), specifies which extractor to use for
124-
getting the data. The following APIs are supported: ``ceilomenter`` and
125-
``nova``. Both should generate equivalent information.
124+
getting the data. The following extractors are available:
125+
126+
* ``nova`` - Extract VM accounting records from OpenStack Nova
127+
* ``cinder`` - Extract storage accounting records from OpenStack Cinder
128+
* ``neutron`` - Extract network/IP accounting records from OpenStack Neutron
129+
* ``prometheus`` - Extract energy consumption metrics from Prometheus
130+
131+
You can configure multiple extractors by providing a list (e.g.,
132+
``nova,cinder,prometheus``).
126133
* ``site_name`` (default value: ``<None>``). Name of the site as defined in
127134
GOCDB.
128135
* ``service_name`` (default value: ``$site_name``). Name of the service within
@@ -201,6 +208,25 @@ messenger. Available options:
201208
* ``host`` (default: ``localhost``), host of Logstash server.
202209
* ``port`` (default: ``5000``), Logstash server port.
203210

211+
``[prometheus]`` section
212+
------------------------
213+
214+
Options defined here configure the Prometheus extractor for gathering energy
215+
consumption metrics. This extractor queries a Prometheus instance to retrieve
216+
energy usage data. Available options:
217+
218+
* ``prometheus_endpoint`` (default: ``http://localhost:9090``), Prometheus
219+
server endpoint URL.
220+
* ``prometheus_query`` (default:
221+
``sum(rate(node_energy_joules_total[5m])) * 300 / 3600000``), PromQL query
222+
to retrieve energy consumption in kWh. This query should return energy
223+
consumption metrics that will be converted to accounting records.
224+
* ``prometheus_timeout`` (default: ``30``), Timeout for Prometheus API
225+
requests in seconds.
226+
227+
To use the Prometheus extractor, add ``prometheus`` to the ``extractor`` option
228+
in the main configuration.
229+
204230
Other cASO configuration options
205231
--------------------------------
206232

etc/caso/caso.conf.sample

Lines changed: 47 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@
3737

3838
# Property key used to get the VO name from the project properties. (string
3939
# value)
40-
#vo_property = accounting:VO
40+
#vo_property = VO
4141

4242
# DEPRECATED: File containing the VO <-> project mapping as used in Keystone-
4343
# VOMS. (string value)
@@ -123,11 +123,15 @@
123123
# Deprecated group/name - [DEFAULT]/logdir
124124
#log_dir = <None>
125125

126-
# Uses logging handler designed to watch file system. When log file is moved or
127-
# removed this handler will open a new log file with specified path
126+
# DEPRECATED: Uses logging handler designed to watch file system. When log file
127+
# is moved or removed this handler will open a new log file with specified path
128128
# instantaneously. It makes sense only if log_file option is specified and
129129
# Linux platform is used. This option is ignored if log_config_append is set.
130130
# (boolean value)
131+
# This option is deprecated for removal.
132+
# Its value may be silently ignored in the future.
133+
# Reason: This function is known to have bene broken for long time, and depends
134+
# on the unmaintained library
131135
#watch_log_file = false
132136

133137
# Use syslog for logging. Existing syslog format is DEPRECATED and will be
@@ -153,9 +157,17 @@
153157
# set. (boolean value)
154158
#use_stderr = false
155159

156-
# Log output to Windows Event Log. (boolean value)
160+
# DEPRECATED: Log output to Windows Event Log. (boolean value)
161+
# This option is deprecated for removal.
162+
# Its value may be silently ignored in the future.
163+
# Reason: Windows support is no longer maintained.
157164
#use_eventlog = false
158165

166+
# (Optional) Set the 'color' key according to log levels. This option takes
167+
# effect only when logging to stderr or stdout is used. This option is ignored
168+
# if log_config_append is set. (boolean value)
169+
#log_color = false
170+
159171
# The amount of time before the log files are rotated. This option is ignored
160172
# unless log_rotation_type is set to "interval". (integer value)
161173
#log_rotate_interval = 1
@@ -228,10 +240,16 @@
228240
# Maximum number of logged messages per rate_limit_interval. (integer value)
229241
#rate_limit_burst = 0
230242

231-
# Log level name used by rate limiting: CRITICAL, ERROR, INFO, WARNING, DEBUG
232-
# or empty string. Logs with level greater or equal to rate_limit_except_level
233-
# are not filtered. An empty string means that all levels are filtered. (string
234-
# value)
243+
# Log level name used by rate limiting. Logs with level greater or equal to
244+
# rate_limit_except_level are not filtered. An empty string means that all
245+
# levels are filtered. (string value)
246+
# Possible values:
247+
# CRITICAL - <No description provided>
248+
# ERROR - <No description provided>
249+
# INFO - <No description provided>
250+
# WARNING - <No description provided>
251+
# DEBUG - <No description provided>
252+
# '' - <No description provided>
235253
#rate_limit_except_level = CRITICAL
236254

237255
# Enables or disables fatal status of deprecations. (boolean value)
@@ -380,6 +398,23 @@
380398
#port = 5000
381399

382400

401+
[prometheus]
402+
403+
#
404+
# From caso
405+
#
406+
407+
# Prometheus server endpoint URL. (string value)
408+
#prometheus_endpoint = http://localhost:9090
409+
410+
# Prometheus query to retrieve energy consumption in kWh. The query should
411+
# return energy consumption metrics. (string value)
412+
#prometheus_query = sum(rate(node_energy_joules_total[5m])) * 300 / 3600000
413+
414+
# Timeout for Prometheus API requests in seconds. (integer value)
415+
#prometheus_timeout = 30
416+
417+
383418
[sample_remote_file_source]
384419
# Example of using a remote_file source
385420
#
@@ -439,6 +474,10 @@
439474
# includes the private key. (string value)
440475
#client_key = <None>
441476

477+
# Timeout is the number of seconds the request will wait for your client to
478+
# establish a connection to a remote machine call on the socket. (string value)
479+
#timeout = 60
480+
442481

443482
[ssm]
444483

0 commit comments

Comments
 (0)