Mercurial > hg > orthanc-book
comparison Sphinx/source/users/advanced-rest.rst @ 228:972900443cf8
prometheus
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Wed, 06 Mar 2019 11:45:03 +0100 |
parents | 08c47b8abeea |
children | a64197133114 |
comparison
equal
deleted
inserted
replaced
227:08c47b8abeea | 228:972900443cf8 |
---|---|
191 Please note that the ``/tools/create-dicom`` API call will return the | 191 Please note that the ``/tools/create-dicom`` API call will return the |
192 Orthanc instance ID of the newly created DICOM resource. | 192 Orthanc instance ID of the newly created DICOM resource. |
193 | 193 |
194 You can use the ``/instances/.../pdf`` URI to retrieve an embedded PDF | 194 You can use the ``/instances/.../pdf`` URI to retrieve an embedded PDF |
195 file. | 195 file. |
196 | |
197 | |
198 | |
199 .. _prometheus: | |
200 | |
201 Instrumentation with Prometheus | |
202 ------------------------------- | |
203 | |
204 .. highlight:: text | |
205 | |
206 Orthanc publishes its metrics according to the `text-based format of | |
207 Prometheus | |
208 <https://prometheus.io/docs/instrumenting/exposition_formats/#text-based-format>`__ | |
209 (check also the `OpenMetrics project <https://openmetrics.io/>`__), onto | |
210 the ``/tools/metrics-prometheus`` URI of the REST API. For instance:: | |
211 | |
212 $ curl http://localhost:8042/tools/metrics-prometheus | |
213 orthanc_count_instances 1 1551868380543 | |
214 orthanc_count_patients 1 1551868380543 | |
215 orthanc_count_series 1 1551868380543 | |
216 orthanc_count_studies 1 1551868380543 | |
217 orthanc_disk_size_mb 0.0135002136 1551868380543 | |
218 orthanc_jobs_completed 1 1551868380543 | |
219 orthanc_jobs_failed 0 1551868380543 | |
220 orthanc_jobs_pending 0 1551868380543 | |
221 orthanc_jobs_running 0 1551868380543 | |
222 orthanc_jobs_success 1 1551868380543 | |
223 orthanc_rest_api_active_requests 1 1551868380543 | |
224 orthanc_rest_api_duration_ms 0 1551868094265 | |
225 orthanc_storage_create_duration_ms 0 1551865919315 | |
226 orthanc_storage_read_duration_ms 0 1551865943752 | |
227 orthanc_store_dicom_duration_ms 5 1551865919319 | |
228 orthanc_uncompressed_size_mb 0.0135002136 1551868380543 | |
229 | |
230 | |
231 .. highlight:: bash | |
232 | |
233 Note that the collection of metrics can be statically disabled by | |
234 setting the :ref:`global configuration option <configuration>` | |
235 ``MetricsEnabled`` to ``false``, or dynamically disabled by PUT-ing | |
236 ``0`` on ``/tools/metrics``:: | |
237 | |
238 $ curl http://localhost:8042/tools/metrics | |
239 1 | |
240 $ curl http://localhost:8042/tools/metrics -X PUT -d '0' | |
241 $ curl http://localhost:8042/tools/metrics | |
242 0 | |
243 | |
244 | |
245 .. highlight:: yaml | |
246 | |
247 Here is a sample configuration for Prometheus (in the `YAML format | |
248 <https://en.wikipedia.org/wiki/YAML>`__):: | |
249 | |
250 scrape_configs: | |
251 - job_name: 'orthanc' | |
252 scrape_interval: 10s | |
253 metrics_path: /tools/metrics-prometheus | |
254 basic_auth: | |
255 username: orthanc | |
256 password: orthanc | |
257 static_configs: | |
258 - targets: ['192.168.0.2:8042'] | |
259 | |
260 .. highlight:: bash | |
261 | |
262 Obviously, make sure to adapt this sample with your actual IP | |
263 address. Thanks to Docker, you can easily start a Prometheus server by | |
264 writing this configuration to, say, ``/tmp/prometheus.yml``, then | |
265 type:: | |
266 | |
267 $ sudo docker run -p 9090:9090 -v /tmp/prometheus.yml:/etc/prometheus/prometheus.yml --rm prom/prometheus:v2.7.0 |