---
title: "Creates a new derived metric"
method: GET
path: "/pmapi/derive"
tags: ["PMAPI HOST SERVICES"]
---

# Creates a new derived metric

`GET /pmapi/derive`

Create a new derived metric, as defined by the [pmAddDerived](https://man7.org/linux/man-pages/man3/pmAddDerived.3.html)(3) metric interface. Derived 
metrics are associated with the named context, or a new context is created and returned in the result.
```bash
$ curl -s http://localhost:44322/pmapi/derive?name=blkio.avgsz&expr=disk.all.blktotal/disk.all.total | pmjson
```
This interface is one of the few that allows a POST to be used in place of a GET. In this case the HTTP POST request body may be used to provide one or 
more derived metrics specifications (all at once, across multiple lines, as a convenience).
```bash
$ curl -s http://localhost:44322/pmapi/fetch?name=blkio.avgsz&samples=2 | pmjson
```
**Reference:** [pmAddDerived](https://man7.org/linux/man-pages/man3/pmAddDerived.3.html)(3)

## Query parameters

- `expr` string
- `name` string
- `hostspec` string
- `context` number
- `polltimeout` number
- `client` string

## Response `200`

OK

## Changes

- **2020-10-21** `26cabf98ddfb` — 1 info
  - endpoint added
- **2020-10-20** `7da0633fad91` — 1 breaking
  - api path removed without deprecation

[Change history](https://skmtc.dev/performancecopilot/apis/pmwebapi/changes/pmapi/derive/get.md)

---

[API](https://skmtc.dev/performancecopilot/apis/pmwebapi.md) · [All operations](https://skmtc.dev/performancecopilot/apis/pmwebapi/llms.txt) · [OpenAPI document](https://skmtc-service-production.skmtc.workers.dev/v1/apis/performancecopilot/pmwebapi/revisions/666212c8ed6b/schema)
