https://github.com/nmasse-itix/prometheus-examples
Some sample code around prometheus
https://github.com/nmasse-itix/prometheus-examples
Last synced: 2 months ago
JSON representation
Some sample code around prometheus
- Host: GitHub
- URL: https://github.com/nmasse-itix/prometheus-examples
- Owner: nmasse-itix
- Created: 2022-06-25T16:21:07.000Z (almost 3 years ago)
- Default Branch: main
- Last Pushed: 2022-06-26T13:50:44.000Z (almost 3 years ago)
- Last Synced: 2025-02-12T11:16:25.084Z (4 months ago)
- Language: Go
- Size: 81.1 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Discovering Prometheus
## Installation
```sh
podman-compose up -d
go run main.go scrape
```## Usage
```sh
$ curl -s -X POST http://localhost:9090/api/v1/query_range -d query='myapp_processed_ops_total' --data-urlencode start="$(date -Iseconds -u --date='1 minute ago')" --data-urlencode end="$(date -Iseconds -u)" -d step=5s | jq .{
"status": "success",
"data": {
"resultType": "matrix",
"result": [
{
"metric": {
"__name__": "myapp_processed_ops_total",
"instance": "192.168.122.1:2112",
"job": "test-exporter"
},
"values": [
[
1656171931,
"359"
],
[
1656171936,
"361"
],
[
1656171941,
"364"
],
[
1656171946,
"367"
],
[
1656171951,
"369"
],
[
1656171956,
"371"
],
[
1656171961,
"374"
],
[
1656171966,
"376"
],
[
1656171971,
"379"
],
[
1656171976,
"381"
],
[
1656171981,
"384"
],
[
1656171986,
"386"
],
[
1656171991,
"389"
]
]
}
]
}
}
```