Путеводитель по Руководству Linux

  User  |  Syst  |  Libr  |  Device  |  Files  |  Other  |  Admin  |  Head  |



   pmwebapi    ( 3 )

введение в интерфейс программирования веб-приложений с показателями производительности (introduction to the Performance Metrics Web Application Programming Interface)

OPEN METRICS

Exporting of live performance metrics in an Open Metrics
       compatible format (as described at https://openmetrics.io  and
       popularized by the https://prometheus.io  project) is available.

All requests are performed on the web server host by default, unless a hostspec parameter is provided.

GET /metrics ┌───────────┬─────────┬────────────────────────────────────────────────┐ │Parameters │ Type │ Explanation │ ├───────────┼─────────┼────────────────────────────────────────────────┤ │names │ string │ Comma-separated list of metric names │ │times │ boolean │ Append sample times (milliseconds since epoch) │ ├───────────┼─────────┼────────────────────────────────────────────────┤ │hostspec │ string │ Host specification as described in PCPIntro(1) │ └───────────┴─────────┴────────────────────────────────────────────────┘ Fetches current values and metadata for all metrics, or only metrics indicated by a comma-separated list of names.

For all numeric metrics with the given NAME prefixes, create an Open Metrics (Prometheus) text export format giving their current value and related metadata.

The response has plain text type rather than JSON commonly used elsewhere in the REST API. This format can be injested by many open source monitoring tools, including Prometheus and pmdaopenmetrics(1).

The native PCP metric metadata (metric name, type, indom, semantics and units) is first output for each metric with # PCP prefix. The metadata reported is of the form described on pmTypeStr(3), pmInDomStr(3), pmSemStr(3) and pmUnitsStr(3) respectively. If the pmUnitsStr(3) units string is empty, then none is output. The units metadata string may contain spaces and extends to the end of the line.

PCP metric names are mapped so that the . separators are exchanged with _ (':' in back-compatibility mode, where "# PCP" is the identifying line suffix). Both metric labels and instances are represented as Prometheus labels, with external instance names being quoted and the flattened PCP metric hierarchy being presented with each value.

$ curl -s http://localhost:44322/metrics?names=proc.nprocs,kernel.pernode.cpu.intr,filesys.blocksize

# PCP5 proc.nprocs 3.8.99 u32 PM_INDOM_NULL instant none # HELP proc_nprocs instantaneous number of processes # TYPE proc_nprocs gauge proc_nprocs {hostname="app1"} 7

# PCP5 kernel.pernode.cpu.intr 60.0.66 u64 60.19 counter millisec # HELP kernel_pernode_cpu_intr total interrupt CPU [...] # TYPE kernel_pernode_cpu_intr counter kernel_pernode_cpu_intr{hostname="app1",instname="node0"} 25603

# PCP5 filesys.blocksize 60.5.9 u32 60.5 instant byte # HELP filesys_blocksize Size of each block on mounted file[...] # TYPE filesys_blocksize gauge filesys_blocksize{hostname="app1",instname="/dev/sda1"} 4096 filesys_blocksize{hostname="app1",instname="/dev/sda2"} 4096